summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2017-06-20 18:28:47 -0400
committermonsta <[email protected]>2017-08-07 17:28:44 +0300
commit9eb0130a902aa509a3f4f61d0312af807fa87936 (patch)
tree3c49feb2716bd3739b275a9c24ee67a339822940
parent250e6874f0e0d2f0cbfdcaa0fc92f28840ada7d9 (diff)
downloadmate-settings-daemon-9eb0130a902aa509a3f4f61d0312af807fa87936.tar.bz2
mate-settings-daemon-9eb0130a902aa509a3f4f61d0312af807fa87936.tar.xz
Request keyboard event reports from global keybindings of other windows
This allows mate-settings-daemon to honor global keybindings whenever a different application has keybindings that seem conflicting, but are usually not. For example, an application defining a `Super_L` keybinding and MATE having defining a shortcut that uses the `<Mod4>` key. They are the same physical keyboard, but one is a modifier and the other is not. Without requesting keyboard reports from other windows, the `<Mod4>` shortcuts are swallowed whenever there is a `Super_L` shortcut elsewhere. (squashed cf0b97690c9d8606be4e07b58a4cf7070b53570d + 603e331e6cf480d2f9aed1e7d096333df39215aa for 1.18 branch)
-rw-r--r--plugins/keybindings/msd-keybindings-manager.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/plugins/keybindings/msd-keybindings-manager.c b/plugins/keybindings/msd-keybindings-manager.c
index 89ae0bc..c022547 100644
--- a/plugins/keybindings/msd-keybindings-manager.c
+++ b/plugins/keybindings/msd-keybindings-manager.c
@@ -538,20 +538,34 @@ msd_keybindings_manager_start (MsdKeybindingsManager *manager,
{
GdkDisplay *dpy;
GdkScreen *screen;
+ GdkWindow *window;
int screen_num;
int i;
+ Display *xdpy;
+ Window xwindow;
+ XWindowAttributes atts;
g_debug ("Starting keybindings manager");
mate_settings_profile_start (NULL);
dpy = gdk_display_get_default ();
+ xdpy = GDK_DISPLAY_XDISPLAY (dpy);
screen_num = gdk_display_get_n_screens (dpy);
for (i = 0; i < screen_num; i++) {
screen = gdk_display_get_screen (dpy, i);
- gdk_window_add_filter (gdk_screen_get_root_window (screen),
+ window = gdk_screen_get_root_window (screen);
+ xwindow = GDK_WINDOW_XID (window);
+
+ gdk_window_add_filter (window,
(GdkFilterFunc) keybindings_filter,
manager);
+
+ gdk_error_trap_push ();
+ /* Add KeyPressMask to the currently reportable event masks */
+ XGetWindowAttributes (xdpy, xwindow, &atts);
+ XSelectInput (xdpy, xwindow, atts.your_event_mask | KeyPressMask);
+ gdk_error_trap_pop_ignored ();
}
manager->priv->screens = get_screens_list ();