Re: How To Enable X Root Window PropertyNotify Event ("property-notify-event" signal?) In GTK+?




Brian J. Tarricone wrote:
On 01/05/2010 01:36 PM, Daniel Yek wrote:
I want to receive X's PropertyNotify event for _NET_WORKAREA and
_NET_CURRENT_DESKTOP root window properties.

How can I enable them? Can they be received as "property-notify-event"
signal? Or do I need to use lower level event interface?

  
I usually use gdk_window_add_filter() on the root GdkWindow, after
gdk_window_set_events().

-brian

Thanks for responding. I saw this email a little late, partly because it
wasn't directly addressing me, so it escaped me a little bit.

So, you showed a solution using a "lower level" event interface.

Here is what I ended up with, which could be quite nice -- higher level
interface -- (if nothing below was a horrible hack that I might still
haven't realized; it sure worked quite well at this moment):

main():
root_window_property_notify_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);

g_signal_connect( root_window_property_notify_widget,
                  "property-notify-event",
G_CALLBACK(hx_root_window_property_notify_event_cb),
                  (gpointer) window_widget);


Top-level window_widget's "map" signal callback function:
GdkWindow *root_gdk_window = gtk_widget_get_root_window( window_widget );

gdk_window_set_user_data(root_gdk_window,
root_window_property_notify_widget);

GTK_OBJECT_FLAGS( GTK_OBJECT(root_window_property_notify_widget) ) |=
GTK_REALIZED | GTK_MAPPED | GTK_VISIBLE;

root_window_property_notify_widget->window = root_gdk_window;

gdk_window_set_events(root_gdk_window, GDK_PROPERTY_CHANGE_MASK);


Thanks!

-- 
Daniel Yek.





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