macOS clientRect implementation for non-primary displays
This commit is contained in:
committed by
Vadim Zeitlin
parent
d5180d3604
commit
8bad3b5e80
@@ -485,6 +485,24 @@ wxRect wxOSXGetMainDisplayClientArea()
|
|||||||
return wxFromNSRect( NULL, displayRect );
|
return wxFromNSRect( NULL, displayRect );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NSScreen* wxOSXGetScreenFromDisplay( CGDirectDisplayID ID)
|
||||||
|
{
|
||||||
|
for (NSScreen* screen in [NSScreen screens])
|
||||||
|
{
|
||||||
|
CGDirectDisplayID displayID = [[[screen deviceDescription] objectForKey:@"NSScreenNumber"] intValue];
|
||||||
|
if ( displayID == ID )
|
||||||
|
return screen;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern // used from src/osx/core/display.cpp
|
||||||
|
wxRect wxOSXGetDisplayClientArea(CGDirectDisplayID ID)
|
||||||
|
{
|
||||||
|
NSRect displayRect = [wxOSXGetScreenFromDisplay(ID) visibleFrame];
|
||||||
|
return wxFromNSRect( NULL, displayRect );
|
||||||
|
}
|
||||||
|
|
||||||
void wxGetMousePosition( int* x, int* y )
|
void wxGetMousePosition( int* x, int* y )
|
||||||
{
|
{
|
||||||
wxPoint pt = wxFromNSPoint(NULL, [NSEvent mouseLocation]);
|
wxPoint pt = wxFromNSPoint(NULL, [NSEvent mouseLocation]);
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
// This one is defined in Objective C++ code.
|
// This one is defined in Objective C++ code.
|
||||||
extern wxRect wxOSXGetMainDisplayClientArea();
|
extern wxRect wxOSXGetMainDisplayClientArea();
|
||||||
|
extern wxRect wxOSXGetDisplayClientArea(CGDirectDisplayID id);
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@@ -297,13 +298,7 @@ wxRect wxDisplayImplMacOSX::GetGeometry() const
|
|||||||
|
|
||||||
wxRect wxDisplayImplMacOSX::GetClientArea() const
|
wxRect wxDisplayImplMacOSX::GetClientArea() const
|
||||||
{
|
{
|
||||||
// VZ: I don't know how to get client area for arbitrary display but
|
return wxOSXGetDisplayClientArea(m_id);
|
||||||
// wxGetClientDisplayRect() does work correctly for at least the main
|
|
||||||
// one (TODO: do it correctly for the other displays too)
|
|
||||||
if ( IsPrimary() )
|
|
||||||
return wxOSXGetMainDisplayClientArea();
|
|
||||||
|
|
||||||
return wxDisplayImpl::GetClientArea();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDisplayImplMacOSX::GetDepth() const
|
int wxDisplayImplMacOSX::GetDepth() const
|
||||||
|
Reference in New Issue
Block a user