forge
Explore
Log in

Don't you dare go Hollow

Set data device focus on focus change

Browse files at this commit

0da94d77ca16dff3e27d4202056b6718a21292e8Ivan MolodetskikhParent: ac73688
Fixes clipboard.
src/handlers/mod.rsmodified+10 -4
@@ -4,10 +4,11 @@ mod xdg_shell;
4 4
5 //5 //
6 // Wl Seat6 // Wl Seat
7-use smithay::input::{SeatHandler, SeatState};7+use smithay::input::{Seat, SeatHandler, SeatState};
8 use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;8 use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
9+use smithay::reexports::wayland_server::Resource;
9 use smithay::wayland::data_device::{10 use smithay::wayland::data_device::{
10- ClientDndGrabHandler, DataDeviceHandler, ServerDndGrabHandler,11+ set_data_device_focus, ClientDndGrabHandler, DataDeviceHandler, ServerDndGrabHandler,
11 };12 };
12 use smithay::{delegate_data_device, delegate_output, delegate_seat};13 use smithay::{delegate_data_device, delegate_output, delegate_seat};
13 14
@@ -23,11 +24,16 @@ impl SeatHandler for Niri {
23 24
24 fn cursor_image(25 fn cursor_image(
25 &mut self,26 &mut self,
26- _seat: &smithay::input::Seat<Self>,27+ _seat: &Seat<Self>,
27 _image: smithay::input::pointer::CursorImageStatus,28 _image: smithay::input::pointer::CursorImageStatus,
28 ) {29 ) {
29 }30 }
30- fn focus_changed(&mut self, _seat: &smithay::input::Seat<Self>, _focused: Option<&WlSurface>) {}31+
32+ fn focus_changed(&mut self, seat: &Seat<Self>, focused: Option<&WlSurface>) {
33+ let dh = &self.display_handle;
34+ let client = focused.and_then(|s| dh.get_client(s.id()).ok());
35+ set_data_device_focus(dh, seat, client);
36+ }
31 }37 }
32 38
33 delegate_seat!(Niri);39 delegate_seat!(Niri);