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

imgui on touchscreen #2650

Closed
sailfish009 opened this issue Jul 5, 2019 · 8 comments
Closed

imgui on touchscreen #2650

sailfish009 opened this issue Jul 5, 2019 · 8 comments

Comments

@sailfish009
Copy link

sailfish009 commented Jul 5, 2019

Hi, not much to add my code here, because it is simple question.

Version/Branch of Dear ImGui:

Version: v1.49
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp
Compiler: vs2017
Operating System: Windows 10 64bit

My Issue/Question:

If i test button with mouse, it clicked with single-click.
But if i test button on touchscreen, it can not be clicked with single-click,
but only double-click.

How i use imgui button on my touchscreen(microsoft surface, win10) with single-click?

Screenshots/Video

realsense_viewer

Standalone, minimal, complete and verifiable example: (see #2261)


ImGui::Begin("Example Bug");
static int counter = 0;
if (ImGui::Button("-##1"))  // <----- single click doesn't work on touchscreen
{
    --counter;
}
ImGui::End();

Thanks!

@ocornut
Copy link
Owner

ocornut commented Jul 5, 2019

Forgot to fill requested issue template, closing. Please fill template and i’ll reopen.

@ocornut ocornut closed this as completed Jul 5, 2019
@ocornut ocornut added the inputs label Jul 5, 2019
@sailfish009
Copy link
Author

Forgot to fill requested issue template, closing. Please fill template and i’ll reopen.

Hi, i have updated my question.

@ocornut ocornut reopened this Jul 7, 2019
@sailfish009
Copy link
Author

sailfish009 commented Jul 9, 2019

based on what i searched the problem,

i need some converter single-click to double-click in imgui.

or, need to implement WM_TOUCH

@bvgastel
Copy link

The problem is something else. In the Windows event layer, the touch down and touch up events are fired and processed in the same frame. So the event handling logic of ImGui does not encounter it. As a fix, if the touch up is in the same frame as touch down, handling of the touch up should be delayed until the next frame. I have some working code for this if you are still interested (also contains a fix for touch scrolling).

@rickyviking
Copy link

@bvgastel regarding your fix about scrolling, are you talking about scrolling with the lateral scrollbar on by touch+drag up/down the contents in the middle of the widget, as you would do on a phone?

@bvgastel
Copy link

bvgastel commented Apr 2, 2022

In the middle of the widget, just like a phone.

@rickyviking
Copy link

@bvgastel nice! would you be able to share some code? Thank you

@ocornut
Copy link
Owner

ocornut commented Mar 29, 2023

The problem is something else. In the Windows event layer, the touch down and touch up events are fired and processed in the same frame. So the event handling logic of ImGui does not encounter it. As a fix, if the touch up is in the same frame as touch down, handling of the touch up should be delayed until the next frame.

Closing this specific/old touch issue with should be solved by input trickling introduced in 1.87.

@ocornut ocornut closed this as completed Mar 29, 2023
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

4 participants