From 1d0c2f3e099cb67c00fcd7e544daa8daa09a084f Mon Sep 17 00:00:00 2001
From: gimli <gimli@gimlis-Mac-mini.local>
Date: Sun, 8 May 2011 11:41:09 +0200
Subject: [osx] Workaround to fix fullscreen switching in multi monitor setup.

---
 xbmc/guilib/GraphicContext.cpp     | 4 ++++
 xbmc/windowing/osx/WinSystemOSX.mm | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xbmc/guilib/GraphicContext.cpp b/xbmc/guilib/GraphicContext.cpp
index 0cab11d27a..61bd4c6b8f 100644
--- a/xbmc/guilib/GraphicContext.cpp
+++ b/xbmc/guilib/GraphicContext.cpp
@@ -307,6 +307,10 @@ bool CGraphicContext::IsValidResolution(RESOLUTION res)
 
 void CGraphicContext::SetVideoResolution(RESOLUTION res, bool forceUpdate)
 {
+#if defined __APPLE__
+  /* Update the resolutions. XBMC window can be moved to another screen. */
+  g_Windowing.UpdateResolutions();
+#endif  
   RESOLUTION lastRes = m_Resolution;
 
   // If the user asked us to guess, go with desktop
diff --git a/xbmc/windowing/osx/WinSystemOSX.mm b/xbmc/windowing/osx/WinSystemOSX.mm
index 9ff835bf64..59964b4de2 100644
--- a/xbmc/windowing/osx/WinSystemOSX.mm
+++ b/xbmc/windowing/osx/WinSystemOSX.mm
@@ -391,8 +391,8 @@ bool CWinSystemOSX::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool bl
     if (g_guiSettings.GetBool("videoscreen.fakefullscreen"))
     {
       // This is Cocca Windowed FullScreen Mode
-      // Get the screen rect of our current display
-      NSScreen* pScreen = [[NSScreen screens] objectAtIndex:res.iScreen];
+      // Get the screen rect of our current display      
+      NSScreen* pScreen = [NSScreen mainScreen];
       NSRect    screenRect = [pScreen frame];
       
       // remove frame origin offset of orginal display
@@ -721,7 +721,7 @@ void CWinSystemOSX::GetScreenResolution(int* w, int* h, double* fps)
       window = [view window];
       if (window)
       {
-        display_id = GetDisplayIDFromScreen( [window screen] );      
+        display_id = GetDisplayIDFromScreen( [NSScreen mainScreen] );      
         mode  = CGDisplayCurrentMode(display_id);
       }
     }
-- 
cgit v1.2.3