Fix drag-and-drop keygrab unbinding

Solves http://dev.laptop.org/ticket/10643

Patch already upstream. Adding to Fedora with permission from
Matthias Clasen.
This commit is contained in:
Daniel Drake 2011-06-13 15:28:45 +01:00
parent 53c2152cca
commit 9f850dca40
2 changed files with 53 additions and 1 deletions

View File

@ -18,7 +18,7 @@
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
Name: gtk2 Name: gtk2
Version: 2.24.4 Version: 2.24.4
Release: 1%{?dist} Release: 2%{?dist}
License: LGPLv2+ License: LGPLv2+
Group: System Environment/Libraries Group: System Environment/Libraries
URL: http://www.gtk.org URL: http://www.gtk.org
@ -39,6 +39,7 @@ Patch8: tooltip-positioning.patch
#Patch14: gtk2-landscape-pdf-print.patch #Patch14: gtk2-landscape-pdf-print.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=611313 # https://bugzilla.gnome.org/show_bug.cgi?id=611313
Patch15: window-dragging.patch Patch15: window-dragging.patch
Patch16: gtkdnd-keycode-unbind.patch
BuildRequires: atk-devel >= %{atk_version} BuildRequires: atk-devel >= %{atk_version}
BuildRequires: glib2-devel >= %{glib2_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 %patch8 -p1 -b .tooltip-positioning
#%patch14 -p1 -b .landscape-pdf-print #%patch14 -p1 -b .landscape-pdf-print
%patch15 -p1 -b .window-dragging %patch15 -p1 -b .window-dragging
%patch16 -p1 -b .keycode-unbind
%build %build
# For the gobject-introspection patch # For the gobject-introspection patch
@ -350,6 +352,9 @@ fi
%doc tmpdocs/examples %doc tmpdocs/examples
%changelog %changelog
* Mon Jun 13 2011 Daniel Drake <dsd@laptop.org> - 2.24.4-2
- Fix unbinding of keycodes on drag-and-drop (olpc#10643)
* Fri Apr 1 2011 Matthias Clasen <mclasen@redhat.com> - 2.24.4-1 * Fri Apr 1 2011 Matthias Clasen <mclasen@redhat.com> - 2.24.4-1
- Update to 2.24.4 - Update to 2.24.4

View File

@ -0,0 +1,47 @@
From 794a3706cd29f8457731b09ac39870ee1d11bf94 Mon Sep 17 00:00:00 2001
From: Daniel Drake <dsd@laptop.org>
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