diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/qwaylandwindow.cpp | 29 | ||||
-rw-r--r-- | src/client/qwaylandwlshellsurface.cpp | 3 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 922b1ee0..b98dd9da 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -128,7 +128,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window) if (window->type() != Qt::Popup) { mShellSurface->updateTransientParent(window->transientParent()); } - } else if (mShellSurface) { + } else if (mShellSurface && window->type() != Qt::ToolTip) { mShellSurface->setTopLevel(); } @@ -240,17 +240,18 @@ void QWaylandWindow::setGeometry(const QRect &rect) void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (window()->type() == Qt::Popup) { - QWaylandWindow *parent = transientParent(); - if (!parent) { - // Try with the current focus window. It should be the right one and anyway - // better than having no parent at all. - parent = mDisplay->lastInputWindow(); - } - if (parent) { - QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface); - if (wlshellSurface) - wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); + if (mShellSurface) { + if (window()->type() == Qt::Popup) { + QWaylandWindow *parent = transientParent(); + if (parent) { + QWaylandWlShellSurface *wlshellSurface = qobject_cast<QWaylandWlShellSurface*>(mShellSurface); + if (wlshellSurface) + wlshellSurface->setPopup(parent, mDisplay->lastInputDevice(), mDisplay->lastInputSerial()); + } + } else if (window()->type() == Qt::ToolTip) { + if (QWaylandWindow *parent = transientParent()) { + mShellSurface->updateTransientParent(parent->window()); + } } } @@ -609,7 +610,9 @@ QWaylandWindow *QWaylandWindow::transientParent() const // events. return static_cast<QWaylandWindow *>(topLevelWindow(window()->transientParent())->handle()); } - return 0; + // Try with the current focus window. It should be the right one and anyway + // better than having no parent at all. + return mDisplay->lastInputWindow(); } void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e) diff --git a/src/client/qwaylandwlshellsurface.cpp b/src/client/qwaylandwlshellsurface.cpp index 8888dbf4..f7bdc2c9 100644 --- a/src/client/qwaylandwlshellsurface.cpp +++ b/src/client/qwaylandwlshellsurface.cpp @@ -159,8 +159,7 @@ void QWaylandWlShellSurface::updateTransientParent(QWindow *parent) // set_transient expects a position relative to the parent QPoint transientPos = m_window->geometry().topLeft(); // this is absolute - QWindow *parentWin = m_window->window()->transientParent(); - transientPos -= parentWin->geometry().topLeft(); + transientPos -= parent->geometry().topLeft(); if (parent_wayland_window->decoration()) { transientPos.setX(transientPos.x() + parent_wayland_window->decoration()->margins().left()); transientPos.setY(transientPos.y() + parent_wayland_window->decoration()->margins().top()); |