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

Fix for #1648: menubar not clickable on macOS Catalina #1802

Closed
wants to merge 1 commit into from

Conversation

richardwilkes
Copy link

NSApp setActivationPolicy was being called too soon when the app was not
bundled and launched from the command line.

NSApp setActivationPolicy was being called too soon when the app was not
bundled and launched from the command line.
@andydotxyz
Copy link
Contributor

Tested this and it fixes the issue for me thanks!

@elmindreda elmindreda self-assigned this Nov 11, 2020
@elmindreda elmindreda added bug Bug reports and bugfix pull requests macOS labels Nov 11, 2020
@elmindreda elmindreda added this to the 3.3.3 milestone Nov 11, 2020
@elmindreda elmindreda added the verified Reproduced or otherwise verified bugs label Nov 11, 2020
@elmindreda elmindreda added this to Urgent in Queue Nov 11, 2020
@elmindreda
Copy link
Member

Thank you for this!

Is this behavior documented anywhere? Would it be safe to set the policy from applicationDidFinishLaunching:? It appears to work, but Cocoa.

@richardwilkes
Copy link
Author

The (bad) behavior seemed to be introduced in macOS Catalina. There was no documentation at the time as to why it changed nor have I found any since. As for trying to make the call from applicationDidFinishLaunching, I did try that and it didn't have the desired effect for some reason.

@elmindreda
Copy link
Member

Thanks! I'll merge the current version and we'll hope for clarity later.

@elmindreda
Copy link
Member

The dispatch_get_main_queue function does not appear to be available on 10.8. Does it work for you to instead call setActivationPolicy: after run in _glfwPlatformInit?

@richardwilkes
Copy link
Author

Looks like it wasn't introduced until 10.10. :-(

I believe all that really needs to be done is to have that call to setActivationPolicy run on the event thread, after the event loop is executing.

elmindreda added a commit that referenced this pull request Dec 8, 2020
NSApp setActivationPolicy: was being called too soon when the app was
not bundled and launched from the command line.

This fix is based on #1802 by @richardwilkes.

Fixes #1648.
Closes #1802.
@elmindreda
Copy link
Member

cdc3b71 is my proposal for a backwards compatible fix.

@richardwilkes
Copy link
Author

Hmm... I'm not sure that will actually fix the problem. Earlier experiments showed it had to be done as the result of an event coming in on the event loop, not anywhere else. I had also tried on some of the callbacks, like applicationDidFinishLaunching, to no avail.

Have you tested this change and seen it work both incorrectly without and then correctly with?

@elmindreda
Copy link
Member

elmindreda commented Dec 8, 2020

Have you tested this change and seen it work both incorrectly without and then correctly with?

Yup, the bug is consistently reproducible on my machine and cdc3b71 Works on My Machine™ when launched from a terminal, Finder and Xcode.

Edit: Admittedly I'm trying to simplify but I'm not set on any particular solution. If it's reasonable and backwards compatible then I'll be happy to merge it.

@richardwilkes
Copy link
Author

Fantastic. Glad to hear that works.

@elmindreda
Copy link
Member

Anyone following this thread, please test cdc3b71 and report the results.

@elmindreda elmindreda added the help needed Issues needing more contributors to solve label Dec 8, 2020
@andydotxyz
Copy link
Contributor

yes that works for me too.

elmindreda added a commit that referenced this pull request Jan 18, 2021
NSApp setActivationPolicy: was being called too soon when the app was
not bundled and launched from the command line.

This fix is based on #1802 by @richardwilkes.

Fixes #1648.
Closes #1802.
elmindreda added a commit that referenced this pull request Feb 10, 2021
NSApp setActivationPolicy: was being called too soon when the app was
not bundled and launched from the command line.

This fix is based on #1802 by @richardwilkes.

Fixes #1648.
Closes #1802.

Adapted to 3.3-stable from 8b11867.
swarnimarun pushed a commit to swarnimarun/glfw-meson that referenced this pull request Jul 9, 2022
NSApp setActivationPolicy: was being called too soon when the app was
not bundled and launched from the command line.

This fix is based on glfw#1802 by @richardwilkes.

Fixes glfw#1648.
Closes glfw#1802.

Adapted to 3.3-stable from 8b11867.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports and bugfix pull requests help needed Issues needing more contributors to solve macOS verified Reproduced or otherwise verified bugs
Projects
Queue
Urgent
Development

Successfully merging this pull request may close these issues.

menubar not clickable on macOS Catalina until it lost and regained focus.
3 participants