Skip to content

Commit

Permalink
Merge pull request #1457 from rxhanson/fix-dbl-click-chrome-tab-other…
Browse files Browse the repository at this point in the history
…-display

Fix a bug with double-click titlebar to maximize not working on chrome tabs dragged to another display
  • Loading branch information
rxhanson authored Sep 10, 2024
2 parents 31ea4f6 + 1951aad commit 30786f7
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 30786f7

Please sign in to comment.