Comment 110 for bug 45843

Revision history for this message
In , ultr (ultr) wrote :

@bartek

You are right, it works for Firefox. But not for apps created with Qt4, GTK2 and GTK3.

The reason is Firefox (XUL?) grabs only the mouse pointer and not the keyboard when displaying a context menu. While the rest of the above grab both mouse and keyboard, thus overriding separate keyboard grabs for the shortcuts.

So, to fix this issue we would need to modify Qt (maybe already fixed in Qt5?) and GTK not to unnecessarily (?) grab the keyboard when displaying menus.

Please find the 'grabtest' program in the attachment. It checks whether mouse and/or keyboard are already grabbed.
Comilation: gcc -lX11 grabtest.c -o grabtest
Test: Run "sleep 3 && ./grabtest" and quickly open a context menu

Results:
1) no context menu:
MOUSE GRAB SUCCEEDED
KEYBOARD GRAB SUCCEEDED
2) Firefox context menu:
MOUSE GRAB FAILED, already grabbed?
KEYBOARD GRAB SUCCEEDED
3) Qt4 context menu (tested with Konsole 4.14.2)
MOUSE GRAB FAILED, already grabbed?
KEYBOARD GRAB FAILED, already grabbed?
4) GTK2 context menu (tested with GIMP 2.8)
MOUSE GRAB FAILED, already grabbed?
KEYBOARD GRAB FAILED, already grabbed?
5) GTK3 context menu (tested with Cheese 3.14.1)
MOUSE GRAB FAILED, already grabbed?
KEYBOARD GRAB FAILED, already grabbed?