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

Toggling fullscreen stalls event updates (macOS) #1052

Open
GoldenbergDaniel opened this issue May 18, 2024 · 2 comments
Open

Toggling fullscreen stalls event updates (macOS) #1052

GoldenbergDaniel opened this issue May 18, 2024 · 2 comments
Assignees

Comments

@GoldenbergDaniel
Copy link

When I toggle fullscreen on a key_down event, the key_up event does not trigger unless I release the key after the window finishes resizing, which means that I need to press the key twice to toggle fullscreen. This probably means that during the resize event, no other events get triggered at all. Is this behavior intended or a bug? I found that if I resize the window on a key_up event, I am able to toggle fullscreen as normal, so it isn't a huge issue but other apps (such as VS Code) can resize on key_down.

@GoldenbergDaniel
Copy link
Author

I think this issue is related to #1046. The suggested solution is to check if the window has been unfocused, but I'm not sure if toggling fullscreen actually unfocuses the window on mac or if something else is going on.

@floooh floooh self-assigned this May 19, 2024
@floooh
Copy link
Owner

floooh commented May 19, 2024

I'll try to investigate soon-ish. When testing in the events-sapp sample, the focused/unfocused events don't seem to be fired reliably when going into and out of fullscreen via the window chrome buttons (which is a strange thing on its own).

The resize event seems to be reliably fired though which could be used after a fullscreen toggle to discard your buffered input state (or just generally when a RESIZE event is received - thinking about it, it's probably a good idea to discard buffered input on the following events: RESIZED, ICONIFIED, RESTORED, FOCUSED, UNFOCUSED, SUSPENDED, RESUMED).

I'll see if I can investigate a bit more soon-ish. My guess is that since the fullscreen toggling takes some time to animate that I'm not receiving any input events from macOS during that time until the resize is finished, and that input events are also not queued inside macOS (so they would be lost).

sokol_app.h directly forwards KEYUP and KEYDOWN events from the macOS event callbacks:

...so any strange behaviour should already happen "up" in macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants