Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in GetCurrentMonitor() #3057

Closed
hamyyy opened this issue May 13, 2023 · 2 comments
Closed

Bug in GetCurrentMonitor() #3057

hamyyy opened this issue May 13, 2023 · 2 comments

Comments

@hamyyy
Copy link
Contributor

hamyyy commented May 13, 2023

I found a bug. When calling GetCurrentMonitor() I noticed it gave a different value based on if the window was maximized or not, even if it was on the same monitor. It got really annoying so I tracked it down to this line:

raylib/src/rcore.c

Lines 1788 to 1792 in 5978358

if (x >= mx && x <= (mx + width) && y >= my && y <= (my + height))
{
index = i;
break;
}

The problem is when the window is maximized, its (x,y) position is equal to the position of the monitor the screen is rendered on. The code above checks if the window's bounds are fully in the monitor bounds inclusively. This is an off by one error and instead the two <= should be changed to <

@hamyyy
Copy link
Contributor Author

hamyyy commented May 13, 2023

Apologies in advance for not using the template, I opened the issue by selecting the line in code view on GitHub and it didn't give a template to use, i didn't notice until after i posted.

@raysan5
Copy link
Owner

raysan5 commented May 13, 2023

@hamyyy thanks for reporting! feel free to send a PR for review! 👍🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants