From adc1a56982c70c06a0f8549c2c1b3bddd17930c2 Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Sat, 24 Aug 2024 09:11:00 +0200 Subject: Implement general.focus_follows_mouse/auto_raise; remove the rest as dead Auditing "clicking behavior and basics": general.focus_follows_mouse, general.mouse_follows_focus, general.auto_raise, general.auto_focus, the entire window.* namespace (8 more keys, a full duplicate of the same four plus remember_position/size/state), and general. smart_placement/border_width were all seeded into default_config() and documented in DEFAULTS.md, but none were read anywhere - srd.set()/ srd.get() on any of them silently succeeded while doing nothing. focus_follows_mouse is real, well-defined, and directly relevant to clicking basics - implemented it plus auto_raise (raise, not just focus, on hover) rather than just deleting the promise like the others. WindowManager gained focus_follows_mouse/auto_raise bools, wired from apply_general_settings the same way every other general.* flag is. handle_pointer_position now tracks whichever window (content or decoration) is under the pointer and, when the setting is on and that differs from the currently-focused window, focuses it through the same focus_window() free function every click-driven focus change already uses (real keyboard focus, not just core state) - skipped entirely while dragging/resizing or over a layer-shell surface, so the pointer sweeping over other windows mid-drag or hovering a bar can't steal focus from what's actually being manipulated. mouse_follows_focus (pointer warp on keybinding-driven focus change) and auto_focus (no clear distinct meaning beyond click-to-focus) stay unimplemented and are now undocumented rather than promised. --- crates/core/src/manager/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'crates/core/src') diff --git a/crates/core/src/manager/mod.rs b/crates/core/src/manager/mod.rs index 609b87f..6285736 100644 --- a/crates/core/src/manager/mod.rs +++ b/crates/core/src/manager/mod.rs @@ -86,6 +86,17 @@ pub struct WindowManager { /// redraws constantly - see `crates/wayland/src/rounded_corners.rs`). /// `Some(_)` only when the user explicitly set it, and wins either way. pub rounded_corners_enabled: Option, + /// Whether hovering a window (no click needed) focuses it, read from + /// `general.focus_follows_mouse`. Off by default - matches + /// `general.focus_follows_mouse`'s own documented default, and every + /// desktop's convention of click-to-focus unless a user explicitly + /// opts into the classic X11 sloppy-focus behaviour. + pub focus_follows_mouse: bool, + /// Whether hover-driven focus (above) also raises the window, not just + /// focuses it - read from `general.auto_raise`. Meaningless (never + /// consulted) while `focus_follows_mouse` is off, since a plain click + /// already raises unconditionally regardless of this. + pub auto_raise: bool, /// Default decoration colours and border width, read from `theme.colors.*`/ /// `theme.decorations.*`. See `ThemeConfig`'s own doc comment. pub theme: ThemeConfig, @@ -131,6 +142,8 @@ impl WindowManager { shadows_enabled: true, resize_margin: RESIZE_MARGIN, rounded_corners_enabled: None, + focus_follows_mouse: false, + auto_raise: false, theme: ThemeConfig::default(), drag: None, resize: None, -- cgit v1.2.3