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 macOS main menu not working before refocus. #994

Merged
merged 2 commits into from
May 31, 2020

Conversation

xStrom
Copy link
Member

@xStrom xStrom commented May 28, 2020

This PR fixes the issue on macOS where the application menu can't be interacted with until the window loses and regains focus.

There are some pretty wild workarounds out there for this, like setting a timer to automatically refocus the window. However as shown in this PR it can be done in an easier fashion. From the surface it seems to be mostly about not letting the app activate before the menu is all set up.

Fixes #753.

@xStrom xStrom added shell/mac concerns the macOS backend S-needs-review waits for review labels May 28, 2020
@cmyr
Copy link
Member

cmyr commented May 28, 2020

I'm confused by this; I haven't been able to reproduce the original bug? When the application launches, I'm able to interact with the menus?

@xStrom
Copy link
Member Author

xStrom commented May 28, 2020

Are you on macOS Catalina? It's 100% reproduction for me on Catalina.

@cmyr
Copy link
Member

cmyr commented May 28, 2020

no I'm on 10.14.6

@xStrom
Copy link
Member Author

xStrom commented May 28, 2020

I'm not fully sure if Catalina is the cause here, but I did see one person mention it on Stack Overflow that for them the menu issue appeared in Catalina and they needed a new fix.

@totsteps could you check if this PR here fixes the menu issue for you?

@totsteps
Copy link
Collaborator

totsteps commented May 29, 2020

Thanks for the fix.

I double-checked with the current master, the menu is not accessible when running examples!

I can confirm that this PR fixes issue.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@xStrom xStrom removed the S-needs-review waits for review label May 31, 2020
@xStrom xStrom merged commit 05311d1 into linebender:master May 31, 2020
@xStrom xStrom deleted the mac-menu-fix branch May 31, 2020 18:15
madsmtm added a commit to madsmtm/winit that referenced this pull request Apr 6, 2021
This fixes the main menu not responding until you refocus, at least from what I can tell - though we might have to do something similar to linebender/druid#994 to fix it fully?
madsmtm added a commit to madsmtm/winit that referenced this pull request Apr 6, 2021
This fixes the main menu not responding until you refocus, at least from what I can tell - though we might have to do something similar to linebender/druid#994 to fix it fully?
madsmtm added a commit to madsmtm/winit that referenced this pull request Apr 29, 2021
This fixes the main menu not responding until you refocus, at least from what I can tell - though we might have to do something similar to linebender/druid#994 to fix it fully?
ArturKovacs pushed a commit to rust-windowing/winit that referenced this pull request Apr 29, 2021
)

* MacOS: Only activate after the application has finished launching

This fixes the main menu not responding until you refocus, at least from what I can tell - though we might have to do something similar to linebender/druid#994 to fix it fully?

* MacOS: Remove activation hack

* Stop unnecessarily calling `makeKeyWindow` on initially hidden windows

You can't make hidden windows the key window

* Add new, simpler activation hack

For activating multiple windows created before the application finished launching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shell/mac concerns the macOS backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in menu options during initial window launch.
3 participants