gardesk/gar / 97e7c05

Browse files

Filter duplicate UnmapNotify events from StructureNotify

Only process UnmapNotify when event.event == root (SubstructureNotify).
Ignore events sent directly to window (StructureNotify) to prevent
double-processing which caused windows to be unmanaged incorrectly.
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
97e7c05651fbfc25f7c64eabcb25b96cf97fd633
Parents
52f19d4
Tree
8bc9c17

1 changed file

StatusFile+-
M gar/src/x11/events.rs 9 1
gar/src/x11/events.rsmodified
@@ -310,7 +310,15 @@ impl WindowManager {
310310
 
311311
     fn handle_unmap_notify(&mut self, event: UnmapNotifyEvent) -> Result<()> {
312312
         let window = event.window;
313
-        tracing::debug!("UnmapNotify for window {}", window);
313
+        tracing::debug!("UnmapNotify for window {} (event on {})", window, event.event);
314
+
315
+        // Only handle SubstructureNotify events (event.event == root)
316
+        // Ignore StructureNotify events sent directly to the window (event.event == window)
317
+        // This prevents double-processing since we get both types of events
318
+        if event.event != self.conn.root {
319
+            tracing::debug!("Ignoring UnmapNotify (not from root, likely StructureNotify)");
320
+            return Ok(());
321
+        }
314322
 
315323
         // Check if this was a dock window with struts
316324
         if self.dock_struts.remove(&window).is_some() {