backward compatibility with glfw v3.2

This commit is contained in:
brunoherbelin
2020-08-01 12:06:18 +02:00
parent cb62706791
commit 6e002a8451

View File

@@ -448,7 +448,14 @@ GLFWmonitor *RenderingWindow::monitorAt(int x, int y)
int i = 0; int i = 0;
for (; i < count_monitors; i++) { for (; i < count_monitors; i++) {
int workarea_x, workarea_y, workarea_width, workarea_height; int workarea_x, workarea_y, workarea_width, workarea_height;
#if GLFW_VERSION_MINOR > 2
glfwGetMonitorWorkarea(monitors[i], &workarea_x, &workarea_y, &workarea_width, &workarea_height); glfwGetMonitorWorkarea(monitors[i], &workarea_x, &workarea_y, &workarea_width, &workarea_height);
#else
glfwGetMonitorPos(monitors[i], &workarea_x, &workarea_y);
const GLFWvidmode *vm = glfwGetVideoMode(monitors[i]);
workarea_width = vm->width;
workarea_height = vm->height;
#endif
if ( x >= workarea_x && x <= workarea_x + workarea_width && if ( x >= workarea_x && x <= workarea_x + workarea_width &&
y >= workarea_y && y <= workarea_y + workarea_height) y >= workarea_y && y <= workarea_y + workarea_height)
break; break;
@@ -545,10 +552,7 @@ int RenderingWindow::height()
int RenderingWindow::maxHeight() int RenderingWindow::maxHeight()
{ {
int workarea_x, workarea_y, workarea_width, workarea_height; return glfwGetVideoMode(monitor())->height;
glfwGetMonitorWorkarea(monitor(), &workarea_x, &workarea_y, &workarea_width, &workarea_height);
return workarea_height * dpi_scale_;
} }
float RenderingWindow::aspectRatio() float RenderingWindow::aspectRatio()