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

SDL2+Wayland+Touch - TabItem only activated after second touch #5131

Closed
elfenix opened this issue Mar 22, 2022 · 1 comment
Closed

SDL2+Wayland+Touch - TabItem only activated after second touch #5131

elfenix opened this issue Mar 22, 2022 · 1 comment
Labels
inputs tabs tab bars, tabs

Comments

@elfenix
Copy link

elfenix commented Mar 22, 2022

Version/Branch of Dear ImGui:

Version: v1.87 (exact tag)
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
Compiler: gcc 9.3.0
Operating System: embedded linux w/ wayland

My Issue/Question:

A handful of widgets seem to require more than one touch event to activate. I'm utilizing ImGui on a touch screen device without keyboard or mouse. The device runs wayland (no X11).

Screenshots/Video

(None Currently)

Standalone, minimal, complete and verifiable example:

The ImGui demo recreates this issue with no modifications.

Inside the demo window, select the "Tab widget". Tapping on the tab items consistently requires 2 touches to have the tab switch. The majority of other widgets appear to work fine - buttons require only a single press generally.

Hacky (Fix?)

A (probably incorrect) code change seemed to get behavior as desired was responding to SDL_FINGERUP, inside of imgui_impl_sdl.cpp . Enabling the preprocessor block here results in the desired behavior - but I'm not entirely certain what the exact chain of events is or if the behavior I'm creating is correct or not. (Also - probably wrong if we're dealing with Mouse + Touch screen interactions!) Still need to debug.

On my version of SDL, the FINGERUP appears to happen after the "button release" event.

bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
{
    ImGuiIO& io = ImGui::GetIO();
    ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData();

    switch (event->type)
    {
        case SDL_FINGERUP:
        {
#if 0
            printf("FINGER UP EVENT - Set Mouse Pos - Single Clikck on Tab Item OK!\n");
            io.AddMousePosEvent(-1, -1);
            return true;
#else
            printf("FINGER UP IGNORED - Do nothing (current behavior)\n");
#endif
            break;
        }
@ocornut
Copy link
Owner

ocornut commented Mar 23, 2022

Same as #2702, moving there!

@ocornut ocornut closed this as completed Mar 23, 2022
@ocornut ocornut added inputs tabs tab bars, tabs labels Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inputs tabs tab bars, tabs
Projects
None yet
Development

No branches or pull requests

2 participants