gardesk/gar / c402981

Browse files

Fix mouse clicks not working on floating windows

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
c402981f84196248d801ed6916ea1c44ecdff3c1
Parents
0753cf4
Tree
37506d2

1 changed file

StatusFile+-
M gar/src/x11/events.rs 9 12
gar/src/x11/events.rsmodified
@@ -535,21 +535,17 @@ impl WindowManager {
535535
 
536536
         // Focus the clicked window
537537
         if self.focused_window != Some(window) {
538
-            // Regrab button on old focused window (unless it's floating - keep grab for edge resize)
538
+            // Regrab button on old focused window for click-to-focus
539539
             if let Some(old) = self.focused_window {
540
-                if !self.is_floating(old) {
541
-                    self.conn.grab_button(old)?;
542
-                }
540
+                self.conn.grab_button(old)?;
543541
             }
544542
 
545543
             // Set focus
546544
             self.set_focus(window, false)?;
547545
 
548
-            // For non-floating windows, ungrab button for click-through
549
-            // For floating windows, keep grab for edge resize detection
550
-            if !self.is_floating(window) {
551
-                self.conn.ungrab_button(window)?;
552
-            }
546
+            // Ungrab buttons so clicks pass through to the application
547
+            // Edge resize detection uses POINTER_MOTION events, not button grabs
548
+            self.conn.ungrab_button(window)?;
553549
 
554550
             // Raise floating windows on focus
555551
             if self.is_floating(window) {
@@ -2074,9 +2070,10 @@ impl WindowManager {
20742070
                     | EventMask::POINTER_MOTION,
20752071
             )?;
20762072
 
2077
-            // Re-establish button grabs for edge resize detection
2078
-            // (buttons may have been ungrabbed when the window was focused as tiled)
2079
-            self.conn.grab_button(window)?;
2073
+            // Don't grab buttons - the window is already focused (we're acting on focused window)
2074
+            // and grabbing would intercept all clicks, preventing app interaction.
2075
+            // Mod+button grabs on root handle floating move/resize.
2076
+            // Button grabs are only for click-to-focus on unfocused windows.
20802077
 
20812078
             // Add to floating list (on top)
20822079
             self.current_workspace_mut().add_floating(window);