1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
From 1ba7b5ec63b61fa00b7eac59a1beca12323fefb3 Mon Sep 17 00:00:00 2001
From: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Date: Wed, 17 Nov 2021 18:36:00 +0200
Subject: [PATCH] wayland: Enable window rules for all xdg-toplevel
If a window wants to be initially shown in fullscreen mode, it will
issue an xdg_toplevel.set_fullscreen request before the first surface
commit.
If a window wants to be shown in fullscreen mode and there hasn't been
any first surface commit, kwin will cache the request and apply
fullscreen mode when checking window rules in the initialize() function.
On the other hand, window rules are disabled for plasma surfaces. The
motivation behind that was to forbid user from messing with plasma's
surfaces (this change was suggested during redesign of xdg-shell
implementation).
As it turns out, there are cases where plasma may ask to show a window
in fullscreen mode, which also has a plasma surface installed, e.g.
fullscreen application dashboard.
In order to fix the dashboard, this change allows window rules to be
applied to xdg-toplevel windows that also have plasma surfaces installed.
As is, xdg-toplevel surfaces and plasma surfaces are very different in
nature. Adding more quirks to handle plasma surfaces in
XdgToplevelClient is not worth the effort and there are better
alternatives, e.g. layer-shell.
(cherry picked from commit 039b1d031e3e30c238c8d67ade376c6d52297d81)
---
src/xdgshellclient.cpp | 65 +++++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 33 deletions(-)
diff --git a/src/xdgshellclient.cpp b/src/xdgshellclient.cpp
index 9e8216a3a0..b4427b8cf7 100644
--- a/src/xdgshellclient.cpp
+++ b/src/xdgshellclient.cpp
@@ -647,7 +647,7 @@ void XdgToplevelClient::updateDecoration(bool check_workspace_pos, bool force)
bool XdgToplevelClient::supportsWindowRules() const
{
- return !m_plasmaShellSurface;
+ return true;
}
StrutRect XdgToplevelClient::strutRect(StrutArea area) const
@@ -946,7 +946,7 @@ void XdgToplevelClient::handleWindowClassChanged()
{
const QByteArray applicationId = m_shellSurface->windowClass().toUtf8();
setResourceClass(resourceName(), applicationId);
- if (shellSurface()->isConfigured() && supportsWindowRules()) {
+ if (shellSurface()->isConfigured()) {
evaluateWindowRules();
}
setDesktopFileName(applicationId);
@@ -1196,40 +1196,39 @@ void XdgToplevelClient::initialize()
// is sent if the client has called the set_mode() request with csd mode.
updateDecoration(false, true);
- if (supportsWindowRules()) {
- setupWindowRules(false);
-
- moveResize(rules()->checkGeometry(frameGeometry(), true));
- maximize(rules()->checkMaximize(initialMaximizeMode(), true));
- setFullScreen(rules()->checkFullScreen(initialFullScreenMode(), true), false);
- setOnActivities(rules()->checkActivity(activities(), true));
- setDesktops(rules()->checkDesktops(desktops(), true));
- setDesktopFileName(rules()->checkDesktopFile(desktopFileName(), true).toUtf8());
- if (rules()->checkMinimize(isMinimized(), true)) {
- minimize(true); // No animation.
- }
- setSkipTaskbar(rules()->checkSkipTaskbar(skipTaskbar(), true));
- setSkipPager(rules()->checkSkipPager(skipPager(), true));
- setSkipSwitcher(rules()->checkSkipSwitcher(skipSwitcher(), true));
- setKeepAbove(rules()->checkKeepAbove(keepAbove(), true));
- setKeepBelow(rules()->checkKeepBelow(keepBelow(), true));
- setShortcut(rules()->checkShortcut(shortcut().toString(), true));
- setNoBorder(rules()->checkNoBorder(noBorder(), true));
+ setupWindowRules(false);
+
+ moveResize(rules()->checkGeometry(frameGeometry(), true));
+ maximize(rules()->checkMaximize(initialMaximizeMode(), true));
+ setFullScreen(rules()->checkFullScreen(initialFullScreenMode(), true), false);
+ setOnActivities(rules()->checkActivity(activities(), true));
+ setDesktops(rules()->checkDesktops(desktops(), true));
+ setDesktopFileName(rules()->checkDesktopFile(desktopFileName(), true).toUtf8());
+ if (rules()->checkMinimize(isMinimized(), true)) {
+ minimize(true); // No animation.
+ }
+ setSkipTaskbar(rules()->checkSkipTaskbar(skipTaskbar(), true));
+ setSkipPager(rules()->checkSkipPager(skipPager(), true));
+ setSkipSwitcher(rules()->checkSkipSwitcher(skipSwitcher(), true));
+ setKeepAbove(rules()->checkKeepAbove(keepAbove(), true));
+ setKeepBelow(rules()->checkKeepBelow(keepBelow(), true));
+ setShortcut(rules()->checkShortcut(shortcut().toString(), true));
+ setNoBorder(rules()->checkNoBorder(noBorder(), true));
+
+ // Don't place the client if its position is set by a rule.
+ if (rules()->checkPosition(invalidPoint, true) != invalidPoint) {
+ needsPlacement = false;
+ }
- // Don't place the client if its position is set by a rule.
- if (rules()->checkPosition(invalidPoint, true) != invalidPoint) {
- needsPlacement = false;
- }
+ // Don't place the client if the maximize state is set by a rule.
+ if (requestedMaximizeMode() != MaximizeRestore) {
+ needsPlacement = false;
+ }
- // Don't place the client if the maximize state is set by a rule.
- if (requestedMaximizeMode() != MaximizeRestore) {
- needsPlacement = false;
- }
+ discardTemporaryRules();
+ RuleBook::self()->discardUsed(this, false); // Remove Apply Now rules.
+ updateWindowRules(Rules::All);
- discardTemporaryRules();
- RuleBook::self()->discardUsed(this, false); // Remove Apply Now rules.
- updateWindowRules(Rules::All);
- }
if (isRequestedFullScreen()) {
needsPlacement = false;
}
--
GitLab
|