diff options
author | Miguel Borges de Freitas <92enen@gmail.com> | 2022-12-28 14:29:09 +0000 |
---|---|---|
committer | Miguel Borges de Freitas <92enen@gmail.com> | 2023-02-21 11:23:37 +0000 |
commit | 3a78f664958803fcc9fad28c8e9f4a0d4f05ef57 (patch) | |
tree | 739cfcf32b40946737cb6ee956936f546a1fdbc2 | |
parent | 4f82f94b80d29182d5a05d5511d48c9280a321d5 (diff) |
[macOS][NativeWindowing] Implement window move callbacks
-rw-r--r-- | xbmc/windowing/osx/OpenGL/OSXGLWindow.mm | 9 | ||||
-rw-r--r-- | xbmc/windowing/osx/WinSystemOSX.mm | 20 |
2 files changed, 7 insertions, 22 deletions
diff --git a/xbmc/windowing/osx/OpenGL/OSXGLWindow.mm b/xbmc/windowing/osx/OpenGL/OSXGLWindow.mm index ad5ff771c2..afe8738b60 100644 --- a/xbmc/windowing/osx/OpenGL/OSXGLWindow.mm +++ b/xbmc/windowing/osx/OpenGL/OSXGLWindow.mm @@ -136,10 +136,11 @@ - (void)windowDidChangeScreen:(NSNotification*)notification { - // user has moved the window to a - // different screen - // if (CServiceBroker::GetWinSystem()->IsFullScreen()) - // CServiceBroker::GetWinSystem()->SetMovedToOtherScreen(true); + // user has moved the window to a different screen + CWinSystemOSX* winSystem = dynamic_cast<CWinSystemOSX*>(CServiceBroker::GetWinSystem()); + if (!winSystem) + return; + winSystem->WindowChangedScreen(); } - (NSSize)windowWillResize:(NSWindow*)sender toSize:(NSSize)frameSize diff --git a/xbmc/windowing/osx/WinSystemOSX.mm b/xbmc/windowing/osx/WinSystemOSX.mm index 023d4ce07e..90f6e969ce 100644 --- a/xbmc/windowing/osx/WinSystemOSX.mm +++ b/xbmc/windowing/osx/WinSystemOSX.mm @@ -1189,27 +1189,11 @@ void CWinSystemOSX::OnMove(int x, int y) void CWinSystemOSX::WindowChangedScreen() { - // user has moved the window to a - // different screen - NSOpenGLContext* context = [NSOpenGLContext currentContext]; - m_lastDisplayNr = 0; - // if we are here the user dragged the window to a different // screen and we return the screen of the window - if (context) + if (m_appWindow) { - NSView* view; - - view = context.view; - if (view) - { - NSWindow* window; - window = view.window; - if (window) - { - m_lastDisplayNr = GetDisplayIndex(GetDisplayIDFromScreen(window.screen)); - } - } + m_lastDisplayNr = GetDisplayIndex(GetDisplayIDFromScreen(m_appWindow.screen)); } } |