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

commitf810e6690547aad3fae5313d4c7f7e9b6e44426c
parent71e3f20cb9
authorLucas Galante <[email protected]>
date2026-07-02 20:59
feat: return to normal mode when clicking on desktop background in overview mode

 src/server/cursor.rs | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/server/cursor.rs b/src/server/cursor.rs
index f9b8d5f..1281d30 100644
--- a/src/server/cursor.rs
+++ b/src/server/cursor.rs
@@ -51,6 +51,7 @@ pub struct Cursor {
     pub last_click_window: *mut crate::window::Window,
     pub right_click_on_bg: bool,
     pub right_click_on_border: bool,
+    pub left_click_on_bg_in_overview: bool,
 }
 
 impl Default for Cursor {
@@ -99,6 +100,7 @@ impl Default for Cursor {
             last_click_window: std::ptr::null_mut(),
             right_click_on_bg: false,
             right_click_on_border: false,
+            left_click_on_bg_in_overview: false,
         }
     }
 }
@@ -658,6 +660,11 @@ unsafe extern "C" fn handle_button(listener: *mut ffi::wl_listener, data: *mut s
                 cursor.pressed.insert((*event).button, None);
                 cursor.set_xcursor(b"grab\0".as_ptr() as *const _);
                 return;
+            } else {
+                cursor.left_click_on_bg_in_overview = true;
+                (*server).wm.execute_action(&crate::config::Action::Expose, None);
+                cursor.pressed.insert((*event).button, None);
+                return;
             }
         }
 
@@ -1083,6 +1090,15 @@ unsafe extern "C" fn handle_button(listener: *mut ffi::wl_listener, data: *mut s
                 return;
             }
 
+            if (*event).button == 0x110 && cursor.left_click_on_bg_in_overview {
+                cursor.left_click_on_bg_in_overview = false;
+                if cursor.pressed.is_empty() && seat.op.is_some() {
+                    seat.op_release = true;
+                    (*(*seat).server).wm.dirty_windowing();
+                }
+                return;
+            }
+
             if (*event).button == 0x111 && (cursor.right_click_on_bg || cursor.right_click_on_border) {
                 cursor.right_click_on_bg = false;
                 cursor.right_click_on_border = false;