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

io.WantCaptureMouse doesn't work for scrollwheel #7588

Open
YTN0 opened this issue May 15, 2024 · 3 comments
Open

io.WantCaptureMouse doesn't work for scrollwheel #7588

YTN0 opened this issue May 15, 2024 · 3 comments
Labels

Comments

@YTN0
Copy link

YTN0 commented May 15, 2024

Version/Branch of Dear ImGui:

Latest

Back-ends:

Custom

Compiler, OS:

Windows 11

Full config/build information:

No response

Details:

io.WantCaptureMouse always seems to return true for scrollwheel changes even when not "captured" within a window. This makes it difficult to tell if a scrollwheel action is intended for the window or the main (non-ImGui) UI.

Any recommended solutions for this?

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

@ocornut
Copy link
Owner

ocornut commented May 15, 2024

Merely hovering a window will generally set io.WantCaptureMouse, and mouse wheels are processed by hovered windows, so I am not sure I understand your question or reasoning. Could you clarify?

@ocornut ocornut added the inputs label May 15, 2024
@YTN0
Copy link
Author

YTN0 commented May 15, 2024

I have some imgui windows on the screen overlaying parts of the main rendered window.

For my mouse event processing, I send the mouse events to imgui first and if WantCaptureMouse is false, I then forward the event to my main mouse event handler.

For scrollwheel events., even when I am not over an imgui window (am over the main rendered screen) and I send the mouse scroll event to imgui, it returns "true" for WantCaptureMouse., so my main window (which should process the event) never gets it.

@ocornut
Copy link
Owner

ocornut commented May 15, 2024

For scrollwheel events., even when I am not over an imgui window (am over the main rendered screen) and I send the mouse scroll event to imgui, it returns "true" for WantCaptureMouse., so my main window (which should process the event) never gets it.

That's not the case in our vanilla demo, you can verify it in Demo->Inputs.
And as a general fact wheel state or events have no effect on WantCaptureMouse.
So I think you have another thing interfering which is causing WantCaptureMouse to be set.

When unsure, just display the live value using ImGui::Text() so you can investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants