commit:     1b43fcc1e01ff658872aff2853a78061af74a1c7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 15 00:02:57 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 15 00:02:57 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b43fcc1

kde-plasma/kwin: misc backports to 6.3.4-r1

One of them is recommended by upstream on the distributions mailing list,
the others are interesting looking fixes from the Plasma/6.3 branch (so
queued for 6.3.5).

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../kwin/files/kwin-6.3.4-0001-drm-crash.patch     |  44 ++++++
 .../kwin/files/kwin-6.3.4-0002-layer-shell.patch   |  92 ++++++++++++
 .../files/kwin-6.3.4-0003-renderloop-crash.patch   |  35 +++++
 .../kwin/files/kwin-6.3.4-0004-xwayland.patch      | 137 ++++++++++++++++++
 .../kwin/files/kwin-6.3.4-0005-x11-crash.patch     |  36 +++++
 kde-plasma/kwin/kwin-6.3.4-r1.ebuild               | 158 +++++++++++++++++++++
 6 files changed, 502 insertions(+)

diff --git a/kde-plasma/kwin/files/kwin-6.3.4-0001-drm-crash.patch 
b/kde-plasma/kwin/files/kwin-6.3.4-0001-drm-crash.patch
new file mode 100644
index 000000000000..c94bdddf4c96
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-6.3.4-0001-drm-crash.patch
@@ -0,0 +1,44 @@
+https://mail.kde.org/pipermail/distributions/2025-April/001573.html
+https://invent.kde.org/plasma/kwin/-/commit/93bf2f98ae22e654d997c7140b7fe9936fa3f2d3
+
+From 93bf2f98ae22e654d997c7140b7fe9936fa3f2d3 Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <[email protected]>
+Date: Thu, 10 Apr 2025 14:13:33 +0000
+Subject: [PATCH] backends/drm: also clean up pending commits with legacy
+ modesetting
+
+The thread is only created with atomic modesetting, but m_committed is set with
+legacy modesetting too, so it also has to be dealt with.
+
+This should address remaining cases of
+https://crash-reports.kde.org/share/issue/c27bccb6794a48349b42b70a4e655619/
+
+
+(cherry picked from commit d357c110f1d5d41f597bce731bb1b8f9eb8de598)
+
+Co-authored-by: Xaver Hugl <[email protected]>
+---
+ src/backends/drm/drm_commit_thread.cpp | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/backends/drm/drm_commit_thread.cpp 
b/src/backends/drm/drm_commit_thread.cpp
+index 2b23b59bb35..49a2085ae9e 100644
+--- a/src/backends/drm/drm_commit_thread.cpp
++++ b/src/backends/drm/drm_commit_thread.cpp
+@@ -301,10 +301,10 @@ DrmCommitThread::~DrmCommitThread()
+             m_pong.notify_all();
+         }
+         m_thread->wait();
+-        if (m_committed) {
+-            m_committed->setDefunct();
+-            m_gpu->addDefunctCommit(std::move(m_committed));
+-        }
++    }
++    if (m_committed) {
++        m_committed->setDefunct();
++        m_gpu->addDefunctCommit(std::move(m_committed));
+     }
+ }
+ 
+-- 
+GitLab

