Re: Property notify on root window in Gtk2.0



Peter Zelezny <pzel dodo com au> writes:

Hi All,

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:

static gboolean
handle_property_notify (GtkWidget *widget, GdkEventProperty *event,
                      gpointer user_data)
{
      ...
}

{
      proxy_invisible = gtk_invisible_new ();
      /* Make the root window send events to the invisible proxy widget */
      gdk_window_set_user_data (GDK_ROOT_PARENT (), proxy_invisible);
      /* Select for PropertyNotify events from the root window */
      XSelectInput (GDK_DISPLAY (), GDK_ROOT_WINDOW (), PropertyChangeMask);
      g_signal_connect (G_OBJECT (proxy_invisible), "property_notify_event",
                      G_CALLBACK (handle_property_notify), NULL);
      gtk_widget_show (proxy_invisible);
}

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.)

Regards,
                                        Owen



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