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 769214 - keyval field not filled correctly for Pause key
keyval field not filled correctly for Pause key
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
3.20.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-07-27 08:39 UTC by Frediano Ziglio
Modified: 2017-01-09 15:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GDK W32: Special handling for VK_PAUSE (1.45 KB, patch)
2016-07-27 18:09 UTC, LRN
committed Details | Review

Description Frediano Ziglio 2016-07-27 08:39:48 UTC
Hi,
  I was trying to handle the pause key correctly using spice protocol and virtualization. Turns out that this key is really weird and GDK does not support it correctly either.

Skipping all spice/ps2/virtualization background when the Pause key is pressed Windows sent a WM_KEYDOWN/WM_KEYUP sequence with virtual key code VK_PAUSE. This VK_PAUSE value is correctly copied in the hardware_keycode field if GtkEventKey. However keyval is set to GDK_KEY_VoidSymbol instead of GDK_KEY_Pause making hard to handle this key in a portable way.

Some details on Pause key. This key produce different hardware scancodes if combined with Ctrl (sending a Break sequence) or not (sending a Pause sequence). The Pause sequence contains an extended key which starts with E1 while mostly all other keys (beside some rare keyboard) use E0 prefix. Specifically a kind of Third-Ctrl NumLock is sent by hardware for the Pause. The Windows driver take this sequence (E1 1D 45 on press E1 9D C5 on release) and send WM_KEYDOWN/WM_KEYUP (with VK_PAUSE as virtual key and 0x45 as scancode). The GTK bug could be due to the fact that MapVirtualKey does not work perfectly with extended keys (the table is built from scancode to virtual codes as the low level layout tables translate scancodes to virtual codes).

Note: please try this on real machines, not virtual ones.
Comment 1 LRN 2016-07-27 18:09:34 UTC
Created attachment 332235 [details] [review]
GDK W32: Special handling for VK_PAUSE

Similar to VK_DIVIDE, this key can't be mapped to a scancode by
MapVirtualKeyEx(). Googling suggests that this is a known bug.

This patch might apply to GTK+-master (or 2.24 branch) or it might not. I wrote
it on top of patches for bug 768722 and bug 569581.
If it doesn't apply cleanly, it can be applied manually, as the change is,
essentially, a one-liner.
Comment 2 Matthias Clasen 2016-08-01 12:56:42 UTC
Frediano, can you test that patch and let us know if it works for you ?
Comment 3 LRN 2016-11-25 17:04:13 UTC
The patch is simple enough, so
Attachment 332235 [details] pushed as 962d3df - GDK W32: Special handling for VK_PAUSE
Comment 4 LRN 2017-01-09 15:17:54 UTC
Also pushed as 125ef35 into gtk-3-22 (totally forgot about it!)