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

Browser shortcut keys don't work with an SDL2 Emscripten page that handles keypress events #16462

Closed
adam4235 opened this issue Mar 10, 2022 · 9 comments
Assignees

Comments

@adam4235
Copy link

I reported this issue here a while ago:

emscripten-ports/SDL2#128

That repository got archived but the issue still remains (Emscripten 3.1.7).

To summarize, I want my application to handle some keypresses, but I want the other keypresses that I don't handle to fall back on the regular browser behaviour (such as F11 making the window full screen, for Firefox).

There was a patch that fixed it which @Daft-Freak said he would need to test before applying.

I also noticed that the issue did not seem to be present in an older version of Emscripten, 1.39.8 (i.e. without the patch, the behaviour I wanted was already happening, as long as I created the FilterEvents function mentioned in that issue). I can't downgrade to work around it because that version has other issues, but it might be interesting that something other than that patch caused this behaviour to change.

@Daft-Freak
Copy link
Collaborator

Ah, I got as far as committing emscripten-ports/SDL2@65c1316, but apparently never merged it.

The only side-effect I can see there is not preventDefault-ing keys that SDL doesn't handle... which probably isn't a bad thing. May just rebase and push upstream when I get the chance.

@Daft-Freak
Copy link
Collaborator

Did a quick check that SDL_EventState still worked and... pushed: libsdl-org/SDL@9de97e1

@adam4235
Copy link
Author

Thanks!

@sbc100
Copy link
Collaborator

sbc100 commented Mar 11, 2022

Presumably we still to update the SDL version used in emscripten?

@adam4235
Copy link
Author

OK sorry I'm not sure of the process - maybe I wasn't supposed to close this? Is there anything else I need to do?

@adam4235 adam4235 reopened this Mar 11, 2022
@Daft-Freak
Copy link
Collaborator

Hmm, yeah need to update the tag here. Not sure what we're doing for updates outside of upstream releases now though...

@kripken
Copy link
Member

kripken commented Mar 16, 2022

I believe we can update the "tag" in ports/sdl2.py to any hash of a commit in that repo. That is, the https://github.com/libsdl-org/SDL/archive/???.zip notation works with both tag names and hashes. So if we want a commit before there is a tag that is possible.

Daft-Freak added a commit to Daft-Freak/emscripten that referenced this issue Mar 22, 2022
Daft-Freak added a commit to Daft-Freak/emscripten that referenced this issue Mar 25, 2022
@jdarpinian
Copy link

This fix was undone shortly after it was committed, by this commit libsdl-org/SDL@9221548

@Daft-Freak
Copy link
Collaborator

Hmm, not sure if that was intentional... or when I might get the chance to see if adding the prevent_default = SDL_SendKeyboardKey... back breaks anything.

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

No branches or pull requests

5 participants