-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Meta + [key] on macOS using emscripten is broken (sdl2 + glfw backends) #7732
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
Comments
I believe the issue, in both instances, is linked to this javascript problem. Although it is not an ImGui bug per se, but more an issue in the underlying implementations/platform, I just wanted to file this bug here in case other people run into this issue and know that there is, at the moment, an issue when using ImGui in the browser... In the end, it does break ImGui since the state of keys maintained by ImGui becomes out of whack with reality which can then lead to other issues... I am going to investigate if there is a workaround I can implement in emscripten-glfw at the minimum since I am in control of this library... I am going to report it to emscripten as well... |
The issue was actually reported for the built-in/embedded implementation of GLFW3 back on 10/2022 (and never addressed for what I can tell) I have now implemented a workaround for emscripten-glfw and issued a PR to be merged. |
I released a new version of contrib.glfw3 with a workaround/bug fix. I wanted to point out that there is the same issue that was [created](#18089) on 10/22 for the built-in implementation. That was never addressed. I also wanted to point out that SDL2 also suffers from the same issue... I found [this issue](ocornut/imgui#7732) while working on a project using ImGui.  Release notes: - Implemented workaround for [#4](pongasoft/emscripten-glfw#4): _Using Super + "Key" on macOS results in "Key" not being released_. Due to the [broken state](https://stackoverflow.com/questions/11818637/why-does-javascript-drop-keyup-events-when-the-metakey-is-pressed-on-mac-browser) of javascript handling the `Super/Meta` key, there is no good solution. The workaround implemented, releases all keys when `Super` is released. Although not a perfect solution, it guarantees that the state is _eventually_ consistent: - if "Key" was released while "Super" was held, then when "Super" gets released, "Key" is released (later than when actually released, final state is consistent: "Key" in `Release` state) - if "Key" is still held when "Super" is released, "Key" is released when "Super" gets released, but immediately gets a down event (Up/Down event, final state is consistent": "Key" in `Pressed` state)
Another issue in this case, is that Normally we do this:
But of course this doesn't run on Emscripten. |
Version/Branch of Dear ImGui:
master
Back-ends:
example_sdl2_opengl3 / example_glfw_wgpu
Compiler, OS:
emscripten / browser
Full config/build information:
Details:
I uncovered this issue while working on a separate project tied to the PR
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
Using fresh imgui clone
Under
examples/example_sdl2_opengl3
Under
examples/example_glfw_wgpu
In both builds (using sdl2 as the backend or glfw as the backend),
"LeftSuper" 530 "ModSuper" 665
"LeftSuper" 530 "V" 567 "ModSuper" 665
"LeftSuper" 530 "V" 567 "ModSuper" 665
(this is wrong)"V" 567
(this is wrong)The text was updated successfully, but these errors were encountered: