Commit 297557bd authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[wayland] Implement belongsToDesktop check

Summary:
When user asks KWin to show desktop, the compositor just raises every
desktop window, it doesn't attempt to minimize normal clients, etc.
Because desktop windows contain stuff like background and icons, the
compositor has to raise all clients that are somehow correlated with
desktop (e.g. panels, etc). Otherwise it would pretty weird to show only
desktop background.

Currently, not all plasmashell's clients are raised when the compositor
shows desktop because belongsToDesktop is not implemented for ShellClient.

BUG: 404801

Test Plan:
* Show desktop;
* Open Kickoff (without this patch Kickoff is not visible).

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19386
parent 82b3e2a6
......@@ -449,6 +449,20 @@ void ShellClient::debug(QDebug &stream) const
<< resourceName() << ";Caption:" << caption() << "\'";
}
bool ShellClient::belongsToDesktop() const
{
const auto clients = waylandServer()->clients();
return std::any_of(clients.constBegin(), clients.constEnd(),
[this](const ShellClient *client) {
if (belongsToSameApplication(client, SameApplicationChecks())) {
return client->isDesktop();
}
return false;
}
);
}
Layer ShellClient::layerForDock() const
{
if (m_plasmaShellSurface) {
......@@ -982,22 +996,9 @@ void ShellClient::takeFocus()
setActive(true);
}
bool breakShowingDesktop = !keepAbove() && !isOnScreenDisplay();
if (breakShowingDesktop) {
// check that it doesn't belong to the desktop
const auto &clients = waylandServer()->clients();
for (auto c: clients) {
if (!belongsToSameApplication(c, SameApplicationChecks())) {
continue;
}
if (c->isDesktop()) {
breakShowingDesktop = false;
break;
}
}
}
if (breakShowingDesktop)
if (!keepAbove() && !isOnScreenDisplay() && !belongsToDesktop()) {
workspace()->setShowingDesktop(false);
}
}
void ShellClient::doSetActive()
......
......@@ -167,6 +167,7 @@ protected:
void addDamage(const QRegion &damage) override;
bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) const override;
void doSetActive() override;
bool belongsToDesktop() const override;
Layer layerForDock() const override;
void changeMaximize(bool horizontal, bool vertical, bool adjust) override;
void setGeometryRestore(const QRect &geo) override {
......
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