Windows: Prevent spurious leave events.

When behind a mouse-event-transparent window, synthesized leave events
are emitted, because the transparent window is considered as the window
under the mouse, not the Qt window.
This change skips transparent windows when searching for the window
under the mouse.

Task-number: QTBUG-31464

Change-Id: I85c8b46a1af37b4d1c5d1d77566ab045657aa9ae
Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Sebastian Eifert 2013-05-30 19:13:32 +02:00 committed by The Qt Project
parent 0d459619a9
commit 7ae6e48d57
2 changed files with 4 additions and 1 deletions

View File

@ -74,6 +74,7 @@
#ifndef CWP_SKIPINVISIBLE
#define CWP_SKIPINVISIBLE 0x0001
#define CWP_SKIPTRANSPARENT 0x0004
#define findPlatformWindowAt(a, b, c) findPlatformWindowAt(a, b)
#endif

View File

@ -232,8 +232,10 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
}
const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition);
// In this context, neither an invisible nor a transparent window (transparent regarding mouse
// events, "click-through") can be considered as the window under mouse.
QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ?
QWindowsScreen::windowAt(globalPosition) : window;
QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window;
compressMouseMove(&msg);
// Qt expects the platform plugin to capture the mouse on