summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2020-02-11 14:46:17 +0100
committerJohan Helsing <johan.helsing@qt.io>2020-02-27 14:55:19 +0000
commit6f614fb2aac17bf7cf675a51c6c97a9124772216 (patch)
tree110ce57508c9dc49c090ffb739b67d29d8d8de32 /src
parent061e29274712f51d982eb29286229f0fca6e464d (diff)
downloadqtwayland-6f614fb2aac17bf7cf675a51c6c97a9124772216.tar.gz
Client: Delete decoration object when frameless window hint is added
We don't want windows with FramelessWindowHint to have a zxdg_toplevel_decoration_v1 object, because that allows the compositor to force server-side window decorations. We already have code in place that avoids creating the decoration object when the window is created. However, if the frameless window hint is added after the window has been shown, then the decoration object has already been created. The protocol states that if a decoration object is destroyed, the window will switch back to a mode without any server-side decorations on the next commit... so this is what we do in this patch. Unfortunately, there is no clean way to handle the case when the hint is removed while the window is visible since the protocol explicitly forbids creating toplevel decoration objects for surfaces with committed buffers. Discussion is ongoing as to whether this should be fixed in the next version of the protocol: https://gitlab.freedesktop.org/wayland/wayland-protocols/issues/9 If we want to work around it, it is perhaps possible to destroy and create a new wl_surface, but ideally, it will be fixed in the next version of the xdg-decoration protocol and we can just wait for that. Task-number: QTBUG-80702 Change-Id: I7e76c05fc3629f1fbbba1d18482808fe588e3878 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index 56d77ec4..b6d23ac1 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -156,10 +156,12 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_close()
void QWaylandXdgSurface::Toplevel::requestWindowFlags(Qt::WindowFlags flags)
{
if (m_decoration) {
- if (flags & Qt::FramelessWindowHint)
- m_decoration->requestMode(QWaylandXdgToplevelDecorationV1::mode_client_side);
- else
+ if (flags & Qt::FramelessWindowHint) {
+ delete m_decoration;
+ m_decoration = nullptr;
+ } else {
m_decoration->unsetMode();
+ }
}
}