Update primary selection focus

This commit is contained in:
Ivan Molodetskikh
2023-09-27 16:51:17 +04:00
parent 1085ea99ff
commit dbcc1182ef
+5 -2
View File
@@ -14,7 +14,9 @@ use smithay::wayland::data_device::{
ServerDndGrabHandler, ServerDndGrabHandler,
}; };
use smithay::wayland::dmabuf::{DmabufGlobal, DmabufHandler, DmabufState, ImportError}; use smithay::wayland::dmabuf::{DmabufGlobal, DmabufHandler, DmabufState, ImportError};
use smithay::wayland::primary_selection::{PrimarySelectionHandler, PrimarySelectionState}; use smithay::wayland::primary_selection::{
set_primary_focus, PrimarySelectionHandler, PrimarySelectionState,
};
use smithay::{ use smithay::{
delegate_data_device, delegate_dmabuf, delegate_output, delegate_pointer_gestures, delegate_data_device, delegate_dmabuf, delegate_output, delegate_pointer_gestures,
delegate_presentation, delegate_primary_selection, delegate_seat, delegate_tablet_manager, delegate_presentation, delegate_primary_selection, delegate_seat, delegate_tablet_manager,
@@ -39,7 +41,8 @@ impl SeatHandler for State {
fn focus_changed(&mut self, seat: &Seat<Self>, focused: Option<&WlSurface>) { fn focus_changed(&mut self, seat: &Seat<Self>, focused: Option<&WlSurface>) {
let dh = &self.niri.display_handle; let dh = &self.niri.display_handle;
let client = focused.and_then(|s| dh.get_client(s.id()).ok()); let client = focused.and_then(|s| dh.get_client(s.id()).ok());
set_data_device_focus(dh, seat, client); set_data_device_focus(dh, seat, client.clone());
set_primary_focus(dh, seat, client);
} }
} }
delegate_seat!(State); delegate_seat!(State);