config: make focus-follows-mouse optional
This commit is contained in:
parent
fe2663fca3
commit
a12065a915
14 changed files with 96 additions and 6 deletions
|
|
@ -181,6 +181,7 @@ pub struct WlSeatGlobal {
|
|||
input_method: CloneCell<Option<Rc<ZwpInputMethodV2>>>,
|
||||
input_method_grab: CloneCell<Option<Rc<ZwpInputMethodKeyboardGrabV2>>>,
|
||||
forward: Cell<bool>,
|
||||
focus_follows_mouse: Cell<bool>,
|
||||
}
|
||||
|
||||
const CHANGE_CURSOR_MOVED: u32 = 1 << 0;
|
||||
|
|
@ -250,6 +251,7 @@ impl WlSeatGlobal {
|
|||
input_method: Default::default(),
|
||||
input_method_grab: Default::default(),
|
||||
forward: Cell::new(false),
|
||||
focus_follows_mouse: Cell::new(true),
|
||||
});
|
||||
state.add_cursor_size(*DEFAULT_CURSOR_SIZE);
|
||||
let seat = slf.clone();
|
||||
|
|
@ -1165,6 +1167,10 @@ impl WlSeatGlobal {
|
|||
pub fn select_workspace(self: &Rc<Self>, selector: impl WorkspaceSelector) {
|
||||
self.pointer_owner.select_workspace(self, selector);
|
||||
}
|
||||
|
||||
pub fn set_focus_follows_mouse(&self, focus_follows_mouse: bool) {
|
||||
self.focus_follows_mouse.set(focus_follows_mouse);
|
||||
}
|
||||
}
|
||||
|
||||
global_base!(WlSeatGlobal, WlSeat, WlSeatError);
|
||||
|
|
|
|||
|
|
@ -756,7 +756,10 @@ impl WlSeatGlobal {
|
|||
// Enter callbacks
|
||||
impl WlSeatGlobal {
|
||||
pub fn enter_toplevel(self: &Rc<Self>, n: Rc<dyn ToplevelNode>) {
|
||||
if n.tl_accepts_keyboard_focus() && self.changes.get().contains(CHANGE_CURSOR_MOVED) {
|
||||
if n.tl_accepts_keyboard_focus()
|
||||
&& self.changes.get().contains(CHANGE_CURSOR_MOVED)
|
||||
&& self.focus_follows_mouse.get()
|
||||
{
|
||||
self.focus_toplevel(n);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue