After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 652402 - gtkdnd unbinds all key grabs
gtkdnd unbinds all key grabs
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-06-12 16:52 UTC by Daniel Drake
Modified: 2011-06-13 01:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtkdnd: Don't bind/unbind keycodes that couldn't be determined (1.60 KB, patch)
2011-06-12 16:52 UTC, Daniel Drake
committed Details | Review
gtkdnd: Don't bind/unbind keycodes that couldn't be determined (1.65 KB, patch)
2011-06-13 01:46 UTC, Matthias Clasen
committed Details | Review

Description Daniel Drake 2011-06-12 16:52:53 UTC
Created attachment 189769 [details] [review]
gtkdnd: Don't bind/unbind keycodes that couldn't be determined

At http://dev.laptop.org/ticket/10643 we are seeing that Sugar's own global keybindings (created with direct calls to XGrabKey) stop working after dragging and dropping in certain contexts.

I have tracked this down to gtkdnd.c:ungrab_dnd_keys() which is being called in this situation.

On both my test systems (fully-updated Fedora 14 and fully-updated Fedora 15), XKeysymToKeycode(XK_KP_Space) (the 3rd entry in grab_keys) returns NoSymbol. NoSymbol has value 0, so we end up calling XUngrabKey(0). A value of 0 (AnyKey) means "unbind all keys".

I propose to fix this by checking for NoSymbol before creating/destroying key bindings in this path.

If this passes review I have access to commit it, and I propose it for both master and gtk-2-24 branches.
Comment 1 Matthias Clasen 2011-06-13 01:44:56 UTC
The following fix has been pushed:
794a370 gtkdnd: Don't bind/unbind keycodes that couldn't be determined
Comment 2 Matthias Clasen 2011-06-13 01:46:44 UTC
Created attachment 189794 [details] [review]
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.