gnome-settings-daemon r435 - in trunk: . plugins/xrandr



Author: jensg
Date: Tue Aug 12 17:11:20 2008
New Revision: 435
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=435&view=rev

Log:
2008-08-12  Jens Granseuer  <jensgr gmx net>

	Even if we can't properly remove a client message handler at least
	make sure everything works as expected when enabling/disabling the
	plugin at runtime

	* plugins/xrandr/gsd-xrandr-manager.c: (on_client_message),
	(gsd_xrandr_manager_start): pass the manager as user data instead of
	the screen because the manager will remain stable during the lifetime
	of the daemon; also, don't filter messages when the plugin is disabled


Modified:
   trunk/ChangeLog
   trunk/plugins/xrandr/gsd-xrandr-manager.c

Modified: trunk/plugins/xrandr/gsd-xrandr-manager.c
==============================================================================
--- trunk/plugins/xrandr/gsd-xrandr-manager.c	(original)
+++ trunk/plugins/xrandr/gsd-xrandr-manager.c	Tue Aug 12 17:11:20 2008
@@ -73,6 +73,7 @@
         guint keycode;
         GnomeRRScreen *rw_screen;
         gboolean running;
+        gboolean client_filter_set;
 
         GtkStatusIcon *status_icon;
         GConfClient *client;
@@ -105,11 +106,13 @@
 		   GdkEvent   *event,
 		   gpointer    data)
 {
-        GnomeRRScreen *screen = data;
+        GsdXrandrManager *manager = GSD_XRANDR_MANAGER (data);
+        GnomeRRScreen *screen = manager->priv->rw_screen;
         XEvent *ev = (XEvent *)xevent;
 
-        if (ev->type == ClientMessage		&&
-            ev->xclient.message_type == gnome_randr_xatom()) {
+        if (manager->priv->running &&
+            ev->type == ClientMessage &&
+            ev->xclient.message_type == gnome_randr_xatom ()) {
 
                 gnome_rr_config_apply_stored (screen);
 
@@ -330,10 +333,14 @@
                                (GdkFilterFunc)event_filter,
                                manager);
 
-        /* FIXME: need to remove this in _stop */
-        gdk_add_client_message_filter (gnome_randr_atom(),
-                                       on_client_message,
-                                       manager->priv->rw_screen);
+        if (!manager->priv->client_filter_set) {
+                /* FIXME: need to remove this in _stop;
+                 * for now make sure to only add it once */
+                gdk_add_client_message_filter (gnome_randr_atom (),
+                                               on_client_message,
+                                               manager);
+                manager->priv->client_filter_set = TRUE;
+        }
 
         start_or_stop_icon (manager);
 



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