diff --git a/Cargo.lock b/Cargo.lock index d05945b..2bf3ad8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2336,7 +2336,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -3642,7 +3642,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/smithay/smithay?rev=df79eeb#df79eeba63a8e9c2d33b9be2418aee6a940135e7" +source = "git+https://github.com/ids1024/smithay?branch=update_mask#57aaf6e80b10f7153dd2313cc11e70452187be9d" dependencies = [ "appendlist", "bitflags 2.6.0", @@ -3679,7 +3679,7 @@ dependencies = [ [[package]] name = "smithay-client-toolkit" version = "0.19.2" -source = "git+https://github.com/Smithay/client-toolkit//#618a876400cb6c6b07a8ac5d3557f404602ec077" +source = "git+https://github.com/ids1024/client-toolkit//?branch=raw_modifiers#45963e8b5a7f6751adc0568bf378b3742a82133e" dependencies = [ "bitflags 2.6.0", "bytemuck", @@ -4735,7 +4735,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 065afd4..67b3618 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,12 +22,12 @@ sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/c ] } [patch."https://github.com/Smithay/client-toolkit"] -sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit//", features = [ +sctk = { package = "smithay-client-toolkit", git = "https://github.com/ids1024/client-toolkit//", branch = "raw_modifiers", features = [ "calloop", "xkbcommon", ] } [patch."crates-io"] -sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit//", features = [ +sctk = { package = "smithay-client-toolkit", git = "https://github.com/ids1024/client-toolkit//", branch = "raw_modifiers", features = [ "calloop", "xkbcommon", ] } diff --git a/cosmic-panel-bin/Cargo.toml b/cosmic-panel-bin/Cargo.toml index ab7cb75..1f0f064 100644 --- a/cosmic-panel-bin/Cargo.toml +++ b/cosmic-panel-bin/Cargo.toml @@ -11,13 +11,13 @@ path = "src/main.rs" [dependencies] calloop = { version = "0.14.0", features = ["executor"] } ordered-float = "4.2.0" -smithay = { git = "https://github.com/smithay/smithay", default-features = false, features = [ +smithay = { default-features = false, features = [ "use_system_lib", "desktop", "backend_egl", "backend_drm", "renderer_gl", -], rev = "df79eeb" } +], git = "https://github.com/ids1024/smithay", branch = "update_mask" } # sctk = { git = "https://github.com/smithay/client-toolkit", package = "smithay-client-toolkit", features = ["calloop", "xkbcommon"] } sctk.workspace = true # sctk = { package = "smithay-client-toolkit", path = "../../fork/client-toolkit", default-features = false, features = ["calloop", "xkbcommon"] } diff --git a/cosmic-panel-bin/src/xdg_shell_wrapper/client/handlers/keyboard.rs b/cosmic-panel-bin/src/xdg_shell_wrapper/client/handlers/keyboard.rs index 145de26..51989db 100644 --- a/cosmic-panel-bin/src/xdg_shell_wrapper/client/handlers/keyboard.rs +++ b/cosmic-panel-bin/src/xdg_shell_wrapper/client/handlers/keyboard.rs @@ -9,7 +9,7 @@ use sctk::{ seat::keyboard::{KeyCode, KeyboardHandler, Keysym, RepeatInfo}, shell::WaylandSurface, }; -use smithay::{backend::input::KeyState, input::keyboard::FilterResult, utils::SERIAL_COUNTER}; +use smithay::{backend::input::KeyState, input::keyboard::{FilterResult, Layout}, utils::SERIAL_COUNTER}; impl KeyboardHandler for GlobalState { fn enter( @@ -260,12 +260,26 @@ impl KeyboardHandler for GlobalState { &mut self, _conn: &sctk::reexports::client::Connection, _qh: &sctk::reexports::client::QueueHandle, - _keyboard: &sctk::reexports::client::protocol::wl_keyboard::WlKeyboard, + keyboard: &sctk::reexports::client::protocol::wl_keyboard::WlKeyboard, _serial: u32, _modifiers: sctk::seat::keyboard::Modifiers, - _: u32, + raw_modifiers: sctk::seat::keyboard::RawModifiers, + layout: u32, ) { // TODO should these be handled specially + if let Some((name, Some(kbd))) = self + .server_state + .seats + .iter() + .find(|SeatPair { client, .. }| { + client.kbd.as_ref().map(|k| k == keyboard).unwrap_or(false) + }) + .map(|seat| (seat.name.as_str(), seat.server.seat.get_keyboard())) + { + kbd.with_xkb_state(self, |mut context| { + context.update_mask(raw_modifiers.depressed, raw_modifiers.latched, raw_modifiers.locked, Layout(layout)); + }); + } } } diff --git a/cosmic-panel-bin/src/xdg_shell_wrapper/client/handlers/seat.rs b/cosmic-panel-bin/src/xdg_shell_wrapper/client/handlers/seat.rs index 57acc49..d804e86 100644 --- a/cosmic-panel-bin/src/xdg_shell_wrapper/client/handlers/seat.rs +++ b/cosmic-panel-bin/src/xdg_shell_wrapper/client/handlers/seat.rs @@ -62,7 +62,8 @@ impl SeatHandler for GlobalState { // So instead of doing the right thing (and initialize these capabilities as // matching devices appear), we have to surrender to reality and // just always expose a keyboard and pointer. - new_server_seat.add_keyboard(Default::default(), 200, 20).unwrap(); + let keyboard = new_server_seat.add_keyboard(Default::default(), 200, 20).unwrap(); + keyboard.set_update_key(false); new_server_seat.add_pointer(); let data_device = self.client_state.data_device_manager.get_data_device(qh, &seat); @@ -147,7 +148,8 @@ impl SeatHandler for GlobalState { match capability { sctk::seat::Capability::Keyboard => { if info.has_keyboard { - sp.server.seat.add_keyboard(Default::default(), 200, 20).unwrap(); + let keyboard = sp.server.seat.add_keyboard(Default::default(), 200, 20).unwrap(); + keyboard.set_update_key(false); if let Ok(kbd) = self.client_state.seat_state.get_keyboard(qh, &seat, None) { sp.client.kbd.replace(kbd); } diff --git a/cosmic-panel-bin/src/xdg_shell_wrapper/server/handlers/mod.rs b/cosmic-panel-bin/src/xdg_shell_wrapper/server/handlers/mod.rs index 2a7f2a2..15ea508 100644 --- a/cosmic-panel-bin/src/xdg_shell_wrapper/server/handlers/mod.rs +++ b/cosmic-panel-bin/src/xdg_shell_wrapper/server/handlers/mod.rs @@ -234,7 +234,7 @@ impl ClientDndGrabHandler for GlobalState { seat.server.dnd_icon = icon; } - fn dropped(&mut self, seat: Seat) { + fn dropped(&mut self, _target: Option, _validated: bool, seat: Seat) { let seat = match self.server_state.seats.iter_mut().find(|s| s.server.seat == seat) { Some(s) => s, None => return,