[arch-commits] Commit in deepin-qt5platform-plugins/repos/community-x86_64 (7 files)

Balló György bgyorgy at archlinux.org
Thu May 13 06:42:23 UTC 2021


    Date: Thursday, May 13, 2021 @ 06:42:22
  Author: bgyorgy
Revision: 932915

archrelease: copy trunk to community-x86_64

Added:
  deepin-qt5platform-plugins/repos/community-x86_64/PKGBUILD
    (from rev 932914, deepin-qt5platform-plugins/trunk/PKGBUILD)
  deepin-qt5platform-plugins/repos/community-x86_64/deepin-only.patch
    (from rev 932914, deepin-qt5platform-plugins/trunk/deepin-only.patch)
  deepin-qt5platform-plugins/repos/community-x86_64/deepin-qt5platform-plugins-qt5.15.patch
    (from rev 932914, deepin-qt5platform-plugins/trunk/deepin-qt5platform-plugins-qt5.15.patch)
  deepin-qt5platform-plugins/repos/community-x86_64/fix-crasher.patch
    (from rev 932914, deepin-qt5platform-plugins/trunk/fix-crasher.patch)
Deleted:
  deepin-qt5platform-plugins/repos/community-x86_64/PKGBUILD
  deepin-qt5platform-plugins/repos/community-x86_64/deepin-qt5platform-plugins-qt5.15.patch
  deepin-qt5platform-plugins/repos/community-x86_64/fix-crasher.patch

-----------------------------------------+
 PKGBUILD                                |   95 ++++++-----
 deepin-only.patch                       |   46 +++++
 deepin-qt5platform-plugins-qt5.15.patch |  238 ++++++++++++++---------------
 fix-crasher.patch                       |  242 +++++++++++++++---------------
 4 files changed, 335 insertions(+), 286 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2021-05-13 06:42:14 UTC (rev 932914)
+++ PKGBUILD	2021-05-13 06:42:22 UTC (rev 932915)
@@ -1,46 +0,0 @@
-# Maintainer: Felix Yan <felixonmars at archlinux.org>
-
-pkgname=deepin-qt5platform-plugins
-pkgver=5.0.23
-pkgrel=1
-pkgdesc='Qt platform plugins for DDE'
-arch=('x86_64')
-url="https://github.com/linuxdeepin/qt5platform-plugins"
-license=('GPL3')
-provides=('deepin-qt5dxcb-plugin')
-# FIXME: this platform plugin makes vokoscreen to crash
-# https://github.com/linuxdeepin/qt5platform-plugins/issues/54
-conflicts=('deepin-qt5dxcb-plugin' 'vokoscreen')
-replaces=('deepin-qt5dxcb-plugin')
-depends=('cairo' 'kwayland' 'qt5-wayland' 'qt5-x11extras')
-makedepends=('expac' 'qt5-xcb-private-headers' 'libglvnd' 'libxcb')
-groups=('deepin')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/qt5platform-plugins/archive/$pkgver.tar.gz"
-        'fix-crasher.patch')
-sha512sums=('0efc4294829d39f599c26f9ab6cfa9da93ede9723b7238a1dde0b30b0ed79bbe5c17b8ab35f9fd5e87dcd3ccfb17e245b4aa0f1f67e6aea424f58061bd833aeb'
-            'fb49ed1bff09b21e6f42f550002fef5dbff7c9913a6ebd839441eba5fa708d7a60d850c4608637f3edb9a7d428778facd7d065c313c9f29988a34338df9151ee')
-
-prepare() {
-  cd qt5platform-plugins-$pkgver
-
-  # Upstream fix for the crashes in krita and rapid-photo-downloader
-  patch -Np1 -i ../fix-crasher.patch
-
-  rm -r xcb/libqt5xcbqpa-dev wayland/qtwayland-dev
-  # Disable wayland for now: https://github.com/linuxdeepin/qt5platform-plugins/issues/47
-  sed -i '/wayland/d' qt5platform-plugins.pro
-
-  sed -i 's|error(Not support Qt Version: .*)|INCLUDEPATH += /usr/include/qtxcb-private|' xcb/linux.pri
-  sed -i "/qtwayland-dev/a /usr/include/qt/QtWaylandClient/$(expac %v qt5-wayland | cut -d - -f 1) /usr/include/qt/QtXkbCommonSupport/$(expac %v qt5-base | cut -d - -f 1) \\\\" wayland/wayland.pro
-}
-
-build() {
-  cd qt5platform-plugins-$pkgver
-  qmake-qt5 PREFIX=/usr
-  make
-}
-
-package() {
-  cd qt5platform-plugins-$pkgver
-  make INSTALL_ROOT="$pkgdir" install
-}

