http://bugs.winehq.org/show_bug.cgi?id=30853
Bug #: 30853 Summary: Wine doesn’t always handle "right alt" properly Product: Wine Version: 1.5.5 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winex11.drv AssignedTo: wine-bugs@winehq.org ReportedBy: sloonz@gmail.com Classification: Unclassified
Created attachment 40410 --> http://bugs.winehq.org/attachment.cgi?id=40410 workaround/quick and dirty fix
I’m trying to get World of Warcraft working under Wine. However, I have huge trouble with key bindings (I use unusual key bindings : I use the right half of my keyboard, whereas most players use the left half).
After investigation, I found 3 bugs (different behaviors between Wine and my Windows installation). The first one is the management of the right "Alt" key (labeled "Alt-Gr" on my keyboard). When I press AltGr+l under Windows with Spy++, I get the followings events :
<03637> 0007045A P WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0 <03638> 0007045A P WM_KEYDOWN nVirtKey:VK_MENU cRepeat:1 ScanCode:38 fExtended:1 fAltDown:1 fRepeat:0 fUp:0 <03639> 0007045A P WM_KEYDOWN nVirtKey:'L' cRepeat:1 ScanCode:18 fExtended:0 fAltDown:1 fRepeat:0 fUp:0 <03640> 0007045A P WM_DEADCHAR chCharCode:'002F' (47) cRepeat:1 ScanCode:18 fExtended:0 fAltDown:1 fRepeat:0 fUp:0 <03641> 0007045A P WM_KEYUP nVirtKey:'L' cRepeat:1 ScanCode:18 fExtended:0 fAltDown:1 fRepeat:1 fUp:1 <03642> 0007045A P WM_SYSKEYUP nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:1 fRepeat:1 fUp:1 <03643> 0007045A P WM_KEYUP nVirtKey:VK_MENU cRepeat:1 ScanCode:38 fExtended:1 fAltDown:0 fRepeat:1 fUp:1
Under Wine 1.5.5 however (WINEDEBUG=+msg), I get those :
trace:msg:peek_message got type 7 msg 100 (WM_KEYDOWN) hwnd 0x6007e wp eb lp 760001 [note: wp = VK_OEM_PA2] trace:msg:peek_message got type 7 msg 101 (WM_KEYUP) hwnd 0x6007e wp 4c lp c0260001 [note: wp = 'L'] trace:msg:peek_message got type 7 msg 101 (WM_KEYUP) hwnd 0x6007e wp eb lp c0760001 [note: wp = VK_OEM_PA2]
With xev, I get :
KeyPress event, serial 93, synthetic NO, window 0x4000001, root 0xbc, subw 0x0, time 5086996, (1585,410), root:(2578,425), state 0x0, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES, XKeysymToKeycode returns keycode: 92 XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False
KeyRelease event, serial 93, synthetic NO, window 0x4000001, root 0xbc, subw 0x0, time 5087052, (1585,410), root:(2578,425), state 0x80, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES, XKeysymToKeycode returns keycode: 92 XLookupString gives 0 bytes: XFilterEvent returns: False
After "setxkbmap us", AltGr is bound to Alt_R under X (checked with xev), and I get this under Wine :
trace:msg:peek_message got type 7 msg 104 (WM_SYSKEYDOWN) hwnd 0x10046 wp a5 lp 21380001 [wp = VK_RMENU] trace:msg:peek_message got type 7 msg 104 (WM_SYSKEYDOWN) hwnd 0x10046 wp 4c lp 20260001 [wp = 'L'] trace:msg:peek_message got type 6 msg 106 (WM_SYSCHAR) hwnd 0x10046 wp 6c lp 20260001 [wp = 'l'] trace:msg:peek_message got type 7 msg 105 (WM_SYSKEYUP) hwnd 0x10046 wp 4c lp e0260001 [wp = 'L'] trace:msg:peek_message got type 7 msg 101 (WM_KEYUP) hwnd 0x10046 wp a5 lp c1380001 [wp = VK_RMENU]
(yes, I have a KEYUP without KEYDOWN)
Wich is still not the same as Windows. So I think there is two problems here : - ISO_Level3_Shift is not properly recognized by Wine - "AltGr" doesn't have the same behavior under Wine and Windows
FYI, attached patch is a workaround to have the same behavior than Windows. With it, I get this under Wine :
trace:msg:peek_message got type 7 msg 100 (WM_KEYDOWN) hwnd 0x10062 wp a2 lp 1d0001 [note: wp = VK_LCONTROL] trace:msg:peek_message got type 7 msg 100 (WM_KEYDOWN) hwnd 0x10062 wp a4 lp 20380001 [note: wp = VK_LMENU] trace:msg:peek_message got type 7 msg 100 (WM_KEYDOWN) hwnd 0x10062 wp 4c lp 20260001 [note: wp = 'L'] trace:msg:peek_message got type 7 msg 101 (WM_KEYUP) hwnd 0x10062 wp 4c lp e0260001 trace:msg:peek_message got type 7 msg 105 (WM_SYSKEYUP) hwnd 0x10062 wp a2 lp e01d0001 trace:msg:peek_message got type 7 msg 101 (WM_KEYUP) hwnd 0x10062 wp a4 lp c0380001
Which is still not the same as Windows : - Windows uses (right) control + menu (with fExtended flag for menu) whereas Wine uses left control + left menu. Not investigated if this is related to TranslateMessage. - AltGr+L is a dead symbol on my keymap. Windows send a DEADCHAR message, wheras Wine send nothing. Note that I had to disable the XFilterEvent test in event.c to have those messages, otherwise nothing is sent to the program (but that’s another story for another bug report)
But it suffice for my use case (WoW key bindings with right alt)
http://bugs.winehq.org/show_bug.cgi?id=30853
Sebastian Loncar sebastian.loncar@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian.loncar@gmail.com
--- Comment #1 from Sebastian Loncar sebastian.loncar@gmail.com --- This Bug is 1,5 years old, but absoluty up-to-date.
I have an german keyboard, too, with an right "AltGr"-Key (this is not simple a right alt-key, its on a german keyboard a "special" alt-key.
When using special chars with this key, for example , @ or €, it works in most wine applications. But not in "Starcraft II". In Starcraft2, i can set custom key bindings, and want to bind "AltGr+p". Normally, in the windows version, it will be migrated to "CTRL+ALT+P". (in other words: AltGr=CTRL+ALT). This is "normal" (unter real windows installation).
In Wine, in starcraft2, the keybinder in the game will show only "p" instead of CTRL+ALT+P, when i hit "AltGr+P".
As i remind, in an previous version of wine, it showed "ALT+P" instead of "CTRL+ALT+P". But in the lastest version, the key is completly skipped.
With the patch of Sloonz, the keybinding works correctly! (Hitting AltGr+P in starcraft keybinder, and CTRL+ALT+P is showed).
The downside of his patch: keybindings and recall of keybindings are working - but all special AltGr-chars are broken than. "@"-char for example is on german keyboard "AltGr+Q".
Greetings from Germany, Sebastian
http://bugs.winehq.org/show_bug.cgi?id=30853
--- Comment #2 from Sebastian Loncar sebastian.loncar@gmail.com --- Here is a new comparison.
Output of spy++ on native windows, when pressing/releasing ALTGR+L:
<000001> 0003048A P WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0 <000002> 0003048A P WM_KEYDOWN nVirtKey:VK_MENU cRepeat:1 ScanCode:38 fExtended:1 fAltDown:1 fRepeat:0 fUp:0 <000003> 0003048A P WM_KEYDOWN nVirtKey:'L' cRepeat:1 ScanCode:26 fExtended:0 fAltDown:1 fRepeat:0 fUp:0 <000004> 0003048A P WM_SYSKEYUP nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:1 fRepeat:1 fUp:1 <000005> 0003048A P WM_KEYUP nVirtKey:VK_MENU cRepeat:1 ScanCode:38 fExtended:1 fAltDown:0 fRepeat:1 fUp:1 <000006> 0003048A P WM_KEYUP nVirtKey:'L' cRepeat:1 ScanCode:26 fExtended:0 fAltDown:0 fRepeat:1 fUp:1
Output of spy++ in wine 1.7.15 (from git):
<00001> 00020046 P WM_KEYDOWN nVirtKey:VK_OEM_RESET cRepeat:1 ScanCode:6B fExtended:0 fAltDown:0 fRepeat:0 fUp:0 <00002> 00020046 P WM_KEYDOWN nVirtKey:'L' cRepeat:1 ScanCode:26 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 <00003> 00020046 P WM_CHAR chCharCode:'322' (66) cRepeat:1 ScanCode:26 fExtended:0 fAltDown:0 fRepeat:0 fUp:0 <00004> 00020046 P WM_KEYUP nVirtKey:'L' cRepeat:1 ScanCode:26 fExtended:0 fAltDown:0 fRepeat:1 fUp:1 <00005> 00020046 P WM_KEYUP nVirtKey:VK_OEM_RESET cRepeat:1 ScanCode:6B fExtended:0 fAltDown:0 fRepeat:1 fUp:1
http://bugs.winehq.org/show_bug.cgi?id=30853
--- Comment #3 from Sebastian Loncar sebastian.loncar@gmail.com --- here's the spy++ tool from visual studio 10.0 tools: http://stne.net/temp/spyxx.zip
Open notepad, open spy++, select notepad window, right click --> Messages, enter keystrokes in notepad, right click messages-window --> logging options --> messages --> clear all, check only "Keyboard". Rightclick message window, clear messages. Enter key strokes in notepad and watach the message windows. Seems complicated but its all self explaining.
https://bugs.winehq.org/show_bug.cgi?id=30853
--- Comment #4 from Ken Sharp imwellcushtymelike@gmail.com --- Does this still occur in Wine 1.7.44 or later?
https://bugs.winehq.org/show_bug.cgi?id=30853
--- Comment #5 from Sebastian Loncar sebastian.loncar@gmail.com --- I just tested this again with starcraft II, still it's unpossible to assign or use AltGr key combinations (Wine 1.7.45)
https://bugs.winehq.org/show_bug.cgi?id=30853
Daniel Berger 3dk@protonmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |3dk@protonmail.com
--- Comment #6 from Daniel Berger 3dk@protonmail.com --- I also tried using AltGr keycombinations in SCII on a German keyboard and it still doesn't work (wine version 2.0-rc3). To get around the issue, I simply rebound my AltGr key to work as Left Alt, using xmodmap:
$ xmodmap -e "keycode 108 = Alt_L"
To make the key AltGr again:
$ xmodmap -e "keycode 108 = ISO_Level3_Shift"
The change only lasts until reboot. Keycodes may differ from keyboard to keyboard, use
$ xev
to find out the necessary keycodes for the xmodmap command. I found practical info on how to use xmodmap at this askubuntu thread:
http://askubuntu.com/questions/296155/how-can-i-remap-keyboard-keys
https://bugs.winehq.org/show_bug.cgi?id=30853
Jan Henning Klasen id@goldsteal.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |id@goldsteal.com
--- Comment #7 from Jan Henning Klasen id@goldsteal.com --- This is still a thing in 2020. So much so that a bounty has been put on it on Bountysource a few months ago: https://www.bountysource.com/issues/90161687-wine-doesn-t-always-handle-righ...
How does one confirm a bug btw.?
https://bugs.winehq.org/show_bug.cgi?id=30853
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #8 from Austin English austinenglish@gmail.com --- Confirming.