imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Mouse scrolling not working

Open Thalenberghen opened this issue 1 year ago • 11 comments

Version/Branch of Dear ImGui:

Version 1.90.5, Branch: master (master/docking/etc.), no modifications

Back-ends:

imgui_impl_opengl3.cpp + imgui_impl_sdl2.cpp

Compiler, OS:

Windows 10 + MSVC2022

Full config/build information:

No response

Details:

My Issue/Question: I'm not quite sure when this started, since I never really have this situation much, but I recently noticed that any kind of scrolling (e.g. of list-boxes) with the mouse wheel is not working for me. This is also the case for the demo window. I checked with the debugger, that the mousewheel event is emitted correctly (?, with wheel_y != 0). I'm pretty sure this was working at some point. I have recently updated dearImGui but can't be sure if that broke it or if it was already broken before. Any help would be greatly appreciated. Same problem also happens with clang.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();

Thalenberghen avatar May 01 '24 20:05 Thalenberghen

You will need to provide more details. First try in to see if it happens official unmodified examples.

ocornut avatar May 01 '24 22:05 ocornut

I compiled the unmodified opengl3/sdl2 example. The behaviour is slightly different but still not working as expected. Here is a video of what it looks like: https://www.youtube.com/watch?v=dFMub49vs2g

The scrolling down produces some flickering as if it always resets to the top on the next frame. Scrolling up instead directly jumps to the top. I don't know if this information helps or what else I can/should provide.

Thalenberghen avatar May 02 '24 18:05 Thalenberghen

@Thalenberghen since you use SDL2 backend, you can try to add printf(stdout, "wheel x=%f, y=%f\n", wheel_x, wheel_y); fflush(stdout); to see what wheel x/y offsets passed into Dear ImGui. Put it before io.AddMouseWheelEvent(wheel_x, wheel_y) in imgui_impl_sdl2.cpp here:

https://github.com/ocornut/imgui/blob/4bb75671414f532fc11e85e06e0ab972e42a8907/backends/imgui_impl_sdl2.cpp#L321-L337

inobelar avatar May 02 '24 18:05 inobelar

I have added the line, and interestingly it behaves like my program now, where nothing happens at all. All the values it prints for wheel x and y are 0 or -0.

Edit: I checked and the value for the event->wheel_y is showing +-1 as I would expect. But the precise_y which it seems to pick up is 0 or a gigantic negative number.

image

Thalenberghen avatar May 02 '24 19:05 Thalenberghen

Use Demo>Debug Log>IO to visualize data received by dear imgui.

ocornut avatar May 02 '24 22:05 ocornut

So what's the verdict? If I uncomment the preciseX/Y stuff and use the standard one everything works. Should I just do that?

Thalenberghen avatar May 08 '24 20:05 Thalenberghen