Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug with double-click titlebar to maximize not working on chrome tabs dragged to another display #1457

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading