commit:     fc03ea97850597e3d1f70a5189080af4078ee272
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat May 16 22:02:17 2020 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat May 16 22:38:09 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc03ea97

kde-plasma/kwin: Don't exec() QDialog

KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=421
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../kwin/files/kwin-5.18.5-dont-exec-QDialog.patch | 149 +++++++++++++++++++++
 kde-plasma/kwin/kwin-5.18.5-r1.ebuild              | 116 ++++++++++++++++
 2 files changed, 265 insertions(+)

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
new file mode 100644
index 00000000000..df65c32fb13
--- /dev/null
+++ b/kde-plasma/kwin/files/kwin-5.18.5-dont-exec-QDialog.patch
@@ -0,0 +1,149 @@
+From 5ea54eda5d1f91428933d338ea8b950aea86d43a Mon Sep 17 00:00:00 2001
+From: Kai Uwe Broulik <k...@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/kwin-5.18.5-r1.ebuild 
b/kde-plasma/kwin/kwin-5.18.5-r1.ebuild
new file mode 100644
index 00000000000..c755f96bbcf
--- /dev/null
+++ b/kde-plasma/kwin/kwin-5.18.5-r1.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+ECM_HANDBOOK="optional"
+ECM_TEST="optional"
+KFMIN=5.66.0
+PVCUT=$(ver_cut 1-3)
+QTMIN=5.12.3
+VIRTUALX_REQUIRED="test"
+inherit ecm kde.org
+
+DESCRIPTION="Flexible, composited Window Manager for windowing systems on 
Linux"
+
+LICENSE="GPL-2+"
+SLOT="5"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
+IUSE="caps gles2-only multimedia"
+
+COMMON_DEPEND="
+       >=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/kinit-${KFMIN}:5
+       >=kde-frameworks/kio-${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
+       >=dev-qt/qtdbus-${QTMIN}:5
+       >=dev-qt/qtdeclarative-${QTMIN}:5
+       >=dev-qt/qtgui-${QTMIN}:5=[gles2-only=]
+       >=dev-qt/qtscript-${QTMIN}:5
+       >=dev-qt/qtsensors-${QTMIN}:5
+       >=dev-qt/qtwidgets-${QTMIN}:5
+       >=dev-qt/qtx11extras-${QTMIN}:5
+       >=dev-libs/libinput-1.9
+       >=dev-libs/wayland-1.2
+       media-libs/fontconfig
+       media-libs/freetype
+       media-libs/libepoxy
+       media-libs/mesa[egl,gbm,wayland,X(+)]
+       virtual/libudev:=
+       x11-libs/libICE
+       x11-libs/libSM
+       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
+       caps? ( sys-libs/libcap )
+       gles2-only? ( media-libs/mesa[gles2] )
+"
+RDEPEND="${COMMON_DEPEND}
+       >=kde-frameworks/kirigami-${KFMIN}:5
+       >=dev-qt/qtquickcontrols-${QTMIN}:5
+       >=dev-qt/qtquickcontrols2-${QTMIN}:5
+       >=dev-qt/qtvirtualkeyboard-${QTMIN}:5
+       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
+"
+PDEPEND="
+       >=kde-plasma/kde-cli-tools-${PVCUT}:5
+"
+
+RESTRICT+=" test"
+
+PATCHES=(
+       # in Plasma/5.18
+       "${FILESDIR}/${P}-dont-exec-QDialog.patch" # KDE-bug 421053
+)
+
+src_prepare() {
+       ecm_src_prepare
+       use multimedia || eapply 
"${FILESDIR}/${PN}-5.16.80-gstreamer-optional.patch"
+
+       # Access violations, bug #640432
+       sed -e "s/^ecm_find_qmlmodule.*QtMultimedia/#&/" \
+               -i CMakeLists.txt || die
+}
+
+src_configure() {
+       local mycmakeargs=(
+               $(cmake_use_find_package caps Libcap)
+       )
+
+       ecm_src_configure
+}

Reply via email to