-
Notifications
You must be signed in to change notification settings - Fork 96
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
BUG: Mouse pos being updated when other widget has focus #52
Comments
Hello! After some time of testing, I think that it feels snappier to have mouse position updated even when the widget is unfocused. What I ended up using was the function bool isActive() const override {
// the window containing the widget top-level window that currently has focus
//return w->isActiveWindow();
// the widget is the one with focus among the window wigets
//return w->isActiveWindow() && w->hasFocus();
// the widget area is under the mouse, but it seems like other widgets being open/focused cancel it e.g. an open combo box
return w->isActiveWindow() && w->underMouse();
} I also changed the mouse position set for inactive wrappers to
...
else
{
//https://github.com/ocornut/imgui/blob/031e152d292b386b7b6149e455924cfc6bab8c7c/imgui.h#L2048
// Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.)
//https://github.com/ocornut/imgui/blob/fd943182bd9fe1d801e721a20a41dcde84be39d0/imgui.cpp#L679
// - 2017/08/25 (1.52) - io.MousePos needs to be set to ImVec2(-FLT_MAX,-FLT_MAX) when mouse is unavailable/missing. Previously ImVec2(-1,-1) was enough but we now accept negative mouse coordinates. In your backend if you need to support unavailable mouse, make sure to replace "io.MousePos = ImVec2(-1,-1)" with "io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX)".
io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX);
}
Results:
|
Describe the bug
Currently the imgui mouse pos is updated whenever the widget window/window is active. But in the case of widgets windows it also makes sense to check the focus. Otherwise a mouse over the area can trigger hovering effects in imgui when the user is interacting with other QT widgets.
To Reproduce
Have any widget like a combo box that expands over the widgets area when interacted.
Expected behavior
Imgui mouse pos should not be updated when
the widget has no focusother widget has focus to avoid hovering triggers.Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: