summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowswindow.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-10-05 14:12:11 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-10 06:51:12 +0200
commit78dddc280235e3b298922189bfef8aca6f42d879 (patch)
treeac8eceb68dea4b1557a9108334d4975ce23603bc /src/plugins/platforms/windows/qwindowswindow.cpp
parent187b61d879129f79da5dbc57805600d5159b1740 (diff)
Fix wheel events in Windows
Wheel events were always passed to window that got them from native message loop, which isn't what Qt expects. Changed the receiver to preferably be the window under cursor, as long as it is not blocked by modal window. Change-Id: I4edf0608842fe5b822a7f574abfdae81fa755ee5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 2f7058ab97..955617e399 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -783,10 +783,26 @@ void QWindowsWindow::unregisterDropSite()
}
}
+// Returns topmost QWindowsWindow ancestor even if there are embedded windows in the chain.
+// Returns this window if it is the topmost ancestor.
QWindow *QWindowsWindow::topLevelOf(QWindow *w)
{
while (QWindow *parent = w->parent())
w = parent;
+
+ const QWindowsWindow *ww = static_cast<const QWindowsWindow *>(w->handle());
+
+ // In case the topmost parent is embedded, find next ancestor using native methods
+ if (ww->isEmbedded(0)) {
+ HWND parentHWND = GetAncestor(ww->handle(), GA_PARENT);
+ const HWND desktopHwnd = GetDesktopWindow();
+ const QWindowsContext *ctx = QWindowsContext::instance();
+ while (parentHWND && parentHWND != desktopHwnd) {
+ if (QWindowsWindow *ancestor = ctx->findPlatformWindow(parentHWND))
+ return topLevelOf(ancestor->window());
+ parentHWND = GetAncestor(parentHWND, GA_PARENT);
+ }
+ }
return w;
}