[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
icc-effect-5.17.5
Vlad Zagorodniy 2019-02-27 12:52:44 +02:00
parent 82b3e2a63a
commit 297557bde4
2 changed files with 17 additions and 15 deletions

View File

@ -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()

View File

@ -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 {