mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-08 04:18:15 +00:00
Fixes GetCurrentMonitor() detection inconsistency issue (#3215)
This commit is contained in:
26
src/rcore.c
26
src/rcore.c
@@ -1835,20 +1835,24 @@ int GetCurrentMonitor(void)
|
|||||||
int mx = 0;
|
int mx = 0;
|
||||||
int my = 0;
|
int my = 0;
|
||||||
|
|
||||||
int width = 0;
|
|
||||||
int height = 0;
|
|
||||||
|
|
||||||
monitor = monitors[i];
|
monitor = monitors[i];
|
||||||
glfwGetMonitorWorkarea(monitor, &mx, &my, &width, &height);
|
glfwGetMonitorPos(monitor, &mx, &my);
|
||||||
|
const GLFWvidmode *mode = glfwGetVideoMode(monitor);
|
||||||
if ((x >= mx) &&
|
if (mode)
|
||||||
(x < (mx + width)) &&
|
|
||||||
(y >= my) &&
|
|
||||||
(y < (my + height)))
|
|
||||||
{
|
{
|
||||||
index = i;
|
const int width = mode->width;
|
||||||
break;
|
const int height = mode->height;
|
||||||
|
|
||||||
|
if ((x >= mx) &&
|
||||||
|
(x < (mx + width)) &&
|
||||||
|
(y >= my) &&
|
||||||
|
(y < (my + height)))
|
||||||
|
{
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else TRACELOG(LOG_WARNING, "GLFW: Failed to find video mode for selected monitor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user