commit:     fdc345a74e390b0a01204a77f8f4827610d3b238
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 10 14:12:32 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Fri Dec 10 14:58:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fdc345a7

kde-plasma/kwin: wayland: fix client window size, input; scripting

Upstream commit 6a84b9454c869a16c2fa5fd49a8fac4a9497f30f
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=444962

Upstream commit 8a0036fdee0eaa7dc5808dfe2dfc516fc32dfd8e
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=446699

Scripting fix:
Upstream commit fd8d01d9892f12c48a82c6e2ab675396bf6ec113
See also: https://invent.kde.org/plasma/kwin/-/merge_requests/1762

Package-Manager: Portage-3.0.29, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...remove-dpms-filter-when-outputs-are-added.patch |  30 +++++
 ...ripting-fix-KWinComponents-Workspace-type.patch |  34 +++++
 ...land-resize-to-last-requested-client-size.patch | 100 +++++++++++++++
 kde-plasma/kwin/kwin-5.23.4-r1.ebuild              | 137 +++++++++++++++++++++
 4 files changed, 301 insertions(+)

diff --git 
a/kde-plasma/kwin/files/kwin-5.23.4-drm-remove-dpms-filter-when-outputs-are-added.patch
 
b/kde-plasma/kwin/files/kwin-5.23.4-drm-remove-dpms-filter-when-outputs-are-added.patch
new file mode 100644
index 000000000000..cc323e4540f6
--- /dev/null
+++ 
b/kde-plasma/kwin/files/kwin-5.23.4-drm-remove-dpms-filter-when-outputs-are-added.patch
@@ -0,0 +1,30 @@
+From 8a0036fdee0eaa7dc5808dfe2dfc516fc32dfd8e Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <xaver.h...@gmail.com>
+Date: Thu, 9 Dec 2021 12:51:55 +0100
+Subject: [PATCH] platforms/drm: remove the dpms filter when outputs are added
+
+When the dpms filter is active and an output is hotunplugged, or
+is momentarily detected as hotunplugged, adding a new output should
+remove the dpms filter again.
+
+BUG: 446699
+FIXED-IN: 5.23.5
+---
+ src/plugins/platforms/drm/drm_backend.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/plugins/platforms/drm/drm_backend.cpp 
b/src/plugins/platforms/drm/drm_backend.cpp
+index a99b720177..d7908f6332 100644
+--- a/src/plugins/platforms/drm/drm_backend.cpp
++++ b/src/plugins/platforms/drm/drm_backend.cpp
+@@ -321,6 +321,7 @@ void DrmBackend::addOutput(DrmAbstractOutput *o)
+         primaryGpu()->removeVirtualOutput(m_placeHolderOutput);
+         m_placeHolderOutput = nullptr;
+     }
++    checkOutputsAreOn();
+ }
+ 
+ void DrmBackend::removeOutput(DrmAbstractOutput *o)
+-- 
+GitLab
+

diff --git 
a/kde-plasma/kwin/files/kwin-5.23.4-scripting-fix-KWinComponents-Workspace-type.patch
 
b/kde-plasma/kwin/files/kwin-5.23.4-scripting-fix-KWinComponents-Workspace-type.patch
new file mode 100644
index 000000000000..6ec6a59cd59f
--- /dev/null
+++ 
b/kde-plasma/kwin/files/kwin-5.23.4-scripting-fix-KWinComponents-Workspace-type.patch
@@ -0,0 +1,34 @@
+From fd8d01d9892f12c48a82c6e2ab675396bf6ec113 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <vlad.zahorod...@kde.org>
+Date: Sun, 5 Dec 2021 18:24:35 +0200
+Subject: [PATCH] scripting: Fix type of KWinComponents.Workspace
+
+Currently, the workspace.clients property doesn't work in declarative
+scripts because wrong workspace wrapper is used.
+
+
+(cherry picked from commit 29a85e830cdca5ae483b411e942e7a5bf85f6140)
+---
+ src/scripting/scripting.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/scripting/scripting.cpp b/src/scripting/scripting.cpp
+index b901db7455..929c94afab 100644
+--- a/src/scripting/scripting.cpp
++++ b/src/scripting/scripting.cpp
+@@ -650,10 +650,10 @@ void KWin::Scripting::init()
+     qmlRegisterType<ScriptingModels::V3::ClientModel>("org.kde.kwin", 3, 0, 
"ClientModel");
+     qmlRegisterType<ScriptingModels::V3::ClientFilterModel>("org.kde.kwin", 
3, 0, "ClientFilterModel");
+ 
+-    qmlRegisterSingletonType<QtScriptWorkspaceWrapper>("org.kde.kwin", 3, 0, 
"Workspace", [](QQmlEngine *qmlEngine, QJSEngine *jsEngine) {
++    
qmlRegisterSingletonType<DeclarativeScriptWorkspaceWrapper>("org.kde.kwin", 3, 
0, "Workspace", [](QQmlEngine *qmlEngine, QJSEngine *jsEngine) {
+         Q_UNUSED(qmlEngine)
+         Q_UNUSED(jsEngine)
+-        return new QtScriptWorkspaceWrapper();
++        return new DeclarativeScriptWorkspaceWrapper();
+     });
+ 
+     qmlRegisterType<KWin::AbstractClient>();
+-- 
+GitLab
+

diff --git 
a/kde-plasma/kwin/files/kwin-5.23.4-wayland-resize-to-last-requested-client-size.patch
 
b/kde-plasma/kwin/files/kwin-5.23.4-wayland-resize-to-last-requested-client-size.patch
new file mode 100644
index 000000000000..7846681ed528
--- /dev/null
+++ 
b/kde-plasma/kwin/files/kwin-5.23.4-wayland-resize-to-last-requested-client-size.patch
@@ -0,0 +1,100 @@
+From 6a84b9454c869a16c2fa5fd49a8fac4a9497f30f Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <vlad.zahorod...@kde.org>
+Date: Tue, 7 Dec 2021 09:32:33 +0200
+Subject: [PATCH] wayland: Resize the client to last requested client size if
+ decoration is destroyed
+
+If the decoration is destroyed before the window is mapped, kwin can
+respond with a configure event that has 0x0 size. New tests check that
+problematic case.
+
+BUG: 444962
+(cherry picked from commit 9cc80d7468c92a2800daf98319e626e022ff1045)
+---
+ autotests/integration/xdgshellclient_test.cpp | 48 +++++++++++++++++++
+ src/abstract_client.cpp                       |  3 +-
+ 2 files changed, 50 insertions(+), 1 deletion(-)
+
+diff --git a/autotests/integration/xdgshellclient_test.cpp 
b/autotests/integration/xdgshellclient_test.cpp
+index c00e4ebb2d..eabed754dd 100644
+--- a/autotests/integration/xdgshellclient_test.cpp
++++ b/autotests/integration/xdgshellclient_test.cpp
+@@ -104,6 +104,8 @@ private Q_SLOTS:
+     void testPointerInputTransform();
+     void testReentrantSetFrameGeometry();
+     void testDoubleMaximize();
++    void testMaximizeAndChangeDecorationModeAfterInitialCommit();
++    void testFullScreenAndChangeDecorationModeAfterInitialCommit();
+ };
+ 
+ void TestXdgShellClient::testXdgWindowReactive()
+@@ -1839,5 +1841,51 @@ void TestXdgShellClient::testMaximizeFull()
+     QVERIFY(Test::waitForWindowDestroyed(client));
+ }
+ 
++void 
TestXdgShellClient::testMaximizeAndChangeDecorationModeAfterInitialCommit()
++{
++    // Ideally, the app would initialize the xdg-toplevel surface before the 
initial commit, but
++    // many don't do it. They initialize the surface after the first commit.
++    // This test verifies that the client will receive a configure event with 
correct size
++    // if an xdg-toplevel surface is set maximized and decoration mode 
changes after initial commit.
++
++    QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
++    QScopedPointer<Test::XdgToplevel> 
shellSurface(Test::createXdgToplevelSurface(surface.data())); // will wait for 
the first configure event
++    QScopedPointer<Test::XdgToplevelDecorationV1> 
decoration(Test::createXdgToplevelDecorationV1(shellSurface.data()));
++    QSignalSpy toplevelConfigureRequestedSpy(shellSurface.data(), 
&Test::XdgToplevel::configureRequested);
++    QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), 
&Test::XdgSurface::configureRequested);
++
++    // Request maximized mode and set decoration mode, i.e. perform late 
initialization.
++    shellSurface->set_maximized();
++    decoration->set_mode(Test::XdgToplevelDecorationV1::mode_client_side);
++
++    // The compositor will respond with a new configure event, which should 
contain maximized state.
++    QVERIFY(surfaceConfigureRequestedSpy.wait());
++    QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), 
QSize(1280, 1024));
++    
QCOMPARE(toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>(),
 Test::XdgToplevel::State::Maximized);
