@@ -726,7 +726,7 @@ impl WindowManager { |
| 726 | 726 | let edge_result = self.find_tiled_edge(event.root_x, event.root_y, &geometries); |
| 727 | 727 | tracing::debug!("find_tiled_edge result: {:?}", edge_result); |
| 728 | 728 | |
| 729 | | - if let Some((window, direction, container_size)) = edge_result { |
| 729 | + if let Some((window, _window2, direction, container_size)) = edge_result { |
| 730 | 730 | // Get current ratio from tree |
| 731 | 731 | let start_ratio = self |
| 732 | 732 | .current_workspace() |
@@ -1111,37 +1111,33 @@ impl WindowManager { |
| 1111 | 1111 | |
| 1112 | 1112 | let edge = self.find_tiled_edge(root_x, root_y, &geometries); |
| 1113 | 1113 | |
| 1114 | | - let new_state = edge.map(|(w, dir, _)| (w, dir)); |
| 1114 | + let new_state = edge.map(|(w1, w2, dir, _)| (w1, w2, dir)); |
| 1115 | 1115 | |
| 1116 | 1116 | // Check if cursor state changed |
| 1117 | | - if new_state.map(|(_, d)| d) == self.tiled_edge_cursor { |
| 1117 | + if new_state == self.tiled_edge_cursor { |
| 1118 | 1118 | return Ok(()); // No change |
| 1119 | 1119 | } |
| 1120 | 1120 | |
| 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 | | - } |
| 1121 | + // Clear old cursor state on the specific windows that had it |
| 1122 | + if let Some((old_w1, old_w2, _)) = self.tiled_edge_cursor { |
| 1123 | + self.conn.clear_window_cursor(old_w1)?; |
| 1124 | + self.conn.clear_window_cursor(old_w2)?; |
| 1127 | 1125 | self.conn.clear_window_cursor(self.conn.root)?; |
| 1128 | 1126 | } |
| 1129 | 1127 | |
| 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 |
| 1128 | + if let Some((w1, w2, dir)) = new_state { |
| 1129 | + // Set resize cursor on the two windows sharing the edge AND root |
| 1133 | 1130 | let cursor = match dir { |
| 1134 | 1131 | Direction::Left | Direction::Right => self.conn.cursor_h_double, |
| 1135 | 1132 | Direction::Up | Direction::Down => self.conn.cursor_v_double, |
| 1136 | 1133 | }; |
| 1137 | | - for (win, _) in &geometries { |
| 1138 | | - self.conn.set_window_cursor(*win, cursor)?; |
| 1139 | | - } |
| 1134 | + self.conn.set_window_cursor(w1, cursor)?; |
| 1135 | + self.conn.set_window_cursor(w2, cursor)?; |
| 1140 | 1136 | self.conn.set_window_cursor(self.conn.root, cursor)?; |
| 1141 | | - self.conn.flush()?; |
| 1142 | 1137 | } |
| 1138 | + self.conn.flush()?; |
| 1143 | 1139 | |
| 1144 | | - self.tiled_edge_cursor = new_state.map(|(_, d)| d); |
| 1140 | + self.tiled_edge_cursor = new_state; |
| 1145 | 1141 | Ok(()) |
| 1146 | 1142 | } |
| 1147 | 1143 | |
@@ -2361,14 +2357,14 @@ impl WindowManager { |
| 2361 | 2357 | } |
| 2362 | 2358 | |
| 2363 | 2359 | /// Find if cursor is in the gap between two adjacent tiled windows. |
| 2364 | | - /// Returns (window, direction, container_size) if on a valid shared edge. |
| 2360 | + /// Returns (window1, window2, direction, container_size) if on a valid shared edge. |
| 2365 | 2361 | /// Only matches gaps between windows, NOT outer edges. |
| 2366 | 2362 | fn find_tiled_edge( |
| 2367 | 2363 | &self, |
| 2368 | 2364 | x: i16, |
| 2369 | 2365 | y: i16, |
| 2370 | 2366 | geometries: &[(u32, Rect)], |
| 2371 | | - ) -> Option<(u32, Direction, u16)> { |
| 2367 | + ) -> Option<(u32, u32, Direction, u16)> { |
| 2372 | 2368 | const TILED_EDGE_THRESHOLD: i16 = 16; |
| 2373 | 2369 | let gap_tolerance = self.config.gap_inner as i16 + 4; |
| 2374 | 2370 | |
@@ -2391,7 +2387,7 @@ impl WindowManager { |
| 2391 | 2387 | let gap_center = (r1_right + r2.x) / 2; |
| 2392 | 2388 | if (x - gap_center).abs() <= TILED_EDGE_THRESHOLD { |
| 2393 | 2389 | let container_width = (r1.width + r2.width) as u16; |
| 2394 | | - return Some((*w1, Direction::Right, container_width)); |
| 2390 | + return Some((*w1, *w2, Direction::Right, container_width)); |
| 2395 | 2391 | } |
| 2396 | 2392 | } |
| 2397 | 2393 | } |
@@ -2409,7 +2405,7 @@ impl WindowManager { |
| 2409 | 2405 | let gap_center = (r1_bottom + r2.y) / 2; |
| 2410 | 2406 | if (y - gap_center).abs() <= TILED_EDGE_THRESHOLD { |
| 2411 | 2407 | let container_height = (r1.height + r2.height) as u16; |
| 2412 | | - return Some((*w1, Direction::Down, container_height)); |
| 2408 | + return Some((*w1, *w2, Direction::Down, container_height)); |
| 2413 | 2409 | } |
| 2414 | 2410 | } |
| 2415 | 2411 | } |