git.lucas.co / cce-files
file manager
git clone https://git.lucas.co/cce-files.git

commit15a2f2fc78b35961a92496e30d8a4dba9f314fb5
parent7cdcd9f39c
authorLucas Galante <[email protected]>
date2026-06-24 22:59
Override is_movable_window_at to fix click-to-drag interception

 src/main.rs | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/main.rs b/src/main.rs
index 9506d7f..6ee26b8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -491,6 +491,34 @@ impl Application for FilesystemApp {
         Some(&self.ui_context)
     }
 
+    fn is_movable_window_at(&self, px: f32, py: f32) -> bool {
+        // 1. If dialog is open, do not drag
+        if self.open_with_dialog.is_some() {
+            return false;
+        }
+        // 2. If context menu is visible, do not drag
+        if self.context_menu.visible {
+            return false;
+        }
+        // 3. If in the sidebar area (when sidebar is active), do not drag
+        if !self.select_mode {
+            let sidebar_w = self.paginator.sidebar_w();
+            if px <= sidebar_w {
+                return false;
+            }
+        }
+        // 4. If over any page button, do not drag
+        for (btn, _) in &self.page_buttons {
+            if let Some(base) = btn.base() {
+                if px >= base.x && px <= base.x + base.w && py >= base.y && py <= base.y + base.h {
+                    return false;
+                }
+            }
+        }
+        // 5. Fallback to ui_context's check for registered widgets
+        self.ui_context.is_movable_window_at(px, py)
+    }
+
     fn new(_qh: &QueueHandle<cce_ui::engine::EngineState<Self>>, sender: calloop::channel::Sender<Self::Message>) -> Self {
         // Parse command line arguments
         let args: Vec<String> = std::env::args().collect();