-
Notifications
You must be signed in to change notification settings - Fork 527
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
Sokol app focus steal #982
Conversation
Interesting fix and thanks for the investigation! I'll try to have a closer look and do some testing within the next couple of days. |
...ah wait the original issue was about cmdline apps, not app bundles... I'll test that too... PS: works the same as cmdline app without the fix (e.g. the app start unfocused, but then focuses automatically at the first rendered frame). I remember that this had issues in the past though... I guess Apple keeps fixing (and breaking) such things randomly in OS updates... Anyway... I'll merge your fix since it doesn't seem to have any undesired side effects either :) |
PS: are you actually on the latest Sonoma macOS or an older version? |
And merged! I shortened your comment a bit (basically replaced it with a link to this PR), and updated the changelog. Many thanks for the PR! |
PPS: whether the window starts focused or unfocused when there's a long delay between window creation and the first random frame seems to be fairly random, but with and without the focusEvent fix. E.g. not sure if the fix is actually redundant in Sonoma, but if it helps with older macOS versions then it's fine. |
Hi, this pr solves the issue sometimes, on luanch an executable file could not get window focus.
it has a time interval between app launch and the app fully activated.
the time interval becomes longer when init_cb is slower.
if there are mouse events(e.g. mouse move) during the interval, then app can not be activated and focus will lost even when app launched and order front.
I read some Apple documents and found nothing about this situation.I think maybe it's a bug in Cocoa Appkit.
By the way, GTK also has this problem. And GTK solved it even though they are not 100% sure about the root cause.
see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2342
As a walkaround, we send a focus event in front of event queue.