Skip to content

Commit a8246e0

Browse files
Gasparokendacap
authored andcommitted
Fix bounds and workarea on additional screen in macOS
Before this fix, the 'y' coordinate of the bounds and the workarea of additional screens omitted the origin of the main window.
1 parent c7188d1 commit a8246e0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

os/osx/screen.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// LAF OS Library
2-
// Copyright (c) 2020-2021 Igara Studio S.A.
2+
// Copyright (c) 2020-2025 Igara Studio S.A.
33
//
44
// This file is released under the terms of the MIT license.
55
// Read LICENSE.txt for more information.
@@ -23,14 +23,15 @@ class ScreenOSX : public Screen {
2323
{
2424
auto rc = screen.frame;
2525
auto wa = screen.visibleFrame;
26+
const int mainScreenHeight = [NSScreen mainScreen].frame.size.height;
2627

2728
m_bounds.x = rc.origin.x;
28-
m_bounds.y = rc.origin.y;
29+
m_bounds.y = mainScreenHeight - rc.origin.y - rc.size.height;
2930
m_bounds.w = rc.size.width;
3031
m_bounds.h = rc.size.height;
3132

3233
m_workarea.x = wa.origin.x;
33-
m_workarea.y = m_bounds.h - wa.origin.y - wa.size.height;
34+
m_workarea.y = mainScreenHeight - wa.origin.y - wa.size.height;
3435
m_workarea.w = wa.size.width;
3536
m_workarea.h = wa.size.height;
3637
}

0 commit comments

Comments
 (0)