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

Mouse Capture Anomalies #1828

RobertBColton opened this issue Jul 23, 2019 · 0 comments

Mouse Capture Anomalies #1828

RobertBColton opened this issue Jul 23, 2019 · 0 comments


Copy link

@RobertBColton RobertBColton commented Jul 23, 2019

This is a continuation of #1823 to address minor anomalies that still exist between ENIGMA and GM with regards to mouse behavior. What ENIGMA did in #1825 and #1824 was correct and an improvement. However, it's not exactly like GM since the capture can be prematurely released by press-and-releasing a different mouse button than the one that started the capture.

The problem here is that GM8.1 not only captures the mouse when a button is pressed inside the window, it seems to also record which button was pressed. From testing, I am able to show that it's possible to get GM8.1's mouse state stuck just like you can ENIGMA's. If we use the below draw code, we can actually press-and-move the left mouse button outside the window, which captures the mouse. Then we can press-and-hold the right mouse button and finally release the left button. GM8.1 at that point releases the mouse capture and if we release the right mouse button outside the window then, GM8.1 thinks it is still activated!

draw_text(0,0,string(mouse_check_button(mb_left)) + " " +
              string(mouse_check_button_pressed(mb_left)) + " " +
              string(mouse_check_button_released(mb_left)) + "#" +
              string(mouse_check_button(mb_right)) + " " +
              string(mouse_check_button_pressed(mb_right)) + " " +

This is NOT reproducible in GMSv1.4 and the issue seems to have been fixed!

I don't actually see this as an issue that we necessarily need to do anything about, but GMSv1.4 suggests YoYo did something about it. I think we could go years without anybody ever having a problem, but it is possible for us to easily adopt what GM8.1 does. However, since GM8.1 is also busted, I have my own proposal, which is that we just hold the mouse capture until ALL mouse buttons are released. We could also just read the mouse state directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.