Win32: Use cached monitor handle for work area

This facility was added after the original PR was made.

Related to #1322.
This commit is contained in:
Camilla Löwy 2019-02-25 14:09:34 +01:00
parent 0118743333
commit d82e7b5cb1

View File

@ -365,28 +365,17 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor,
int* xpos, int* ypos, int* xpos, int* ypos,
int* width, int* height) int* width, int* height)
{ {
MONITORINFO monitorInfo; MONITORINFO mi = { sizeof(mi) };
int x, y; GetMonitorInfo(monitor->win32.handle, &mi);
POINT pointInMonitor;
HMONITOR hMonitor;
_glfwPlatformGetMonitorPos(monitor, &x, &y);
monitorInfo.cbSize = sizeof(MONITORINFO);
pointInMonitor.x = x + 1;
pointInMonitor.y = y + 1;
hMonitor = MonitorFromPoint(pointInMonitor, 0);
GetMonitorInfo(hMonitor, &monitorInfo);
if (xpos) if (xpos)
*xpos = monitorInfo.rcWork.left; *xpos = mi.rcWork.left;
if (ypos) if (ypos)
*ypos = monitorInfo.rcWork.top; *ypos = mi.rcWork.top;
if (width) if (width)
*width = monitorInfo.rcWork.right - monitorInfo.rcWork.left; *width = mi.rcWork.right - mi.rcWork.left;
if (height) if (height)
*height = monitorInfo.rcWork.bottom - monitorInfo.rcWork.top; *height = mi.rcWork.bottom - mi.rcWork.top;
} }
GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count) GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)