git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commitb18443efa5ce391b0c283bbea9e01a2bccb2d5ef
parent90c741e324
authorLucas Galante <[email protected]>
date2026-06-24 22:59
Restrict window drag to non-interactive area and fix test

 src/backend/window_runner.rs   | 14 ++++++++++----
 src/widget/container/window.rs |  2 +-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/backend/window_runner.rs b/src/backend/window_runner.rs
index b5bc5e1..e39096f 100644
--- a/src/backend/window_runner.rs
+++ b/src/backend/window_runner.rs
@@ -945,6 +945,14 @@ pub trait Application: Sized + 'static {
     fn ui_context(&self) -> Option<&crate::context::UiContext> {
         None
     }
+
+    fn is_movable_window_at(&self, px: f32, py: f32) -> bool {
+        if let Some(ctx) = self.ui_context() {
+            ctx.is_movable_window_at(px, py)
+        } else {
+            false
+        }
+    }
     
     fn text_areas(&self, scale_f32: f32, bounds: TextBounds) -> Vec<TextArea<'_>> {
         let overlay_rects: Vec<(f32, f32, f32, f32)> = Vec::new();
@@ -1762,10 +1770,8 @@ impl<A: Application> PointerHandler for EngineState<A> {
                         let mut should_move = false;
                         if ly >= border && ly < 32.0 && lx < self.logical_width - 70.0 {
                             should_move = true;
-                        } else if let Some(ctx) = self.inner.ui_context() {
-                            if ctx.is_movable_window_at(lx, ly) {
-                                should_move = true;
-                            }
+                        } else if self.inner.is_movable_window_at(lx, ly) {
+                            should_move = true;
                         }
 
                         if should_move {
diff --git a/src/widget/container/window.rs b/src/widget/container/window.rs
index 2693882..4ee641c 100644
--- a/src/widget/container/window.rs
+++ b/src/widget/container/window.rs
@@ -334,7 +334,7 @@ mod tests {
             .with_radius(8.0);
 
         assert_eq!(win.rect(), (10.0, 20.0, 100.0, 200.0));
-        assert_eq!(win.color(), [0.1, 0.2, 0.3, 0.4]);
+        assert_eq!(win.background_color, Some([0.1, 0.2, 0.3, 0.4]));
         assert_eq!(win.solid_border(), Some(([1.0, 0.0, 0.0, 1.0], 2.5)));
         assert_eq!(win.corner_radius(), 8.0);
         assert_eq!(win.rounded_corners(), (true, true, true, true));