RE: [gtk-list] Re: Pixmap oddity



Hi Owen,

Thanks very much for your explanation.  I attached the hbox to the table before
I created the pixmaps and now I don't get the error.  Now I can rest easy.

Thanks,
Scott


On 04-Jun-99 Owen Taylor wrote:
> 
> "Scott A. Barron" <sbarron@abalonesoft.com> writes:
> 
> 
> I'll see if I can quickly summarize the situation with
> pixmaps and colormaps/visuals.
> 
>  gdk_pixmap_create_from_xpm_d()
> 
> requires a non-NULL window parameter, to get a colormap
> for the pixmap. (At one point, GTK+ would silently use
> the default colormap if the window was NULL, but using
> that colormap is not correct.)
> 
> Typically, people do this by doing:
> 
>  gdk_pixmap_create_from_xpm_d (widget->window, ...)
> 
> Which works only if 'widget' is realized. To be realized
> a widget must first be added into a widget heirarchy
> that includes a toplevel window at the top; you
> may also need to explicitely call gtk_widget_realize()
> on the widget.
> 
> However, this is not the best way to handle the
> problem. Instead, you should use:
> 
>   GdkPixmap* gdk_pixmap_colormap_create_from_xpm 
>                                         (GdkWindow   *window,
>                                        GdkColormap *colormap,
>                                        GdkBitmap  **mask,
>                                        GdkColor    *transparent_color,
>                                        const gchar *filename);
> 
> Which takes, in addition to the window parameter,
> a colormap parameter. If you pass in a non-null
> colormap, then you can pass in a null window parameter.
> 
> Where do you get the colormap from? You can 
> get the colormap for any widget using 
> gtk_widget_get_colormap(); this does not
> require the widget to be realized.
> 
> Regards,
>                                         Owen
> 
> 
> -- 
> 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]