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

Slightly unimportant problem and inconsistency across recent imgui versions for Ctrl key handling #6100

Closed
mjhurd opened this issue Jan 20, 2023 · 3 comments

Comments

@mjhurd
Copy link

mjhurd commented Jan 20, 2023

Set up is Rocky8 Linux with opengl3 + glfw on nvidia - v1.89.2

Ctrl+Q not being detected.

Long story short: it turns out the Ctrl key modifier for highlighting the position cursor for gnome is interfering in strange ways with the ImGui key press events.

Screenshot from 2023-01-20 16-35-36

Ctrl+Q being detected with 1.88, 1.89, 1.89.1 - but other inconsistencies.

Ctrl press also not registering on its own with the gnome cursor highlight setting - but is sometimes with other key combinations such a shift and alt. Sometimes ctrl is sticky and the key press hangs around though it is released. Demo window key press behaviour shows the same issue.

Wrote a little visual tracker

    ImGui::Separator();

    if (ImGui::IsKeyDown(ImGuiMod_Ctrl)) {
      ImGui::TextColored(ImVec4(1, 1, 0, 1), "Ctrl");
    }
    ImGui::SameLine();

    if (ImGui::IsKeyDown(ImGuiMod_Alt)) {
      ImGui::TextColored(ImVec4(1, 1, 0, 1), "Alt");
    }


    ImGui::SameLine();
    if (ImGui::IsKeyDown(ImGuiKey_Q)) {
      ImGui::TextColored(ImVec4(1, 1, 0, 1), "Q");
    }
    ImGui::SameLine();

    ImGuiContext& g = *ImGui::GetCurrentContext();
    if (g.IO.KeyCtrl) {
      ImGui::TextColored(ImVec4(0, 1, 0, 1), "Ctrl");
    }

Without the gnome tweak, this works fine across all versions 1.88, 1.89, 1.89.1, 1.89.2. Worth noting the Alt key handling is different with menu navigation and the IsKeyDown across those versions.

Quite a few little inconsistencies across the versions regarding the Ctrl key, key press ordering, and stickiness (ctrl showing down but it isn't) with the gnome Ctrl key to highlight the position cursor tweak setting running, but 1.88 was ok for Ctrl+Q and 1.89.2 was not.

It is perhaps fixable as versions prior to 1.89.2 at least let ctrl+q work, but other things are slightly dodgy with that gnome tweak turned on. Reminds me of the old quip, "Dr Dr it hurts when I do this." "Well, don't do that." My solution is to turn the gnome tweak off, but perhaps it is something being aware of as the ImGui behaviour has changed recently.

Thanks for the great library. --Matt.

@ocornut
Copy link
Owner

ocornut commented Jan 20, 2023

It is possible that the change for #6034 broke it. Final fix was 1f6e62a.
Can you try without ?
If that's the case that it works for you reverting, we are are stuck with the fact the #6034 is required to workaround issue in GLFW. Unless you can think of a workaround that works for both situation, I think this would be better pushed toward GLFW (e.g. glfw/glfw#1630) so we can remove the first workaround.

It would be useful to also test with the SDL backend to compare.

@ocornut
Copy link
Owner

ocornut commented Mar 8, 2023

@mjhurd Any news about this?

@ocornut ocornut added the inputs label Mar 8, 2023
@ocornut
Copy link
Owner

ocornut commented May 13, 2024

Closing as lacking information. Feel free to comment if you have more info and we can reopen.

@ocornut ocornut closed this as completed May 13, 2024
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