From 9f850dca404321ac319280ffe06050346b6a35f1 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Jun 13 2011 14:42:39 +0000 Subject: Fix drag-and-drop keygrab unbinding Solves http://dev.laptop.org/ticket/10643 Patch already upstream. Adding to Fedora with permission from Matthias Clasen. --- diff --git a/gtk2.spec b/gtk2.spec index 8c93f0e..a8c20c1 100644 --- a/gtk2.spec +++ b/gtk2.spec @@ -18,7 +18,7 @@ Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X Name: gtk2 Version: 2.24.4 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.gtk.org @@ -39,6 +39,7 @@ Patch8: tooltip-positioning.patch #Patch14: gtk2-landscape-pdf-print.patch # https://bugzilla.gnome.org/show_bug.cgi?id=611313 Patch15: window-dragging.patch +Patch16: gtkdnd-keycode-unbind.patch BuildRequires: atk-devel >= %{atk_version} BuildRequires: glib2-devel >= %{glib2_version} @@ -155,6 +156,7 @@ This package contains developer documentation for the GTK+ widget toolkit. %patch8 -p1 -b .tooltip-positioning #%patch14 -p1 -b .landscape-pdf-print %patch15 -p1 -b .window-dragging +%patch16 -p1 -b .keycode-unbind %build # For the gobject-introspection patch @@ -350,6 +352,9 @@ fi %doc tmpdocs/examples %changelog +* Mon Jun 13 2011 Daniel Drake - 2.24.4-2 +- Fix unbinding of keycodes on drag-and-drop (olpc#10643) + * Fri Apr 1 2011 Matthias Clasen - 2.24.4-1 - Update to 2.24.4 diff --git a/gtkdnd-keycode-unbind.patch b/gtkdnd-keycode-unbind.patch new file mode 100644 index 0000000..9c8d680 --- /dev/null +++ b/gtkdnd-keycode-unbind.patch @@ -0,0 +1,47 @@ +From 794a3706cd29f8457731b09ac39870ee1d11bf94 Mon Sep 17 00:00:00 2001 +From: Daniel Drake +Date: Sun, 12 Jun 2011 17:48:17 +0100 +Subject: [PATCH] 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 4805a6f..617a02e 100644 +--- a/gtk/gtkdnd.c ++++ b/gtk/gtkdnd.c +@@ -475,6 +475,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), +@@ -508,6 +510,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)); +-- +1.7.5.2 +