From d82e7b5cb1a19d7d165347a84743bd0ce86206ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 25 Feb 2019 14:09:34 +0100 Subject: [PATCH] Win32: Use cached monitor handle for work area This facility was added after the original PR was made. Related to #1322. --- src/win32_monitor.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/win32_monitor.c b/src/win32_monitor.c index 6fc48c99..f893f988 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -365,28 +365,17 @@ void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height) { - MONITORINFO monitorInfo; - int x, y; - 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); + MONITORINFO mi = { sizeof(mi) }; + GetMonitorInfo(monitor->win32.handle, &mi); if (xpos) - *xpos = monitorInfo.rcWork.left; + *xpos = mi.rcWork.left; if (ypos) - *ypos = monitorInfo.rcWork.top; + *ypos = mi.rcWork.top; if (width) - *width = monitorInfo.rcWork.right - monitorInfo.rcWork.left; + *width = mi.rcWork.right - mi.rcWork.left; if (height) - *height = monitorInfo.rcWork.bottom - monitorInfo.rcWork.top; + *height = mi.rcWork.bottom - mi.rcWork.top; } GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count)