summaryrefslogtreecommitdiff
path: root/plugins/keybindings
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-03-07 06:41:17 -0500
committerraveit65 <[email protected]>2018-03-12 09:13:56 +0100
commitb5cb3e0c947013eef2339d382774d7143c43d4b0 (patch)
treef1bdb8aac708a991a28fbab9f24fd148fc6ea718 /plugins/keybindings
parent982a89bc39268101ca56cfecd3238ead6c9244b0 (diff)
downloadmate-settings-daemon-b5cb3e0c947013eef2339d382774d7143c43d4b0.tar.bz2
mate-settings-daemon-b5cb3e0c947013eef2339d382774d7143c43d4b0.tar.xz
Prevent media-keys bindings from swallowing modifier keys
This changes how the media-keys manager determines successful key-bindings from KeyRelease to KeyPress so that it does not conflict with third-party applications that want to use modifier keys as global key-bindings. We've already done this change for general keybindings and marco. It also cleans up a bunch of deprectation warnings.
Diffstat (limited to 'plugins/keybindings')
-rw-r--r--plugins/keybindings/msd-keybindings-manager.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/plugins/keybindings/msd-keybindings-manager.c b/plugins/keybindings/msd-keybindings-manager.c
index f04ac54..76905db 100644
--- a/plugins/keybindings/msd-keybindings-manager.c
+++ b/plugins/keybindings/msd-keybindings-manager.c
@@ -297,10 +297,12 @@ key_already_used (MsdKeybindingsManager *manager,
static void
binding_unregister_keys (MsdKeybindingsManager *manager)
{
+ GdkDisplay *dpy;
GSList *li;
gboolean need_flush = FALSE;
- gdk_error_trap_push ();
+ dpy = gdk_display_get_default ();
+ gdk_x11_display_error_trap_push (dpy);
for (li = manager->priv->binding_list; li != NULL; li = li->next) {
Binding *binding = (Binding *) li->data;
@@ -312,18 +314,20 @@ binding_unregister_keys (MsdKeybindingsManager *manager)
}
if (need_flush)
- gdk_flush ();
+ gdk_display_flush (dpy);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (dpy);
}
static void
binding_register_keys (MsdKeybindingsManager *manager)
{
GSList *li;
+ GdkDisplay *dpy;
gboolean need_flush = FALSE;
- gdk_error_trap_push ();
+ dpy = gdk_display_get_default ();
+ gdk_x11_display_error_trap_push (dpy);
/* Now check for changes and grab new key if not already used */
for (li = manager->priv->binding_list; li != NULL; li = li->next) {
@@ -353,8 +357,8 @@ binding_register_keys (MsdKeybindingsManager *manager)
}
if (need_flush)
- gdk_flush ();
- if (gdk_error_trap_pop ())
+ gdk_display_flush (dpy);
+ if (gdk_x11_display_error_trap_pop (dpy))
g_warning ("Grab failed for some keys, another application may already have access the them.");
}
@@ -540,11 +544,11 @@ msd_keybindings_manager_start (MsdKeybindingsManager *manager,
(GdkFilterFunc) keybindings_filter,
manager);
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (dpy);
/* 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 ();
+ gdk_x11_display_error_trap_pop_ignored (dpy);
manager->priv->screens = get_screens_list ();