#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 );
#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 ] )
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 ] )
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 ] )
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 ] )
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;