Copied: deepin-qt5platform-plugins/repos/community-x86_64/PKGBUILD (from rev 932914, deepin-qt5platform-plugins/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2021-05-13 06:42:22 UTC (rev 932915)
@@ -0,0 +1,49 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+
+pkgname=deepin-qt5platform-plugins
+pkgver=5.0.23
+pkgrel=2
+pkgdesc='Qt platform plugins for DDE'
+arch=('x86_64')
+url="https://github.com/linuxdeepin/qt5platform-plugins"
+license=('GPL3')
+provides=('deepin-qt5dxcb-plugin')
+conflicts=('deepin-qt5dxcb-plugin')
+replaces=('deepin-qt5dxcb-plugin')
+depends=('cairo' 'kwayland' 'qt5-wayland' 'qt5-x11extras')
+makedepends=('expac' 'qt5-xcb-private-headers' 'libglvnd' 'libxcb')
+groups=('deepin')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/qt5platform-plugins/archive/$pkgver.tar.gz"
+        'fix-crasher.patch'
+        'deepin-only.patch')
+sha512sums=('0efc4294829d39f599c26f9ab6cfa9da93ede9723b7238a1dde0b30b0ed79bbe5c17b8ab35f9fd5e87dcd3ccfb17e245b4aa0f1f67e6aea424f58061bd833aeb'
+            'fb49ed1bff09b21e6f42f550002fef5dbff7c9913a6ebd839441eba5fa708d7a60d850c4608637f3edb9a7d428778facd7d065c313c9f29988a34338df9151ee'
+            'f36b079226bdd2917fa91c91d577eb03e43b7c20526079afb95304019d91d3a254e1b6cff60e86749a31eac56cf676c0f0b989a8aa16ab48bb272c948a3afcb9')
+
+prepare() {
+  cd qt5platform-plugins-$pkgver
+
+  # Upstream fix for the crashes in krita and rapid-photo-downloader
+  patch -Np1 -i ../fix-crasher.patch
+
+  # Upstream change to only enable dxcb in dde
+  patch -Np1 -i ../deepin-only.patch
+
+  rm -r xcb/libqt5xcbqpa-dev wayland/qtwayland-dev
+  # Disable wayland for now: https://github.com/linuxdeepin/qt5platform-plugins/issues/47
+  sed -i '/wayland/d' qt5platform-plugins.pro
+
+  sed -i 's|error(Not support Qt Version: .*)|INCLUDEPATH += /usr/include/qtxcb-private|' xcb/linux.pri
+  sed -i "/qtwayland-dev/a /usr/include/qt/QtWaylandClient/$(expac %v qt5-wayland | cut -d - -f 1) /usr/include/qt/QtXkbCommonSupport/$(expac %v qt5-base | cut -d - -f 1) \\\\" wayland/wayland.pro
+}
+
+build() {
+  cd qt5platform-plugins-$pkgver
+  qmake-qt5 PREFIX=/usr
+  make
+}
+
+package() {
+  cd qt5platform-plugins-$pkgver
+  make INSTALL_ROOT="$pkgdir" install
+}

Copied: deepin-qt5platform-plugins/repos/community-x86_64/deepin-only.patch (from rev 932914, deepin-qt5platform-plugins/trunk/deepin-only.patch)
===================================================================
--- deepin-only.patch	                        (rev 0)
+++ deepin-only.patch	2021-05-13 06:42:22 UTC (rev 932915)
@@ -0,0 +1,46 @@
+From b41d5c11f626c00bafc226db4d5a72b30cad01d4 Mon Sep 17 00:00:00 2001
+From: justforlxz <justforlxz at gmail.com>
+Date: Thu, 18 Mar 2021 12:43:50 +0800
+Subject: [PATCH] refactor: Only enable dxcb in dde
+
+The default use of dxcb may affect other programs
+
+Issue: Fixes https://github.com/linuxdeepin/qt5integration/issues/41
+Issue: Fixes https://github.com/keepassxreboot/keepassxc/issues/6277
+Log:
+Change-Id: I465e98128c8374b43197377f10a299601d3618b4
+---
+ xcb/main.cpp | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/xcb/main.cpp b/xcb/main.cpp
+index ee8ded4..ceb5fd4 100644
+--- a/xcb/main.cpp
++++ b/xcb/main.cpp
+@@ -36,16 +36,21 @@ class DPlatformIntegrationPlugin : public QPlatformIntegrationPlugin
+ QPlatformIntegration* DPlatformIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv)
+ {
+ #ifdef Q_OS_LINUX
++    bool loadDXcb = false;
++
+     if (qEnvironmentVariableIsSet("D_DXCB_DISABLE")) {
+-        return new DPlatformIntegrationParent(parameters, argc, argv);
++        loadDXcb = false;
++    } else if (system == "dxcb") {
++        loadDXcb = true;
++    } else if (QString(qgetenv("XDG_CURRENT_DESKTOP")).toLower().startsWith("deepin")) {
++        loadDXcb = true;
+     }
+ 
+-    if (system == "dxcb" || system == "xcb") {
+-        return new DPlatformIntegration(parameters, argc, argv);
+-    }
++    return loadDXcb ? new DPlatformIntegration(parameters, argc, argv)
++                    : new DPlatformIntegrationParent(parameters, argc, argv);
+ #endif
+ 
+-    return 0;
++    return nullptr;
+ }
+ 
+ QT_END_NAMESPACE

