-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add XkbContext::update_mask
and XkbContext::set_update_key
#1597
base: master
Are you sure you want to change the base?
Conversation
For a nested compositor, it's useful to be able to pass through the modifiers state from the parent compositor unchanged. `set_mask` provides a way to do that. Meanwhile `set_update_key()` provides a way to disable the current calls to `xkb_context_updatE_key`. Alternately to `set_update_key()`, a boolean argument could be added to both `input()` and `input_intercept()`. Not sure which is better. Either is a bit ugly. `update_mask` uses seperate arguments for depressed/latched/locked instead of `SerializedMods`, since `effective` isn't applicable here. It uses `u32` for those, like `SerializedMods`, but `Layout` for the layout since it exists. Xkbcommon has a separate depressed/latched/locked layout, but we only use one since that's what the `set_layout` function and `wl_keyboard::modifiers` already assumes. (I guess X11 differentiated these, but depressed/latched didn't end up being used in practice?) This could also be used on the X11 backend. I'm not sure if winit exposes the necessary information to call `set_mask`.
made possible thanks to Smithay/smithay#1597
This isn't just useful, it's required for a correctly behaving implementation. It's also worth noting that this isn't just required for nesting compositors, but also for implementing I think the |
Yeah, this is necessary for correct behavior. At least if you want the nested compositor to behave as a native part of the parent environment with the same latched/locked/group. I guess depressed state could also be addressed by treating keys as released on Yeah, the name is weird. I'm not sure about something like |
Maybe instead of the ackward |
I was also thinking of a second function variant, but that would require a separate version of both So probably either something like |
thought for a different API shape: rename the mods function to something like is this necessarily better? no, you may discuss it. however, I thought of it and I think it's at least worthy of consideration. this would work well for a nested compositor (since we might accidentally implement it correctly and not even realize that the xkb state would've been recomputed normally), but not so much if we mix and match emulated and having two separate input functions or a param there would make it easier to mix real and fake input to the same keyboard, but then race conditions can and will cause incorrect modifier states if the virtual keyboard sends a modifier state and then a keypress. they really should be separate even in this case. |
Looking at those docs, these aren't very clear to begin with, we have
Between "update the state of the keyboard" and "track the state of the keymap", it is difficult to figure out what exactly is happening in there. Additionally your code with Maybe we should split the input forwarding updating the xkb-state into two completely separate user-facing functions? So no combining the two and no variants, just one function to update the xkb-state with a key-event (e.g. |
For a nested compositor, it's useful to be able to pass through the modifiers state from the parent compositor unchanged.
set_mask
provides a way to do that. Meanwhileset_update_key()
provides a way to disable the current calls toxkb_context_updatE_key
.Alternately to
set_update_key()
, a boolean argument could be added to bothinput()
andinput_intercept()
. Not sure which is better. Either is a bit ugly.update_mask
uses seperate arguments for depressed/latched/locked instead ofSerializedMods
, sinceeffective
isn't applicable here. It usesu32
for those, likeSerializedMods
, butLayout
for the layout since it exists. Xkbcommon has a separate depressed/latched/locked layout, but we only use one since that's what theset_layout
function andwl_keyboard::modifiers
already assumes. (I guess X11 differentiated these, but depressed/latched didn't end up being used in practice?)This could also be used on the X11 backend. I'm not sure if winit exposes the necessary information to call
set_mask
.