diff --git a/kde-plasma/kwin/files/kwin-6.3.4-0002-layer-shell.patch 
b/kde-plasma/kwin/files/kwin-6.3.4-0002-layer-shell.patch
new file mode 100644
index 000000000000..874a0cef54c1
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-6.3.4-0002-layer-shell.patch
@@ -0,0 +1,92 @@
+https://invent.kde.org/plasma/kwin/-/merge_requests/7479
+
+From 6f9bc0f2bd51d8e70d0868858e02e3ac04498840 Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <[email protected]>
+Date: Tue, 18 Mar 2025 19:11:22 +0100
+Subject: [PATCH 1/2] layershellv1window: close the window when the desired
+ output gets removed
+
+Workspace::outputRemoved also gets emitted when the output is turned off, and 
it
+doesn't require taking special care to turn the output off before removing it.
+
+(cherry picked from commit 4ee32d7f71de7f7f9a24c44b9dc4dd31fd3be98f)
+---
+ src/layershellv1window.cpp | 8 ++++----
+ src/layershellv1window.h   | 2 +-
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/layershellv1window.cpp b/src/layershellv1window.cpp
+index 0e044fcf183..b6e18dedd61 100644
+--- a/src/layershellv1window.cpp
++++ b/src/layershellv1window.cpp
+@@ -55,8 +55,8 @@ 
LayerShellV1Window::LayerShellV1Window(LayerSurfaceV1Interface *shellSurface,
+     connect(shellSurface->surface(), &SurfaceInterface::aboutToBeDestroyed,
+             this, &LayerShellV1Window::destroyWindow);
+ 
+-    connect(output, &Output::enabledChanged,
+-            this, &LayerShellV1Window::handleOutputEnabledChanged);
++    connect(workspace(), &Workspace::outputRemoved,
++            this, &LayerShellV1Window::handleOutputRemoved);
+ 
+     connect(shellSurface->surface(), &SurfaceInterface::sizeChanged,
+             this, &LayerShellV1Window::handleSizeChanged);
+@@ -338,9 +338,9 @@ void LayerShellV1Window::handleAcceptsFocusChanged()
+     }
+ }
+ 
+-void LayerShellV1Window::handleOutputEnabledChanged()
++void LayerShellV1Window::handleOutputRemoved(Output *output)
+ {
+-    if (!m_desiredOutput->isEnabled()) {
++    if (output == m_desiredOutput) {
+         closeWindow();
+         destroyWindow();
+     }
+diff --git a/src/layershellv1window.h b/src/layershellv1window.h
+index 923b5a6b4e0..9cdaa1d56a9 100644
+--- a/src/layershellv1window.h
++++ b/src/layershellv1window.h
+@@ -66,7 +66,7 @@ private:
+     void handleUnmapped();
+     void handleCommitted();
+     void handleAcceptsFocusChanged();
+-    void handleOutputEnabledChanged();
++    void handleOutputRemoved(Output *output);
+     void scheduleRearrange();
+     void activateScreenEdge();
+     void deactivateScreenEdge();
+-- 
+GitLab
+
+
+From dc9dcc06f75ef12bd6c05d0c549414a5c1d3acea Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <[email protected]>
+Date: Thu, 3 Apr 2025 08:25:31 +0300
+Subject: [PATCH 2/2] Break Workspace::outputRemoved connection when a layer
+ shell window is destroyed
+
+So the destroyWindow() function is not called again when the Workspace
+emits the outputRemoved signal.
+
+(cherry picked from commit 23626717185a560df20615a252b2aba266ad756a)
+---
+ src/layershellv1window.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/layershellv1window.cpp b/src/layershellv1window.cpp
+index b6e18dedd61..2282ac147b8 100644
+--- a/src/layershellv1window.cpp
++++ b/src/layershellv1window.cpp
+@@ -204,7 +204,9 @@ void LayerShellV1Window::destroyWindow()
+     }
+     m_shellSurface->disconnect(this);
+     m_shellSurface->surface()->disconnect(this);
+-    m_desiredOutput->disconnect(this);
++
++    disconnect(workspace(), &Workspace::outputRemoved,
++               this, &LayerShellV1Window::handleOutputRemoved);
+ 
+     markAsDeleted();
+     Q_EMIT closed();
+-- 
+GitLab

diff --git a/kde-plasma/kwin/files/kwin-6.3.4-0003-renderloop-crash.patch 
b/kde-plasma/kwin/files/kwin-6.3.4-0003-renderloop-crash.patch
new file mode 100644
index 000000000000..2991e2c09b11
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-6.3.4-0003-renderloop-crash.patch
@@ -0,0 +1,35 @@
+https://invent.kde.org/plasma/kwin/-/merge_requests/7496
+
+From 6d096dc5ad2e4a5fac6fb65552107473c0e55a6f Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <[email protected]>
+Date: Fri, 11 Apr 2025 12:30:12 +0000
+Subject: [PATCH] Fix a crash in RenderLoop::scheduleRepaint
+
+When kwin shuts down, the output layers may attempt to schedule a repaint
+after the workspace has been destroyed.
+
+SENTRY: KWIN-AYY
+
+
+(cherry picked from commit 534582e089d1dbed9a1e3d18031ac90cc364c570)
+
+Co-authored-by: Vlad Zahorodnii <[email protected]>
+---
+ src/core/renderloop.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/core/renderloop.cpp b/src/core/renderloop.cpp
+index f2ef3ea213b..d997e2bf737 100644
+--- a/src/core/renderloop.cpp
++++ b/src/core/renderloop.cpp
+@@ -263,7 +263,7 @@ void RenderLoop::scheduleRepaint(Item *item, RenderLayer 
*layer, OutputLayer *ou
+     }
+     const bool vrr = d->presentationMode == PresentationMode::AdaptiveSync || 
d->presentationMode == PresentationMode::AdaptiveAsync;
+     const bool tearing = d->presentationMode == PresentationMode::Async || 
d->presentationMode == PresentationMode::AdaptiveAsync;
+-    if ((vrr || tearing) && workspace()->activeWindow() && d->output) {
++    if ((vrr || tearing) && workspace() && workspace()->activeWindow() && 
d->output) {
+         Window *const activeWindow = workspace()->activeWindow();
+         if ((item || layer || outputLayer) && 
activeWindowControlsVrrRefreshRate() && item != activeWindow->surfaceItem()) {
+             d->delayedVrrTimer.start();
+-- 
+GitLab

diff --git a/kde-plasma/kwin/files/kwin-6.3.4-0004-xwayland.patch 
b/kde-plasma/kwin/files/kwin-6.3.4-0004-xwayland.patch
new file mode 100644
index 000000000000..63ab9a36f072
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-6.3.4-0004-xwayland.patch
@@ -0,0 +1,137 @@
+https://invent.kde.org/plasma/kwin/-/merge_requests/7497
+
+From de5253a788841179a9f167476d34ae0747ce0d67 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <[email protected]>
+Date: Fri, 4 Apr 2025 14:34:32 +0300
+Subject: [PATCH] Simplify xwayland surface association
+
+When kwin starts managing or tracking an X11 window, there should not be
+any wl_surface associated with the X11 window.
+
+While on this, also slightly rewire the code so the associate() function
+is not called indirectly by setSurface(). It allows us to find all relevant
+places where the wl_surface is associated by using code navigation tools
+such as "find all references".
+
+(cherry picked from commit cbb86e609b7b39042fb666f6a736f28196ad2cea)
+---
+ src/events.cpp         |  2 +-
+ src/wayland_server.cpp |  4 ++--
+ src/x11window.cpp      | 15 ++++-----------
+ src/x11window.h        |  4 +++-
+ 4 files changed, 10 insertions(+), 15 deletions(-)
+
+diff --git a/src/events.cpp b/src/events.cpp
+index 6f73c712631..b3afa19ead6 100644
+--- a/src/events.cpp
++++ b/src/events.cpp
+@@ -658,7 +658,7 @@ void 
X11Window::clientMessageEvent(xcb_client_message_event_t *e)
+         m_surfaceSerial = (uint64_t(e->data.data32[1]) << 32) | 
e->data.data32[0];
+         if (auto w = waylandServer()) {
+             if (XwaylandSurfaceV1Interface *xwaylandSurface = 
w->xwaylandShell()->findSurface(m_surfaceSerial)) {
+-                setSurface(xwaylandSurface->surface());
++                associate(xwaylandSurface);
+             }
+         }
+     }
+diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp
+index 1278713b8d1..6bd34758442 100644
+--- a/src/wayland_server.cpp
++++ b/src/wayland_server.cpp
+@@ -350,7 +350,7 @@ bool WaylandServer::init()
+             return window->surfaceSerial() == surface->serial();
+         });
+         if (window) {
+-            window->setSurface(surface->surface());
++            window->associate(surface);
+             return;
+         }
+ 
+@@ -358,7 +358,7 @@ bool WaylandServer::init()
+             return window->surfaceSerial() == surface->serial();
+         });
+         if (unmanaged) {
+-            unmanaged->setSurface(surface->surface());
++            unmanaged->associate(surface);
+             return;
+         }
+     });
+diff --git a/src/x11window.cpp b/src/x11window.cpp
+index 1a5c4c16fb2..ab9410bc7a9 100644
+--- a/src/x11window.cpp
++++ b/src/x11window.cpp
+@@ -33,6 +33,7 @@
+ #include "tiles/tilemanager.h"
+ #include "virtualdesktops.h"
+ #include "wayland/surface.h"
++#include "wayland/xwaylandshell_v1.h"
+ #include "wayland_server.h"
+ #include "workspace.h"
+ #include <KDecoration3/DecoratedWindow>
+@@ -588,11 +589,6 @@ bool X11Window::track(xcb_window_t w)
+     switch (kwinApp()->operationMode()) {
+     case Application::OperationModeWayland:
+         // The wayland surface is associated with the override-redirect 
window asynchronously.
+-        if (surface()) {
+-            associate();
+-        } else {
+-            connect(this, &Window::surfaceChanged, this, 
&X11Window::associate);
+-        }
+         break;
+     case Application::OperationModeX11:
+         // We have no way knowing whether the override-redirect window can be 
painted. Mark it
+@@ -1207,11 +1203,6 @@ bool X11Window::manage(xcb_window_t w, bool isMapped)
+     switch (kwinApp()->operationMode()) {
+     case Application::OperationModeWayland:
+         // The wayland surface is associated with the window asynchronously.
+-        if (surface()) {
+-            associate();
+-        } else {
+-            connect(this, &Window::surfaceChanged, this, 
&X11Window::associate);
+-        }
+         connect(kwinApp(), &Application::xwaylandScaleChanged, this, 
&X11Window::handleXwaylandScaleChanged);
+         break;
+     case Application::OperationModeX11:
+@@ -5027,8 +5018,10 @@ void X11Window::updateWindowPixmap()
+     }
+ }
+ 
+-void X11Window::associate()
++void X11Window::associate(XwaylandSurfaceV1Interface *shellSurface)
+ {
++    setSurface(shellSurface->surface());
++
+     if (surface()->isMapped()) {
+         if (m_syncRequest.acked) {
+             finishSync();
+diff --git a/src/x11window.h b/src/x11window.h
+index 797f600d4fb..d97f93764c1 100644
+--- a/src/x11window.h
++++ b/src/x11window.h
+@@ -39,6 +39,7 @@ namespace KWin
+ {
+ 
+ class KillPrompt;
++class XwaylandSurfaceV1Interface;
+ 
+ /**
+  * @brief Defines Predicates on how to search for a Client.
+@@ -82,6 +83,8 @@ public:
+     explicit X11Window();
+     ~X11Window() override; ///< Use destroyWindow() or releaseWindow()
+ 
++    void associate(XwaylandSurfaceV1Interface *shellSurface);
++
+     xcb_window_t frameId() const;
+     xcb_window_t window() const;
+     xcb_window_t wrapperId() const;
+@@ -439,7 +442,6 @@ private:
+ 
+     QWindow *findInternalWindow() const;
+     void checkOutput();
+-    void associate();
+     void handleXwaylandScaleChanged();
+     void handleCommitted();
+ 
+-- 
+GitLab

diff --git a/kde-plasma/kwin/files/kwin-6.3.4-0005-x11-crash.patch 
b/kde-plasma/kwin/files/kwin-6.3.4-0005-x11-crash.patch
new file mode 100644
index 000000000000..42a44bb2ccb1
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-6.3.4-0005-x11-crash.patch
@@ -0,0 +1,36 @@
+https://invent.kde.org/plasma/kwin/-/merge_requests/7498
+
+From 3be0acf56938800be682b0150214fcf9cc3da127 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <[email protected]>
+Date: Fri, 11 Apr 2025 14:23:02 +0000
+Subject: [PATCH] Disconnect committed signal in X11Window::associate()
+
+It's possible that a new surface can be assigned while the previous
+surface is still alive, in which case we want to ignore its committed
+signal.
+
+
+(cherry picked from commit 194cb54eba26e863d5e7c23bda1e2e146f839d9e)
+
+Co-authored-by: Vlad Zahorodnii <[email protected]>
+---
+ src/x11window.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/x11window.cpp b/src/x11window.cpp
+index ab9410bc7a..218bc76af9 100644
+--- a/src/x11window.cpp
++++ b/src/x11window.cpp
+@@ -5020,6 +5020,10 @@ void X11Window::updateWindowPixmap()
+ 
+ void X11Window::associate(XwaylandSurfaceV1Interface *shellSurface)
+ {
++    if (surface()) {
++        disconnect(surface(), &SurfaceInterface::committed, this, 
&X11Window::handleCommitted);
++    }
++
+     setSurface(shellSurface->surface());
+ 
+     if (surface()->isMapped()) {
+-- 
+GitLab

diff --git a/kde-plasma/kwin/kwin-6.3.4-r1.ebuild 
b/kde-plasma/kwin/kwin-6.3.4-r1.ebuild
new file mode 100644
index 000000000000..5e54d6abef7a
--- /dev/null
+++ b/kde-plasma/kwin/kwin-6.3.4-r1.ebuild
@@ -0,0 +1,158 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_HANDBOOK="optional"
+ECM_TEST="true"
+KFMIN=6.10.0
+QTMIN=6.8.1
+inherit ecm fcaps plasma.kde.org xdg
+
+DESCRIPTION="Flexible, composited Window Manager for windowing systems on 
Linux"
+
+LICENSE="GPL-2+"
+SLOT="6"
+KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86"
+IUSE="accessibility gles2-only lock screencast +shortcuts systemd"
+
+RESTRICT="test"
+
+# qtbase slot op: GuiPrivate use in tabbox
+# qtbase[X]: private/qtx11extras_p.h in src/helpers/killer
+COMMON_DEPEND="
+       dev-libs/libei
+       >=dev-libs/libinput-1.27:=
+       >=dev-libs/wayland-1.23.0
+       >=dev-qt/qt5compat-${QTMIN}:6[qml]
+       
>=dev-qt/qtbase-${QTMIN}:6=[accessibility=,gles2-only=,gui,libinput,opengl,widgets,X]
+       >=dev-qt/qtdeclarative-${QTMIN}:6
+       >=dev-qt/qtsensors-${QTMIN}:6
+       >=dev-qt/qtshadertools-${QTMIN}:6
+       >=dev-qt/qtsvg-${QTMIN}:6
+       >=dev-qt/qtwayland-${QTMIN}:6
+       >=kde-frameworks/kauth-${KFMIN}:6
+       >=kde-frameworks/kcmutils-${KFMIN}:6
+       >=kde-frameworks/kcolorscheme-${KFMIN}:6
+       >=kde-frameworks/kconfig-${KFMIN}:6[qml]
+       >=kde-frameworks/kconfigwidgets-${KFMIN}:6
+       >=kde-frameworks/kcoreaddons-${KFMIN}:6
+       >=kde-frameworks/kcrash-${KFMIN}:6
+       >=kde-frameworks/kdbusaddons-${KFMIN}:6
+       >=kde-frameworks/kdeclarative-${KFMIN}:6
+       >=kde-frameworks/kglobalaccel-${KFMIN}:6=[X(+)]
+       >=kde-frameworks/kguiaddons-${KFMIN}:6[wayland]
+       >=kde-frameworks/ki18n-${KFMIN}:6
+       >=kde-frameworks/kidletime-${KFMIN}:6=[wayland]
+       >=kde-frameworks/knewstuff-${KFMIN}:6
+       >=kde-frameworks/knotifications-${KFMIN}:6
+       >=kde-frameworks/kpackage-${KFMIN}:6
+       >=kde-frameworks/kservice-${KFMIN}:6
+       >=kde-frameworks/ksvg-${KFMIN}:6
+       >=kde-frameworks/kwidgetsaddons-${KFMIN}:6
+       >=kde-frameworks/kwindowsystem-${KFMIN}:6=[wayland,X]
+       >=kde-frameworks/kxmlgui-${KFMIN}:6
+       >=kde-plasma/breeze-${KDE_CATV}:6
+       >=kde-plasma/kdecoration-${KDE_CATV}:6
+       >=kde-plasma/kwayland-${KDE_CATV}:6
+       >=kde-plasma/plasma-activities-${KDE_CATV}:6
+       media-libs/fontconfig
+       media-libs/freetype
+       media-libs/lcms:2
+       media-libs/libcanberra
+       >=media-libs/libdisplay-info-0.2.0:=
+       media-libs/libepoxy
+       media-libs/libglvnd
+       >=media-libs/mesa-24.1.0_rc1[opengl,wayland,X]
+       virtual/libudev:=
+       x11-libs/libX11
+       x11-libs/libXi
+       >=x11-libs/libdrm-2.4.116
+       >=x11-libs/libxcb-1.10:=
+       >=x11-libs/libxcvt-0.1.1
+       >=x11-libs/libxkbcommon-1.5.0
+       x11-libs/xcb-util-cursor
+       x11-libs/xcb-util-keysyms
+       x11-libs/xcb-util-wm
+       accessibility? ( media-libs/libqaccessibilityclient:6 )
+       lock? ( >=kde-plasma/kscreenlocker-${KDE_CATV}:6 )
+       screencast? ( >=media-video/pipewire-1.2.0:= )
+       shortcuts? ( >=kde-plasma/kglobalacceld-${KDE_CATV}:6 )
+"
+RDEPEND="${COMMON_DEPEND}
+       !kde-plasma/kdeplasma-addons:5
+       >=dev-qt/qtmultimedia-${QTMIN}:6[qml]
+       || (
+               dev-qt/qtmultimedia:6[ffmpeg]
+               (
+                       dev-qt/qtmultimedia:6[gstreamer]
+                       media-plugins/gst-plugins-soup:1.0
+               )
+       )
+       >=kde-frameworks/kirigami-${KFMIN}:6
+       >=kde-frameworks/kitemmodels-${KFMIN}:6
+       >=kde-plasma/aurorae-${KDE_CATV}:6
+       >=kde-plasma/libplasma-${KDE_CATV}:6[wayland(+)]
+       sys-apps/hwdata
+       >=x11-base/xwayland-23.1.0[libei]
+"
+DEPEND="${COMMON_DEPEND}
+       >=dev-libs/plasma-wayland-protocols-1.16.0
+       >=dev-libs/wayland-protocols-1.38
+       >=dev-qt/qttools-${QTMIN}:6[widgets]
+       >=dev-qt/qtbase-${QTMIN}:6[concurrent]
+       x11-base/xorg-proto
+       x11-libs/xcb-util-image
+       test? ( screencast? ( >=kde-plasma/kpipewire-${KDE_CATV}:6 ) )
+"
+BDEPEND="
+       >=dev-qt/qtwayland-${QTMIN}:6
+       dev-util/wayland-scanner
+       >=kde-frameworks/kcmutils-${KFMIN}:6
+"
+
+# https://bugs.gentoo.org/941628
+# -m 0755 to avoid suid with USE="-filecaps"
+FILECAPS=( -m 0755 cap_sys_nice=ep usr/bin/kwin_wayland )
+
+PATCHES=(
+       "${FILESDIR}"/${P}-0001-drm-crash.patch
+       "${FILESDIR}"/${P}-0002-layer-shell.patch
+       "${FILESDIR}"/${P}-0003-renderloop-crash.patch
+       "${FILESDIR}"/${P}-0004-xwayland.patch
+       "${FILESDIR}"/${P}-0005-x11-crash.patch
+)
+
+src_prepare() {
+       ecm_src_prepare
+
+       # TODO: try to get a build switch upstreamed
+       if ! use screencast; then
+               sed -e "s/^pkg_check_modules.*PipeWire/#&/" -i CMakeLists.txt 
|| die
+       fi
+
+       # TODO: try to get a build switch upstreamed
+       if ! use systemd; then
+               sed -e "s/^pkg_check_modules.*libsystemd/#&/" -i CMakeLists.txt 
|| die
+       fi
+
+       cmake_run_in src/plugins cmake_comment_add_subdirectory kdecorations
+}
+
+src_configure() {
+       local mycmakeargs=(
+               # TODO: KWIN_BUILD_X11=$(usex xwayland) 
KWIN_BUILD_X11_BACKEND=$(usex X)
+               # KWIN_BUILD_NOTIFICATIONS exists, but kdeclarative still 
hard-depends on it
+               $(cmake_use_find_package accessibility QAccessibilityClient6)
+               -DCMAKE_DISABLE_FIND_PACKAGE_Libcap=ON
+               -DKWIN_BUILD_SCREENLOCKER=$(usex lock)
+               -DKWIN_BUILD_GLOBALSHORTCUTS=$(usex shortcuts)
+       )
+
+       ecm_src_configure
+}
+
+pkg_postinst() {
+       xdg_pkg_postinst
+       fcaps_pkg_postinst
+}

Reply via email to