Re: GDK "root" GtkObject?

-> > 	I'm looking to deal with expose events generated by the root
-> > ("desktop") window.  (I'm animating the background)
->  I think you should do the following: get root gdk window using
-> GDK_ROOT_PARENT(), then simpulate creation of GtkWindow from that gdk_window
-> (see gtkwindow.c) - i.e. set all flags appropriately (mark it as mapped,
-> visible, etc) - gtk_window_new() and setting the gdk window and marking it as 
-> realized should be enough IMO. After that you will have to
-> gdk_window_set_events(root,GDK_EXPOSURE_MASK) to make it accepting exposures. 
-> That's all.
->  Please report whether this worked.

	Nope, not working.  Here is the code I tried:

    window = GDK_ROOT_PARENT();
    widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    /* make sure the widget is realized... */
    widget->window = window;


    gtk_signal_connect( GTK_OBJECT(widget), "expose_event",
                        GTK_SIGNAL_FUNC(expose_cb), NULL);

	The function "expose_cb" currently just does a g_print().  It is
not being invoked.

	Of note: if I try to capture the button-press events instead of
the expose event, I get an error (with this C code):


	Here is what happens when I run my program:

Gdk-ERROR **: BadAccess (attempt to access private resource denied)
  serial 75 error_code 10 request_code 2 minor_code 0

	This indicates to me that some other (probably Gnome) program is
listening for those events for the Root window.  However, I should still
be able to get expose events (X allows multiple clients to get
expose events from a single window, but not button presses).

	I also tried connecting the signal handler and setting the
GDK_EXPOSURE_MASK before realizing the GtkWindow widget, but that didn't
change anything.

	Any other ideas?

Derek Simkowiak

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