Update patch to apply to the 2.22 branch

This commit is contained in:
Bastien Nocera 2008-04-29 13:40:52 +00:00
parent bd0a7fc3bb
commit 0d2a3866dd

View File

@ -1,19 +1,22 @@
--- trunk/plugins/common/gsd-keygrab.c 2008/04/13 10:40:01 306
+++ trunk/plugins/common/gsd-keygrab.c 2008/04/29 08:41:52 326
@@ -24,6 +24,11 @@
Index: plugins/media-keys/gsd-media-keys-manager.c
===================================================================
--- plugins/media-keys/gsd-media-keys-manager.c (revision 327)
+++ plugins/media-keys/gsd-media-keys-manager.c (working copy)
@@ -42,6 +42,12 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
+#ifdef HAVE_X11_EXTENSIONS_XKB_H
+#include <X11/XKBlib.h>
+#include <X11/extensions/XKB.h>
+#include <gdk/gdkkeysyms.h>
+#endif
#include "gsd-keygrab.h"
@@ -119,9 +124,60 @@
}
+
#include "gnome-settings-profile.h"
#include "gsd-marshal.h"
#include "gsd-media-keys-manager.h"
@@ -941,6 +947,65 @@
return NULL;
}
+static gboolean
@ -42,9 +45,9 @@
+ return have_xkb;
+}
+
gboolean
match_key (Key *key, XEvent *event)
{
+static gboolean
+match_key (Key *key, XEvent *event)
+{
+ GdkKeymap *keymap;
+ guint keyval;
+ GdkModifierType consumed;
@ -66,10 +69,29 @@
+
+ gdk_keyval_convert_case (keyval, &lower, &upper);
+ return ((lower == key->keysym || upper == key->keysym)
+ && (key->state & ~consumed & GSD_USED_MODS) == key->state);
+ && (key->state & ~consumed & USED_MODS) == key->state);
+ }
+
+ /* The key we passed doesn't have a keysym, so try with just the keycode */
return (key != NULL
&& key->keycode == event->xkey.keycode
&& key->state == (event->xkey.state & GSD_USED_MODS));
+ return (key != NULL
+ && key->keycode == event->xkey.keycode
+ && key->state == (event->xkey.state & USED_MODS));
+}
+
static GdkFilterReturn
acme_filter_events (GdkXEvent *xevent,
GdkEvent *event,
@@ -962,12 +1027,7 @@
state = xev->xkey.state;
for (i = 0; i < HANDLED_KEYS; i++) {
- if (keys[i].key == NULL) {
- continue;
- }
-
- if (keys[i].key->keycode == keycode
- && (state & USED_MODS) == keys[i].key->state) {
+ if (match_key (keys[i].key, xev)) {
switch (keys[i].key_type) {
case VOLUME_DOWN_KEY:
case VOLUME_UP_KEY: