@@ -676,25 +676,33 @@ impl WindowManager { |
| 676 | 676 | tracing::info!("Dock window {} destroyed, removing strut", event.window); |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | + // Check if this window was actually managed before doing layout/focus work |
| 680 | + let was_managed = self.windows.contains_key(&event.window); |
| 681 | + |
| 679 | 682 | // Remove from management |
| 680 | 683 | self.unmanage_window(event.window); |
| 681 | 684 | |
| 682 | | - // Clear the entire root window to remove any leftover pixels |
| 683 | | - // This is needed because X11 without a compositor doesn't automatically repaint |
| 684 | | - self.conn.clear_root_area(0, 0, self.conn.screen_width, self.conn.screen_height)?; |
| 685 | + // Only do layout/focus work if the window was actually managed |
| 686 | + // Unmanaged windows (like popup menus, tooltips) shouldn't trigger pointer warps |
| 687 | + if was_managed { |
| 688 | + // Clear the entire root window to remove any leftover pixels |
| 689 | + // This is needed because X11 without a compositor doesn't automatically repaint |
| 690 | + self.conn.clear_root_area(0, 0, self.conn.screen_width, self.conn.screen_height)?; |
| 685 | 691 | |
| 686 | | - // Re-apply layout |
| 687 | | - self.apply_layout()?; |
| 692 | + // Re-apply layout |
| 693 | + self.apply_layout()?; |
| 688 | 694 | |
| 689 | | - // Focus next window or warp to monitor if none left |
| 690 | | - if let Some(window) = self.focused_window { |
| 691 | | - self.set_focus(window, true)?; |
| 692 | | - } else { |
| 693 | | - // No windows left, warp to current monitor center |
| 694 | | - self.warp_to_monitor(self.focused_monitor)?; |
| 695 | + // Focus next window or warp to monitor if none left |
| 696 | + if let Some(window) = self.focused_window { |
| 697 | + self.set_focus(window, true)?; |
| 698 | + } else { |
| 699 | + // No windows left, warp to current monitor center |
| 700 | + self.warp_to_monitor(self.focused_monitor)?; |
| 701 | + } |
| 702 | + |
| 703 | + self.conn.flush()?; |
| 695 | 704 | } |
| 696 | 705 | |
| 697 | | - self.conn.flush()?; |
| 698 | 706 | Ok(()) |
| 699 | 707 | } |
| 700 | 708 | |