diff --git a/Cargo.lock b/Cargo.lock index e19b0309..75fe423d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3765,7 +3765,7 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smithay" version = "0.3.0" -source = "git+https://github.com/smithay//smithay?rev=cd2f688a0d#cd2f688a0d56a762cf1c3e4606898d0eb5cbe964" +source = "git+https://github.com/smithay//smithay?rev=02ccc8ca17#02ccc8ca17fbc655d2247124fe628d276cb5179a" dependencies = [ "appendlist", "ash", diff --git a/Cargo.toml b/Cargo.toml index 7dd51a58..a5890a3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,4 +80,4 @@ debug = true lto = "fat" [patch."https://github.com/Smithay/smithay.git"] -smithay = { git = "https://github.com/smithay//smithay", rev = "cd2f688a0d" } +smithay = { git = "https://github.com/smithay//smithay", rev = "02ccc8ca17" } diff --git a/src/state.rs b/src/state.rs index e87030eb..8ba5ff4f 100644 --- a/src/state.rs +++ b/src/state.rs @@ -69,6 +69,7 @@ use smithay::{ shell::{kde::decoration::KdeDecorationState, xdg::decoration::XdgDecorationState}, shm::ShmState, viewporter::ViewporterState, + xwayland_keyboard_grab::XWaylandKeyboardGrabState, }, }; use tracing::error; @@ -299,6 +300,7 @@ impl State { let wl_drm_state = WlDrmState; let kde_decoration_state = KdeDecorationState::new::(&dh, Mode::Client); let xdg_decoration_state = XdgDecorationState::new::(&dh); + XWaylandKeyboardGrabState::new::(&dh); let shell = Shell::new(&config, dh); diff --git a/src/wayland/handlers/mod.rs b/src/wayland/handlers/mod.rs index 098b6e4b..a7bfff90 100644 --- a/src/wayland/handlers/mod.rs +++ b/src/wayland/handlers/mod.rs @@ -22,3 +22,4 @@ pub mod viewporter; pub mod wl_drm; pub mod workspace; pub mod xdg_shell; +pub mod xwayland_keyboard_grab; diff --git a/src/wayland/handlers/xwayland_keyboard_grab.rs b/src/wayland/handlers/xwayland_keyboard_grab.rs new file mode 100644 index 00000000..ca1e4c82 --- /dev/null +++ b/src/wayland/handlers/xwayland_keyboard_grab.rs @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0-only + +use crate::{shell::focus::target::KeyboardFocusTarget, state::State}; +use smithay::{ + delegate_xwayland_keyboard_grab, reexports::wayland_server::protocol::wl_surface::WlSurface, + wayland::xwayland_keyboard_grab::XWaylandKeyboardGrabHandler, +}; + +impl XWaylandKeyboardGrabHandler for State { + fn keyboard_focus_for_xsurface(&self, surface: &WlSurface) -> Option { + let element = self + .common + .shell + .workspaces + .spaces() + .find_map(|x| x.element_for_wl_surface(surface))?; + Some(KeyboardFocusTarget::Element(element.clone())) + } +} +delegate_xwayland_keyboard_grab!(State);