Mouse Capture Anomalies

Reporter: RobertBColton  |  Status: open  |  Last Modified: July 22, 2019, 10:15:32 PM
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)) + " " +
              string(mouse_check_button_released(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.

Please sign in to post comments, or you can view this issue on GitHub.