Add glfwGetMonitorWorkarea

This function retrieves the work area rectangle of the specified
monitor.

Related to #920.
Closes #989.
This commit is contained in:
Felipe Ferreira da Silva
2017-04-06 16:48:08 -03:00
committed by Camilla Löwy
parent c20754c4a6
commit be295ccbea
11 changed files with 121 additions and 0 deletions

View File

@@ -408,6 +408,24 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor,
*yscale = (float) (pixels.size.height / points.size.height);
}
void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int *width, int *height)
{
NSScreen *resultScreen;
for (NSScreen *screen in [NSScreen screens]) {
if ([[[screen deviceDescription] valueForKey:@"NSScreenNumber"] intValue] == monitor->ns.displayID) {
resultScreen = screen;
break;
}
}
NSRect frameRect = [[NSScreen resultScreen] visibleFrame];
*xpos = NSMinX(frameRect);
*ypos = NSMinY(frameRect);
*width = NSMaxX(frameRect);
*height = NSMaxY(frameRect);
}
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)
{
CFArrayRef modes;