Skip to content

An attempt to fix the "double click" bug on MacOS#448

Draft
eriksvedang wants to merge 3 commits intonot-fl3:masterfrom
eriksvedang:fix-double-click-bug-macos
Draft

An attempt to fix the "double click" bug on MacOS#448
eriksvedang wants to merge 3 commits intonot-fl3:masterfrom
eriksvedang:fix-double-click-bug-macos

Conversation

@eriksvedang
Copy link

@eriksvedang eriksvedang commented Jun 12, 2024

Here's my attempt at solving the bug described here not-fl3/macroquad#422

The way to reliably (100%) reproduce the bug on MacOS is to launch the program from the command line, and constantly move the cursor around the screen while the program is starting (adding a call to sleep at the beginning of the program makes this easier to perform).

This PR uses the method call [[NSRunningApplication currentApplication] activateWithOptions] which is documented here: https://developer.apple.com/documentation/appkit/nsrunningapplication/1528725-activatewithoptions

In my testing, the game window is still inactive (gray) after this code has been called, but the double click bug described in the original issue is gone after clicking the window once. That the window actually doesn't get active (which one would assume...) implies that there's more room for improvement here, since the method call actually doesn't make the window active. But the user experience with this fix is at least a lot better than the current behaviour.

If this fix is good enough and we want to merge it in, I'd need some help to decide where the best place to actually call prevent_double_click_bug_on_macos function from (right now I manually call it in my test program).

@eriksvedang eriksvedang changed the title Fix "double click" bug on MacOS An attempt to fix the "double click" bug on MacOS Jun 12, 2024
@birhburh
Copy link
Contributor

Oh, so it was a bug, and not me constantly misclicking.

@escobar-west
Copy link

escobar-west commented Jan 11, 2025

I ran into this exact problem today and I am able to reproduce it in my app with the method you suggested (moving the cursor around). I'm going to try build my app with this branch and see if it resolves the problem. If yes, I'll see what feedback I can provide to help get this (or a similar PR) merged in. Not sure what help I can be besides being another tester though.

birhburh added a commit to birhburh/miniquad that referenced this pull request Apr 14, 2025
Based on @pherrymason suggestion in not-fl3#422

#fixes 422
#fixes 524
Probably makes not-fl3#448 not needed anymore also
not-fl3 pushed a commit that referenced this pull request Apr 14, 2025
Based on @pherrymason suggestion in #422

#fixes 422
#fixes 524
Probably makes #448 not needed anymore also
BeaconBrigade pushed a commit to BeaconBrigade/miniquad that referenced this pull request Jan 21, 2026
Based on @pherrymason suggestion in not-fl3#422

#fixes 422
#fixes 524
Probably makes not-fl3#448 not needed anymore also
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

Successfully merging this pull request may close these issues.

3 participants