summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2022-04-11 15:32:52 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2022-04-18 16:16:44 +0200
commit23e47003cf63c24dda9601d60d35e08f29e44468 (patch)
treefab9bb8922d25d84d1192128d8502ca0276b8ee3 /kde-plasma/kwin
parentgames-fps/yamagi-quake2: Version bump to 8.01 (diff)
downloadgentoo-23e47003cf63c24dda9601d60d35e08f29e44468.tar.gz
gentoo-23e47003cf63c24dda9601d60d35e08f29e44468.tar.bz2
gentoo-23e47003cf63c24dda9601d60d35e08f29e44468.zip
kde-plasma/kwin: Various stability fixes
Upstream commits: 9d38f57d84fb9a6f2c4e60f7051f685842f34e0f 52035f43b90738e2efb4fd7b482719c1ea458578 388402c3b1b37d9f72597aae8d6670e8c0edeb14 82c2324b5675ea2d5e3b962f270bda1d186e7326 a5404234dbd26e170acb97789599fbcd705cf6cb a35e3075a7aa4616c8930ccd3869dc4cca5d287e c1d7919ad7cc8a7e55f5b93ec84de63547bc53b9 7a26f93cb579cf6b1cbc1e32790f93be70013157 ee625b2d8acad2ba81693107740a12d8a03863c0 KDE-bug: https://bugs.kde.org/show_bug.cgi?id=452334 KDE-bug: https://bugs.kde.org/show_bug.cgi?id=452171 KDE-bug: https://bugs.kde.org/show_bug.cgi?id=450564 KDE-bug: https://bugs.kde.org/show_bug.cgi?id=447705 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-plasma/kwin')
-rw-r--r--kde-plasma/kwin/files/kwin-5.24.4-backends-drm-dont-perm-disable-vrr.patch32
-rw-r--r--kde-plasma/kwin/files/kwin-5.24.4-backends-drm-fetch-immutable-blobs.patch214
-rw-r--r--kde-plasma/kwin/files/kwin-5.24.4-dont-send-geom-to-text-input.patch26
-rw-r--r--kde-plasma/kwin/files/kwin-5.24.4-dont-use-xcb-in-wayland.patch41
-rw-r--r--kde-plasma/kwin/files/kwin-5.24.4-fix-current-VD-always-added.patch50
-rw-r--r--kde-plasma/kwin/files/kwin-5.24.4-fix-unlocking-wayland-sessions.patch44
-rw-r--r--kde-plasma/kwin/files/kwin-5.24.4-waylandserver-lockScreenShown.patch93
-rw-r--r--kde-plasma/kwin/files/kwin-5.24.4-waylandserver-move-LockScreenPresentationWatcher.patch36
-rw-r--r--kde-plasma/kwin/files/kwin-5.24.4-xdgactivation-demand-attention.patch32
-rw-r--r--kde-plasma/kwin/kwin-5.24.4-r1.ebuild145
10 files changed, 713 insertions, 0 deletions
diff --git a/kde-plasma/kwin/files/kwin-5.24.4-backends-drm-dont-perm-disable-vrr.patch b/kde-plasma/kwin/files/kwin-5.24.4-backends-drm-dont-perm-disable-vrr.patch
new file mode 100644
index 000000000000..38d4771c2345
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.24.4-backends-drm-dont-perm-disable-vrr.patch
@@ -0,0 +1,32 @@
+From a5404234dbd26e170acb97789599fbcd705cf6cb Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <xaver.hugl@gmail.com>
+Date: Fri, 8 Apr 2022 17:47:09 +0200
+Subject: [PATCH] backends/drm: don't permanently disable VRR when the test
+ commit fails
+
+In 5.24, the same code path is used for testing direct scanout, so that
+causes false negatives. Generally though, the user setting shouldn't be
+touched, it's not really proper feedback for the driver or KWin having
+problems.
+
+
+(cherry picked from commit 2ef6215a517e4220f147f5327e7ecdad02762b64)
+---
+ src/backends/drm/drm_output.cpp | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/backends/drm/drm_output.cpp b/src/backends/drm/drm_output.cpp
+index bd08631cf7..048803883b 100644
+--- a/src/backends/drm/drm_output.cpp
++++ b/src/backends/drm/drm_output.cpp
+@@ -337,7 +337,6 @@ bool DrmOutput::present(const QSharedPointer<DrmBuffer> &buffer, QRegion damaged
+ m_pipeline->applyPendingChanges();
+ } else {
+ m_pipeline->revertPendingChanges();
+- setVrrPolicy(RenderLoop::VrrPolicy::Never);
+ }
+ }
+ if (m_pipeline->present(buffer)) {
+--
+GitLab
+
diff --git a/kde-plasma/kwin/files/kwin-5.24.4-backends-drm-fetch-immutable-blobs.patch b/kde-plasma/kwin/files/kwin-5.24.4-backends-drm-fetch-immutable-blobs.patch
new file mode 100644
index 000000000000..16c7756d33e2
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.24.4-backends-drm-fetch-immutable-blobs.patch
@@ -0,0 +1,214 @@
+From 82c2324b5675ea2d5e3b962f270bda1d186e7326 Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <xaver.hugl@gmail.com>
+Date: Mon, 4 Apr 2022 20:19:05 +0200
+Subject: [PATCH] backends/drm: fetch immutable blobs in DrmProperty
+
+If the blob is fetched while there is no kernel-visible reference to it,
+the driver may re-use the blob ID. When DrmProperty is created or updated,
+KWin holds a reference on the blob via drmModeObjectProperties, so this
+should prevent any possible issues.
+
+CCBUG: 449285
+---
+ src/backends/drm/drm_object_connector.cpp | 13 +++-----
+ src/backends/drm/drm_object_plane.cpp | 39 +++++++++++------------
+ src/backends/drm/drm_property.cpp | 27 +++++++++++++++-
+ src/backends/drm/drm_property.h | 7 +++-
+ 4 files changed, 54 insertions(+), 32 deletions(-)
+
+diff --git a/src/backends/drm/drm_object_connector.cpp b/src/backends/drm/drm_object_connector.cpp
+index a0045290df..0cdbd70b4f 100644
+--- a/src/backends/drm/drm_object_connector.cpp
++++ b/src/backends/drm/drm_object_connector.cpp
+@@ -337,16 +337,11 @@ bool DrmConnector::updateProperties()
+ }
+
+ // parse edid
+- auto edidProp = getProp(PropertyIndex::Edid);
+- if (edidProp) {
+- DrmScopedPointer<drmModePropertyBlobRes> blob(drmModeGetPropertyBlob(gpu()->fd(), edidProp->current()));
+- if (blob && blob->data) {
+- m_edid = Edid(blob->data, blob->length);
+- if (!m_edid.isValid()) {
+- qCWarning(KWIN_DRM) << "Couldn't parse EDID for connector" << this;
+- }
++ if (const auto edidProp = getProp(PropertyIndex::Edid); edidProp && edidProp->immutableBlob()) {
++ m_edid = Edid(edidProp->immutableBlob()->data, edidProp->immutableBlob()->length);
++ if (!m_edid.isValid()) {
++ qCWarning(KWIN_DRM) << "Couldn't parse EDID for connector" << this;
+ }
+- deleteProp(PropertyIndex::Edid);
+ } else {
+ qCDebug(KWIN_DRM) << "Could not find edid for connector" << this;
+ }
+diff --git a/src/backends/drm/drm_object_plane.cpp b/src/backends/drm/drm_object_plane.cpp
+index 6967fdd50d..c4dcca96d4 100644
+--- a/src/backends/drm/drm_object_plane.cpp
++++ b/src/backends/drm/drm_object_plane.cpp
+@@ -73,29 +73,26 @@ bool DrmPlane::init()
+ checkSupport(5, Transformation::ReflectY);
+
+ // read formats from blob if available and if modifiers are supported, and from the plane object if not
+- if (auto formatProp = getProp(PropertyIndex::In_Formats); formatProp && gpu()->addFB2ModifiersSupported()) {
+- DrmScopedPointer<drmModePropertyBlobRes> propertyBlob(drmModeGetPropertyBlob(gpu()->fd(), formatProp->current()));
+- if (propertyBlob && propertyBlob->data) {
+- auto blob = static_cast<drm_format_modifier_blob*>(propertyBlob->data);
+- auto modifiers = reinterpret_cast<drm_format_modifier*>(reinterpret_cast<uint8_t*>(blob) + blob->modifiers_offset);
+- uint32_t *formatarr = reinterpret_cast<uint32_t*>(reinterpret_cast<uint8_t*>(blob) + blob->formats_offset);
+-
+- for (uint32_t f = 0; f < blob->count_formats; f++) {
+- auto format = formatarr[f];
+- QVector<uint64_t> mods;
+- for (uint32_t m = 0; m < blob->count_modifiers; m++) {
+- auto modifier = &modifiers[m];
+- // The modifier advertisement blob is partitioned into groups of 64 formats
+- if (m < modifier->offset || m > modifier->offset + 63) {
+- continue;
+- }
+- if (!(modifier->formats & (1 << (f - modifier->offset)))) {
+- continue;
+- }
+- mods << modifier->modifier;
++ if (const auto formatProp = getProp(PropertyIndex::In_Formats); formatProp && formatProp->immutableBlob() && gpu()->addFB2ModifiersSupported()) {
++ auto blob = static_cast<drm_format_modifier_blob *>(formatProp->immutableBlob()->data);
++ auto modifiers = reinterpret_cast<drm_format_modifier *>(reinterpret_cast<uint8_t *>(blob) + blob->modifiers_offset);
++ uint32_t *formatarr = reinterpret_cast<uint32_t *>(reinterpret_cast<uint8_t *>(blob) + blob->formats_offset);
++
++ for (uint32_t f = 0; f < blob->count_formats; f++) {
++ auto format = formatarr[f];
++ QVector<uint64_t> mods;
++ for (uint32_t m = 0; m < blob->count_modifiers; m++) {
++ auto modifier = &modifiers[m];
++ // The modifier advertisement blob is partitioned into groups of 64 formats
++ if (m < modifier->offset || m > modifier->offset + 63) {
++ continue;
+ }
+- m_supportedFormats.insert(format, mods);
++ if (!(modifier->formats & (1 << (f - modifier->offset)))) {
++ continue;
++ }
++ mods << modifier->modifier;
+ }
++ m_supportedFormats.insert(format, mods);
+ }
+ } else {
+ for (uint32_t i = 0; i < p->count_formats; i++) {
+diff --git a/src/backends/drm/drm_property.cpp b/src/backends/drm/drm_property.cpp
+index 28af8ec07f..8ab0dc0e5a 100644
+--- a/src/backends/drm/drm_property.cpp
++++ b/src/backends/drm/drm_property.cpp
+@@ -24,6 +24,7 @@ DrmProperty::DrmProperty(DrmObject *obj, drmModePropertyRes *prop, uint64_t val,
+ , m_next(val)
+ , m_current(val)
+ , m_immutable(prop->flags & DRM_MODE_PROP_IMMUTABLE)
++ , m_isBlob(prop->flags & DRM_MODE_PROP_BLOB)
+ , m_obj(obj)
+ {
+ if (!enumNames.isEmpty()) {
+@@ -35,6 +36,7 @@ DrmProperty::DrmProperty(DrmObject *obj, drmModePropertyRes *prop, uint64_t val,
+ m_minValue = prop->values[0];
+ m_maxValue = prop->values[1];
+ }
++ updateBlob();
+ }
+
+ DrmProperty::~DrmProperty() = default;
+@@ -110,7 +112,10 @@ bool DrmProperty::needsCommit() const
+
+ void DrmProperty::setCurrent(uint64_t value)
+ {
+- m_current = value;
++ if (m_current != value) {
++ updateBlob();
++ m_current = value;
++ }
+ }
+
+ uint64_t DrmProperty::current() const
+@@ -122,10 +127,12 @@ QVector<QByteArray> DrmProperty::enumNames() const
+ {
+ return m_enumNames;
+ }
++
+ bool DrmProperty::hasEnum(uint64_t value) const
+ {
+ return m_enumMap.contains(value);
+ }
++
+ bool DrmProperty::hasAllEnums() const
+ {
+ return m_enumMap.count() == m_enumNames.count();
+@@ -166,4 +173,22 @@ uint64_t DrmProperty::maxValue() const
+ return m_maxValue;
+ }
+
++void DrmProperty::updateBlob()
++{
++ if (m_immutable && m_isBlob) {
++ if (m_current != 0) {
++ m_immutableBlob.reset(drmModeGetPropertyBlob(m_obj->gpu()->fd(), m_current));
++ if (m_immutableBlob && (!m_immutableBlob->data || !m_immutableBlob->length)) {
++ m_immutableBlob.reset();
++ }
++ } else {
++ m_immutableBlob.reset();
++ }
++ }
++}
++
++drmModePropertyBlobRes *DrmProperty::immutableBlob() const
++{
++ return m_immutableBlob.get();
++}
+ }
+diff --git a/src/backends/drm/drm_property.h b/src/backends/drm/drm_property.h
+index 48bdeafdc2..1ae547f41e 100644
+--- a/src/backends/drm/drm_property.h
++++ b/src/backends/drm/drm_property.h
+@@ -9,9 +9,9 @@
+ */
+
+ #pragma once
++#include "drm_pointer.h"
+
+ #include <xf86drmMode.h>
+-
+ #include <QVector>
+ #include <QMap>
+ #include <QByteArray>
+@@ -59,6 +59,7 @@ public:
+
+ void setCurrent(uint64_t value);
+ uint64_t current() const;
++ drmModePropertyBlobRes *immutableBlob() const;
+
+ uint64_t minValue() const;
+ uint64_t maxValue() const;
+@@ -78,6 +79,8 @@ public:
+ }
+
+ private:
++ void updateBlob();
++
+ uint32_t m_propId = 0;
+ QByteArray m_propName;
+
+@@ -89,6 +92,7 @@ private:
+ uint64_t m_next = 0;
+ // the value currently set for or by the kernel
+ uint64_t m_current = 0;
++ DrmScopedPointer<drmModePropertyBlobRes> m_immutableBlob;
+
+ uint64_t m_minValue = -1;
+ uint64_t m_maxValue = -1;
+@@ -96,6 +100,7 @@ private:
+ QMap<uint32_t, uint64_t> m_enumMap;
+ QVector<QByteArray> m_enumNames;
+ const bool m_immutable;
++ const bool m_isBlob;
+ bool m_legacy = false;
+ const DrmObject *m_obj;
+ };
+--
+GitLab
+
diff --git a/kde-plasma/kwin/files/kwin-5.24.4-dont-send-geom-to-text-input.patch b/kde-plasma/kwin/files/kwin-5.24.4-dont-send-geom-to-text-input.patch
new file mode 100644
index 000000000000..acd7bf4149ab
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.24.4-dont-send-geom-to-text-input.patch
@@ -0,0 +1,26 @@
+From a35e3075a7aa4616c8930ccd3869dc4cca5d287e Mon Sep 17 00:00:00 2001
+From: Weng Xuetian <wengxt@gmail.com>
+Date: Sat, 9 Apr 2022 07:25:44 -0700
+Subject: [PATCH] Do not send overlay geometry to text input.
+
+(cherry picked from commit 374e94918238f3ddb9d00c542f281d3d8a309efb)
+---
+ src/inputmethod.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp
+index e7951d9580..5b8e54efbc 100644
+--- a/src/inputmethod.cpp
++++ b/src/inputmethod.cpp
+@@ -615,7 +615,7 @@ void InputMethod::updateInputPanelState()
+ const bool bottomKeyboard = m_inputClient && m_inputClient->mode() != InputPanelV1Client::Overlay && m_inputClient->isShown();
+ m_trackedClient->setVirtualKeyboardGeometry(bottomKeyboard ? m_inputClient->inputGeometry() : QRect());
+
+- if (m_inputClient) {
++ if (m_inputClient && m_inputClient->mode() != InputPanelV1Client::Overlay) {
+ overlap = m_trackedClient->frameGeometry() & m_inputClient->inputGeometry();
+ overlap.moveTo(m_trackedClient->mapToLocal(overlap.topLeft()));
+ }
+--
+GitLab
+
diff --git a/kde-plasma/kwin/files/kwin-5.24.4-dont-use-xcb-in-wayland.patch b/kde-plasma/kwin/files/kwin-5.24.4-dont-use-xcb-in-wayland.patch
new file mode 100644
index 000000000000..667b91b8dc5c
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.24.4-dont-use-xcb-in-wayland.patch
@@ -0,0 +1,41 @@
+From 7a26f93cb579cf6b1cbc1e32790f93be70013157 Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <xaver.hugl@gmail.com>
+Date: Tue, 12 Apr 2022 15:45:52 +0200
+Subject: [PATCH] effects/kscreen: don't use xcb on Wayland
+
+BUG: 450564
+FIXED-IN: 5.24.5
+(cherry picked from commit db3f27336f2172fd70be3411874d9bbeb3db6a24)
+---
+ src/effects/kscreen/kscreen.cpp | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/effects/kscreen/kscreen.cpp b/src/effects/kscreen/kscreen.cpp
+index 9484399756..0673915aad 100644
+--- a/src/effects/kscreen/kscreen.cpp
++++ b/src/effects/kscreen/kscreen.cpp
+@@ -44,15 +44,15 @@ namespace KWin
+
+ KscreenEffect::KscreenEffect()
+ : Effect()
+- , m_atom(effects->announceSupportProperty("_KDE_KWIN_KSCREEN_SUPPORT", this))
++ , m_atom(effects->waylandDisplay() ? XCB_ATOM_NONE : effects->announceSupportProperty("_KDE_KWIN_KSCREEN_SUPPORT", this))
+ {
+ initConfig<KscreenConfig>();
+- connect(effects, &EffectsHandler::propertyNotify, this, &KscreenEffect::propertyNotify);
+- connect(effects, &EffectsHandler::xcbConnectionChanged, this,
+- [this] {
++ if (!effects->waylandDisplay()) {
++ connect(effects, &EffectsHandler::propertyNotify, this, &KscreenEffect::propertyNotify);
++ connect(effects, &EffectsHandler::xcbConnectionChanged, this, [this]() {
+ m_atom = effects->announceSupportProperty(QByteArrayLiteral("_KDE_KWIN_KSCREEN_SUPPORT"), this);
+- }
+- );
++ });
++ }
+ reconfigure(ReconfigureAll);
+
+ const QList<EffectScreen *> screens = effects->screens();
+--
+GitLab
+
diff --git a/kde-plasma/kwin/files/kwin-5.24.4-fix-current-VD-always-added.patch b/kde-plasma/kwin/files/kwin-5.24.4-fix-current-VD-always-added.patch
new file mode 100644
index 000000000000..195d33b1f3a2
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.24.4-fix-current-VD-always-added.patch
@@ -0,0 +1,50 @@
+From c1d7919ad7cc8a7e55f5b93ec84de63547bc53b9 Mon Sep 17 00:00:00 2001
+From: Ismael Asensio <isma.af@gmail.com>
+Date: Fri, 8 Apr 2022 22:53:08 +0200
+Subject: [PATCH] AbstractClient: Fix the current VD being always added to the
+ plasma interface
+
+When setting-up the plasma window interface we need to call
+`setOnAllDesktops()` after the actual virtual desktops have
+been set.
+
+Otherwise, the current desktop would be always added to the
+interface (as if the user were unsetting the "onAllDesktops"
+flag) and the plasma interface and KWin can get un-synced,
+specially if there are specific window rules.
+
+BUG: 452171
+FIXED-IN: 5.24.5
+
+
+(cherry picked from commit 4c8711f121430caa658f9848070e4e25c4a12208)
+---
+ src/abstract_client.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp
+index 7e8a7eec04..0714b9ac3f 100644
+--- a/src/abstract_client.cpp
++++ b/src/abstract_client.cpp
+@@ -1488,7 +1488,6 @@ void AbstractClient::setupWindowManagementInterface()
+ w->setKeepBelow(keepBelow());
+ w->setMaximized(maximizeMode() == KWin::MaximizeFull);
+ w->setMinimized(isMinimized());
+- w->setOnAllDesktops(isOnAllDesktops());
+ w->setDemandsAttention(isDemandingAttention());
+ w->setCloseable(isCloseable());
+ w->setMaximizeable(isMaximizable());
+@@ -1620,6 +1619,10 @@ void AbstractClient::setupWindowManagementInterface()
+ for (const auto vd : qAsConst(m_desktops)) {
+ w->addPlasmaVirtualDesktop(vd->id());
+ }
++ // We need to set `OnAllDesktops` after the actual VD list has been added.
++ // Otherwise it will unconditionally add the current desktop to the interface
++ // which may not be the case, for example, when using rules
++ w->setOnAllDesktops(isOnAllDesktops());
+
+ //Plasma Virtual desktop management
+ //show/hide when the window enters/exits from desktop
+--
+GitLab
+
diff --git a/kde-plasma/kwin/files/kwin-5.24.4-fix-unlocking-wayland-sessions.patch b/kde-plasma/kwin/files/kwin-5.24.4-fix-unlocking-wayland-sessions.patch
new file mode 100644
index 000000000000..9e9a4dabc998
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.24.4-fix-unlocking-wayland-sessions.patch
@@ -0,0 +1,44 @@
+From ee625b2d8acad2ba81693107740a12d8a03863c0 Mon Sep 17 00:00:00 2001
+From: Aleix Pol <aleixpol@kde.org>
+Date: Mon, 28 Mar 2022 03:40:12 +0200
+Subject: [PATCH] Fix unlocking wayland sessions
+
+We were never issuing a repaint which confused thoroughly the
+compositor.
+
+BUG: 447705
+---
+ src/wayland_server.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp
+index eb3600f824..9e60787465 100644
+--- a/src/wayland_server.cpp
++++ b/src/wayland_server.cpp
+@@ -15,6 +15,7 @@
+ #include "inputpanelv1integration.h"
+ #include "keyboard_input.h"
+ #include "screens.h"
++#include "scene.h"
+ #include "layershellv1integration.h"
+ #include "main.h"
+ #include "xdgshellintegration.h"
+@@ -610,6 +611,7 @@ void WaylandServer::initScreenLocker()
+ connect(seat, &KWaylandServer::SeatInterface::timestampChanged,
+ screenLockerApp, &ScreenLocker::KSldApp::userActivity);
+ }
++ Compositor::self()->scene()->addRepaintFull();
+ }
+ );
+
+@@ -627,6 +629,7 @@ void WaylandServer::initScreenLocker()
+ screenLockerApp, &ScreenLocker::KSldApp::userActivity);
+ }
+ ScreenLocker::KSldApp::self()->setWaylandFd(-1);
++ Compositor::self()->scene()->addRepaintFull();
+ }
+ );
+
+--
+GitLab
+
diff --git a/kde-plasma/kwin/files/kwin-5.24.4-waylandserver-lockScreenShown.patch b/kde-plasma/kwin/files/kwin-5.24.4-waylandserver-lockScreenShown.patch
new file mode 100644
index 000000000000..4defd5ae5945
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.24.4-waylandserver-lockScreenShown.patch
@@ -0,0 +1,93 @@
+From 9d38f57d84fb9a6f2c4e60f7051f685842f34e0f Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <xaver.hugl@gmail.com>
+Date: Mon, 28 Mar 2022 18:08:59 +0200
+Subject: [PATCH] waylandserver: only signal lockScreenShown once it has
+ actually been shown
+
+When the system goes to suspend and screen locking for suspend is enabled,
+suspend is inhibited until ScreenLocker::KSldApp::self()->lockScreenShown()
+gets called, in order to make sure that the lockscreen is shown before the
+system goes to standby, and thus also when the system wakes (instead of
+potentially sensitive user information).
+However, signalling that when the lockscreen gets mapped can't work reliably,
+as it's then a matter of timing whether or not KWin actually presents an
+image with the lockscreen before suspending. To fix that, this commit replaces
+that logic with only calling lockScreenShown once every output actually got a
+lockscreen presented.
+---
+ src/wayland_server.cpp | 25 +++++++++++++++++++++----
+ src/wayland_server.h | 10 ++++++++++
+ 2 files changed, 31 insertions(+), 4 deletions(-)
+
+diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp
+index c850a1b697..6d5e1206a5 100644
+--- a/src/wayland_server.cpp
++++ b/src/wayland_server.cpp
+@@ -213,10 +213,6 @@ KWaylandServer::ClientConnection *WaylandServer::inputMethodConnection() const
+
+ void WaylandServer::registerShellClient(AbstractClient *client)
+ {
+- if (client->isLockScreen()) {
+- ScreenLocker::KSldApp::self()->lockScreenShown();
+- }
+-
+ if (client->readyForPainting()) {
+ Q_EMIT shellClientAdded(client);
+ } else {
+@@ -623,6 +619,8 @@ void WaylandServer::initScreenLocker()
+ m_screenLockerClientConnection = nullptr;
+ }
+
++ new LockScreenPresentationWatcher(this);
++
+ const QVector<SeatInterface *> seatIfaces = m_display->seats();
+ for (auto *seat : seatIfaces) {
+ disconnect(seat, &KWaylandServer::SeatInterface::timestampChanged,
+@@ -797,4 +795,23 @@ QString WaylandServer::socketName() const
+ return QString();
+ }
+
++WaylandServer::LockScreenPresentationWatcher::LockScreenPresentationWatcher(WaylandServer *server)
++{
++ connect(server, &WaylandServer::shellClientAdded, this, [this](AbstractClient *client) {
++ if (client->isLockScreen()) {
++ connect(client->output()->renderLoop(), &RenderLoop::framePresented, this, [this, client]() {
++ // only signal lockScreenShown once all outputs have been presented at least once
++ m_signaledOutputs << client->output();
++ if (m_signaledOutputs.size() == kwinApp()->platform()->enabledOutputs().size()) {
++ ScreenLocker::KSldApp::self()->lockScreenShown();
++ delete this;
++ }
++ });
++ }
++ });
++ QTimer::singleShot(1000, this, [this]() {
++ ScreenLocker::KSldApp::self()->lockScreenShown();
++ delete this;
++ });
++}
+ }
+diff --git a/src/wayland_server.h b/src/wayland_server.h
+index bf1ba6eee5..58dda9a7a2 100644
+--- a/src/wayland_server.h
++++ b/src/wayland_server.h
+@@ -243,6 +243,16 @@ private:
+ void handleOutputRemoved(AbstractOutput *output);
+ void handleOutputEnabled(AbstractOutput *output);
+ void handleOutputDisabled(AbstractOutput *output);
++
++ class LockScreenPresentationWatcher : public QObject
++ {
++ public:
++ LockScreenPresentationWatcher(WaylandServer *server);
++
++ private:
++ QSet<AbstractOutput *> m_signaledOutputs;
++ };
++
+ KWaylandServer::Display *m_display = nullptr;
+ KWaylandServer::CompositorInterface *m_compositor = nullptr;
+ KWaylandServer::SeatInterface *m_seat = nullptr;
+--
+GitLab
+
diff --git a/kde-plasma/kwin/files/kwin-5.24.4-waylandserver-move-LockScreenPresentationWatcher.patch b/kde-plasma/kwin/files/kwin-5.24.4-waylandserver-move-LockScreenPresentationWatcher.patch
new file mode 100644
index 000000000000..0607e2ff3030
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.24.4-waylandserver-move-LockScreenPresentationWatcher.patch
@@ -0,0 +1,36 @@
+From 388402c3b1b37d9f72597aae8d6670e8c0edeb14 Mon Sep 17 00:00:00 2001
+From: Xaver Hugl <xaver.hugl@gmail.com>
+Date: Wed, 6 Apr 2022 21:08:25 +0200
+Subject: [PATCH] waylandserver: move LockScreenPresentationWatcher to the
+ correct place
+
+CCBUG: 452334
+---
+ src/wayland_server.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp
+index 6d5e1206a5..eb3600f824 100644
+--- a/src/wayland_server.cpp
++++ b/src/wayland_server.cpp
+@@ -603,6 +603,8 @@ void WaylandServer::initScreenLocker()
+ }
+ ScreenLocker::KSldApp::self()->setWaylandFd(clientFd);
+
++ new LockScreenPresentationWatcher(this);
++
+ const QVector<SeatInterface *> seatIfaces = m_display->seats();
+ for (auto *seat : seatIfaces) {
+ connect(seat, &KWaylandServer::SeatInterface::timestampChanged,
+@@ -619,8 +621,6 @@ void WaylandServer::initScreenLocker()
+ m_screenLockerClientConnection = nullptr;
+ }
+
+- new LockScreenPresentationWatcher(this);
+-
+ const QVector<SeatInterface *> seatIfaces = m_display->seats();
+ for (auto *seat : seatIfaces) {
+ disconnect(seat, &KWaylandServer::SeatInterface::timestampChanged,
+--
+GitLab
+
diff --git a/kde-plasma/kwin/files/kwin-5.24.4-xdgactivation-demand-attention.patch b/kde-plasma/kwin/files/kwin-5.24.4-xdgactivation-demand-attention.patch
new file mode 100644
index 000000000000..8efa6b637222
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.24.4-xdgactivation-demand-attention.patch
@@ -0,0 +1,32 @@
+From 5390a4978f3a3903ede15ecd94a750b37931fbd2 Mon Sep 17 00:00:00 2001
+From: Aleix Pol <aleixpol@kde.org>
+Date: Wed, 6 Apr 2022 00:33:21 +0200
+Subject: [PATCH] xdgactivation: Demand attention when a process fails to
+ resolve its token
+
+In xdg_activation_v1, if a process fails to negotiate activation, at
+least decorate it as demanding attention.
+This will give apps ways to indicate attention is required. It can can also
+help detect clients doing weird things.
+
+
+(cherry picked from commit 52035f43b90738e2efb4fd7b482719c1ea458578)
+---
+ src/xdgactivationv1.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/xdgactivationv1.cpp b/src/xdgactivationv1.cpp
+index e2270a3393..97f8575c29 100644
+--- a/src/xdgactivationv1.cpp
++++ b/src/xdgactivationv1.cpp
+@@ -76,6 +76,7 @@ void XdgActivationV1Integration::activateSurface(SurfaceInterface *surface, cons
+
+ if (!m_currentActivationToken || m_currentActivationToken->token != token) {
+ qCDebug(KWIN_CORE) << "Refusing to activate " << client << " (provided token: " << token << ", current token:" << (m_currentActivationToken ? m_currentActivationToken->token : QStringLiteral("null")) << ")";
++ client->demandAttention();
+ return;
+ }
+
+--
+GitLab
+
diff --git a/kde-plasma/kwin/kwin-5.24.4-r1.ebuild b/kde-plasma/kwin/kwin-5.24.4-r1.ebuild
new file mode 100644
index 000000000000..e84dda447284
--- /dev/null
+++ b/kde-plasma/kwin/kwin-5.24.4-r1.ebuild
@@ -0,0 +1,145 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_HANDBOOK="optional"
+ECM_TEST="optional"
+KFMIN=5.90.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.19
+ >=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/kdbusaddons-${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/plasma-wayland-protocols
+ >=dev-libs/wayland-protocols-1.19
+ )
+"
+BDEPEND="test? ( >=dev-qt/qtwaylandscanner-${QTMIN}:5 )"
+PDEPEND=">=kde-plasma/kde-cli-tools-${PVCUT}:5"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-waylandserver-lockScreenShown.patch
+ "${FILESDIR}"/${P}-xdgactivation-demand-attention.patch
+ "${FILESDIR}"/${P}-waylandserver-move-LockScreenPresentationWatcher.patch
+ "${FILESDIR}"/${P}-backends-drm-dont-perm-disable-vrr.patch
+ "${FILESDIR}"/${P}-backends-drm-fetch-immutable-blobs.patch # KDE-bug 449285
+ "${FILESDIR}"/${P}-dont-send-geom-to-text-input.patch
+ "${FILESDIR}"/${P}-fix-current-VD-always-added.patch # KDE-bug 452171
+ "${FILESDIR}"/${P}-dont-use-xcb-in-wayland.patch # KDE-bug 450564
+ "${FILESDIR}"/${P}-fix-unlocking-wayland-sessions.patch # KDE-bug 447705
+)
+
+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\""
+}