Fix invalid mouse press and release events on window maximize
authorMiikka Heikkinen <miikka.heikkinen@digia.com>
Tue, 6 Nov 2012 11:56:18 +0000 (13:56 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 7 Nov 2012 07:44:25 +0000 (08:44 +0100)
commit6dcfbe552af519bc8cb9c9b4203c1a7d191fcdb2
tree08187c4688c301197d619cf03a7d66fa67cb35a0
parent04f6edc37947dee62bf735e39aa5ae9cf5a637c7
Fix invalid mouse press and release events on window maximize

In Windows, if the window is maximized with a doubleclick on the title
bar or resized with a doubleclick on the bottom or top frame border,
there comes no WM_LBUTTONDOWN or WM_LBUTTONDBLCLK event for the second
click, but there comes at least one WM_MOUSEMOVE with left button down
and eventual WM_LBUTTONUP.
Since QWindowSystemInterface::handleMouseEvent() can't differentiate
between actual button down event and a move event with button held
down, the move resulted in a button down event being sent to the widget
that was under cursor after resize.

Fixed by ignoring any events with left button down for which we didn't
get the initial native button down event. Since entering an application
with mouse button already held down is not generating mouse events
anyway until the button is released, this should be safe.

Task-number: QTBUG-27845
Change-Id: Ibc7abf8a127c401801e1b654a2829582f43a1ae8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
src/plugins/platforms/windows/qwindowsmousehandler.cpp
src/plugins/platforms/windows/qwindowsmousehandler.h