GTK and Xscreensaver and Virtual Root Windows



This is not a request for help but is instead maybe the answer to a new
FAQ question:

"Why Doesn't my GTK/GDK program work with xscreensaver or virtual root
windows?"

While attempting to get a simple GDK screensaver to work with
xscreensaver I discovered that GTK is not compatible with same or
virtual root windows.  I think this might be like almost a bug.

Vitual root windows are typically implemented via including vroot.h
which provides a substitute version of RootWindow which returns a
virtual root window if one exists.  While GDK initially obtains
gdk_root_window via RootWindow and could therefore work with virtual
root windows, later, in gdk_window_init in gkd_window.c there is a call
to XGetGeometry which is allowed to rewrite gdk_root_window with the
real root window.  If the root window arg is replaced with a dummy
everything works fine.  In short, to allow GDK(GTK) hacks to work with
xscreensaver or virtual root windows do the following:

        add vroot.h as the final include in gdk.c and gdkdnd.c (vroot.h
is included in the xscreensaver source)
        edit gdk_window_init() in gdk_window.c and replace the
gdk_root_window arg in the call to XGetGeometry() with dummy_window
declared in the body of the function as Window dummy_window.
        remake GTK.

	One can then draw on the (virtual) root window by creating a top level
window and then obtaining its parent.

I did not check the archive for this so if it is general knowledge I'm
sorry to waste your time.

Regards;
Bill Dolson



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