@@ -2984,13 +2984,39 @@ impl WindowManager { |
| 2984 | // Update stacking order in workspace's floating list | 2984 | // Update stacking order in workspace's floating list |
| 2985 | self.current_workspace_mut().raise_floating(window); | 2985 | self.current_workspace_mut().raise_floating(window); |
| 2986 | | 2986 | |
| 2987 | - // Raise in X11 - if window has a frame, raise the frame instead | 2987 | + // Get the window (or frame) to raise |
| 2988 | - let aux = ConfigureWindowAux::new().stack_mode(StackMode::ABOVE); | 2988 | + let window_to_raise = self.frames.frame_for_client(window).unwrap_or(window); |
| 2989 | - if let Some(frame) = self.frames.frame_for_client(window) { | 2989 | + |
| 2990 | - self.conn.conn.configure_window(frame, &aux)?; | 2990 | + // First, find the topmost tiled window across all visible workspaces |
| 2991 | - } else { | 2991 | + // and raise above it to ensure we're above everything |
| 2992 | - self.conn.conn.configure_window(window, &aux)?; | 2992 | + let visible_ws: Vec<usize> = self.monitors.iter().map(|m| m.active_workspace).collect(); |
| | 2993 | + let mut topmost_tiled: Option<u32> = None; |
| | 2994 | + |
| | 2995 | + for ws_idx in visible_ws { |
| | 2996 | + if let Some(ws) = self.workspaces.get(ws_idx) { |
| | 2997 | + // Get tiled windows from the tree |
| | 2998 | + for win_id in ws.tree.windows() { |
| | 2999 | + if let Some(frame) = self.frames.frame_for_client(win_id) { |
| | 3000 | + topmost_tiled = Some(frame); |
| | 3001 | + } else { |
| | 3002 | + topmost_tiled = Some(win_id); |
| | 3003 | + } |
| | 3004 | + } |
| | 3005 | + } |
| 2993 | } | 3006 | } |
| | 3007 | + |
| | 3008 | + // Raise the window - if we found a tiled window, raise above it explicitly |
| | 3009 | + if let Some(sibling) = topmost_tiled { |
| | 3010 | + let aux = ConfigureWindowAux::new() |
| | 3011 | + .sibling(sibling) |
| | 3012 | + .stack_mode(StackMode::ABOVE); |
| | 3013 | + self.conn.conn.configure_window(window_to_raise, &aux)?; |
| | 3014 | + } |
| | 3015 | + |
| | 3016 | + // Then raise to absolute top with plain ABOVE |
| | 3017 | + let aux = ConfigureWindowAux::new().stack_mode(StackMode::ABOVE); |
| | 3018 | + self.conn.conn.configure_window(window_to_raise, &aux)?; |
| | 3019 | + |
| 2994 | self.conn.flush()?; | 3020 | self.conn.flush()?; |
| 2995 | Ok(()) | 3021 | Ok(()) |
| 2996 | } | 3022 | } |