x11: Support xcb-keysyms as fallback when XKB support not available#679
Merged
x11: Support xcb-keysyms as fallback when XKB support not available#679
Conversation
psaavedra
reviewed
Nov 30, 2023
psaavedra
approved these changes
Nov 30, 2023
Member
psaavedra
left a comment
There was a problem hiding this comment.
LGTM. r+
Notice, I0've not tested alternatives builds with/without the COG_X11_USE_XCB_KEYSYMS manually. I assume this works.
Massage the parts from #303 which deal with input using xcb-keysyms to be included in the x11 platform plug-in. This provides a fallback that can be used when XKB initialization fails, typically in cases where the X server does not support XKB or has the support disabled. XKB is a X11 protocol extension after all, and it is wrong to assume that it will be always available. While at it, allow running without keyboard support, producing a warning in this case.
Allow disabling the XKB support in the x11 platform plug-in at build time. For this, introduce a new "x11_keyboard" Meson build option that can be set to use xkb, xcb-keysyms, both, or none. Preprocessor guards are introduced where needed to skip the XKB code.
Add a Wrap subproject definition for the xcb-keysyms dependency. It is a very simple library with a single C source file, so it is easy to make Meson build definitions for it that get added on top of the tarball release fetched by Meson if xcb-keysyms is not available. This way it is guaranteed that there will be at least some support for keyboard input if the XKB extension is not available in the X server, or not enabled at build time.
481158c to
891c33c
Compare
Member
Author
I tested the build options here before submitting the PR 😄 |
3 tasks
This file contains hidden or 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
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.
These patch set pulls the parts of the code from #303 which implement usage of
xcb-keysymsto handle keyboard input event translation, adding a few niceties on top:-Dx11_keyboard=to Meson to choose which methods are supported. It is possible to usexkb,xcb-keysyms, or both. Passing an empty list disables keyboard input to web views.xcb-keysyms, then XKB will be preferred, and if not available thenxcb-keysymsis used as fallback.xcb-keysymslibrary when not available. The library is a single.cfile so it does not add much weight to the X11 platform plug-in, and we make it less likely that people may end up without keyboard input support.Finally, I want to thank @agordon who was the person that originally wrote the code 🙏🏼