On Thu, Jun 16, 2022 at 4:18 PM Nick Couchman <vn...@apache.org> wrote:

> Just another note, here - the issue does not seem to be related to the
> Control key - it's something about the Shift key. If I do the key sequence:
> * Press Shift
> * Press Alt
> * Release Alt
> * Release Shift
>
> I see:
> * Press Shift
> guacamole keydown 0xffe1 Left shift
> * Press Alt
> * Release Alt
> guacamole keydown 0xffe9 Left alt
> guacamole keydown 0xffe7 Left meta
> guacamole keyup 0xffe7 Left meta
> guacamole keyup 0xffe9 Left alt
> * Release Shift
> guacamole keyup 0xffe1 Left shift
>
>
Well, I have managed to figure out at least part of what's going on here.
Apparently Linux tends to map Shift + Alt -> Meta. This can be un-done,
but, by default, if you are holding Shift while you press Alt, you get
Meta. This can be seen with "xev":

KeyPress event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1150678547, (59,133), root:(930,609),
    state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1150679124, (59,133), root:(930,609),
    state 0x1, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1150679335, (59,133), root:(930,609),
    state 0x9, keycode 64 (keysym 0xffe7, Meta_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1150679398, (59,133), root:(930,609),
    state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

There are a couple of interesting things to note, here, that may still be
buggy with how Guacamole handles it:
* xev does not show any delay in pressing the "Alt" key the way that the
Guacamole Keyboard Test page does (Alt keydown was not shown until Alt was
released).
* xev only shows the Meta key event, it does not show the Alt key event,
whereas Guacamole shows both Alt and Meta.
* Order of the key presses matters - if you press Ctrl + Alt + Shift,
things behave as expected - no Meta keypress, no funny hidden menu
behavior, etc. If you press Ctrl + Shift + Alt, you get funny results.

Based on a hint from a forum post (
https://askubuntu.com/questions/567731/why-is-shift-alt-being-mapped-to-meta),
I use xmodmap to remove the Shift + Alt mapping to Meta, and, with xev this
seems to work:

KeyPress event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1151683225, (165,-13), root:(1036,463),
    state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1151683371, (165,-13), root:(1036,463),
    state 0x4, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1151683570, (165,-13), root:(1036,463),
    state 0x5, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1151683720, (165,-13), root:(1036,463),
    state 0xd, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1151684195, (165,-13), root:(1036,463),
    state 0x5, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4c00001,
    root 0x79b, subw 0x0, time 1151684327, (165,-13), root:(1036,463),
    state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

However, to this point, this has not impacted how the Guacamole Keyboard
API interprets the keys - I still see the Meta key trigger when pressing
Ctrl + Shift + Alt. Not sure if I just need to restart Chrome, or if this
is truly a bug??

-Nick

>

Reply via email to