-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Fixed same-frame click/release bug #2525
Conversation
Thank you Blaise, I realize I never got around to reply to this specific PR and apologize for that. |
case WM_MBUTTONUP: { button = 2; } break; | ||
case WM_XBUTTONUP: { button = (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) ? 3 : 4; } break; | ||
} | ||
io.InputMouseReleased[button] = true; | ||
if (!ImGui::IsAnyMouseDown() && ::GetCapture() == hwnd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not get called in case of a mouseup happening before NewFrame() since this is where io.MouseDown gets updated.
As a result clicking on an imgui window does not release mouse capture and trying to click on the main window bar at the top to move, minimise or close it does not work.
An easy fix is to make ::ReleaseCapture not based on io.MouseDown but on the actual hardware inputs WM_LBUTTONUP etc...
0c1e5bd
to
bb6a60b
Compare
8b83e0a
to
d735066
Compare
b3b85d8
to
0755767
Compare
Better late than never, apologies @BlaiseRitchie for not reacting sooner. Your PR was the closest intermediary solution but we wanted to overhaul and fix this more generally, this is now done. Dear imgui 1.87 WIP now uses a new IO api (e.g. See e.g.
Also see #4858 for a general overview (we'll improve this topic soon). |
Fixes Issue #1992 but also fixes the same issue in a general way for all platform impls.
Currently only tested for Win32.
There may be a better approach that involves a larger change to the way ImGui and its components handle mouse button input, but I'll leave that to those who are more familiar with the codebase as a whole and the consequences of such a change.