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
This commit is contained in:
Bastien Nocera 2014-09-05 12:49:00 +02:00
parent c218a2198e
commit 6c43ebe3b0
2 changed files with 13 additions and 3 deletions

View file

@ -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);
}

View file

@ -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 */