++}
++
++void 
TestXdgShellClient::testFullScreenAndChangeDecorationModeAfterInitialCommit()
++{
++    // Ideally, the app would initialize the xdg-toplevel surface before the 
initial commit, but
++    // many don't do it. They initialize the surface after the first commit.
++    // This test verifies that the client will receive a configure event with 
correct size
++    // if an xdg-toplevel surface is set fullscreen and decoration mode 
changes after initial commit.
++
++    QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
++    QScopedPointer<Test::XdgToplevel> 
shellSurface(Test::createXdgToplevelSurface(surface.data())); // will wait for 
the first configure event
++    QScopedPointer<Test::XdgToplevelDecorationV1> 
decoration(Test::createXdgToplevelDecorationV1(shellSurface.data()));
++    QSignalSpy toplevelConfigureRequestedSpy(shellSurface.data(), 
&Test::XdgToplevel::configureRequested);
++    QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), 
&Test::XdgSurface::configureRequested);
++
++    // Request fullscreen mode and set decoration mode, i.e. perform late 
initialization.
++    shellSurface->set_fullscreen(nullptr);
++    decoration->set_mode(Test::XdgToplevelDecorationV1::mode_client_side);
++
++    // The compositor will respond with a new configure event, which should 
contain fullscreen state.
++    QVERIFY(surfaceConfigureRequestedSpy.wait());
++    QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), 
QSize(1280, 1024));
++    
QCOMPARE(toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>(),
 Test::XdgToplevel::State::Fullscreen);
++}
++
+ WAYLANDTEST_MAIN(TestXdgShellClient)
+ #include "xdgshellclient_test.moc"
+diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp
+index 79c079109a..95576de0b1 100644
+--- a/src/abstract_client.cpp
++++ b/src/abstract_client.cpp
+@@ -2361,8 +2361,9 @@ void AbstractClient::createDecoration(const QRect 
&oldGeometry)
+ 
+ void AbstractClient::destroyDecoration()
+ {
++    const QSize clientSize = 
frameSizeToClientSize(moveResizeGeometry().size());
+     setDecoration(nullptr);
+-    resize(clientSizeToFrameSize(clientSize()));
++    resize(clientSize);
+ }
+ 
+ void AbstractClient::setDecoration(KDecoration2::Decoration *decoration)
+-- 
+GitLab
+

