-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Update scancode processing #3138
Merged
matt335672
merged 11 commits into
neutrinolabs:devel
from
matt335672:update_scancode_processing
Aug 6, 2024
Merged
Update scancode processing #3138
matt335672
merged 11 commits into
neutrinolabs:devel
from
matt335672:update_scancode_processing
Aug 6, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unless anyone's got any great objections, I'll merge this and neutrinolabs/xorgxrdp#316 into devel after we've shipped v0.10.1 (see #3155). It seems pretty solid to me, but I've not got a huge array of keyboards here for testing. Getting it out into the community should flush out any last few problems before we ship it in a major release. |
The mapping from scancodes to the indexes used in xrdp_keymap is not well designed and contains an implicit dependency on keycode values. This mapping is alse slightly different from the index used for the 'keys' map in the xrdp_wm structure. This commit introduces support for mapping scancodes directly to 'scancode indexes' suitable for indexing into both structures. Some renaming is also done; [MS-RDPBCGR] uses the terms scancode and keyCode interchangeably. An effort is made to use key_code for a raw value from a TS_KEYBOARD_EVENT, and scancode for a value which is produced by the scancode module.
Replace definitions in ms-rdpbcgr.h marked as TODO with the names defined in [MS-RDPBCGR] Some other simplifications around the fake Unicode event processing have also been made.
- All scancode definitions are moved to scancode.h - Magic numbers are replaced where applicable with definitions
This commit moves processing of the pause key from xorgxrdp back to xrdp itself, so that the key can be passed to the VNC backend.
The Brazilian ABNT2 Keyboard layout contains a keypad decimal key which doesn't exist on other keypads:- https://www.kbdlayout.info/kbdbr/virtualkeys This key is curently mapped in xorgxrdp to keycode 134 (basic mapping), but isn't present in the scancode map. It needs to be added so that it is available to VNC sessions and will be mapped for xorgxrdp when we move to evdev keycode mappings.
Regenerate keymaps with pause key and ABNT2 keypad point keys added.
Add a development header xrdp_scancode_defs.h which contains common scancode definitions for xrdp and xorgxrdp
xrdp_load_keyboard_layout() is used exclusively by the xup module to work out the parameters to pass to xorgxrdp for XKB. This function does not need to be called locally from the SEC module. This commit moves the function to xrdp/lang.c and renames it as xrdp_init_xkb_layout(). The module interface is modified so that xup can call this function. Other modules do not need to call it.
This commit allows a keycode_set to be specified as a module parameter in xrdp.ini. This has the following effects:- 1) xrdp loads the specified keycode set for mapping RDP scancodes to X11 keycodes. These are then passed to xorgxrdp as part of key press/ key release events. 2) The name of the XKB rules which use the specified keycode set are passed to xorgxrdp so that XKB can be configured with rules which match the chosen keycodes. The effect is to remove all keycode set dependencies from xorgxrdp. Normally evdev rules and evdev keycodes will be used but base rules and base keycodes can be used instead for applications that require them. Also, any systems which do not ship the evdev rules can be made to work with base rules.
When a connection is made to a system with the client numlock pressed, a TS_SYNC_EVENT is sent before the module is loaded. This TS_SYNC_EVENT correctly contains the NumLock status as 'pressed'. The event is, however, discarded as the module isn't loaded. When the module is loaded, a TS_SYNC_EVENT is not sent again unless client focus is removed from the xrdp window and re-applied. As a result, the NumLock state is incorrect unless this is done. This commit stores the last TS_SYNC_EVENT sent before a module is loaded. When the module is loaded, the sync state can be correctly communicated to the module.
matt335672
force-pushed
the
update_scancode_processing
branch
from
August 5, 2024 10:00
beda30d
to
3f568b4
Compare
This was referenced Aug 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #621
Fixes #355
This is a significant re-write of xrdp keyboard handling.
See also xorgxrdp PR neutrinolabs/xorgxrdp#316
This builds on the work in #3039 / #3113 with significant changes:-
xrdp_load_keyboard_layout()
which is only needed for xorgxrdp has been renamedxrdp_init_xkb_layout()
and is now only called when needed.base
orevdev
) can be specified for the X server at run-time.The corresponding XKB rules are passed toxorgxrdp
.I've got a bit more testing to do before I can merge this, but I'd welcome any comments.