XWayland keyboard grab protocol
This commit is contained in:
parent
5ecee3c559
commit
c3dddb9917
5 changed files with 25 additions and 2 deletions
|
|
@ -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::<Self>(&dh, Mode::Client);
|
||||
let xdg_decoration_state = XdgDecorationState::new::<Self>(&dh);
|
||||
XWaylandKeyboardGrabState::new::<Self>(&dh);
|
||||
|
||||
let shell = Shell::new(&config, dh);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,3 +22,4 @@ pub mod viewporter;
|
|||
pub mod wl_drm;
|
||||
pub mod workspace;
|
||||
pub mod xdg_shell;
|
||||
pub mod xwayland_keyboard_grab;
|
||||
|
|
|
|||
20
src/wayland/handlers/xwayland_keyboard_grab.rs
Normal file
20
src/wayland/handlers/xwayland_keyboard_grab.rs
Normal file
|
|
@ -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<KeyboardFocusTarget> {
|
||||
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);
|
||||
Loading…
Add table
Add a link
Reference in a new issue