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)