Skip to content

Commit

Permalink
fix: correct position error in macOS14
Browse files Browse the repository at this point in the history
  • Loading branch information
Celve committed Dec 6, 2024
1 parent 4b659ba commit 610b4cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Peninsula.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
CODE_SIGN_ENTITLEMENTS = Peninsula/Peninsula.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"Peninsula/Preview Content\"";
DEVELOPMENT_TEAM = 8TDYAWS6VC;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -340,7 +340,7 @@
CODE_SIGN_ENTITLEMENTS = Peninsula/Peninsula.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"Peninsula/Preview Content\"";
DEVELOPMENT_TEAM = 8TDYAWS6VC;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down
7 changes: 5 additions & 2 deletions Peninsula/Notch/NotchWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Cocoa

private let notchHeight: CGFloat = 800
private let notchWidth: CGFloat = 150

class NotchWindowController: NSWindowController {
var vm: NotchViewModel?
Expand All @@ -26,7 +27,7 @@ class NotchWindowController: NSWindowController {
contentViewController = NotchViewController(vm)

if notchSize == .zero {
notchSize = .init(width: 150, height: 24)
notchSize = .init(width: notchWidth, height: 24)
}
vm.deviceNotchRect = CGRect(
x: screen.frame.origin.x + (screen.frame.width - notchSize.width) / 2,
Expand Down Expand Up @@ -63,8 +64,10 @@ class NotchWindowController: NSWindowController {
width: screen.frame.width,
height: notchHeight
)
window.setFrameOrigin(topRect.origin)

// set content size first, otherwise whether it expands from top-right or from bottom-left is inconsistent between macOS major versions
window.setContentSize(topRect.size)
window.setFrameOrigin(topRect.origin)
}

deinit {
Expand Down

0 comments on commit 610b4cd

Please sign in to comment.