aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Borges de Freitas <92enen@gmail.com>2023-02-11 15:36:05 +0000
committerMiguel Borges de Freitas <92enen@gmail.com>2023-02-21 11:23:37 +0000
commit009fc59225190cb07922c14389967591284fc2cc (patch)
tree230a168aed81c87accf44d3cfb6aad61ca33dcb3
parentcf55e526c8efcda726f16b8411059b18a1969edd (diff)
[macos][nativewindowing] if starting in windowed mode center window on screen
-rw-r--r--xbmc/windowing/osx/WinSystemOSX.mm16
1 files changed, 14 insertions, 2 deletions
diff --git a/xbmc/windowing/osx/WinSystemOSX.mm b/xbmc/windowing/osx/WinSystemOSX.mm
index 3d9586f3ce..7a57e058ea 100644
--- a/xbmc/windowing/osx/WinSystemOSX.mm
+++ b/xbmc/windowing/osx/WinSystemOSX.mm
@@ -705,8 +705,20 @@ bool CWinSystemOSX::CreateNewWindow(const std::string& name, bool fullScreen, RE
// associate with current window
[appWindow setContentView:view];
- // set the window to the appropriate screen
- [appWindow setFrameOrigin:screen.frame.origin];
+ // set the window to the appropriate screen and screen position
+ if (m_bFullScreen)
+ {
+ [appWindow setFrameOrigin:screen.frame.origin];
+ }
+ else
+ {
+ // if in window mode we center the window on the screen
+ // TODO: we should remember window positions and use that instead, similar to what is currently done for windowsDX
+ NSPoint centerOfTheScreen =
+ NSMakePoint(screen.frame.origin.x + screen.frame.size.width / 2 - m_nWidth / 2,
+ screen.frame.origin.y + screen.frame.size.height / 2 - m_nHeight / 2);
+ [appWindow setFrameOrigin:centerOfTheScreen];
+ }
});
[view.getGLContext makeCurrentContext];