summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSergey Radionov <RSATom@gmail.com>2015-02-06 15:48:02 +0600
committerSergey Radionov <RSATom@gmail.com>2015-02-10 16:55:37 +0000
commit34ea269b3b173498312b0203d6875ef3b4ba0253 (patch)
tree8c0acceb32dbaba98612f928ac3c08c38ff902e6 /src/plugins
parent68293395ed6c513703a206389734201d3202c30c (diff)
Win: fix wrong mouse leave event generation
When Qt runs in process with low integrity level, and place child QWindow to HWND from less restricted process, ChildWindowFromPointEx could fail with ERROR_ACCESS_DENIED and QWindowsScreen::windowAt will return 0 despite mouse is on window. Task-number: QTBUG-44332 Change-Id: I07e1594b90cbde8a9496f8d53ef247a7c69d8715 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index acb692579b..b3c31c3de9 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -271,6 +271,16 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ?
QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window;
+ // QTBUG-44332: When Qt is running at low integrity level and
+ // a Qt Window is parented on a Window of a higher integrity process
+ // using QWindow::fromWinId() (for example, Qt running in a browser plugin)
+ // ChildWindowFromPointEx() may not find the Qt window (failing with ERROR_ACCESS_DENIED)
+ if (!currentWindowUnderMouse) {
+ const QRect clientRect(QPoint(0, 0), window->size());
+ if (clientRect.contains(winEventPosition / QWindowsScaling::factor()))
+ currentWindowUnderMouse = window;
+ }
+
compressMouseMove(&msg);
// Qt expects the platform plugin to capture the mouse on
// any button press until release.