Skip to content

Commit

Permalink
Fix the layout HUD when multiple screen are arranged vertically (#1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
Henkru committed Jan 4, 2022
1 parent a831dd8 commit 66b0a1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Amethyst/Managers/ScreenManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ final class ScreenManager<Delegate: ScreenManagerDelegate>: NSObject, Codable {
return
}

let screenFrame = screen.frameIncludingDockAndMenu()
let screenFrame = screen.frame()
let screenCenter = CGPoint(x: screenFrame.midX, y: screenFrame.midY)
let windowOrigin = CGPoint(
x: screenCenter.x - layoutNameWindow.frame.width / 2.0,
Expand Down
7 changes: 7 additions & 0 deletions Amethyst/Model/Screen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ protocol ScreenType: Equatable {
/// The frame adjusted such that the dock and menu are not included.
func frameWithoutDockOrMenu() -> CGRect

/// The frame without adjustment.
func frame() -> CGRect

/// The opaque idenfitifer for the screen in the underlying graphics system.
func screenID() -> String?

Expand Down Expand Up @@ -119,6 +122,10 @@ struct AMScreen: ScreenType {
return screen.frameWithoutDockOrMenu()
}

func frame() -> CGRect {
return screen.frame
}

func screenID() -> String? {
guard let managedDisplay = CGSCopyBestManagedDisplayForRect(CGSMainConnectionID(), frameIncludingDockAndMenu()) else {
return nil
Expand Down
4 changes: 4 additions & 0 deletions AmethystTests/Model/TestScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ final class TestScreen: ScreenType {
return internalFrame
}

func frame() -> CGRect {
return internalFrame
}

func screenID() -> String? {
return id
}
Expand Down

0 comments on commit 66b0a1c

Please sign in to comment.