git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commitc0a2918d11106e6f18293a1fdb31aac0964a5823
parent0d7a599b5a
authorLucas Galante <[email protected]>
date2026-06-26 12:49
feat: disable keyboard, pointer button, and touch inputs on windows in Overview mode, and make scroll events pan the viewport globally

 src/server/cursor.rs         | 70 ++++++++++++++++++++++++++++----------------
 src/server/keyboard_group.rs |  6 ++--
 2 files changed, 48 insertions(+), 28 deletions(-)

diff --git a/src/server/cursor.rs b/src/server/cursor.rs
index 853eff8..31416fc 100644
--- a/src/server/cursor.rs
+++ b/src/server/cursor.rs
@@ -457,7 +457,11 @@ impl Cursor {
                 }
             }
 
+            let mut is_window = false;
             if let SceneNodeDataVal::Window(window) = result.data {
+                if !(*window).is_status_bar() {
+                    is_window = true;
+                }
                 if (*window).tiling_mode != crate::tiling::TilingMode::Popup
                     && (*window).tiling_mode != crate::tiling::TilingMode::Fullscreen
                     && (*window).tiling_mode != crate::tiling::TilingMode::Status
@@ -480,6 +484,11 @@ impl Cursor {
                 }
             }
 
+            if is_window && (*server).wm.mode == crate::window_manager::WindowManagerMode::Overview {
+                self.clear_focus();
+                return;
+            }
+
             if !result.surface.is_null() {
                 ffi::wlr_seat_pointer_notify_enter((*self.seat).wlr_seat, result.surface, result.sx, result.sy);
                 ffi::wlr_seat_pointer_notify_motion((*self.seat).wlr_seat, time_msec, result.sx, result.sy);
@@ -795,12 +804,14 @@ unsafe extern "C" fn handle_button(listener: *mut ffi::wl_listener, data: *mut s
 
         cursor.pressed.insert((*event).button, None);
 
-        ffi::wlr_seat_pointer_notify_button(
-            seat.wlr_seat,
-            (*event).time_msec,
-            (*event).button,
-            (*event).state,
-        );
+        if (*(*seat).server).wm.mode != crate::window_manager::WindowManagerMode::Overview {
+            ffi::wlr_seat_pointer_notify_button(
+                seat.wlr_seat,
+                (*event).time_msec,
+                (*event).button,
+                (*event).state,
+            );
+        }
 
         // If pressed, update focus to window under cursor
         let lx = cursor.x();
@@ -905,12 +916,14 @@ unsafe extern "C" fn handle_button(listener: *mut ffi::wl_listener, data: *mut s
                 return;
             }
 
-            ffi::wlr_seat_pointer_notify_button(
-                seat.wlr_seat,
-                (*event).time_msec,
-                (*event).button,
-                (*event).state,
-            );
+            if (*(*seat).server).wm.mode != crate::window_manager::WindowManagerMode::Overview {
+                ffi::wlr_seat_pointer_notify_button(
+                    seat.wlr_seat,
+                    (*event).time_msec,
+                    (*event).button,
+                    (*event).state,
+                );
+            }
 
             if cursor.pressed.is_empty() && seat.op.is_some() {
                 seat.op_release = true;
@@ -992,8 +1005,9 @@ unsafe extern "C" fn handle_axis(listener: *mut ffi::wl_listener, data: *mut std
         }
         !over_interactive
     };
+    let is_overview = (*(*seat).server).wm.mode == crate::window_manager::WindowManagerMode::Overview;
 
-    if (modifiers & 0x40) != 0 || is_on_background {
+    if (modifiers & 0x40) != 0 || is_on_background || is_overview {
         let wm = &mut (*seat.server).wm;
         wm.stop_panning_animation();
         let step = delta / wm.desk_zoom;
@@ -1149,7 +1163,7 @@ unsafe extern "C" fn handle_touch_down(listener: *mut ffi::wl_listener, data: *m
             }
             _ => {}
         }
-        if !result.surface.is_null() {
+        if !result.surface.is_null() && (*(*seat).server).wm.mode != crate::window_manager::WindowManagerMode::Overview {
             ffi::wlr_seat_touch_notify_down(
                 seat.wlr_seat,
                 result.surface,
@@ -1188,13 +1202,15 @@ unsafe extern "C" fn handle_touch_motion(listener: *mut ffi::wl_listener, data:
 
         let server = seat.server;
         if let Some(result) = (*server).scene.at(lx, ly) {
-            ffi::wlr_seat_touch_notify_motion(
-                seat.wlr_seat,
-                (*event).time_msec,
-                (*event).touch_id,
-                result.sx,
-                result.sy,
-            );
+            if (*(*seat).server).wm.mode != crate::window_manager::WindowManagerMode::Overview {
+                ffi::wlr_seat_touch_notify_motion(
+                    seat.wlr_seat,
+                    (*event).time_msec,
+                    (*event).touch_id,
+                    result.sx,
+                    result.sy,
+                );
+            }
         }
     }
 }
@@ -1207,11 +1223,13 @@ unsafe extern "C" fn handle_touch_up(listener: *mut ffi::wl_listener, data: *mut
     seat.handle_activity();
 
     if cursor.touch_points.remove(&(*event).touch_id).is_some() {
-        ffi::wlr_seat_touch_notify_up(
-            seat.wlr_seat,
-            (*event).time_msec,
-            (*event).touch_id,
-        );
+        if (*(*seat).server).wm.mode != crate::window_manager::WindowManagerMode::Overview {
+            ffi::wlr_seat_touch_notify_up(
+                seat.wlr_seat,
+                (*event).time_msec,
+                (*event).touch_id,
+            );
+        }
     }
 }
 
diff --git a/src/server/keyboard_group.rs b/src/server/keyboard_group.rs
index 689dfa3..ed67286 100644
--- a/src/server/keyboard_group.rs
+++ b/src/server/keyboard_group.rs
@@ -441,8 +441,10 @@ unsafe extern "C" fn handle_group_key(listener: *mut ffi::wl_listener, data: *mu
             }
         }
         KeyConsumer::Focus => {
-            ffi::wlr_seat_set_keyboard((*group.seat).wlr_seat, &mut group.wlr_keyboard);
-            ffi::wlr_seat_keyboard_notify_key((*group.seat).wlr_seat, (*event).time_msec, (*event).keycode, (*event).state);
+            if (*(*group.seat).server).wm.mode != crate::window_manager::WindowManagerMode::Overview {
+                ffi::wlr_seat_set_keyboard((*group.seat).wlr_seat, &mut group.wlr_keyboard);
+                ffi::wlr_seat_keyboard_notify_key((*group.seat).wlr_seat, (*event).time_msec, (*event).keycode, (*event).state);
+            }
         }
     }