Menu

#85 Super+L not passed through and getting stuck with VcXsrv

v1.0_(example)
open
nobody
None
5
2022-11-01
2018-08-28
laur
No

ver 1.20.1.1, installed via chocolatey pkg manager.
windows 10

Server is launched with -keyhook option so modifier keys get passed to the clients as well.

When Super+L has been disabled in windows, it still isn't correctly passed to vcxsrv, and causes Super key to get stuck; note getting stuck happens only when shortcut is used while vcxsrv window is active.

Other Super-related combinations (eg Super+E) work just fine.

Sidenote - I understand this keycombo is treated differently by Windows, but following this registry edit (disabling locking functionality), windows releases the keybinding, and can now be intercepted by other processes (eg the same AHK script in that example).

FYI this issue is also up in StackOverflow.

Discussion

  • laur

    laur - 2018-08-28

    Suspect we should be looking in hw/xwin/winkeyhook.c.

    Any suggestions on how to debug it? -logverbose with values of 3 or 4 didn't change anything in logs.

     
  • marha

    marha - 2018-08-28

    logverbose 3 and 4 are only working when having installed the debug binaries.

    I already looket at this, but I do not see any filtering on the Super+L key. in the code. The key is seen by the keyboard hook that is installed.

     
  • laur

    laur - 2018-08-28

    I already looket at this, but I do not see any filtering on the Super+L key. in the code. The key is seen by the keyboard hook that is installed.

    So you see no reason in the code why super+L should act any different than say super+E?
    Any idea what my problem might be caused by? Are you able to reproduce (assuming you're willing to edit your registry in order to disable widows' hook)?

    Off topic - would it be possible to force vcxsrv hook be installed after other hooks like AHK? In that case it would be possible to hack around this sort of corner cases - eg AHK could intercept Super+L and instead send other keys to xserver.


    Edit: key events not passing through can also be seen by intercepting them with xev - we receive Super down & up, but no L input.

     

    Last edit: laur 2018-08-29
  • laur

    laur - 2019-08-15

    Managed to compile debug build from 5c535d5a5228b8810e25c86e5fc2e7b5663d41b4.
    Added a bit logging (see my git stash, apply with $git apply /path/to/file), and defined WIN_DEBUG_MESSAGES=1 environment variable.
    vcxsrv is launched using -keyhook -logfile C:\Users\layr\file.log -logverbose 4 options.

    For Super+H, which works fine, we get following output in log:
    (note in all log excerpts below, different button event blocks have been separated by an empty line)

    winKeyboardMessageHook: vkCode: 0000005b scanCode: 0000005b
    !! fPassKeystroke = TRUE
    winWindowProc - Message WM_KEYDOWN
            hwnd 0x0000000000C308A2 wParam 0x5b lParam 0x5b0001
    winTranslateKey: wParam 0000005b lParam 005b0001
    !! in KEYDOWN, should send winSendKeyEvent
    @winSendKeyEvent: dwKey: 107, fDown: 1
    XSERVER_SEND_EVENT: 7 2 73 0 0 0 0
    
    winKeyboardMessageHook: vkCode: 00000048 scanCode: 00000023
    !! fPassKeystroke = FALSE
    !! calling next hook
    winWindowProc - Message WM_KEYDOWN
            hwnd 0x0000000000C308A2 wParam 0x48 lParam 0x230001
    winTranslateKey: wParam 00000048 lParam 00230001
    !! in KEYDOWN, should send winSendKeyEvent
    @winSendKeyEvent: dwKey: 35, fDown: 1
    XSERVER_SEND_EVENT: 7 2 2b 0 0 0 0
    XSERVER_SEND_EVENT: 6 6 0 14 2 63be5d2 63be5d8
    
    winKeyboardMessageHook: vkCode: 00000048 scanCode: 00000023
    !! fPassKeystroke = FALSE
    !! calling next hook
    winWindowProc - Message WM_KEYUP
            hwnd 0x0000000000C308A2 wParam 0x48 lParam 0xc0230001
    winTranslateKey: wParam 00000048 lParam c0230001
    !! in KEYUP, should send winSendKeyEvent
    @winSendKeyEvent: dwKey: 35, fDown: 0
    XSERVER_SEND_EVENT: 7 3 2b 0 0 0 0
    
    winKeyboardMessageHook: vkCode: 0000005b scanCode: 0000005b
    !! fPassKeystroke = TRUE
    winWindowProc - Message WM_KEYUP
            hwnd 0x0000000000C308A2 wParam 0x5b lParam 0x805b0001
    winTranslateKey: wParam 0000005b lParam 805b0001
    !! in KEYUP, should send winSendKeyEvent
    @winSendKeyEvent: dwKey: 107, fDown: 0
    XSERVER_SEND_EVENT: 7 3 73 0 0 0 0
    

    Super+L gives us this:

    winKeyboardMessageHook: vkCode: 0000005b scanCode: 0000005b
    !! fPassKeystroke = TRUE
    winWindowProc - Message WM_KEYDOWN
            hwnd 0x0000000000C308A2 wParam 0x5b lParam 0x5b0001
    winTranslateKey: wParam 0000005b lParam 005b0001
    !! in KEYDOWN, should send winSendKeyEvent
    @winSendKeyEvent: dwKey: 107, fDown: 1
    XSERVER_SEND_EVENT: 7 2 73 0 0 0 0
    
    winKeyboardMessageHook: vkCode: 0000004c scanCode: 00000026
    !! fPassKeystroke = FALSE
    !! calling next hook
      // NOTE: winWindowProc is not processing windows message: does this mean windows sent none?
    
    winKeyboardMessageHook: vkCode: 0000004c scanCode: 00000026
    !! fPassKeystroke = FALSE
    !! calling next hook
    winWindowProc - Message WM_KEYUP
            hwnd 0x0000000000C308A2 wParam 0x4c lParam 0x80260001
    winTranslateKey: wParam 0000004c lParam 80260001
    !! in KEYUP, should send winSendKeyEvent
    @winSendKeyEvent: dwKey: 38, fDown: 0
    !! in winSendKeyEvent: aborting because of alttab protection! //<-- probably because keyup on L key is odd as keydown state had not been stored?
    
    winKeyboardMessageHook: vkCode: 0000005b scanCode: 0000005b
    !! fPassKeystroke = TRUE
    winWindowProc - Message WM_KEYUP
            hwnd 0x0000000000C308A2 wParam 0x5b lParam 0x805b0001
    winTranslateKey: wParam 0000005b lParam 805b0001
    !! in KEYUP, should send winSendKeyEvent
    @winSendKeyEvent: dwKey: 107, fDown: 0
    XSERVER_SEND_EVENT: 7 3 73 0 0 0 0
    

    You're right in that keyhook sees all the presses for Super+L; what is wrong though is L keydown event - keyhook sees it, but winWindowProc() is not picking up a message, thus no event is triggered from it to Xserver.
    What does all this mean? We're not receiving message from Windows?

    Capturing it should be possible, as some othe programs (such as AHK, Virtualbox) happily capture & pass all Super+key shortcuts.

     

    Last edit: laur 2019-08-15
  • laur

    laur - 2020-06-09

    @marha any hope you'd be willing to look into this issue again?

     
  • laur

    laur - 2022-11-01

    Bump, still looking for a solution.

     

Log in to post a comment.