2023-08-07 16:15:19 -07:00
|
|
|
// 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()
|
2024-03-21 12:44:40 +01:00
|
|
|
.find_map(|x| x.element_for_surface(surface))?;
|
2023-08-07 16:15:19 -07:00
|
|
|
Some(KeyboardFocusTarget::Element(element.clone()))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
delegate_xwayland_keyboard_grab!(State);
|