From: Stefan Csomor Date: Sat, 11 Sep 2010 09:20:28 +0000 (+0000) Subject: fixing 'main screen' X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5d57348ef570e5bce5b5148ba63f910c65a9b8dd fixing 'main screen' git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index 857e98908f..3381cbddb8 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -272,6 +272,7 @@ protected : #ifdef __OBJC__ + WXDLLIMPEXP_CORE NSScreen* wxOSXGetMenuScreen(); WXDLLIMPEXP_CORE NSRect wxToNSRect( NSView* parent, const wxRect& r ); WXDLLIMPEXP_CORE wxRect wxFromNSRect( NSView* parent, const NSRect& rect ); WXDLLIMPEXP_CORE NSPoint wxToNSPoint( NSView* parent, const wxPoint& p ); diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 35e7553229..1cd9e84b48 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -19,9 +19,19 @@ #include "wx/osx/private.h" +NSScreen* wxOSXGetMenuScreen() +{ + if ( [NSScreen screens] == nil ) + return [NSScreen mainScreen]; + else + { + return [[NSScreen screens] objectAtIndex:0]; + } +} + NSRect wxToNSRect( NSView* parent, const wxRect& r ) { - NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame]; + NSRect frame = parent ? [parent bounds] : [wxOSXGetMenuScreen() frame]; int y = r.y; int x = r.x ; if ( parent == NULL || ![ parent isFlipped ] ) @@ -31,7 +41,7 @@ NSRect wxToNSRect( NSView* parent, const wxRect& r ) wxRect wxFromNSRect( NSView* parent, const NSRect& rect ) { - NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame]; + NSRect frame = parent ? [parent bounds] : [wxOSXGetMenuScreen() frame]; int y = (int)rect.origin.y; int x = (int)rect.origin.x; if ( parent == NULL || ![ parent isFlipped ] ) @@ -41,7 +51,7 @@ wxRect wxFromNSRect( NSView* parent, const NSRect& rect ) NSPoint wxToNSPoint( NSView* parent, const wxPoint& p ) { - NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame]; + NSRect frame = parent ? [parent bounds] : [wxOSXGetMenuScreen() frame]; int x = p.x ; int y = p.y; if ( parent == NULL || ![ parent isFlipped ] ) @@ -51,7 +61,7 @@ NSPoint wxToNSPoint( NSView* parent, const wxPoint& p ) wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p ) { - NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame]; + NSRect frame = parent ? [parent bounds] : [wxOSXGetMenuScreen() frame]; int x = (int)p.x; int y = (int)p.y; if ( parent == NULL || ![ parent isFlipped ] ) diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index e8d122f171..fb325bd19c 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -226,7 +226,7 @@ void wxApp::DoCleanUp() void wxClientDisplayRect(int *x, int *y, int *width, int *height) { - NSRect displayRect = [[NSScreen mainScreen] visibleFrame]; + NSRect displayRect = [wxOSXGetMenuScreen() visibleFrame]; wxRect r = wxFromNSRect( NULL, displayRect ); if ( x ) *x = r.x;