Re: Finding out the background pixmap



Derek Simkowiak <dereks@kd-dev.com> writes:

>      Hello,
> 	I'm trying to obtain a pointer to the GdkPixmap that is currently
> being used for the background image by Gnome.
> 
> 	I tried creating a new GC and the probing it with
> 
> gc = gdk_gc_new( GDK_ROOT_PARENT() );
> gdk_gc_get_values(gc, &values);
> root_bg_pixmap = values.tile;
> 
> 	...but 'root_bg_pixmap' turns out to be NULL.  So, what am I doing
> wrong?

The default values of the GC have nothing to do with the drawable
it was created for. There is no way through X (alone) to retrieve
the background pixmap of the drawable.

 	Another oddity: I've written a program which sets the background
> image of the GDK_ROOT_PARENT() GdkWindow with 
> 
> gdk_window_set_back_pixmap(root_window, pixmap, FALSE);
> 
> 	But when I set the background of Gnome Terminal to be
> "transparent", it still uses the pixmap I set with the Gnome Control
> Panel.  I.e., it doesn't really look transparent, but instead looks like
> it *would* look transparent if I never ran my background-setting program
> and the Gnome background were the one shown on the screen.  Eterm behaves
> the same way.
> 
> 	Can someone explain to me how the Root background image is
> handled/obtained?

The secret is the _XROOTPMAP_ID pixmap property on the root
window. Take a look at the background properties capplet sources and
the gnome-terminal sources. Pay special attention to how the bg
properties capplet creates an extra persistant X connection.

In fact, just copy the code out of bg-properties capplet (1.2.1 or CVS
control-center-1-2 branch) - it's not at all easy code to get right.

Regards,
                                        Owen 





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