Deleted: deepin-qt5platform-plugins-qt5.15.patch
===================================================================
--- deepin-qt5platform-plugins-qt5.15.patch	2021-05-13 06:42:14 UTC (rev 932914)
+++ deepin-qt5platform-plugins-qt5.15.patch	2021-05-13 06:42:22 UTC (rev 932915)
@@ -1,119 +0,0 @@
-diff --git a/xcb/dplatformwindowhelper.cpp b/xcb/dplatformwindowhelper.cpp
-index de4478d..a85f14e 100644
---- a/xcb/dplatformwindowhelper.cpp
-+++ b/xcb/dplatformwindowhelper.cpp
-@@ -35,6 +35,8 @@
- #include <private/qguiapplication_p.h>
- #include <qpa/qplatformcursor.h>
- 
-+#include <QPainterPath>
-+
- Q_DECLARE_METATYPE(QPainterPath)
- Q_DECLARE_METATYPE(QMargins)
- 
-@@ -511,10 +513,17 @@ bool DPlatformWindowHelper::setWindowModified(bool modified)
-     return me()->m_frameWindow->handle()->setWindowModified(modified);
- }
- 
-+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
- bool DPlatformWindowHelper::startSystemResize(const QPoint &pos, Qt::Corner corner)
- {
-     return me()->m_frameWindow->handle()->startSystemResize(pos, corner);
- }
-+#else
-+bool DPlatformWindowHelper::startSystemResize(Qt::Edges edges)
-+{
-+    return me()->m_frameWindow->handle()->startSystemResize(edges);
-+}
-+#endif
- 
- void DPlatformWindowHelper::setFrameStrutEventsEnabled(bool enabled)
- {
-diff --git a/xcb/dplatformwindowhelper.h b/xcb/dplatformwindowhelper.h
-index 8d9fa14..e43809a 100644
---- a/xcb/dplatformwindowhelper.h
-+++ b/xcb/dplatformwindowhelper.h
-@@ -92,8 +92,12 @@ public:
- 
-     bool setWindowModified(bool modified);
- 
-+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
-     bool startSystemResize(const QPoint &pos, Qt::Corner corner);
--
-+#else
-+    bool startSystemResize(Qt::Edges edges);
-+#endif
-+    
-     void setFrameStrutEventsEnabled(bool enabled);
-     bool frameStrutEventsEnabled() const;
- 
-diff --git a/xcb/linux.pri b/xcb/linux.pri
-index 3be1e5f..59e237a 100644
---- a/xcb/linux.pri
-+++ b/xcb/linux.pri
-@@ -30,26 +30,37 @@ contains(QT_CONFIG, xcb-xlib)|qtConfig(xcb-xlib) {
-     DEFINES += XCB_USE_XLIB
-     QMAKE_USE += xcb_xlib
- 
--    greaterThan(QT_MINOR_VERSION, 11) {
--        contains(QT_CONFIG, xcb-xinput)|qtConfig(xcb-xinput) {
--            DEFINES += XCB_USE_XINPUT2 XCB_USE_XINPUT21 XCB_USE_XINPUT22
--            QMAKE_USE += xcb_xinput
-+    greaterThan(QT_MINOR_VERSION, 14) {
-+        DEFINES += XCB_USE_XINPUT2 XCB_USE_XINPUT21 XCB_USE_XINPUT22
-+        QMAKE_USE += xcb_xinput
- 
--            !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
--                DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
--                           LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
--                           LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
--            }
-+        !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
-+            DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
-+                       LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
-+                       LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
-         }
-     } else {
--        contains(QT_CONFIG, xinput2)|qtConfig(xinput2) {
--            DEFINES += XCB_USE_XINPUT2
--            QMAKE_USE += xinput2
-+        greaterThan(QT_MINOR_VERSION, 11) {
-+            contains(QT_CONFIG, xcb-xinput)|qtConfig(xcb-xinput) {
-+                DEFINES += XCB_USE_XINPUT2 XCB_USE_XINPUT21 XCB_USE_XINPUT22
-+                QMAKE_USE += xcb_xinput
-+
-+                !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
-+                    DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
-+                               LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
-+                               LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
-+                }
-+            }
-+        } else {
-+            contains(QT_CONFIG, xinput2)|qtConfig(xinput2) {
-+                DEFINES += XCB_USE_XINPUT2
-+                QMAKE_USE += xinput2
- 
--            !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
--                DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
--                           LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
--                           LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
-+                !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
-+                    DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
-+                               LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
-+                               LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
-+                }
-             }
-         }
-     }
-diff --git a/xcb/utility.h b/xcb/utility.h
-index 2e819e1..d3b2677 100644
---- a/xcb/utility.h
-+++ b/xcb/utility.h
-@@ -19,6 +19,7 @@
- #define UTILITY_H
- 
- #include <QImage>
-+#include <QPainterPath>
- 
- #include "global.h"
- 

Copied: deepin-qt5platform-plugins/repos/community-x86_64/deepin-qt5platform-plugins-qt5.15.patch (from rev 932914, deepin-qt5platform-plugins/trunk/deepin-qt5platform-plugins-qt5.15.patch)
===================================================================
--- deepin-qt5platform-plugins-qt5.15.patch	                        (rev 0)
+++ deepin-qt5platform-plugins-qt5.15.patch	2021-05-13 06:42:22 UTC (rev 932915)
@@ -0,0 +1,119 @@
+diff --git a/xcb/dplatformwindowhelper.cpp b/xcb/dplatformwindowhelper.cpp
+index de4478d..a85f14e 100644
+--- a/xcb/dplatformwindowhelper.cpp
++++ b/xcb/dplatformwindowhelper.cpp
+@@ -35,6 +35,8 @@
+ #include <private/qguiapplication_p.h>
+ #include <qpa/qplatformcursor.h>
+ 
++#include <QPainterPath>
++
+ Q_DECLARE_METATYPE(QPainterPath)
+ Q_DECLARE_METATYPE(QMargins)
+ 
+@@ -511,10 +513,17 @@ bool DPlatformWindowHelper::setWindowModified(bool modified)
+     return me()->m_frameWindow->handle()->setWindowModified(modified);
+ }
+ 
++#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ bool DPlatformWindowHelper::startSystemResize(const QPoint &pos, Qt::Corner corner)
+ {
+     return me()->m_frameWindow->handle()->startSystemResize(pos, corner);
+ }
++#else
++bool DPlatformWindowHelper::startSystemResize(Qt::Edges edges)
++{
++    return me()->m_frameWindow->handle()->startSystemResize(edges);
++}
++#endif
+ 
+ void DPlatformWindowHelper::setFrameStrutEventsEnabled(bool enabled)
+ {
+diff --git a/xcb/dplatformwindowhelper.h b/xcb/dplatformwindowhelper.h
+index 8d9fa14..e43809a 100644
+--- a/xcb/dplatformwindowhelper.h
++++ b/xcb/dplatformwindowhelper.h
+@@ -92,8 +92,12 @@ public:
+ 
+     bool setWindowModified(bool modified);
+ 
++#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+     bool startSystemResize(const QPoint &pos, Qt::Corner corner);
+-
++#else
++    bool startSystemResize(Qt::Edges edges);
++#endif
++    
+     void setFrameStrutEventsEnabled(bool enabled);
+     bool frameStrutEventsEnabled() const;
+ 
+diff --git a/xcb/linux.pri b/xcb/linux.pri
+index 3be1e5f..59e237a 100644
+--- a/xcb/linux.pri
++++ b/xcb/linux.pri
+@@ -30,26 +30,37 @@ contains(QT_CONFIG, xcb-xlib)|qtConfig(xcb-xlib) {
+     DEFINES += XCB_USE_XLIB
+     QMAKE_USE += xcb_xlib
+ 
+-    greaterThan(QT_MINOR_VERSION, 11) {
+-        contains(QT_CONFIG, xcb-xinput)|qtConfig(xcb-xinput) {
+-            DEFINES += XCB_USE_XINPUT2 XCB_USE_XINPUT21 XCB_USE_XINPUT22
+-            QMAKE_USE += xcb_xinput
++    greaterThan(QT_MINOR_VERSION, 14) {
++        DEFINES += XCB_USE_XINPUT2 XCB_USE_XINPUT21 XCB_USE_XINPUT22
++        QMAKE_USE += xcb_xinput
+ 
+-            !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
+-                DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
+-                           LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
+-                           LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
+-            }
++        !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
++            DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
++                       LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
++                       LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
+         }
+     } else {
+-        contains(QT_CONFIG, xinput2)|qtConfig(xinput2) {
+-            DEFINES += XCB_USE_XINPUT2
+-            QMAKE_USE += xinput2
++        greaterThan(QT_MINOR_VERSION, 11) {
++            contains(QT_CONFIG, xcb-xinput)|qtConfig(xcb-xinput) {
++                DEFINES += XCB_USE_XINPUT2 XCB_USE_XINPUT21 XCB_USE_XINPUT22
++                QMAKE_USE += xcb_xinput
++
++                !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
++                    DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
++                               LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
++                               LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
++                }
++            }
++        } else {
++            contains(QT_CONFIG, xinput2)|qtConfig(xinput2) {
++                DEFINES += XCB_USE_XINPUT2
++                QMAKE_USE += xinput2
+ 
+-            !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
+-                DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
+-                           LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
+-                           LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
++                !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
++                    DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
++                               LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
++                               LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
++                }
+             }
+         }
+     }
+diff --git a/xcb/utility.h b/xcb/utility.h
+index 2e819e1..d3b2677 100644
+--- a/xcb/utility.h
++++ b/xcb/utility.h
+@@ -19,6 +19,7 @@
+ #define UTILITY_H
+ 
+ #include <QImage>
++#include <QPainterPath>
+ 
+ #include "global.h"
+ 

Deleted: fix-crasher.patch
===================================================================
--- fix-crasher.patch	2021-05-13 06:42:14 UTC (rev 932914)
+++ fix-crasher.patch	2021-05-13 06:42:22 UTC (rev 932915)
@@ -1,121 +0,0 @@
-From de6c9f3e735403077d66e8c8e9acfe236f06d6f5 Mon Sep 17 00:00:00 2001
-From: zccrs <zccrs at live.com>
-Date: Fri, 15 Jan 2021 10:28:34 +0800
-Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B9=B3=E5=8F=B0=E6=8F=92?=
- =?UTF-8?q?=E4=BB=B6=E7=B1=BB=E6=94=AF=E6=8C=81=E5=A4=9A=E6=AC=A1=E5=88=9B?=
- =?UTF-8?q?=E5=BB=BA=E4=BD=BF=E7=94=A8?=
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-主要是为了支持在程序运行期间销毁并重新创建QGuiApplication
-对象的场景, 如在deepin-turbo的booster中会预先创建一个
-QGuiApplication对象(主要是预加载数据), 之后可能会删除这个
-对象, 当booster开始加载一个程序时, 在程序的代码中会再次创建
-QGuiApplication对象.
-
-Log:
-Change-Id: Ie9811910d86945aa26b8ebb111d57b4bfdccdaf7
----
- src/vtablehook.h             |  6 ++++++
- xcb/dhighdpi.cpp             | 19 +++++++++++++++----
- xcb/dplatformintegration.cpp | 14 +++++++++-----
- 3 files changed, 30 insertions(+), 9 deletions(-)
-
-diff --git a/src/vtablehook.h b/src/vtablehook.h
-index b1e73f0..ea7c51f 100644
---- a/src/vtablehook.h
-+++ b/src/vtablehook.h
-@@ -72,6 +72,12 @@ class VtableHook
-     static bool hasVtable(const void *obj);
-     static void resetVtable(const void *obj);
-     static quintptr resetVfptrFun(const void *obj, quintptr functionOffset);
-+    template <typename Fun> // for class
-+    static inline quintptr resetVfptrFun(Fun fun)
-+    {
-+        typedef QtPrivate::FunctionPointer<Fun> FunInfo;
-+        return resetVfptrFun(getVtableOfClass<typename FunInfo::Object>(), toQuintptr(&fun));
-+    }
-     static quintptr originalFun(const void *obj, quintptr functionOffset);
-     static bool forceWriteMemory(void *adr, const void *data, size_t length);
-     static QFunctionPointer resolve(const char *symbol);
-diff --git a/xcb/dhighdpi.cpp b/xcb/dhighdpi.cpp
-index 1f54d49..c507676 100644
---- a/xcb/dhighdpi.cpp
-+++ b/xcb/dhighdpi.cpp
-@@ -43,11 +43,16 @@ QPointF DHighDpi::fromNativePixels(const QPointF &pixelPoint, const QWindow *win
-     return QHighDpi::fromNativePixels(pixelPoint, window);
- }
- 
--__attribute__((constructor)) // 在库被加载时就执行此函数
--static void init()
-+inline static void init()
- {
-+    // 禁用platform theme中的缩放机制
-+    // 当DHighDpi存在时不应该再使用这个过时的机制
-+    qputenv("D_DISABLE_RT_SCREEN_SCALE", "1");
-+
-     DHighDpi::init();
- }
-+// 在插件被加载时先做一次初始化
-+Q_CONSTRUCTOR_FUNCTION(init)
- void DHighDpi::init()
- {
-     if (QGuiApplication::testAttribute(Qt::AA_DisableHighDpiScaling)
-@@ -57,11 +62,17 @@ void DHighDpi::init()
-             || !DXcbXSettings::getOwner()
-             || (qEnvironmentVariableIsSet("QT_SCALE_FACTOR_ROUNDING_POLICY")
-                 && qgetenv("QT_SCALE_FACTOR_ROUNDING_POLICY") != "PassThrough")) {
-+        // init函数可能会被重复调用, 此处应该清理VtableHook
-+        if (active) {
-+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
-+            VtableHook::resetVfptrFun(&QXcbScreen::pixelDensity);
-+#endif
-+            VtableHook::resetVfptrFun(&QXcbScreen::logicalDpi);
-+            active = false;
-+        }
-         return;
-     }
- 
--    // 禁用platform theme中的缩放机制
--    qputenv("D_DISABLE_RT_SCREEN_SCALE", "1");
-     // 设置为完全控制缩放比例,避免被Qt“4舍5入”了缩放比
-     qputenv("QT_SCALE_FACTOR_ROUNDING_POLICY", "PassThrough");
- 
-diff --git a/xcb/dplatformintegration.cpp b/xcb/dplatformintegration.cpp
-index faa2c9b..aca0bcd 100644
---- a/xcb/dplatformintegration.cpp
-+++ b/xcb/dplatformintegration.cpp
-@@ -116,16 +116,19 @@ DPlatformIntegration::DPlatformIntegration(const QStringList &parameters, int &a
-     VtableHook::overrideVfptrFun(nativeInterface(),
-                                  &QPlatformNativeInterface::platformFunction,
-                                  &DPlatformNativeInterfaceHook::platformFunction);
-+
-+    // 不仅仅需要在插件被加载时初始化, 也有可能DPlatformIntegration会被创建多次, 也应当在
-+    // DPlatformIntegration每次被创建时都重新初始化DHighDpi.
-+    DHighDpi::init();
- }
- 
- DPlatformIntegration::~DPlatformIntegration()
- {
- #ifdef Q_OS_LINUX
--    if (!m_eventFilter)
--        return;
--
--    qApp->removeNativeEventFilter(m_eventFilter);
--    delete m_eventFilter;
-+    if (m_eventFilter) {
-+        qApp->removeNativeEventFilter(m_eventFilter);
-+        delete m_eventFilter;
-+    }
- #endif
- 
- #ifdef USE_NEW_IMPLEMENTING
-@@ -134,6 +137,7 @@ DPlatformIntegration::~DPlatformIntegration()
- 
-     if (m_xsettings) {
-         delete m_xsettings;
-+        m_xsettings = nullptr;
-     }
- #endif
- }

Copied: deepin-qt5platform-plugins/repos/community-x86_64/fix-crasher.patch (from rev 932914, deepin-qt5platform-plugins/trunk/fix-crasher.patch)
===================================================================
--- fix-crasher.patch	                        (rev 0)
+++ fix-crasher.patch	2021-05-13 06:42:22 UTC (rev 932915)
@@ -0,0 +1,121 @@
+From de6c9f3e735403077d66e8c8e9acfe236f06d6f5 Mon Sep 17 00:00:00 2001
+From: zccrs <zccrs at live.com>
+Date: Fri, 15 Jan 2021 10:28:34 +0800
+Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B9=B3=E5=8F=B0=E6=8F=92?=
+ =?UTF-8?q?=E4=BB=B6=E7=B1=BB=E6=94=AF=E6=8C=81=E5=A4=9A=E6=AC=A1=E5=88=9B?=
+ =?UTF-8?q?=E5=BB=BA=E4=BD=BF=E7=94=A8?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+主要是为了支持在程序运行期间销毁并重新创建QGuiApplication
+对象的场景, 如在deepin-turbo的booster中会预先创建一个
+QGuiApplication对象(主要是预加载数据), 之后可能会删除这个
+对象, 当booster开始加载一个程序时, 在程序的代码中会再次创建
+QGuiApplication对象.
+
+Log:
+Change-Id: Ie9811910d86945aa26b8ebb111d57b4bfdccdaf7
+---
+ src/vtablehook.h             |  6 ++++++
+ xcb/dhighdpi.cpp             | 19 +++++++++++++++----
+ xcb/dplatformintegration.cpp | 14 +++++++++-----
+ 3 files changed, 30 insertions(+), 9 deletions(-)
+
+diff --git a/src/vtablehook.h b/src/vtablehook.h
+index b1e73f0..ea7c51f 100644
+--- a/src/vtablehook.h
++++ b/src/vtablehook.h
+@@ -72,6 +72,12 @@ class VtableHook
+     static bool hasVtable(const void *obj);
+     static void resetVtable(const void *obj);
+     static quintptr resetVfptrFun(const void *obj, quintptr functionOffset);
++    template <typename Fun> // for class
++    static inline quintptr resetVfptrFun(Fun fun)
++    {
++        typedef QtPrivate::FunctionPointer<Fun> FunInfo;
++        return resetVfptrFun(getVtableOfClass<typename FunInfo::Object>(), toQuintptr(&fun));
++    }
+     static quintptr originalFun(const void *obj, quintptr functionOffset);
+     static bool forceWriteMemory(void *adr, const void *data, size_t length);
+     static QFunctionPointer resolve(const char *symbol);
+diff --git a/xcb/dhighdpi.cpp b/xcb/dhighdpi.cpp
+index 1f54d49..c507676 100644
+--- a/xcb/dhighdpi.cpp
++++ b/xcb/dhighdpi.cpp
+@@ -43,11 +43,16 @@ QPointF DHighDpi::fromNativePixels(const QPointF &pixelPoint, const QWindow *win
+     return QHighDpi::fromNativePixels(pixelPoint, window);
+ }
+ 
+-__attribute__((constructor)) // 在库被加载时就执行此函数
+-static void init()
++inline static void init()
+ {
++    // 禁用platform theme中的缩放机制
++    // 当DHighDpi存在时不应该再使用这个过时的机制
++    qputenv("D_DISABLE_RT_SCREEN_SCALE", "1");
++
+     DHighDpi::init();
+ }
++// 在插件被加载时先做一次初始化
++Q_CONSTRUCTOR_FUNCTION(init)
+ void DHighDpi::init()
+ {
+     if (QGuiApplication::testAttribute(Qt::AA_DisableHighDpiScaling)
+@@ -57,11 +62,17 @@ void DHighDpi::init()
+             || !DXcbXSettings::getOwner()
+             || (qEnvironmentVariableIsSet("QT_SCALE_FACTOR_ROUNDING_POLICY")
+                 && qgetenv("QT_SCALE_FACTOR_ROUNDING_POLICY") != "PassThrough")) {
++        // init函数可能会被重复调用, 此处应该清理VtableHook
++        if (active) {
++#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
++            VtableHook::resetVfptrFun(&QXcbScreen::pixelDensity);
++#endif
++            VtableHook::resetVfptrFun(&QXcbScreen::logicalDpi);
++            active = false;
++        }
+         return;
+     }
+ 
+-    // 禁用platform theme中的缩放机制
+-    qputenv("D_DISABLE_RT_SCREEN_SCALE", "1");
+     // 设置为完全控制缩放比例,避免被Qt“4舍5入”了缩放比
+     qputenv("QT_SCALE_FACTOR_ROUNDING_POLICY", "PassThrough");
+ 
+diff --git a/xcb/dplatformintegration.cpp b/xcb/dplatformintegration.cpp
+index faa2c9b..aca0bcd 100644
+--- a/xcb/dplatformintegration.cpp
++++ b/xcb/dplatformintegration.cpp
+@@ -116,16 +116,19 @@ DPlatformIntegration::DPlatformIntegration(const QStringList &parameters, int &a
+     VtableHook::overrideVfptrFun(nativeInterface(),
+                                  &QPlatformNativeInterface::platformFunction,
+                                  &DPlatformNativeInterfaceHook::platformFunction);
++
++    // 不仅仅需要在插件被加载时初始化, 也有可能DPlatformIntegration会被创建多次, 也应当在
++    // DPlatformIntegration每次被创建时都重新初始化DHighDpi.
++    DHighDpi::init();
+ }
+ 
+ DPlatformIntegration::~DPlatformIntegration()
+ {
+ #ifdef Q_OS_LINUX
+-    if (!m_eventFilter)
+-        return;
+-
+-    qApp->removeNativeEventFilter(m_eventFilter);
+-    delete m_eventFilter;
++    if (m_eventFilter) {
++        qApp->removeNativeEventFilter(m_eventFilter);
++        delete m_eventFilter;
++    }
+ #endif
+ 
+ #ifdef USE_NEW_IMPLEMENTING
+@@ -134,6 +137,7 @@ DPlatformIntegration::~DPlatformIntegration()
+ 
+     if (m_xsettings) {
+         delete m_xsettings;
++        m_xsettings = nullptr;
+     }
+ #endif
+ }



More information about the arch-commits mailing list