diff options
author | Marco Martin <mart@kde.org> | 2017-07-25 14:40:41 +0200 |
---|---|---|
committer | Marco Martin <notmart@gmail.com> | 2017-08-10 08:33:53 +0000 |
commit | e1605103ab79d7ef377afc73ac69925a082a87f7 (patch) | |
tree | 8ae8b3ef43bc5566d9baa21ac520123d4bfea4fc | |
parent | 54cd03c41a79cfc64ef56f855da76e0082a71b23 (diff) | |
download | qtwayland-e1605103ab79d7ef377afc73ac69925a082a87f7.tar.gz |
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.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 98d0603c..4a60a661 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; } |