diff options
Diffstat (limited to 'kde-plasma/kwin/files')
5 files changed, 162 insertions, 454 deletions
diff --git a/kde-plasma/kwin/files/kwin-5.18.5-dont-exec-QDialog.patch b/kde-plasma/kwin/files/kwin-5.18.5-dont-exec-QDialog.patch deleted file mode 100644 index df65c32fb13a..000000000000 --- a/kde-plasma/kwin/files/kwin-5.18.5-dont-exec-QDialog.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 5ea54eda5d1f91428933d338ea8b950aea86d43a Mon Sep 17 00:00:00 2001 -From: Kai Uwe Broulik <kde@privat.broulik.de> -Date: Wed, 6 May 2020 15:15:03 +0200 -Subject: [kcmkwin/kwindecoration] Don't exec() QDialog - -Using nested event loops with QML is always troublesome. - -BUG: 421053 -FIXED-IN: 5.18.6 - -Differential Revision: https://phabricator.kde.org/D29473 ---- - .../declarative-plugin/previewbridge.cpp | 32 +++++++++++++++------- - .../declarative-plugin/previewbridge.h | 4 ++- - .../kwindecoration/package/contents/ui/Themes.qml | 3 +- - 3 files changed, 27 insertions(+), 12 deletions(-) - -diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewbridge.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewbridge.cpp -index bad4cc1..83a9bd9 100644 ---- a/kcmkwin/kwindecoration/declarative-plugin/previewbridge.cpp -+++ b/kcmkwin/kwindecoration/declarative-plugin/previewbridge.cpp -@@ -36,7 +36,11 @@ - #include <QDialog> - #include <QDialogButtonBox> - #include <QPushButton> -+#include <QQuickItem> -+#include <QQuickRenderControl> -+#include <QQuickWindow> - #include <QVBoxLayout> -+#include <QWindow> - - namespace KDecoration2 - { -@@ -173,15 +177,16 @@ DecorationButton *PreviewBridge::createButton(KDecoration2::Decoration *decorati - return m_factory->create<KDecoration2::DecorationButton>(QStringLiteral("button"), parent, QVariantList({QVariant::fromValue(type), QVariant::fromValue(decoration)})); - } - --void PreviewBridge::configure() -+void PreviewBridge::configure(QQuickItem *ctx) - { - if (!m_valid) { - return; - } - //setup the UI -- QDialog dialog; -+ QDialog *dialog = new QDialog(); -+ dialog->setAttribute(Qt::WA_DeleteOnClose); - if (m_lastCreatedClient) { -- dialog.setWindowTitle(m_lastCreatedClient->caption()); -+ dialog->setWindowTitle(m_lastCreatedClient->caption()); - } - - // create the KCModule through the plugintrader -@@ -189,7 +194,7 @@ void PreviewBridge::configure() - if (!m_theme.isNull()) { - args.insert(QStringLiteral("theme"), m_theme); - } -- KCModule *kcm = m_factory->create<KCModule>(QStringLiteral("kcmodule"), &dialog, QVariantList({args})); -+ KCModule *kcm = m_factory->create<KCModule>(QStringLiteral("kcmodule"), dialog, QVariantList({args})); - if (!kcm) { - return; - } -@@ -205,28 +210,35 @@ void PreviewBridge::configure() - QStringLiteral("reloadConfig")); - QDBusConnection::sessionBus().send(message); - }; -- connect(&dialog, &QDialog::accepted, this, save); -+ connect(dialog, &QDialog::accepted, this, save); - - QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | - QDialogButtonBox::Cancel | - QDialogButtonBox::RestoreDefaults | - QDialogButtonBox::Reset, -- &dialog); -+ dialog); - - QPushButton *reset = buttons->button(QDialogButtonBox::Reset); - reset->setEnabled(false); - // Here we connect our buttons with the dialog -- connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); -- connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); -+ connect(buttons, &QDialogButtonBox::accepted, dialog, &QDialog::accept); -+ connect(buttons, &QDialogButtonBox::rejected, dialog, &QDialog::reject); - connect(reset, &QPushButton::clicked, kcm, &KCModule::load); - auto changedSignal = static_cast<void(KCModule::*)(bool)>(&KCModule::changed); - connect(kcm, changedSignal, reset, &QPushButton::setEnabled); - connect(buttons->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, kcm, &KCModule::defaults); - -- QVBoxLayout *layout = new QVBoxLayout(&dialog); -+ QVBoxLayout *layout = new QVBoxLayout(dialog); - layout->addWidget(kcm); - layout->addWidget(buttons); -- dialog.exec(); -+ -+ if (ctx->window()) { -+ dialog->winId(); // so it creates windowHandle -+ dialog->windowHandle()->setTransientParent(QQuickRenderControl::renderWindowFor(ctx->window())); -+ dialog->setModal(true); -+ } -+ -+ dialog->show(); - } - - BridgeItem::BridgeItem(QObject *parent) -diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewbridge.h b/kcmkwin/kwindecoration/declarative-plugin/previewbridge.h -index 7e1d8f3..85fccbe 100644 ---- a/kcmkwin/kwindecoration/declarative-plugin/previewbridge.h -+++ b/kcmkwin/kwindecoration/declarative-plugin/previewbridge.h -@@ -26,6 +26,8 @@ - #include <QList> - #include <QPointer> - -+class QQuickItem; -+ - class KPluginFactory; - - namespace KDecoration2 -@@ -70,7 +72,7 @@ public: - KDecoration2::DecorationButton *createButton(KDecoration2::Decoration *decoration, KDecoration2::DecorationButtonType type, QObject *parent = nullptr); - - public Q_SLOTS: -- void configure(); -+ void configure(QQuickItem *ctx); - - Q_SIGNALS: - void pluginChanged(); -diff --git a/kcmkwin/kwindecoration/package/contents/ui/Themes.qml b/kcmkwin/kwindecoration/package/contents/ui/Themes.qml -index 28e5899..1eeb4cd 100644 ---- a/kcmkwin/kwindecoration/package/contents/ui/Themes.qml -+++ b/kcmkwin/kwindecoration/package/contents/ui/Themes.qml -@@ -40,6 +40,7 @@ KCM.GridView { - view.implicitCellWidth: Kirigami.Units.gridUnit * 18 - - view.delegate: KCM.GridDelegate { -+ id: delegate - text: model.display - - thumbnailAvailable: true -@@ -101,7 +102,7 @@ KCM.GridView { - onTriggered: { - kcm.theme = index - view.currentIndex = index -- bridgeItem.bridge.configure() -+ bridgeItem.bridge.configure(delegate) - } - } - ] --- -cgit v1.1 diff --git a/kde-plasma/kwin/files/kwin-5.18.5-mesa-21.patch b/kde-plasma/kwin/files/kwin-5.18.5-mesa-21.patch deleted file mode 100644 index dc87b4045483..000000000000 --- a/kde-plasma/kwin/files/kwin-5.18.5-mesa-21.patch +++ /dev/null @@ -1,193 +0,0 @@ -From 2c76cc4784382b3df9b5413860d0793ea26cea31 Mon Sep 17 00:00:00 2001 -From: Vlad Zahorodnii <vlad.zahorodnii@kde.org> -Date: Fri, 29 May 2020 16:01:27 +0300 -Subject: [wayland] Fix misuse of EGL/eglmesaext.h - -The recommended way to get all EGL extension defines is to include -EGL/eglext.h. EGL/eglmesaext.h is a private header that compositors -should not use. - -BUG: 422131 ---- - .../scenes/opengl/abstract_egl_backend.cpp | 11 +--- - platformsupport/scenes/opengl/egl_dmabuf.cpp | 41 +----------- - platformsupport/scenes/opengl/kwineglext.h | 76 ++++++++++++++++++++++ - 3 files changed, 78 insertions(+), 50 deletions(-) - create mode 100644 platformsupport/scenes/opengl/kwineglext.h - -diff --git a/platformsupport/scenes/opengl/abstract_egl_backend.cpp b/platformsupport/scenes/opengl/abstract_egl_backend.cpp -index 532ec27..e160ef3 100644 ---- a/platformsupport/scenes/opengl/abstract_egl_backend.cpp -+++ b/platformsupport/scenes/opengl/abstract_egl_backend.cpp -@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. - *********************************************************************/ - #include "abstract_egl_backend.h" - #include "egl_dmabuf.h" -+#include "kwineglext.h" - #include "texture.h" - #include "composite.h" - #include "egl_context_attribute_builder.h" -@@ -49,16 +50,6 @@ eglBindWaylandDisplayWL_func eglBindWaylandDisplayWL = nullptr; - eglUnbindWaylandDisplayWL_func eglUnbindWaylandDisplayWL = nullptr; - eglQueryWaylandBufferWL_func eglQueryWaylandBufferWL = nullptr; - --#ifndef EGL_WAYLAND_BUFFER_WL --#define EGL_WAYLAND_BUFFER_WL 0x31D5 --#endif --#ifndef EGL_WAYLAND_PLANE_WL --#define EGL_WAYLAND_PLANE_WL 0x31D6 --#endif --#ifndef EGL_WAYLAND_Y_INVERTED_WL --#define EGL_WAYLAND_Y_INVERTED_WL 0x31DB --#endif -- - AbstractEglBackend::AbstractEglBackend() - : QObject(nullptr) - , OpenGLBackend() -diff --git a/platformsupport/scenes/opengl/egl_dmabuf.cpp b/platformsupport/scenes/opengl/egl_dmabuf.cpp -index 3f75bc7..753f15e 100644 ---- a/platformsupport/scenes/opengl/egl_dmabuf.cpp -+++ b/platformsupport/scenes/opengl/egl_dmabuf.cpp -@@ -21,10 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. - #include "egl_dmabuf.h" - - #include "drm_fourcc.h" -+#include "kwineglext.h" - #include "../../../wayland_server.h" - - #include <unistd.h> --#include <EGL/eglmesaext.h> - - namespace KWin - { -@@ -34,45 +34,6 @@ typedef EGLBoolean (*eglQueryDmaBufModifiersEXT_func) (EGLDisplay dpy, EGLint fo - eglQueryDmaBufFormatsEXT_func eglQueryDmaBufFormatsEXT = nullptr; - eglQueryDmaBufModifiersEXT_func eglQueryDmaBufModifiersEXT = nullptr; - --#ifndef EGL_EXT_image_dma_buf_import --#define EGL_LINUX_DMA_BUF_EXT 0x3270 --#define EGL_LINUX_DRM_FOURCC_EXT 0x3271 --#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 --#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 --#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 --#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 --#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 --#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 --#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 --#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 --#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A --#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B --#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C --#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D --#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E --#define EGL_ITU_REC601_EXT 0x327F --#define EGL_ITU_REC709_EXT 0x3280 --#define EGL_ITU_REC2020_EXT 0x3281 --#define EGL_YUV_FULL_RANGE_EXT 0x3282 --#define EGL_YUV_NARROW_RANGE_EXT 0x3283 --#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 --#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 --#endif // EGL_EXT_image_dma_buf_import -- --#ifndef EGL_EXT_image_dma_buf_import_modifiers --#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440 --#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441 --#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442 --#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443 --#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444 --#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445 --#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446 --#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447 --#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448 --#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449 --#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A --#endif // EGL_EXT_image_dma_buf_import_modifiers -- - struct YuvPlane - { - int widthDivisor; -diff --git a/platformsupport/scenes/opengl/kwineglext.h b/platformsupport/scenes/opengl/kwineglext.h -new file mode 100644 -index 0000000..834701b ---- /dev/null -+++ b/platformsupport/scenes/opengl/kwineglext.h -@@ -0,0 +1,76 @@ -+/******************************************************************** -+ KWin - the KDE window manager -+ This file is part of the KDE project. -+ -+Copyright (C) 2018 Fredrik Höglund <fredrik@kde.org> -+Copyright (C) 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org> -+ -+This program is free software; you can redistribute it and/or modify -+it under the terms of the GNU General Public License as published by -+the Free Software Foundation; either version 2 of the License, or -+(at your option) any later version. -+ -+This program is distributed in the hope that it will be useful, -+but WITHOUT ANY WARRANTY; without even the implied warranty of -+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+GNU General Public License for more details. -+ -+You should have received a copy of the GNU General Public License -+along with this program. If not, see <http://www.gnu.org/licenses/>. -+*********************************************************************/ -+ -+#ifndef KWINEGLEXT_H -+#define KWINEGLEXT_H -+ -+#include <EGL/eglext.h> -+ -+#ifndef EGL_WL_bind_wayland_display -+#define EGL_WAYLAND_BUFFER_WL 0x31D5 -+#define EGL_WAYLAND_PLANE_WL 0x31D6 -+#define EGL_TEXTURE_Y_U_V_WL 0x31D7 -+#define EGL_TEXTURE_Y_UV_WL 0x31D8 -+#define EGL_TEXTURE_Y_XUXV_WL 0x31D9 -+#define EGL_TEXTURE_EXTERNAL_WL 0x31DA -+#define EGL_WAYLAND_Y_INVERTED_WL 0x31DB -+#endif // EGL_WL_bind_wayland_display -+ -+#ifndef EGL_EXT_image_dma_buf_import -+#define EGL_LINUX_DMA_BUF_EXT 0x3270 -+#define EGL_LINUX_DRM_FOURCC_EXT 0x3271 -+#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 -+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 -+#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 -+#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 -+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 -+#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 -+#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 -+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 -+#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A -+#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B -+#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C -+#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D -+#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E -+#define EGL_ITU_REC601_EXT 0x327F -+#define EGL_ITU_REC709_EXT 0x3280 -+#define EGL_ITU_REC2020_EXT 0x3281 -+#define EGL_YUV_FULL_RANGE_EXT 0x3282 -+#define EGL_YUV_NARROW_RANGE_EXT 0x3283 -+#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 -+#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 -+#endif // EGL_EXT_image_dma_buf_import -+ -+#ifndef EGL_EXT_image_dma_buf_import_modifiers -+#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440 -+#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441 -+#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442 -+#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443 -+#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444 -+#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445 -+#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446 -+#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447 -+#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448 -+#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449 -+#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A -+#endif // EGL_EXT_image_dma_buf_import_modifiers -+ -+#endif // KWINEGLEXT_H --- -cgit v1.1 - diff --git a/kde-plasma/kwin/files/kwin-5.18.5-qt-5.15.patch b/kde-plasma/kwin/files/kwin-5.18.5-qt-5.15.patch deleted file mode 100644 index eb8f6617026c..000000000000 --- a/kde-plasma/kwin/files/kwin-5.18.5-qt-5.15.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ec602e0c2a676aed0707c7fb7edfe964516dbc77 Mon Sep 17 00:00:00 2001 -From: Fabian Vogt <fabian@ritter-vogt.de> -Date: Sun, 7 Jun 2020 18:05:21 +0200 -Subject: [PATCH] Fix the Plastik decoration with Qt 5.15 - -The trick in qmldir no longer works with Qt 5.15, so use a more reliable -approach. This way works with Qt 5.15 and also on previous versions of Qt. ---- - .../kdecorations/aurorae/themes/plastik/code/plastikplugin.cpp | 3 ++- - plugins/kdecorations/aurorae/themes/plastik/code/qmldir | 3 --- - 2 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/plugins/kdecorations/aurorae/themes/plastik/code/plastikplugin.cpp b/plugins/kdecorations/aurorae/themes/plastik/code/plastikplugin.cpp -index 25d11251f..4304dcdc1 100644 ---- a/plugins/kdecorations/aurorae/themes/plastik/code/plastikplugin.cpp -+++ b/plugins/kdecorations/aurorae/themes/plastik/code/plastikplugin.cpp -@@ -20,7 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. - - void PlastikPlugin::registerTypes(const char *uri) - { -- Q_UNUSED(uri) -+ // Need to register something to tell Qt that it loaded (QTBUG-84571) -+ qmlRegisterModule(uri, 1, 0); - } - - void PlastikPlugin::initializeEngine(QQmlEngine *engine, const char *uri) -diff --git a/plugins/kdecorations/aurorae/themes/plastik/code/qmldir b/plugins/kdecorations/aurorae/themes/plastik/code/qmldir -index 49a4b402d..aa7bf16b3 100644 ---- a/plugins/kdecorations/aurorae/themes/plastik/code/qmldir -+++ b/plugins/kdecorations/aurorae/themes/plastik/code/qmldir -@@ -1,5 +1,2 @@ - module org.kde.kwin.decorations.plastik - plugin plastikplugin -- --# we need to have at least one element of Qt is not able to find the plugin *shrug* --Foo 1.0 Foo.qml --- -2.27.0 - diff --git a/kde-plasma/kwin/files/kwin-5.18.5-wayland-lockscreen-greeter.patch b/kde-plasma/kwin/files/kwin-5.18.5-wayland-lockscreen-greeter.patch deleted file mode 100644 index ac4b9d24c8e1..000000000000 --- a/kde-plasma/kwin/files/kwin-5.18.5-wayland-lockscreen-greeter.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 6f8b8efb338117ee197092e46b25b489b612257d Mon Sep 17 00:00:00 2001 -From: Vlad Zahorodnii <vlad.zahorodnii@kde.org> -Date: Fri, 8 May 2020 11:26:27 +0300 -Subject: [wayland] Place lockscreen greeter above other windows - -Summary: BUG: 420802 - -Reviewers: #kwin, davidedmundson - -Reviewed By: #kwin, davidedmundson - -Subscribers: apol, kwin - -Tags: #kwin - -Differential Revision: https://phabricator.kde.org/D29523 ---- - abstract_client.cpp | 2 ++ - autotests/integration/lockscreen.cpp | 19 +++++++++++++++++++ - 2 files changed, 21 insertions(+) - -diff --git a/abstract_client.cpp b/abstract_client.cpp -index ca6c422..48918e7 100644 ---- a/abstract_client.cpp -+++ b/abstract_client.cpp -@@ -275,6 +275,8 @@ Layer AbstractClient::belongsToLayer() const - // Since the desktop is also activated, nothing should be in the ActiveLayer, though - if (isInternal()) - return UnmanagedLayer; -+ if (isLockScreen()) -+ return UnmanagedLayer; - if (isDesktop()) - return workspace()->showingDesktop() ? AboveLayer : DesktopLayer; - if (isSplash()) // no damn annoying splashscreens -diff --git a/autotests/integration/lockscreen.cpp b/autotests/integration/lockscreen.cpp -index e258540..82cac09 100644 ---- a/autotests/integration/lockscreen.cpp -+++ b/autotests/integration/lockscreen.cpp -@@ -62,6 +62,7 @@ private Q_SLOTS: - void initTestCase(); - void init(); - void cleanup(); -+ void testStackingOrder(); - void testPointer(); - void testPointerButton(); - void testPointerAxis(); -@@ -223,6 +224,24 @@ void LockScreenTest::cleanup() - Test::destroyWaylandConnection(); - } - -+void LockScreenTest::testStackingOrder() -+{ -+ // This test verifies that the lockscreen greeter is placed above other windows. -+ -+ QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); -+ QVERIFY(clientAddedSpy.isValid()); -+ -+ LOCK -+ QVERIFY(clientAddedSpy.wait()); -+ -+ AbstractClient *client = clientAddedSpy.first().first().value<AbstractClient *>(); -+ QVERIFY(client); -+ QVERIFY(client->isLockScreen()); -+ QCOMPARE(client->layer(), UnmanagedLayer); -+ -+ UNLOCK -+} -+ - void LockScreenTest::testPointer() - { - using namespace KWayland::Client; --- -cgit v1.1 diff --git a/kde-plasma/kwin/files/kwin-5.19.5-safe-removal-of-X11-event-filters.patch b/kde-plasma/kwin/files/kwin-5.19.5-safe-removal-of-X11-event-filters.patch new file mode 100644 index 000000000000..7eeccf6e8c5f --- /dev/null +++ b/kde-plasma/kwin/files/kwin-5.19.5-safe-removal-of-X11-event-filters.patch @@ -0,0 +1,162 @@ +From c5880833d94330d022c4b6fc84c175aadeaf9632 Mon Sep 17 00:00:00 2001 +From: Vlad Zahorodnii <vlad.zahorodnii@kde.org> +Date: Tue, 22 Sep 2020 08:53:17 +0000 +Subject: [PATCH] x11: Make removal of X11 event filters safe + +If an X11 event filter has been activated and it unregisters another X11 +event filter, then the window manager may crash because the foreach macro +in Workspace::workspaceEvent() makes a copy of m_genericEventFilters or +m_eventFilters and we can call the event() method for an already defunct +filter. + +With this change, X11 event filters can be safely removed and installed +at any particular moment. + +BUG: 423319 + + +(cherry picked from commit a433fb08a3a9255802405a17dd4c8270c68fcb25) +--- + events.cpp | 52 +++++++++++++++++++++++++++++++++++++++++---------- + workspace.cpp | 10 ++++++++++ + workspace.h | 17 +++++++++++++++-- + 3 files changed, 67 insertions(+), 12 deletions(-) + +diff --git a/events.cpp b/events.cpp +index eb3572d13..2e8885d76 100644 +--- a/events.cpp ++++ b/events.cpp +@@ -165,18 +165,34 @@ QVector<QByteArray> s_xcbEerrors({ + + void Workspace::registerEventFilter(X11EventFilter *filter) + { +- if (filter->isGenericEvent()) +- m_genericEventFilters.append(filter); +- else +- m_eventFilters.append(filter); ++ if (filter->isGenericEvent()) { ++ m_genericEventFilters.append(new X11EventFilterContainer(filter)); ++ } else { ++ m_eventFilters.append(new X11EventFilterContainer(filter)); ++ } ++} ++ ++static X11EventFilterContainer *takeEventFilter(X11EventFilter *eventFilter, ++ QList<QPointer<X11EventFilterContainer>> &list) ++{ ++ for (int i = 0; i < list.count(); ++i) { ++ X11EventFilterContainer *container = list.at(i); ++ if (container->filter() == eventFilter) { ++ return list.takeAt(i); ++ } ++ } ++ return nullptr; + } + + void Workspace::unregisterEventFilter(X11EventFilter *filter) + { +- if (filter->isGenericEvent()) +- m_genericEventFilters.removeOne(filter); +- else +- m_eventFilters.removeOne(filter); ++ X11EventFilterContainer *container = nullptr; ++ if (filter->isGenericEvent()) { ++ container = takeEventFilter(filter, m_genericEventFilters); ++ } else { ++ container = takeEventFilter(filter, m_eventFilters); ++ } ++ delete container; + } + + +@@ -219,13 +235,29 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e) + if (eventType == XCB_GE_GENERIC) { + xcb_ge_generic_event_t *ge = reinterpret_cast<xcb_ge_generic_event_t *>(e); + +- foreach (X11EventFilter *filter, m_genericEventFilters) { ++ // We need to make a shadow copy of the event filter list because an activated event ++ // filter may mutate it by removing or installing another event filter. ++ const auto eventFilters = m_genericEventFilters; ++ ++ for (X11EventFilterContainer *container : eventFilters) { ++ if (!container) { ++ continue; ++ } ++ X11EventFilter *filter = container->filter(); + if (filter->extension() == ge->extension && filter->genericEventTypes().contains(ge->event_type) && filter->event(e)) { + return true; + } + } + } else { +- foreach (X11EventFilter *filter, m_eventFilters) { ++ // We need to make a shadow copy of the event filter list because an activated event ++ // filter may mutate it by removing or installing another event filter. ++ const auto eventFilters = m_eventFilters; ++ ++ for (X11EventFilterContainer *container : eventFilters) { ++ if (!container) { ++ continue; ++ } ++ X11EventFilter *filter = container->filter(); + if (filter->eventTypes().contains(eventType) && filter->event(e)) { + return true; + } +diff --git a/workspace.cpp b/workspace.cpp +index a87a622e9..fd3634b16 100644 +--- a/workspace.cpp ++++ b/workspace.cpp +@@ -66,6 +66,16 @@ namespace KWin + extern int screen_number; + extern bool is_multihead; + ++X11EventFilterContainer::X11EventFilterContainer(X11EventFilter *filter) ++ : m_filter(filter) ++{ ++} ++ ++X11EventFilter *X11EventFilterContainer::filter() const ++{ ++ return m_filter; ++} ++ + ColorMapper::ColorMapper(QObject *parent) + : QObject(parent) + , m_default(kwinApp()->x11DefaultScreen()->default_colormap) +diff --git a/workspace.h b/workspace.h +index 489d7bae4..61fb215a8 100644 +--- a/workspace.h ++++ b/workspace.h +@@ -55,6 +55,19 @@ class X11Client; + class X11EventFilter; + enum class Predicate; + ++class X11EventFilterContainer : public QObject ++{ ++ Q_OBJECT ++ ++public: ++ explicit X11EventFilterContainer(X11EventFilter *filter); ++ ++ X11EventFilter *filter() const; ++ ++private: ++ X11EventFilter *m_filter; ++}; ++ + class KWIN_EXPORT Workspace : public QObject + { + Q_OBJECT +@@ -654,8 +667,8 @@ private: + + QScopedPointer<KillWindow> m_windowKiller; + +- QList<X11EventFilter *> m_eventFilters; +- QList<X11EventFilter *> m_genericEventFilters; ++ QList<QPointer<X11EventFilterContainer>> m_eventFilters; ++ QList<QPointer<X11EventFilterContainer>> m_genericEventFilters; + QScopedPointer<X11EventFilter> m_movingClientFilter; + QScopedPointer<X11EventFilter> m_syncAlarmFilter; + +-- +GitLab + |