diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-15 14:23:14 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-08-15 14:23:14 +0400 |
| commit | 0da94d77ca16dff3e27d4202056b6718a21292e8 (patch) | |
| tree | 5f6398ad03ecea5f3e73d8bd24da15ebbef2b2e8 /src/handlers | |
| parent | ac73688a2baca9bc5f3c8340b97bf535f682ae41 (diff) | |
| download | niri-0da94d77ca16dff3e27d4202056b6718a21292e8.tar.gz niri-0da94d77ca16dff3e27d4202056b6718a21292e8.tar.bz2 niri-0da94d77ca16dff3e27d4202056b6718a21292e8.zip | |
Set data device focus on focus change
Fixes clipboard.
Diffstat (limited to 'src/handlers')
| -rw-r--r-- | src/handlers/mod.rs | 14 |
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); |
