gardesk/gar / eae66ae

Browse files

fix: set resize cursor on tiled windows not just root

When hovering near the edge between tiled windows, the cursor is now
set on all tiled windows (not just root), ensuring the resize cursor
shows even when the mouse is over a window. Also adds debug logging
for tiled edge detection.
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
eae66aeae7e2d0f41f1ffd7b1c65f76fd5a468b3
Parents
731913d
Tree
5c43092

1 changed file

StatusFile+-
M gar/src/x11/events.rs 27 12
gar/src/x11/events.rsmodified
@@ -718,9 +718,15 @@ impl WindowManager {
718718
             let work_area = self.work_area();
719719
             let geometries = self.current_workspace().tree.calculate_geometries(work_area);
720720
 
721
-            if let Some((window, direction, container_size)) =
722
-                self.find_tiled_edge(event.root_x, event.root_y, &geometries)
723
-            {
721
+            tracing::debug!(
722
+                "Tiled edge check: pos=({},{}), work_area={:?}, geometries={:?}",
723
+                event.root_x, event.root_y, work_area, geometries
724
+            );
725
+
726
+            let edge_result = self.find_tiled_edge(event.root_x, event.root_y, &geometries);
727
+            tracing::debug!("find_tiled_edge result: {:?}", edge_result);
728
+
729
+            if let Some((window, direction, container_size)) = edge_result {
724730
                 // Get current ratio from tree
725731
                 let start_ratio = self
726732
                     .current_workspace()
@@ -1105,28 +1111,37 @@ impl WindowManager {
11051111
 
11061112
         let edge = self.find_tiled_edge(root_x, root_y, &geometries);
11071113
 
1108
-        let new_direction = edge.map(|(_, dir, _)| dir);
1114
+        let new_state = edge.map(|(w, dir, _)| (w, dir));
11091115
 
11101116
         // Check if cursor state changed
1111
-        if new_direction == self.tiled_edge_cursor {
1117
+        if new_state.map(|(_, d)| d) == self.tiled_edge_cursor {
11121118
             return Ok(()); // No change
11131119
         }
11141120
 
1115
-        if let Some(dir) = new_direction {
1116
-            // Set resize cursor on root (double-arrow cursors)
1121
+        // Clear old cursor state
1122
+        if self.tiled_edge_cursor.is_some() {
1123
+            // Clear cursor on all tiled windows and root
1124
+            for (win, _) in &geometries {
1125
+                self.conn.clear_window_cursor(*win)?;
1126
+            }
1127
+            self.conn.clear_window_cursor(self.conn.root)?;
1128
+        }
1129
+
1130
+        if let Some((_, dir)) = new_state {
1131
+            // Set resize cursor on all tiled windows AND root
1132
+            // This ensures cursor shows even when mouse is over a window
11171133
             let cursor = match dir {
11181134
                 Direction::Left | Direction::Right => self.conn.cursor_h_double,
11191135
                 Direction::Up | Direction::Down => self.conn.cursor_v_double,
11201136
             };
1137
+            for (win, _) in &geometries {
1138
+                self.conn.set_window_cursor(*win, cursor)?;
1139
+            }
11211140
             self.conn.set_window_cursor(self.conn.root, cursor)?;
11221141
             self.conn.flush()?;
1123
-        } else if self.tiled_edge_cursor.is_some() {
1124
-            // Clear resize cursor from root
1125
-            self.conn.clear_window_cursor(self.conn.root)?;
1126
-            self.conn.flush()?;
11271142
         }
11281143
 
1129
-        self.tiled_edge_cursor = new_direction;
1144
+        self.tiled_edge_cursor = new_state.map(|(_, d)| d);
11301145
         Ok(())
11311146
     }
11321147