diff --git a/Edit.xcodeproj/project.pbxproj b/Edit.xcodeproj/project.pbxproj index f1a52b1..9d5739a 100644 --- a/Edit.xcodeproj/project.pbxproj +++ b/Edit.xcodeproj/project.pbxproj @@ -4969,10 +4969,10 @@ }; C9FE53372A75A75400CACA1A /* XCRemoteSwiftPackageReference "WindowTreatment" */ = { isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/ChimeHQ/WindowTreatment.git"; + repositoryURL = "https://github.com/McNight/WindowTreatment"; requirement = { - kind = upToNextMajorVersion; - minimumVersion = 2.3.0; + branch = main; + kind = branch; }; }; C9FE53AE2A7677D100CACA1A /* XCRemoteSwiftPackageReference "ScrollViewPlus" */ = { diff --git a/Edit/Modules/ProjectWindow/ProjectWindowController.swift b/Edit/Modules/ProjectWindow/ProjectWindowController.swift index 34a5f06..189573a 100644 --- a/Edit/Modules/ProjectWindow/ProjectWindowController.swift +++ b/Edit/Modules/ProjectWindow/ProjectWindowController.swift @@ -52,7 +52,7 @@ public final class ProjectWindowController: NSWindowController { self.siblingProvider = siblingProvider self.model = model - let window = ProjectWindow(contentViewController: controller) + let window = TitlebarClickAwareWindow(contentViewController: controller) window.titlebarAppearsTransparent = true window.styleMask.insert(.fullSizeContentView) @@ -107,39 +107,3 @@ extension ProjectWindowController { openQuicklyWindowController.showWindow(parent: window) } } - -private final class ProjectWindow: NSWindow { - override func mouseDown(with event: NSEvent) { - if event.clickCount > 1, isEventLocationEligible(event.locationInWindow) { - zoomOrMiniaturize(self) - } - super.mouseDown(with: event) - } - - private func isEventLocationEligible(_ location: CGPoint) -> Bool { - guard let windowFrame = contentView?.frame else { - return false - } - var titleBarRect = contentLayoutRect - titleBarRect.origin.y += contentLayoutRect.height - titleBarRect.size.height = windowFrame.height - contentLayoutRect.height - return titleBarRect.contains(location) - } - - private static let actionOnDoubleClickKey: String = "AppleActionOnDoubleClick" - private static let zoomActionOnDoubleClickValue: String = "Maximize" - private static let miniaturizeActionOnDoubleClickValue: String = "Minimize" - - func zoomOrMiniaturize(_ sender: Any?) { - let actionOnDoubleClickValue = UserDefaults.standard.string(forKey: Self.actionOnDoubleClickKey) - - switch actionOnDoubleClickValue { - case Self.zoomActionOnDoubleClickValue: - zoom(sender) - case Self.miniaturizeActionOnDoubleClickValue: - miniaturize(sender) - default: - zoom(sender) - } - } -}