Re: [gtk-list] GDK, and `gdk_pixmap_create_from_xpm_d': NULL window



A widget's window is NULL until it has been realized,
realization occurs sometime after you've done the gtk_widget_Show()
(which realizes then maps the widget to the screen).
(I say sometime as it's not immediate :-)...you'll get an expose
event for the drawing area once it's visible.)
There are ways to force reallization...not usually considered good
design decisions, however (though there are exceptions).

Have you tried gdk_pixmap_colormap_create_from_xpm()?
The first parameter is also a window, but it can be specified
as NULL if you supply a colormap (the 2nd parameter).
You could supply the drawing area's colormap, (or the system colormap
with gdk_colormap_get_system()). And I believe the rest of the parameters
match the xpm_d() function you are using now.

Or, you could wait until you know the drawing area has been realized...just
depends on whether you are trying to set things up "in advance".

Hope that helps!
Donna


----- Original Message -----
From: Nancy MAZUR <nancy@cs.mu.OZ.AU>
To: gtk list <gtk-list@redhat.com>
Sent: Sunday, February 20, 2000 6:51 PM
Subject: [gtk-list] GDK, and `gdk_pixmap_create_from_xpm_d': NULL window


>
> Hi,
>
> I'm quite desperate here, having first tried to live with imlib,
> I now tried another approach to my problem, inspired from Harlow's
> book, chapter about sprites and animation.
>
> My goal is simple: draw some background image, and on top of it
> another image having some non-zero mask. Well, I can't even test
> my code, because as soon as I run it, the message:
>
> Gdk-WARNING **: Creating pixmap from xpm with NULL window and colormap
> Segmentation fault
>
> I assume the source of this problem is my call to:
> GdkPixmap grid  = gdk_pixmap_create_from_xpm_d ( widget->window,
>                         &gridmask, &color, white60 );
>
> The widget is a drawing area, but why is its window NULL?
> When is a widget's window initialised?
> Or am I completely wrong, does the problem reside somewhere else?
>
> I'm really sorry if all this seem so trivial questions, but just
> as GTK is documented well enough, for GDK the only documentation
> is the code, and unfortanetely I don't have all the time in the world. ;-(
>
> Perhaps someone has got some ideas about how I should handle
> this best? Perhaps it's an overkill to use gtk/gdk? Perhaps
> someone knows about some libraries I'm unaware of and which do
> exactly what I'd like to do?
>
> Many many thanks,
> Nancy
>
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com <
/dev/null
>
>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]