fixing 'main screen'

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2010-09-11 09:20:28 +00:00
parent 4d4c704c3e
commit 5d57348ef5
3 changed files with 16 additions and 5 deletions

View File

@ -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 );

View File

@ -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 ] )

View File

@ -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;