protocols/keyboard-layout: Send ei modifiers on group change

This makes `cosmic-osk` show a group change on `super+space`. Previously
a change like that wouldn't be sent until a keyboard input changed the
modifier state, for instance releasing the shift key.
This commit is contained in:
Ian Douglas Scott 2026-09-02 12:49:01 -07:00 • committed by Victoria Brekenfeld
parent 0d75928579
commit 8ec1ffb740
5 changed files with 19 additions and 11 deletions

View file

@ -17,8 +17,10 @@ use smithay::{
use std::mem;
use wayland_backend::server::{ClientId, GlobalId};
pub trait KeyboardLayoutHandler {
pub trait KeyboardLayoutHandler: SeatHandler {
fn keyboard_layout_state(&mut self) -> &mut KeyboardLayoutState;
/// Group has been changed through the protocol
fn group_changed(&mut self, keyboard: &KeyboardHandle<Self>);
}
#[derive(Debug)]
@ -57,6 +59,7 @@ impl KeyboardLayoutState {
let active_layout = handle.with_xkb_state(state, |context| {
context.xkb().lock().unwrap().active_layout()
});
state.group_changed(handle);
if *last_layout != Some(active_layout) {
keyboard_layout.group(active_layout.0);
*last_layout = Some(active_layout);