aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Borges de Freitas <92enen@gmail.com>2022-12-28 14:29:09 +0000
committerMiguel Borges de Freitas <92enen@gmail.com>2023-02-21 11:23:37 +0000
commit3a78f664958803fcc9fad28c8e9f4a0d4f05ef57 (patch)
tree739cfcf32b40946737cb6ee956936f546a1fdbc2
parent4f82f94b80d29182d5a05d5511d48c9280a321d5 (diff)
[macOS][NativeWindowing] Implement window move callbacks
-rw-r--r--xbmc/windowing/osx/OpenGL/OSXGLWindow.mm9
-rw-r--r--xbmc/windowing/osx/WinSystemOSX.mm20
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));
}
}