commit:     05d8b1ff72e2697b27b3cb2284d0e722202a6bf6
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 22 16:14:44 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Nov 23 14:59:13 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05d8b1ff

kde-plasma/kwin: Fix wrong window size in some cases

Upstream commits:
325208347c40d7311aea83572b5150ba3750cba9
1ba7b5ec63b61fa00b7eac59a1beca12323fefb3

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=445444
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...-enable-window-rules-for-all-xdg-toplevel.patch | 132 +++++++++++++++++++++
 .../kwin/files/kwin-5.23.3-revert-2560288e.patch   |  35 ++++++
 kde-plasma/kwin/kwin-5.23.3-r1.ebuild              |   2 +
 3 files changed, 169 insertions(+)

diff --git 
a/kde-plasma/kwin/files/kwin-5.23.3-enable-window-rules-for-all-xdg-toplevel.patch
 
b/kde-plasma/kwin/files/kwin-5.23.3-enable-window-rules-for-all-xdg-toplevel.patch
new file mode 100644
index 000000000000..fa52bd7a3481
--- /dev/null
+++ 
b/kde-plasma/kwin/files/kwin-5.23.3-enable-window-rules-for-all-xdg-toplevel.patch
@@ -0,0 +1,132 @@
+From 1ba7b5ec63b61fa00b7eac59a1beca12323fefb3 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <vlad.zahorod...@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
+

diff --git a/kde-plasma/kwin/files/kwin-5.23.3-revert-2560288e.patch 
b/kde-plasma/kwin/files/kwin-5.23.3-revert-2560288e.patch
new file mode 100644
index 000000000000..db91c918ec3d
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.23.3-revert-2560288e.patch
@@ -0,0 +1,35 @@
+From 325208347c40d7311aea83572b5150ba3750cba9 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <vlad.zahorod...@kde.org>
+Date: Tue, 16 Nov 2021 22:37:26 +0200
+Subject: [PATCH] Revert "wayland: Check workspace position when preferred deco
+ mode changes"
+
+This reverts commit 2560288e4b66acfdbb8a8f4daafd2d600aeb525a.
+
+It broke alacricitty. The fix is not obvious, so revert the commit for
+the time being.
+
+BUG: 445444
+
+
+(cherry picked from commit 068d60e36a112c6b901010331ef3a995019c97cb)
+---
+ src/xdgshellclient.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/xdgshellclient.cpp b/src/xdgshellclient.cpp
+index af1bd57ac7..9e8216a3a0 100644
+--- a/src/xdgshellclient.cpp
++++ b/src/xdgshellclient.cpp
+@@ -1317,7 +1317,7 @@ void 
XdgToplevelClient::installXdgDecoration(XdgToplevelDecorationV1Interface *d
+     connect(m_xdgDecoration, 
&XdgToplevelDecorationV1Interface::preferredModeChanged, this, [this] {
+         if (m_isInitialized) {
+             // force is true as we must send a new configure response.
+-            updateDecoration(/* check_workspace_pos */ true, /* force */ 
true);
++            updateDecoration(/* check_workspace_pos */ false, /* force */ 
true);
+         }
+     });
+ }
+-- 
+GitLab
+

diff --git a/kde-plasma/kwin/kwin-5.23.3-r1.ebuild 
b/kde-plasma/kwin/kwin-5.23.3-r1.ebuild
index cf0d965820df..24a401f083d2 100644
--- a/kde-plasma/kwin/kwin-5.23.3-r1.ebuild
+++ b/kde-plasma/kwin/kwin-5.23.3-r1.ebuild
@@ -102,6 +102,8 @@ PDEPEND=">=kde-plasma/kde-cli-tools-${PVCUT}:5"
 
 PATCHES=(
        "${FILESDIR}/${P}-fix-xwayland-abstract-socket-addr.patch" # KDE-bug 
442362, bug 813888
+       "${FILESDIR}/${P}-revert-2560288e.patch" # KDE-bug 445444
+       "${FILESDIR}/${P}-enable-window-rules-for-all-xdg-toplevel.patch"
 )
 
 src_prepare() {

Reply via email to