fix wl-copy..copy on select bug

This commit is contained in:
Samuel Onoja committed 2026-10-01 18:29:56 +01:00
1 parent 1441875096
commit cd19691f52
2 files changed
+31

No files matched your search

+15
View File
@@ -261,6 +261,18 @@ impl PrimarySelectionHandler for Ferese {
} }
} }
impl smithay::wayland::selection::wlr_data_control::DataControlHandler for Ferese {
fn data_control_state(&self) -> &smithay::wayland::selection::wlr_data_control::DataControlState {
&self.wlr_data_control_state
}
}
impl smithay::wayland::selection::ext_data_control::DataControlHandler for Ferese {
fn data_control_state(&self) -> &smithay::wayland::selection::ext_data_control::DataControlState {
&self.ext_data_control_state
}
}
impl XdgForeignHandler for Ferese { impl XdgForeignHandler for Ferese {
fn xdg_foreign_state(&mut self) -> &mut XdgForeignState { fn xdg_foreign_state(&mut self) -> &mut XdgForeignState {
&mut self.xdg_foreign_state &mut self.xdg_foreign_state
@@ -295,3 +307,6 @@ smithay::delegate_xdg_decoration!(Ferese);
smithay::delegate_xdg_foreign!(Ferese); smithay::delegate_xdg_foreign!(Ferese);
smithay::delegate_xdg_shell!(Ferese); smithay::delegate_xdg_shell!(Ferese);
smithay::delegate_xdg_toplevel_icon!(Ferese); smithay::delegate_xdg_toplevel_icon!(Ferese);
smithay::delegate_data_control!(Ferese);
smithay::delegate_ext_data_control!(Ferese);
+16
View File
@@ -60,6 +60,7 @@ use smithay::wayland::presentation::PresentationState;
use smithay::wayland::relative_pointer::RelativePointerManagerState; use smithay::wayland::relative_pointer::RelativePointerManagerState;
use smithay::wayland::selection::data_device::DataDeviceState; use smithay::wayland::selection::data_device::DataDeviceState;
use smithay::wayland::selection::primary_selection::PrimarySelectionState; use smithay::wayland::selection::primary_selection::PrimarySelectionState;
use smithay::wayland::selection::{ext_data_control, wlr_data_control};
use smithay::wayland::session_lock::SessionLockManagerState; use smithay::wayland::session_lock::SessionLockManagerState;
use smithay::wayland::shell::wlr_layer::{Layer, WlrLayerShellState}; use smithay::wayland::shell::wlr_layer::{Layer, WlrLayerShellState};
use smithay::wayland::shell::xdg::decoration::XdgDecorationState; use smithay::wayland::shell::xdg::decoration::XdgDecorationState;
@@ -403,6 +404,8 @@ pub struct Ferese {
pub pointer_constraints_state: PointerConstraintsState, pub pointer_constraints_state: PointerConstraintsState,
pub presentation_state: PresentationState, pub presentation_state: PresentationState,
pub primary_selection_state: PrimarySelectionState, pub primary_selection_state: PrimarySelectionState,
pub wlr_data_control_state: wlr_data_control::DataControlState,
pub ext_data_control_state: ext_data_control::DataControlState,
pub relative_pointer_state: RelativePointerManagerState, pub relative_pointer_state: RelativePointerManagerState,
pub seat_state: SeatState<Self>, pub seat_state: SeatState<Self>,
pub shm_state: ShmState, pub shm_state: ShmState,
@@ -479,6 +482,17 @@ impl Ferese {
let presentation_state = PresentationState::new::<Self>(&display_handle, libc::CLOCK_MONOTONIC as u32); let presentation_state = PresentationState::new::<Self>(&display_handle, libc::CLOCK_MONOTONIC as u32);
let data_device_state = DataDeviceState::new::<Self>(&display_handle); let data_device_state = DataDeviceState::new::<Self>(&display_handle);
let primary_selection_state = PrimarySelectionState::new::<Self>(&display_handle); let primary_selection_state = PrimarySelectionState::new::<Self>(&display_handle);
// Clipboard tools need direct selection access. Without data control,
// wl-copy maps a temporary window to obtain keyboard focus.
let wlr_data_control_state =
wlr_data_control::DataControlState::new::<Self, _>(&display_handle, Some(&primary_selection_state), |_| {
true
});
let ext_data_control_state =
ext_data_control::DataControlState::new::<Self, _>(&display_handle, Some(&primary_selection_state), |_| {
true
});
let relative_pointer_state = RelativePointerManagerState::new::<Self>(&display_handle); let relative_pointer_state = RelativePointerManagerState::new::<Self>(&display_handle);
let viewporter_state = ViewporterState::new::<Self>(&display_handle); let viewporter_state = ViewporterState::new::<Self>(&display_handle);
let layer_shell_state = WlrLayerShellState::new::<Self>(&display_handle); let layer_shell_state = WlrLayerShellState::new::<Self>(&display_handle);
@@ -607,6 +621,8 @@ impl Ferese {
pointer_constraints_state, pointer_constraints_state,
presentation_state, presentation_state,
primary_selection_state, primary_selection_state,
wlr_data_control_state,
ext_data_control_state,
relative_pointer_state, relative_pointer_state,
seat_state, seat_state,
shm_state, shm_state,