diff options
author | Miguel Borges de Freitas <92enen@gmail.com> | 2023-02-11 12:06:36 +0000 |
---|---|---|
committer | Miguel Borges de Freitas <92enen@gmail.com> | 2023-02-21 11:23:37 +0000 |
commit | 4e7f3bcabef0fb9e143b6c87a9e424cb350cbdf2 (patch) | |
tree | 0e1c119b982d2f73da8c5a5a01716465c521e532 | |
parent | 3a78f664958803fcc9fad28c8e9f4a0d4f05ef57 (diff) |
[macos][nativewindowing] Always start the application on the last known screen
-rw-r--r-- | xbmc/windowing/osx/WinSystemOSX.mm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/xbmc/windowing/osx/WinSystemOSX.mm b/xbmc/windowing/osx/WinSystemOSX.mm index 90f6e969ce..4f4143d5a1 100644 --- a/xbmc/windowing/osx/WinSystemOSX.mm +++ b/xbmc/windowing/osx/WinSystemOSX.mm @@ -641,6 +641,12 @@ bool CWinSystemOSX::DestroyWindowSystem() bool CWinSystemOSX::CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) { + // find the screen where the application started the last time. It'd be the default screen if the + // screen index is not found/available. + const std::shared_ptr<CSettings> settings = CServiceBroker::GetSettingsComponent()->GetSettings(); + m_lastDisplayNr = GetDisplayIndex(settings->GetString(CSettings::SETTING_VIDEOSCREEN_MONITOR)); + NSScreen* screen = [NSScreen.screens objectAtIndex:m_lastDisplayNr]; + // force initial window creation to be windowed, if fullscreen, it will switch to it below // fixes the white screen of death if starting fullscreen and switching to windowed. RESOLUTION_INFO resInfo = CDisplaySettings::GetInstance().GetResolutionInfo(RES_WINDOW); @@ -684,6 +690,9 @@ 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]; }); [view.getGLContext makeCurrentContext]; |