gardesk/gar / 45140be

Browse files

raise floating windows above tiled windows on map

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
45140be5ebe540eec688207ba1225143ac55a594
Parents
73a9223
Tree
bc8d9f2

1 changed file

StatusFile+-
M gar/src/x11/events.rs 32 6
gar/src/x11/events.rsmodified
@@ -2984,13 +2984,39 @@ impl WindowManager {
29842984
         // Update stacking order in workspace's floating list
29852985
         self.current_workspace_mut().raise_floating(window);
29862986
 
2987
-        // Raise in X11 - if window has a frame, raise the frame instead
2988
-        let aux = ConfigureWindowAux::new().stack_mode(StackMode::ABOVE);
2989
-        if let Some(frame) = self.frames.frame_for_client(window) {
2990
-            self.conn.conn.configure_window(frame, &aux)?;
2991
-        } else {
2992
-            self.conn.conn.configure_window(window, &aux)?;
2987
+        // Get the window (or frame) to raise
2988
+        let window_to_raise = self.frames.frame_for_client(window).unwrap_or(window);
2989
+
2990
+        // First, find the topmost tiled window across all visible workspaces
2991
+        // and raise above it to ensure we're above everything
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
+            }
29933006
         }
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
+
29943020
         self.conn.flush()?;
29953021
         Ok(())
29963022
     }