Set data device focus on focus change

Fixes clipboard.
This commit is contained in:
Ivan Molodetskikh
2023-08-15 14:23:14 +04:00
parent ac73688a2b
commit 0da94d77ca
+10 -4
View File
@@ -4,10 +4,11 @@ mod xdg_shell;
// //
// Wl Seat // 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::protocol::wl_surface::WlSurface;
use smithay::reexports::wayland_server::Resource;
use smithay::wayland::data_device::{ use smithay::wayland::data_device::{
ClientDndGrabHandler, DataDeviceHandler, ServerDndGrabHandler, set_data_device_focus, ClientDndGrabHandler, DataDeviceHandler, ServerDndGrabHandler,
}; };
use smithay::{delegate_data_device, delegate_output, delegate_seat}; use smithay::{delegate_data_device, delegate_output, delegate_seat};
@@ -23,11 +24,16 @@ impl SeatHandler for Niri {
fn cursor_image( fn cursor_image(
&mut self, &mut self,
_seat: &smithay::input::Seat<Self>, _seat: &Seat<Self>,
_image: smithay::input::pointer::CursorImageStatus, _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); delegate_seat!(Niri);