[gtk+/gtk-2-24] gtkdnd: Don't bind/unbind keycodes that couldn't be determined
- From: Daniel Drake <dsd src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] gtkdnd: Don't bind/unbind keycodes that couldn't be determined
- Date: Mon, 13 Jun 2011 14:24:38 +0000 (UTC)
commit 149750773e4ef0d1928e16fdacbd867c96679337
Author: Daniel Drake <dsd laptop org>
Date: Sun Jun 12 17:48:17 2011 +0100
gtkdnd: Don't bind/unbind keycodes that couldn't be determined
At http://dev.laptop.org/ticket/10643 we are seeing that drag-and-drop
within the Sugar shell causes all of Sugar's custom keybindings to be
removed.
This is because gtkdnd tries to unbind XK_KP_Space, which (on my systems)
is resolved to NoSymbol by XKeycodeToKeysym(). NoSymbol has value 0,
the same as AnyKey, and XUngrabKey(AnyKey) is equivalent to unbinding
all possible keycodes.
Fix this by catching NoSymbol before binding/unbinding.
https://bugzilla.gnome.org/show_bug.cgi?id=652402
gtk/gtkdnd.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 25f6932..7488358 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -470,6 +470,8 @@ grab_dnd_keys (GtkWidget *widget,
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
{
keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (window), grab_keys[i].keysym);
+ if (keycode == NoSymbol)
+ continue;
XGrabKey (GDK_WINDOW_XDISPLAY (window),
keycode, grab_keys[i].modifiers,
GDK_WINDOW_XID (root),
@@ -502,6 +504,8 @@ ungrab_dnd_keys (GtkWidget *widget,
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
{
keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (window), grab_keys[i].keysym);
+ if (keycode == NoSymbol)
+ continue;
XUngrabKey (GDK_WINDOW_XDISPLAY (window),
keycode, grab_keys[i].modifiers,
GDK_WINDOW_XID (root));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]