Re: Ctrl-Shift-Alt Woes

2022-06-19 Thread Nick Couchman
On Thu, Jun 16, 2022 at 4:18 PM Nick Couchman  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 0x4c1,
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 0x4c1,
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 0x4c1,
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 0x4c1,
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 0x4c1,
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 0x4c1,
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 0x4c1,
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 0x4c1,
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 0x4c1,
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 0x4c1,
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

>


Re: Ctrl-Shift-Alt Woes

2022-06-16 Thread Nick Couchman
On Thu, Jun 16, 2022 at 4:07 PM Nick Couchman 
wrote:

> Hello, everyone,
> I've posted a couple of times out this in various places, but I'm seeing
> some really odd behavior after version 1.4.0 for Ctrl-Shift-Alt sequences.
> I've used the Keyboard API tester, and I'm seeing a few oddities, there, as
> well. I will try to describe them as best I can, though it's a little hard
> to describe...
>
> First, I see an issue where, during the Ctrl-Shift-Alt keypress sequence,
> the Alt key-down doesn't get sent until another key is released. Here's the
> sequence that I press:
>
> * Press Control
> * Press Shift
> * Press Alt
> * Release Control
> * Release Shift
> * Release Alt
>
> Here is how the actual timing works out on the Keyboard API Test page:
> * Press Control
> guacamole keydown 0xffe3 Left control
> * Press Shift
> guacamole keydown 0xffe1 Left shift
> * Press Alt
> * Release Control
> guacamole keyup 0xffe3 Left control
> guacamole keydown 0xffe9 Left alt
> * Release Shift
> guacamole keyup 0xffe1 Left shift
> guacamole keyup 0xffe9 Left alt
> * Release Alt
>
> Two things jump out, here:
> * The "Alt" keydown doesn't get sent until the "Control" key is release.
> * Both the "Shift" and "Alt" keyup events occur as soon as "Shift" is
> released - while "Alt" is still pressed.
>
> The second interesting one is this:
> * Press Control
> * Press Shift
> * Press Alt
> * Release Alt
> * Release Shift
> * Release Control
>
> This results in the following sequence:
> * Press Control
> guacamole keydown 0xffe3 Left control
> * 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
> * Release Control
> guacamole keyup 0xffe3 Left control
>
> The items of note, here, are that:
> * The Alt keydown is not sent until Alt is actually released.
> * The Meta keydown is sent along with the Alt keydown, which is completely
> unintended.
>
>
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

Additionally, if I use the Alt key on its own, or with other keys (letters,
for example), it works fine. And, if I press, Alt, first, and then Shift,
the keydown/keyup also works as expected. It is something about the Shift
-> Alt sequence.

-Nick

>