diff --git a/kde-plasma/kwin/kwin-5.23.4-r1.ebuild 
b/kde-plasma/kwin/kwin-5.23.4-r1.ebuild
new file mode 100644
index 000000000000..443291e3462a
--- /dev/null
+++ b/kde-plasma/kwin/kwin-5.23.4-r1.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_HANDBOOK="optional"
+ECM_TEST="optional"
+KFMIN=5.86.0
+PVCUT=$(ver_cut 1-3)
+QTMIN=5.15.2
+VIRTUALX_REQUIRED="test"
+inherit ecm kde.org optfeature
+
+DESCRIPTION="Flexible, composited Window Manager for windowing systems on 
Linux"
+
+LICENSE="GPL-2+"
+SLOT="5"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
+IUSE="accessibility caps gles2-only multimedia plasma screencast"
+
+RESTRICT="test"
+
+COMMON_DEPEND="
+       >=dev-libs/libinput-1.14
+       >=dev-libs/wayland-1.2
+       >=dev-qt/qtdbus-${QTMIN}:5
+       >=dev-qt/qtdeclarative-${QTMIN}:5
+       >=dev-qt/qtgui-${QTMIN}:5=[gles2-only=,libinput]
+       >=dev-qt/qtwidgets-${QTMIN}:5
+       >=dev-qt/qtx11extras-${QTMIN}:5
+       >=kde-frameworks/kactivities-${KFMIN}:5
+       >=kde-frameworks/kauth-${KFMIN}:5
+       >=kde-frameworks/kcmutils-${KFMIN}:5
+       >=kde-frameworks/kcompletion-${KFMIN}:5
+       >=kde-frameworks/kconfig-${KFMIN}:5
+       >=kde-frameworks/kconfigwidgets-${KFMIN}:5
+       >=kde-frameworks/kcoreaddons-${KFMIN}:5
+       >=kde-frameworks/kcrash-${KFMIN}:5
+       >=kde-frameworks/kdeclarative-${KFMIN}:5
+       >=kde-frameworks/kglobalaccel-${KFMIN}:5=
+       >=kde-frameworks/ki18n-${KFMIN}:5
+       >=kde-frameworks/kiconthemes-${KFMIN}:5
+       >=kde-frameworks/kidletime-${KFMIN}:5=
+       >=kde-frameworks/knewstuff-${KFMIN}:5
+       >=kde-frameworks/knotifications-${KFMIN}:5
+       >=kde-frameworks/kpackage-${KFMIN}:5
+       >=kde-frameworks/kservice-${KFMIN}:5
+       >=kde-frameworks/ktextwidgets-${KFMIN}:5
+       >=kde-frameworks/kwayland-${KFMIN}:5
+       >=kde-frameworks/kwidgetsaddons-${KFMIN}:5
+       >=kde-frameworks/kwindowsystem-${KFMIN}:5=[X]
+       >=kde-frameworks/kxmlgui-${KFMIN}:5
+       >=kde-frameworks/plasma-${KFMIN}:5
+       >=kde-plasma/breeze-${PVCUT}:5
+       >=kde-plasma/kdecoration-${PVCUT}:5
+       >=kde-plasma/kscreenlocker-${PVCUT}:5
+       >=kde-plasma/kwayland-server-${PVCUT}:5
+       media-libs/fontconfig
+       media-libs/freetype
+       media-libs/lcms:2
+       media-libs/libepoxy
+       >=media-libs/mesa-21.1[egl(+),gbm(+),wayland,X]
+       virtual/libudev:=
+       x11-libs/libX11
+       x11-libs/libXi
+       x11-libs/libdrm
+       >=x11-libs/libxcb-1.10
+       >=x11-libs/libxkbcommon-0.7.0
+       x11-libs/xcb-util-cursor
+       x11-libs/xcb-util-image
+       x11-libs/xcb-util-keysyms
+       x11-libs/xcb-util-wm
+       accessibility? ( media-libs/libqaccessibilityclient:5 )
+       caps? ( sys-libs/libcap )
+       gles2-only? ( media-libs/mesa[gles2] )
+       plasma? ( >=kde-frameworks/krunner-${KFMIN}:5 )
+       screencast? ( >=media-video/pipewire-0.3:= )
+"
+RDEPEND="${COMMON_DEPEND}
+       >=dev-qt/qtquickcontrols-${QTMIN}:5
+       >=dev-qt/qtquickcontrols2-${QTMIN}:5
+       >=dev-qt/qtvirtualkeyboard-${QTMIN}:5
+       >=kde-frameworks/kirigami-${KFMIN}:5
+       >=kde-frameworks/kitemmodels-${KFMIN}:5[qml]
+       sys-apps/hwdata
+       x11-base/xwayland
+       multimedia? ( >=dev-qt/qtmultimedia-${QTMIN}:5[gstreamer,qml] )
+"
+DEPEND="${COMMON_DEPEND}
+       >=dev-qt/designer-${QTMIN}:5
+       >=dev-qt/qtconcurrent-${QTMIN}:5
+       x11-base/xorg-proto
+       test? (
+               >=dev-libs/wayland-protocols-1.19
+               >=dev-qt/qtwayland-${QTMIN}:5
+       )
+"
+PDEPEND=">=kde-plasma/kde-cli-tools-${PVCUT}:5"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-wayland-resize-to-last-requested-client-size.patch # 
KDE-bug 444962
+       "${FILESDIR}"/${P}-scripting-fix-KWinComponents-Workspace-type.patch
+       "${FILESDIR}"/${P}-drm-remove-dpms-filter-when-outputs-are-added.patch 
# KDE-bug 446699
+)
+
+src_prepare() {
+       ecm_src_prepare
+       use multimedia || eapply 
"${FILESDIR}/${PN}-5.21.80-gstreamer-optional.patch"
+
+       # TODO: try to get a build switch upstreamed
+       if ! use screencast; then
+               sed -e "s/^pkg_check_modules.*PipeWire/#&/" -i CMakeLists.txt 
|| die
+       fi
+}
+
+src_configure() {
+       local mycmakeargs=(
+               $(cmake_use_find_package accessibility QAccessibilityClient)
+               $(cmake_use_find_package caps Libcap)
+               $(cmake_use_find_package plasma KF5Runner)
+       )
+
+       ecm_src_configure
+}
+
+pkg_postinst() {
+       ecm_pkg_postinst
+       optfeature "color management support" x11-misc/colord
+       elog
+       elog "In Plasma 5.20, default behavior of the Task Switcher to move 
minimised"
+       elog "windows to the end of the list was changed so that it remains in 
the"
+       elog "original order. To revert to the well established behavior:"
+       elog
+       elog " - Edit ~/.config/kwinrc"
+       elog " - Find [TabBox] section"
+       elog " - Add \"MoveMinimizedWindowsToEndOfTabBoxFocusChain=true\""
+}

Reply via email to