Re: Property notify on root window in Gtk2.0
- From: Peter Zelezny <pzel dodo com au>
- To: gtk-app-devel-list gnome org
- Subject: Re: Property notify on root window in Gtk2.0
- Date: Thu, 10 Oct 2002 14:30:19 +1000
On Mon, 7 Oct 2002 10:03:37 -0400 (EDT)
Owen Taylor <otaylor redhat com> wrote:
Could somone suggest a way to get property notifies on the root window
using GTK2's signal system?
In 1.2, I'd do it something like this:
[snip]
I'd suggest that gdk_window_add_filter() and dealing with the raw X events
is the best approach. (I'd think the above would still work, but it's
definitely a hack.)
That means to work, but something strange is happening. I'm doing
something like this:
gdk_window_set_events (GDK_ROOT_PARENT (), GDK_PROPERTY_CHANGE_MASK);
gdk_window_add_filter (GDK_ROOT_PARENT (), root_event_cb, NULL);
But in the callback function, event->type is always GDK_NOTHING. Although,
if I treat "event" as a GdkEventProperty, event->atom is often valid, and one
I'm interested in. Just wondering how I can know that event->atom is valid?
Because when it's not, I get gdk warnings when running gdk_x11_atom_to_xatom()
on it.
My code:
static GdkFilterReturn
root_event_cb (GdkXEvent *xevent, GdkEventProperty *event, gpointer data)
{
Atom at = None;
if (at == None)
at = XInternAtom (GDK_DISPLAY (), "_XROOTPMAP_ID", True);
if (at == gdk_x11_atom_to_xatom (event->atom))
redraw_trans_xtexts (); /* redraw transparent backgrounds */
return GDK_FILTER_CONTINUE;
}
--
Peter Zelezny.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]