Commit 339a08de authored by Martin Flöser's avatar Martin Flöser

Acknowledge the server side deco mode in WaylandServer not ShellClient

Summary:
With GTK applications our code showed issues. With GTK the sequence for
a menu or dialog window is:
 1. create surface
 2. create server side decoration
 3. request csd
 4. create xdg_shell_surface

Which result in KWin to have the ServerSideDecoration object being
created before the ShellClient is created. The connect for mode changed
happens in ShellClient, which is too late to catch that the window
requested client side decoration. Thus KWin created a decoration about
things such as a menu.

This change moves the acknowledge of the mode to WaylandServer. As we
anyway always acknowledge the requested mode we can also do it there and
don't require ShellClient to be present. Thus when the ShellClient is
created the mode is properly reflected and no decoration is created.

BUG: 389117
FIXED-IN: 5.12.0

Test Plan: Played a lot with evince

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9967
parent 5b64f5d2
......@@ -1544,8 +1544,6 @@ void ShellClient::installServerSideDecoration(KWayland::Server::ServerSideDecora
connect(m_serverDecoration, &ServerSideDecorationInterface::modeRequested, this,
[this] (ServerSideDecorationManagerInterface::Mode mode) {
const bool changed = mode != m_serverDecoration->mode();
// always acknowledge the requested mode
m_serverDecoration->setMode(mode);
if (changed && !m_unmapped) {
updateDecoration(false);
}
......
......@@ -337,6 +337,12 @@ bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
if (ShellClient *c = findClient(deco->surface())) {
c->installServerSideDecoration(deco);
}
connect(deco, &ServerSideDecorationInterface::modeRequested, this,
[this, deco] (ServerSideDecorationManagerInterface::Mode mode) {
// always acknowledge the requested mode
deco->setMode(mode);
}
);
}
);
m_decorationManager->create();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment