Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve special key handling #270

Merged
merged 3 commits into from
Sep 30, 2023
Merged

Conversation

pmhahn
Copy link
Collaborator

@pmhahn pmhahn commented Sep 23, 2023

At least (old) version of Qemu (2.6 from ~2016) have a problem when key-sequences are releases in the same order they are pressed. Reverse the order the the key pressed last is released first.

Also two minore code cleanups.

property setter and getter are unnecessary as they add no logic.
to improve readability move the case to handle a non-callable attribute
first as all the other code is only relevant for the callable case.
Versions before Qemu 2.12 (from ~2016) had a bug in handling keys
requiring modifiers, e.g. Shift for upper-case letters: While the
original VNC protocol was designed for remoting X11 applications, where
high-level KeySyms are used (for example "Upper-case 'A'), Qemu (and
other hardware virtualization tools) are required to translate that back
into low-level KeyCode events:
1. Left-Shift down
2. 'A' down
3. 'A' up
4. Left-Shift up

With the default `force_caps = False` this is fully done by Qemu, where
version 2.8 shows the following bug: After sending a capital "A" even
the next lower-case "a" is still received as an upper-case "A". This
continues until the next upper-case letter is sent.

With `force_capse = True` `vncdotool` does part of that translation and
adds KeySyms for Shift-Down and Shift-Up itself, but reversed 3. and 4:
3. Left-Shift up
4. 'a' up

Again this triggers a Qemu bug as now there is a discrepancy: 2. downs
an *upper*-case "A" while 4. releases a *lower*-case "a". For `vndotool`
is is irrelevant, but graphical VNC clients were affected.

To not confuse Qemu release the keys in reverse order.

Switch to logging the actual KeySyms sent to the VNC server.
@pmhahn pmhahn requested a review from sibson September 23, 2023 12:27
@sibson sibson merged commit a4bb988 into sibson:main Sep 30, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants