summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorubkp <[email protected]>2023-08-01 05:42:50 -0300
committerGitHub <[email protected]>2023-08-01 10:42:50 +0200
commit4fd40f0333e48ad0b10a853eacc367b8ac8cc02f (patch)
tree8dcb15e5cb8b6a12fd8d705bfe6b6c35027ba766 /src
parentd3ea64983212f7451a9cfbf644da8a5c43dbc706 (diff)
downloadraylib-4fd40f0333e48ad0b10a853eacc367b8ac8cc02f.tar.gz
raylib-4fd40f0333e48ad0b10a853eacc367b8ac8cc02f.zip
Fixes GetCurrentMonitor() detection inconsistency issue (#3215)
Diffstat (limited to 'src')
-rw-r--r--src/rcore.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/rcore.c b/src/rcore.c
index 66a914ee..282fec17 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -1835,20 +1835,24 @@ int GetCurrentMonitor(void)
int mx = 0;
int my = 0;
- int width = 0;
- int height = 0;
-
monitor = monitors[i];
- glfwGetMonitorWorkarea(monitor, &mx, &my, &width, &height);
-
- if ((x >= mx) &&
- (x < (mx + width)) &&
- (y >= my) &&
- (y < (my + height)))
+ glfwGetMonitorPos(monitor, &mx, &my);
+ const GLFWvidmode *mode = glfwGetVideoMode(monitor);
+ if (mode)
{
- index = i;
- break;
+ const int width = mode->width;
+ 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");
}
}
}