aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/handlers/mod.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 4ad355ca..fcde0585 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -4,10 +4,11 @@ mod xdg_shell;
//
// Wl Seat
-use smithay::input::{SeatHandler, SeatState};
+use smithay::input::{Seat, SeatHandler, SeatState};
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
+use smithay::reexports::wayland_server::Resource;
use smithay::wayland::data_device::{
- ClientDndGrabHandler, DataDeviceHandler, ServerDndGrabHandler,
+ set_data_device_focus, ClientDndGrabHandler, DataDeviceHandler, ServerDndGrabHandler,
};
use smithay::{delegate_data_device, delegate_output, delegate_seat};
@@ -23,11 +24,16 @@ impl SeatHandler for Niri {
fn cursor_image(
&mut self,
- _seat: &smithay::input::Seat<Self>,
+ _seat: &Seat<Self>,
_image: smithay::input::pointer::CursorImageStatus,
) {
}
- fn focus_changed(&mut self, _seat: &smithay::input::Seat<Self>, _focused: Option<&WlSurface>) {}
+
+ fn focus_changed(&mut self, seat: &Seat<Self>, focused: Option<&WlSurface>) {
+ let dh = &self.display_handle;
+ let client = focused.and_then(|s| dh.get_client(s.id()).ok());
+ set_data_device_focus(dh, seat, client);
+ }
}
delegate_seat!(Niri);