Skip to content

Commit

Permalink
Fixes GetCurrentMonitor() detection inconsistency issue (#3215)
Browse files Browse the repository at this point in the history
  • Loading branch information
ubkp committed Aug 1, 2023
1 parent d3ea649 commit 4fd40f0
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/rcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
Expand Down

0 comments on commit 4fd40f0

Please sign in to comment.