Re: Using the same pixmap in multiple windowsx




> > If I have a pixmap, can I display it in multiple windows, and how?
> > Or do I have to recreate it for each one?

>
> i had the same problem with the GLE palette, since i temporarily need
> new pixmaps for dragging them (thanx for your pixmaps btw, it's much nicer
> to click on those than to select them from a popup).
>
> so in order to get the same visual and colormap for the drag
> window, i roughly
> do
>
>   gtk_widget_push_colormap (gtk_widget_get_colormap (GTK_WIDGET
> (wpalette)));
>   gtk_widget_push_visual (gtk_widget_get_visual (GTK_WIDGET (wpalette)));
>   wpalette->pop_window =
>     gtk_widget_new (GTK_TYPE_WINDOW, ...);
>   gtk_widget_realize (wpalette->pop_window);
>   /* add the containers and then the pixmaps */
>   gtk_widget_pop_colormap ();
>   gtk_widget_pop_visual ();
>
> the newly added containers and their children will automatically
> be realized
> as well (with the same visual and colormap), because the toplevel
> is already
> realized.
>
> you can glance at the exact code portions in the CVS module "gle" in
> gle/gle/glewpalette.c:gle_wpalette_create

Thanks for this.
I still don't understand why I need to do this - aren't all widgets
normally created with the same visuals and colormaps anyway (i.e.
the default visual and colormap)?

Damon




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