1
0
Fork 0
forked from wry/wry

config: allow disabling the primary selection

This commit is contained in:
Julian Orth 2025-07-20 11:18:32 +02:00
parent e70be28e22
commit 9c165ab56c
13 changed files with 63 additions and 2 deletions

View file

@ -352,6 +352,7 @@ fn start_compositor2(
head_managers: Default::default(),
head_managers_async: Default::default(),
show_bar: Cell::new(true),
enable_primary_selection: Cell::new(true),
});
state.tracker.register(ClientId::from_raw(0));
create_dummy_output(&state);

View file

@ -2204,6 +2204,10 @@ impl ConfigProxyHandler {
Ok(())
}
fn handle_set_middle_click_paste_enabled(&self, enabled: bool) {
self.state.enable_primary_selection.set(enabled);
}
fn spaces_change(&self) {
struct V;
impl NodeVisitorBase for V {
@ -3064,6 +3068,9 @@ impl ConfigProxyHandler {
ClientMessage::SeatFocusTiles { seat } => {
self.handle_seat_focus_tiles(seat).wrn("seat_focus_tiles")?
}
ClientMessage::SetMiddleClickPasteEnabled { enabled } => {
self.handle_set_middle_click_paste_enabled(enabled)
}
}
Ok(())
}

View file

@ -8,6 +8,7 @@ use {
},
leaks::Tracker,
object::{Object, Version},
state::State,
wire::{ZwpPrimarySelectionDeviceManagerV1Id, zwp_primary_selection_device_manager_v1::*},
},
std::rc::Rc,
@ -96,6 +97,10 @@ impl Global for ZwpPrimarySelectionDeviceManagerV1Global {
fn version(&self) -> u32 {
1
}
fn exposed(&self, state: &State) -> bool {
state.enable_primary_selection.get()
}
}
simple_add_global!(ZwpPrimarySelectionDeviceManagerV1Global);

View file

@ -272,6 +272,7 @@ pub struct State {
CopyHashMap<(ClientId, JayHeadManagerSessionV1Id), Rc<JayHeadManagerSessionV1>>,
pub head_managers_async: AsyncQueue<HeadManagerEvent>,
pub show_bar: Cell<bool>,
pub enable_primary_selection: Cell<bool>,
}
// impl Drop for State {