Skip to content

Commit

Permalink
Fix a bug with double-click titlebar to maximize not working on chrom…
Browse files Browse the repository at this point in the history
…e tabs dragged to another display
  • Loading branch information
rxhanson committed Sep 10, 2024
1 parent 31ea4f6 commit 1951aad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Rectangle/TitleBarManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import Foundation

class TitleBarManager {
private var eventMonitor: EventMonitor!

private var lastEventNumber: Int?

init() {
eventMonitor = PassiveEventMonitor(mask: NSEvent.EventTypeMask.leftMouseUp, handler: handle)
eventMonitor = PassiveEventMonitor(mask: .leftMouseUp, handler: handle)
toggleListening()
Notification.Name.windowTitleBar.onPost { notification in
self.toggleListening()
Expand All @@ -33,6 +34,7 @@ class TitleBarManager {
guard
event.type == .leftMouseUp,
event.clickCount == 2,
event.eventNumber != lastEventNumber,
TitleBarManager.systemSettingDisabled,
let action = WindowAction(rawValue: Defaults.doubleClickTitleBar.value - 1),
case let location = NSEvent.mouseLocation.screenFlipped,
Expand All @@ -42,6 +44,7 @@ class TitleBarManager {
else {
return
}
lastEventNumber = event.eventNumber
if let toolbarFrame = windowElement.getChildElement(.toolbar)?.frame, toolbarFrame != .null {
titleBarFrame = titleBarFrame.union(toolbarFrame)
}
Expand Down

0 comments on commit 1951aad

Please sign in to comment.