2023-09-13 20:52:10 -07:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
|
|
|
|
|
use crate::state::State;
|
|
|
|
|
use smithay::{
|
|
|
|
|
delegate_pointer_constraints,
|
|
|
|
|
input::pointer::PointerHandle,
|
|
|
|
|
reexports::wayland_server::protocol::wl_surface::WlSurface,
|
2024-09-26 13:43:01 -07:00
|
|
|
utils::{Logical, Point},
|
2023-09-13 20:52:10 -07:00
|
|
|
wayland::{
|
|
|
|
|
pointer_constraints::{with_pointer_constraint, PointerConstraintsHandler},
|
|
|
|
|
seat::WaylandFocus,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
impl PointerConstraintsHandler for State {
|
|
|
|
|
fn new_constraint(&mut self, surface: &WlSurface, pointer: &PointerHandle<Self>) {
|
|
|
|
|
// XXX region
|
|
|
|
|
if pointer
|
|
|
|
|
.current_focus()
|
2024-05-13 14:16:21 -07:00
|
|
|
.map_or(false, |x| x.wl_surface().as_deref() == Some(surface))
|
2023-09-13 20:52:10 -07:00
|
|
|
{
|
|
|
|
|
with_pointer_constraint(surface, pointer, |constraint| {
|
|
|
|
|
constraint.unwrap().activate();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-26 13:43:01 -07:00
|
|
|
|
|
|
|
|
fn cursor_position_hint(
|
|
|
|
|
&mut self,
|
|
|
|
|
_surface: &WlSurface,
|
|
|
|
|
_pointer: &PointerHandle<Self>,
|
|
|
|
|
_location: Point<f64, Logical>,
|
|
|
|
|
) {
|
|
|
|
|
// TODO
|
|
|
|
|
}
|
2023-09-13 20:52:10 -07:00
|
|
|
}
|
|
|
|
|
delegate_pointer_constraints!(State);
|