- Add patch from upstream to avoid the Stop button triggering an Eject

(#346201)
This commit is contained in:
Bastien Nocera 2008-04-29 09:51:27 +00:00
parent c59c4dc489
commit bd0a7fc3bb
2 changed files with 83 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: gnome-settings-daemon
Version: 2.22.1
Release: 0.2008.03.26.7%{?dist}
Release: 1.2008.03.26.7%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@ -34,6 +34,9 @@ Patch2: gnome-settings-daemon-2.21.91-ignore-model-if-evdev.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=524499
Patch3: gsd-mouse-too-much-grab.patch
Patch4: gnome-settings-daemon-2.22.1-hide-white-screen.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=530356
# https://bugzilla.redhat.com/show_bug.cgi?id=346201
Patch5: gsd-handle-different-keysyms.patch
%description
A daemon to share settings from GNOME to other applications. It also
@ -59,6 +62,7 @@ pushd plugins/mouse/
%patch3 -p0 -b .no-eat-keys
popd
%patch4 -p1 -b .hide-white-screen
%patch5 -p1 -b .multi-keysyms
%build
%configure --enable-static=no --enable-profiling
@ -140,6 +144,9 @@ fi
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog
* Tue Apr 29 2008 - Bastien Nocera <bnocera@redhat.com> - 2.22.1-1.2008.03.26.7
- Add patch from upstream to avoid the Stop button triggering an Eject (#346201)
* Fri Apr 25 2008 Soren Sandmann <sandmann@redhat.com> - 2.22.1-2008.03.26.7
- Integrate various fixes from other distributions. Remove xrandr-missingok
patch.

View File

@ -0,0 +1,75 @@
--- 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 @@
#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 @@
}
}
+static gboolean
+have_xkb (Display *dpy)
+{
+ static int have_xkb = -1;
+
+ if (have_xkb == -1) {
+#ifdef HAVE_X11_EXTENSIONS_XKB_H
+ int opcode, error_base, major, minor, xkb_event_base;
+
+ gdk_error_trap_push ();
+ have_xkb = XkbQueryExtension (dpy,
+ &opcode,
+ &xkb_event_base,
+ &error_base,
+ &major,
+ &minor)
+ && XkbUseExtension (dpy, &major, &minor);
+ gdk_error_trap_pop ();
+#else
+ have_xkb = 0;
+#endif
+ }
+
+ return have_xkb;
+}
+
gboolean
match_key (Key *key, XEvent *event)
{
+ GdkKeymap *keymap;
+ guint keyval;
+ GdkModifierType consumed;
+ gint group;
+
+ if (key == NULL)
+ return FALSE;
+
+ keymap = gdk_keymap_get_default ();
+ if (have_xkb (event->xkey.display))
+ group = XkbGroupForCoreState (event->xkey.state);
+ else
+ group = (event->xkey.state & GDK_Mode_switch) ? 1 : 0;
+ /* Check if we find a keysym that matches our current state */
+ if (gdk_keymap_translate_keyboard_state (keymap, event->xkey.keycode,
+ event->xkey.state, group,
+ &keyval, NULL, NULL, &consumed)) {
+ guint lower, upper;
+
+ gdk_keyval_convert_case (keyval, &lower, &upper);
+ return ((lower == key->keysym || upper == key->keysym)
+ && (key->state & ~consumed & GSD_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));