@@ -535,21 +535,17 @@ impl WindowManager { |
| 535 | | 535 | |
| 536 | // Focus the clicked window | 536 | // Focus the clicked window |
| 537 | if self.focused_window != Some(window) { | 537 | 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 |
| 539 | if let Some(old) = self.focused_window { | 539 | if let Some(old) = self.focused_window { |
| 540 | - if !self.is_floating(old) { | 540 | + self.conn.grab_button(old)?; |
| 541 | - self.conn.grab_button(old)?; | | |
| 542 | - } | | |
| 543 | } | 541 | } |
| 544 | | 542 | |
| 545 | // Set focus | 543 | // Set focus |
| 546 | self.set_focus(window, false)?; | 544 | self.set_focus(window, false)?; |
| 547 | | 545 | |
| 548 | - // For non-floating windows, ungrab button for click-through | 546 | + // Ungrab buttons so clicks pass through to the application |
| 549 | - // For floating windows, keep grab for edge resize detection | 547 | + // Edge resize detection uses POINTER_MOTION events, not button grabs |
| 550 | - if !self.is_floating(window) { | 548 | + self.conn.ungrab_button(window)?; |
| 551 | - self.conn.ungrab_button(window)?; | | |
| 552 | - } | | |
| 553 | | 549 | |
| 554 | // Raise floating windows on focus | 550 | // Raise floating windows on focus |
| 555 | if self.is_floating(window) { | 551 | if self.is_floating(window) { |
@@ -2074,9 +2070,10 @@ impl WindowManager { |
| 2074 | | EventMask::POINTER_MOTION, | 2070 | | EventMask::POINTER_MOTION, |
| 2075 | )?; | 2071 | )?; |
| 2076 | | 2072 | |
| 2077 | - // Re-establish button grabs for edge resize detection | 2073 | + // Don't grab buttons - the window is already focused (we're acting on focused window) |
| 2078 | - // (buttons may have been ungrabbed when the window was focused as tiled) | 2074 | + // and grabbing would intercept all clicks, preventing app interaction. |
| 2079 | - self.conn.grab_button(window)?; | 2075 | + // Mod+button grabs on root handle floating move/resize. |
| | 2076 | + // Button grabs are only for click-to-focus on unfocused windows. |
| 2080 | | 2077 | |
| 2081 | // Add to floating list (on top) | 2078 | // Add to floating list (on top) |
| 2082 | self.current_workspace_mut().add_floating(window); | 2079 | self.current_workspace_mut().add_floating(window); |