[gnome-control-center/gnome-3-8] keyboard: Make it possible to stop watching for WM changes



commit df246cc8e75cac9054aed0e3f6004bd421088e5b
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Sep 5 12:49:00 2014 +0200

    keyboard: Make it possible to stop watching for WM changes
    
    As we don't want to be doing that anymore if we're not in the keyboard
    panel anymore.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736117

 panels/keyboard/wm-common.c |   11 ++++++++++-
 panels/keyboard/wm-common.h |    5 +++--
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/panels/keyboard/wm-common.c b/panels/keyboard/wm-common.c
index 203dec9..c7270d1 100644
--- a/panels/keyboard/wm-common.c
+++ b/panels/keyboard/wm-common.c
@@ -162,7 +162,7 @@ wm_window_event_filter (GdkXEvent *xev,
   return GDK_FILTER_CONTINUE;
 }
 
-void
+gpointer
 wm_common_register_window_manager_change (GFunc    func,
                                          gpointer data)
 {
@@ -179,6 +179,15 @@ wm_common_register_window_manager_change (GFunc    func,
 
   XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), PropertyChangeMask);
   XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), False);
+
+  return ncb_data;
 }
 
+void
+wm_common_unregister_window_manager_change (gpointer id)
+{
+       g_return_if_fail (id != NULL);
 
+       gdk_window_remove_filter (NULL, wm_window_event_filter, id);
+       g_free (id);
+}
diff --git a/panels/keyboard/wm-common.h b/panels/keyboard/wm-common.h
index 4da0d28..8e4f2c4 100644
--- a/panels/keyboard/wm-common.h
+++ b/panels/keyboard/wm-common.h
@@ -10,8 +10,9 @@ gchar *wm_common_get_current_window_manager (void);
  * using _GNOME_WM_KEYBINDINGS if available, _NET_WM_NAME otherwise. */
 char **wm_common_get_current_keybindings (void);
 
-void   wm_common_register_window_manager_change (GFunc    func,
-                                                gpointer data);
+gpointer   wm_common_register_window_manager_change   (GFunc    func,
+                                                      gpointer data);
+void       wm_common_unregister_window_manager_change (gpointer id);
 
 #endif /* WM_COMMON_H */
 


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