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::IsWindowHovered() bug when left-clicking plot? #6757

Closed
GGbaba opened this issue Aug 28, 2023 · 3 comments
Closed

ImGui::IsWindowHovered() bug when left-clicking plot? #6757

GGbaba opened this issue Aug 28, 2023 · 3 comments

Comments

@GGbaba
Copy link

GGbaba commented Aug 28, 2023

I think it's abnormal that it's becoming false when left-clicking on a plot (ImPlot::BeginPlot() / End())
When hovering and left-clicking directly on the Frame it's staying true !
Can you confirm if it is the desired behavior or not ? Thanks !

ImGui checkout 82d177c
ImPlot checkout 7b9171569bfe846aa1049a70bc599ad44ef0e5c1

@ocornut
Copy link
Owner

ocornut commented Aug 28, 2023

I don't exactly know what BeginPlot(), but by default IsWindowHovered() returns false when an item is active.

You might want to use ImGuiHoveredFlags_AllowWhenBlockedByActiveItem.
Also see Demo->Widgets->Querying Window Status to understand how this works.

There's no right answer it depends what exactly you are using IsWindowHovered() for.

@ocornut ocornut changed the title ImGui::IsWindowHovered() bug ? ImGui::IsWindowHovered() bug when left-clicking plot? Aug 28, 2023
@GGbaba
Copy link
Author

GGbaba commented Aug 28, 2023

Perfect that's clear thank you !!
My goal is just slowing down main refresh loop and keeping GPU use as low as possible when GUI is not used (just displayed on screen without user interaction and no GUI changes). And only when user is using it with mouse or keyboard, or somthg new to display, reactivate the maximum refresh rate.
Currently my solution was to use (ImGui::IsAnyItemHovered() or ImGui::IsAnyItemActive() or ImGui::IsAnyItemFocused())

@GGbaba GGbaba closed this as completed Aug 28, 2023
@ocornut
Copy link
Owner

ocornut commented Aug 28, 2023

You could probably instead poll the InputEventsQueue[] and let thing runs for 2-3 extra frame whenever the queue is not empty.

Also see #4076 #5340 #5599 #2749
I think i will be working on an officially supported solution after 1.90 is done.

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

No branches or pull requests

2 participants