summaryrefslogtreecommitdiffstats
path: root/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-06-15 14:59:26 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-06-19 06:19:13 +0000
commitcf86659c874fcb1d3f88a784cd88a51942e5926b (patch)
tree07933efbc88a58420f6248111ac6018bf6f547e7 /src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
parent9b3260164da42b5edabc6cf6d73b7a35ab38e93d (diff)
Client: Get rid of QWaylandShellSurface::setType
This shouldn't change any behavior, but lets the shell integrations choose if they want to use the extremely hacky QWaylandWindow::transientParent(). Hint: Not all shells need the hacks, and not all shells need them in all cases, and some shells may need even more hacks. Change-Id: Id105e4feb83cc9c14dcf07dcca55fcd5e63d4a2b Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp')
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
index 36a82fe98..ef400a8d4 100644
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
+++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
@@ -172,6 +172,20 @@ QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_sur
, m_shell(shell)
, m_window(window)
{
+ QWaylandDisplay *display = window->display();
+ Qt::WindowType type = window->window()->type();
+ auto *transientParent = window->transientParent();
+
+ if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) {
+ setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup);
+ } else {
+ setToplevel();
+ if (transientParent) {
+ auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(transientParent->shellSurface());
+ if (parentXdgSurface)
+ m_toplevel->set_parent(parentXdgSurface->m_toplevel->object());
+ }
+ }
}
QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6()
@@ -217,21 +231,6 @@ void QWaylandXdgSurfaceV6::setAppId(const QString &appId)
m_toplevel->set_app_id(appId);
}
-void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transientParent)
-{
- QWaylandDisplay *display = m_window->display();
- if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) {
- setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup);
- } else {
- setToplevel();
- if (transientParent) {
- auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(transientParent->shellSurface());
- if (parentXdgSurface)
- m_toplevel->set_parent(parentXdgSurface->m_toplevel->object());
- }
- }
-}
-
bool QWaylandXdgSurfaceV6::handleExpose(const QRegion &region)
{
if (!m_configured && !region.isEmpty()) {