summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Martin <mart@kde.org>2017-07-25 14:40:41 +0200
committerMarco Martin <notmart@gmail.com>2017-08-10 08:33:53 +0000
commite1605103ab79d7ef377afc73ac69925a082a87f7 (patch)
tree8ae8b3ef43bc5566d9baa21ac520123d4bfea4fc
parent54cd03c41a79cfc64ef56f855da76e0082a71b23 (diff)
Fallback to focusWindow as transient parent
The wayland protocol requires Popup windows to have a transient parent set, in order to correctly position the window on the screen. In Qt, some popup menus don't have it, so they will appear misplaced in the screen. This adds an heuristic which makes transientParent() return the current application focus window, which is an approximation which won't be always correct, but seems to fix most applications Task-number: QTBUG-60932 Change-Id: Icec1e306d3f64f4f00ad735a8c2eedb99e85eabb Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r--src/client/qwaylandwindow.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 98d0603cc..4a60a6616 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -720,6 +720,8 @@ QWaylandWindow *QWaylandWindow::transientParent() const
// events.
if (auto transientParent = window()->transientParent())
return static_cast<QWaylandWindow *>(topLevelWindow(transientParent)->handle());
+ else if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup))
+ return static_cast<QWaylandWindow *>(topLevelWindow(QGuiApplication::focusWindow())->handle());
return nullptr;
}