-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
WIP: forwarding certain key events of 'wine_window' to 'host_window' #263
Draft
Goli4thus
wants to merge
1
commit into
robbert-vdh:master
Choose a base branch
from
Goli4thus:PR__REAPER_native_spacebar
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of the reason why I didn't really want to look into myself (and I'd much rather have REAPER implement similar behavior as Bitwig) is that doing something like this is quite brittle, and doing it the right way is a bit involved. These key codes are specific to QWERTY keyboard layouts (and potentially other system settings). The proper way to do this is to map a list of
KEYSYM
s toKEYCODE
s first. See the keyboard section of the X11 spec here: https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#Keyboards(this should also be an
std::unordered_set
for constant time lookups, but I can fix those things up later)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just read through that section you linked (couple times actually). I guess I can see for why this would be the "proper way" of making this robust for any
KEYSYM
.Maybe I just wrongly assumed that at least keys like
spacebar>
andfunction keys
would be quite universally always the sameKEYCODE
on X11. At least that's the impression I got after finding things like this one:https://gist.github.com/rickyzhang82/8581a762c9f9fc6ddb8390872552c250
I did find this library mentioned during my research: https://xkbcommon.org/
Using the
KEYCODE
directly just seemed the only feasible thing for me at the time without adding another dependency like this one. But I might have been mistaken of what can be done "natively" withxcb
.Just had to read up on it. Yeah, I guess that would be the correct choice for a lookup scenario in general. I didn't even think of this, because I figured for such a small list that won't grow any further (assuming this keeps being just about
spacebar
andfunction keys
), any kind of performance gains from a more sophisticated data structure than a simple array seemed negligible. Or if it's about avoiding any kind of issues due to "variable execution time" down the line, well, I'd assume even a simple for-loop for such a small list would be hard to notice.But of course, I didn't make the measurement. Really just tried to learn something from this.