@@ -896,6 +896,9 @@ impl WindowManager { |
| 896 | let window = event.event; | 896 | let window = event.event; |
| 897 | if self.windows.contains_key(&window) && self.is_floating(window) { | 897 | if self.windows.contains_key(&window) && self.is_floating(window) { |
| 898 | self.update_edge_cursor(window, event.root_x, event.root_y)?; | 898 | self.update_edge_cursor(window, event.root_x, event.root_y)?; |
| | 899 | + } else { |
| | 900 | + // Check for tiled edge hover (for cursor feedback) |
| | 901 | + self.update_tiled_edge_cursor(event.root_x, event.root_y)?; |
| 899 | } | 902 | } |
| 900 | return Ok(()); | 903 | return Ok(()); |
| 901 | } | 904 | } |
@@ -1103,6 +1106,38 @@ impl WindowManager { |
| 1103 | Ok(()) | 1106 | Ok(()) |
| 1104 | } | 1107 | } |
| 1105 | | 1108 | |
| | 1109 | + /// Update cursor when hovering over tiled window edges/gaps. |
| | 1110 | + fn update_tiled_edge_cursor(&mut self, root_x: i16, root_y: i16) -> Result<()> { |
| | 1111 | + let work_area = self.work_area(); |
| | 1112 | + let geometries = self.current_workspace().tree.calculate_geometries(work_area); |
| | 1113 | + |
| | 1114 | + let edge = self.find_tiled_edge(root_x, root_y, &geometries); |
| | 1115 | + |
| | 1116 | + let new_direction = edge.map(|(_, dir, _)| dir); |
| | 1117 | + |
| | 1118 | + // Check if cursor state changed |
| | 1119 | + if new_direction == self.tiled_edge_cursor { |
| | 1120 | + return Ok(()); // No change |
| | 1121 | + } |
| | 1122 | + |
| | 1123 | + if let Some(dir) = new_direction { |
| | 1124 | + // Set resize cursor on root |
| | 1125 | + let cursor = match dir { |
| | 1126 | + Direction::Left | Direction::Right => self.conn.cursor_left, |
| | 1127 | + Direction::Up | Direction::Down => self.conn.cursor_top, |
| | 1128 | + }; |
| | 1129 | + self.conn.set_window_cursor(self.conn.root, cursor)?; |
| | 1130 | + self.conn.flush()?; |
| | 1131 | + } else if self.tiled_edge_cursor.is_some() { |
| | 1132 | + // Clear resize cursor from root |
| | 1133 | + self.conn.clear_window_cursor(self.conn.root)?; |
| | 1134 | + self.conn.flush()?; |
| | 1135 | + } |
| | 1136 | + |
| | 1137 | + self.tiled_edge_cursor = new_direction; |
| | 1138 | + Ok(()) |
| | 1139 | + } |
| | 1140 | + |
| 1106 | fn handle_enter_notify(&mut self, event: EnterNotifyEvent) -> Result<()> { | 1141 | fn handle_enter_notify(&mut self, event: EnterNotifyEvent) -> Result<()> { |
| 1107 | let window = event.event; | 1142 | let window = event.event; |
| 1108 | | 1143 | |
@@ -2327,7 +2362,7 @@ impl WindowManager { |
| 2327 | y: i16, | 2362 | y: i16, |
| 2328 | geometries: &[(u32, Rect)], | 2363 | geometries: &[(u32, Rect)], |
| 2329 | ) -> Option<(u32, Direction, u16)> { | 2364 | ) -> Option<(u32, Direction, u16)> { |
| 2330 | - const TILED_EDGE_THRESHOLD: i16 = 8; | 2365 | + const TILED_EDGE_THRESHOLD: i16 = 16; |
| 2331 | let gap_tolerance = self.config.gap_inner as i16 + 4; | 2366 | let gap_tolerance = self.config.gap_inner as i16 + 4; |
| 2332 | | 2367 | |
| 2333 | for (w1, r1) in geometries { | 2368 | for (w1, r1) in geometries { |