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

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

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.

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.

2 participants