[arch-commits] Commit in deepin-kwin/trunk (3 files)

Felix Yan felixonmars at gemini.archlinux.org
Thu Apr 7 23:47:19 UTC 2022


    Date: Thursday, April 7, 2022 @ 23:47:18
  Author: felixonmars
Revision: 1182926

upgpkg: deepin-kwin 5.4.26-2

Modified:
  deepin-kwin/trunk/PKGBUILD
  deepin-kwin/trunk/dde-kwin.5.4.26.patch
  deepin-kwin/trunk/deepin-kwin-tabbox-chameleon-rename.patch

-------------------------------------------+
 PKGBUILD                                  |    8 
 dde-kwin.5.4.26.patch                     |  664 ++++++++++++++++++++++++++--
 deepin-kwin-tabbox-chameleon-rename.patch |    6 
 3 files changed, 632 insertions(+), 46 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-04-07 23:38:24 UTC (rev 1182925)
+++ PKGBUILD	2022-04-07 23:47:18 UTC (rev 1182926)
@@ -4,7 +4,7 @@
 
 pkgname=deepin-kwin
 pkgver=5.4.26
-pkgrel=1
+pkgrel=2
 pkgdesc='KWin configures on DDE'
 arch=('x86_64')
 url="https://github.com/linuxdeepin/dde-kwin"
@@ -15,8 +15,8 @@
         $pkgname-tabbox-chameleon-rename.patch
         dde-kwin.5.4.26.patch)
 sha512sums=('0ce42973d5c4fb861e758f27b7afc3ebe3c743b7157b527c08771bc5d624e124914fbc92ad9e1a9845cc8d302f83352d6991cb287bf2447dbab6a2e87013809c'
-            '07be0f26270c7b87b311d402c002fcc3d6c73eff6a80abdc33fe1b7b1b4a8acc502a0c1c3957d92cf39b5a3c2e1f1c689c90fe0f765f7bd8308f87ee9cbf138b'
-            '8ab15772a8707c30c14e1005434016ef711e7c47ad98ad2813fb5213b50abf5b0b7be81a6e9b72ad6f62cb63e48f96810a87c815b7fef6d8b01206a670e9127a')
+            '454889eaaf48f0e329d6cde870f57dd25dc1f9f88ade234fdb058249c5a9602fdd43dbfffe7c79c0d05843cec500285e719233bf1b4141c32b387bd1c86e02d7'
+            'a94b808c79cae9f58eefed0075f8132692541fa0c5cdcf326b3ac61720371e82016158efee32fc57e151dde9f6342186d00d21796b312d3b93193324d2c09eab')
 
 prepare() {
   cd dde-kwin-$pkgver
@@ -27,7 +27,7 @@
 
 build() {
   cd dde-kwin-$pkgver
-  cmake . -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DUSE_KWIN_NO_SCALE=OFF -DUSE_PLUGINS=OFF -DUSE_WINDOW_TOOL=OFF
+  cmake . -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DUSE_WINDOW_TOOL=OFF -DENABLE_BUILTIN_BLUR=OFF -DENABLE_KDECORATION=ON -DENABLE_BUILTIN_MULTITASKING=OFF -DENABLE_BUILTIN_BLACK_SCREEN=OFF
   ninja
 }
 

Modified: dde-kwin.5.4.26.patch
===================================================================
--- dde-kwin.5.4.26.patch	2022-04-07 23:38:24 UTC (rev 1182925)
+++ dde-kwin.5.4.26.patch	2022-04-07 23:47:18 UTC (rev 1182926)
@@ -1,30 +1,8 @@
-commit 5e5abf523b637a431f398349ea6315b0ac041aba
-Author: justforlxz <justforlxz at gmail.com>
-Date:   Sat Apr 2 15:01:25 2022 +0800
-
-    fix: cannot build on archlinux
-    
-    add options
-    
-    - USE_KWIN_NO_SCALE
-    - USE_PLUGINS
-    - USE_SCRIPTS
-    - USE_DEEPIN_WM_DBUS
-    - USE_TABBOX
-    - USE_WINDOW_TOOL
-    - ENABLE_BUILTIN_BLACK_SCREEN
-    - ENABLE_BUILTIN_MULTITASKING
-    - ENABLE_BUILTIN_SCISSOR_WINDOW
-    - ENABLE_BUILTIN_BLUR
-    
-    Log: 修复在 archlinux 上构建的问题
-    Change-Id: Ib1f40b5729545e56c8a75c8bc50660e3a9eade4a
-
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index cbbf79e0c..ec3af9a1e 100644
+index cbbf79e0c..8321a362c 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -15,6 +15,11 @@ add_definitions(
+@@ -15,6 +15,20 @@ add_definitions(
      -DPROJECT_VERSION=\\"${PROJECT_VERSION}\\"
  )
  
@@ -32,14 +10,24 @@
 +option(USE_SCRIPTS "use scripts" ON)
 +option(USE_DEEPIN_WM_DBUS "use deepin-wm dbus service" ON)
 +option(USE_TABBOX "use deepin style tabbox" ON)
++option(USE_WINDOW_TOOL "support wayland and x11" ON)
++option(ENABLE_BUILTIN_SCISSOR_WINDOW "enable deepin built-in scissor window plugin" ON)
++option(ENABLE_BUILTIN_BLUR "enable deepin built-in blur plugin" ON)
++option(ENABLE_BUILTIN_MULTITASKING "enable deepin built-in multitasking plugin" ON)
++option(ENABLE_BUILTIN_BLACK_SCREEN "enable deepin built-in black screen plugin" ON)
 +
++if(ENABLE_BUILTIN_BLUR)
++     add_definitions(-DENABLE_BUILTIN_BLUR)
++endif(ENABLE_BUILTIN_BLUR)
++
  #when "KWIN_VERSION > KWIN_VERSION_CHECK(5, 18, 90, 0)"
  find_path(
      KWaylandServerPath
-@@ -92,13 +97,23 @@ if (KWIN_VERSION)
+@@ -91,14 +105,28 @@ if (KWIN_VERSION)
+     )
  endif()
  
- add_subdirectory(configures)
+-add_subdirectory(configures)
 -set(DDE_KWIN_SUPPORTED_VERSION "5.21.5")
 -if (${KWIN_VERSION} STRLESS ${DDE_KWIN_SUPPORTED_VERSION} OR  ${KWIN_VERSION} STREQUAL ${DDE_KWIN_SUPPORTED_VERSION})
 -    add_subdirectory(plugins)
@@ -49,7 +37,6 @@
 -    if (BUILD_TESTING)
 -        add_subdirectory(tests)
 -    endif()
-+
 +if (USE_PLUGINS)
 +  add_subdirectory(plugins)
 +endif()
@@ -60,7 +47,7 @@
 +
 +if (USE_DEEPIN_WM_DBUS)
 +  add_subdirectory(deepin-wm-dbus)
-+endif()
+ endif()
 +
 +if (USE_TABBOX)
 +add_subdirectory(tabbox)
@@ -68,18 +55,38 @@
 +
 +if (BUILD_TESTING)
 +    add_subdirectory(tests)
- endif()
++endif()
++
++if (USE_WINDOW_TOOL)
++  add_subdirectory(windowtool)
++endif()
++
++add_subdirectory(configures)
 diff --git a/configures/CMakeLists.txt b/configures/CMakeLists.txt
-index 4ac0a906d..3b2301b36 100644
+index 4ac0a906d..dfbdeaf48 100644
 --- a/configures/CMakeLists.txt
 +++ b/configures/CMakeLists.txt
-@@ -1,4 +1,4 @@
+@@ -1,9 +1,17 @@
 -configure_file(kwin_no_scale.in kwin_no_scale)
 +option(USE_KWIN_NO_SCALE "use deepin LD_PRELOAD kwin_no_scale" ON)
++
++if(ENABLE_BUILTIN_BLUR)
++     set(ENABLE_BUILTIN_BLUR_STRING "false")
++ else()
++     set(ENABLE_BUILTIN_BLUR_STRING "true")
++ endif()
++
++configure_file(kwinrc.in kwinrc)
  
  install(
      FILES
-@@ -11,4 +11,7 @@ install(
+     kglobalshortcutsrc
+-    kwinrc
++    ${CMAKE_CURRENT_BINARY_DIR}/kwinrc
+     kwinrulesrc
+     klaunchrc
+     kdeglobals
+@@ -11,4 +19,7 @@ install(
      "/etc/xdg"
  )
  
@@ -88,6 +95,21 @@
 +    configure_file(kwin_no_scale.in kwin_no_scale)
 +    install_files("/bin" FILES ${CMAKE_CURRENT_BINARY_DIR}/kwin_no_scale)
 +endif()
+diff --git a/configures/kwinrc b/configures/kwinrc.in
+similarity index 98%
+rename from configures/kwinrc
+rename to configures/kwinrc.in
+index c1fde055b..3d73073e5 100644
+--- a/configures/kwinrc
++++ b/configures/kwinrc.in
+@@ -1,6 +1,6 @@
+ [Plugins]
+ #默认使用com.deepin.blur
+-blurEnabled=false
++blurEnabled=@ENABLE_BUILTIN_BLUR_STRING@
+ enforcedecoEnabled=false
+ minimizeallEnabled=true
+ kwin4_effect_dialogparentEnabled=false
 diff --git a/deepin-wm-dbus/CMakeLists.txt b/deepin-wm-dbus/CMakeLists.txt
 index 3312af1d9..3807bc8f9 100644
 --- a/deepin-wm-dbus/CMakeLists.txt
@@ -115,11 +137,127 @@
 +endif()
 +
  add_subdirectory(kwineffects)
+diff --git a/plugins/kdecoration/CMakeLists.txt b/plugins/kdecoration/CMakeLists.txt
+index 0a34ea25d..60196cf37 100644
+--- a/plugins/kdecoration/CMakeLists.txt
++++ b/plugins/kdecoration/CMakeLists.txt
+@@ -5,6 +5,7 @@ add_definitions(-DTARGET_NAME=\\"${TARGET_NAME}\\")
+ find_package(Qt5 CONFIG REQUIRED COMPONENTS Core)
+ find_package(KF5CoreAddons REQUIRED)
+ find_package(Qt5DBus REQUIRED)
++find_package(X11 REQUIRED)
+ find_package(KF5Config REQUIRED)
+ find_package(KF5WindowSystem REQUIRED)
+ find_package(KDecoration2 REQUIRED)
+diff --git a/plugins/kdecoration/chameleon.cpp b/plugins/kdecoration/chameleon.cpp
+index 6896edbde..289b9c3cc 100644
+--- a/plugins/kdecoration/chameleon.cpp
++++ b/plugins/kdecoration/chameleon.cpp
+@@ -80,6 +80,7 @@ void Chameleon::init()
+     updateTheme();
+ 
+     if (!QX11Info::isPlatformX11() && m_client) {
++#ifdef USE_DEEPIN_WAYLAND
+         m_ddeShellSurface = static_cast<KWayland::Server::DDEShellSurfaceInterface*>(KWinUtils::getDDEShellSurface(m_client));
+         if (m_ddeShellSurface) {
+             connect(m_ddeShellSurface, &KWayland::Server::DDEShellSurfaceInterface::noTitleBarPropertyRequested, this,
+@@ -102,6 +103,7 @@ void Chameleon::init()
+                 }
+             );
+         }
++#endif
+     }
+ 
+     connect(global_config, &ChameleonConfig::themeChanged, this, &Chameleon::updateTheme);
+diff --git a/plugins/kdecoration/chameleon.h b/plugins/kdecoration/chameleon.h
+index 6bfde0b16..4eed1e543 100644
+--- a/plugins/kdecoration/chameleon.h
++++ b/plugins/kdecoration/chameleon.h
+@@ -33,7 +33,11 @@
+ #include <QSettings>
+ #include <QScreen>
+ #include <QPainterPath>
++#include <QFont>
++
++#ifdef USE_DEEPIN_WAYLAND
+ #include <KWayland/Server/ddeshell_interface.h>
++#endif
+ 
+ class Settings;
+ class ChameleonWindowTheme;
+@@ -124,7 +128,10 @@ private:
+ 
+     QPointer<KWin::EffectWindow> m_effect;
+     QFont m_font;
++
++#ifdef USE_DEEPIN_WAYLAND
+     KWayland::Server::DDEShellSurfaceInterface * m_ddeShellSurface = nullptr;
++#endif
+ };
+ 
+ #endif // CHAMELEON_H
+diff --git a/plugins/kdecoration/chameleonconfig.cpp b/plugins/kdecoration/chameleonconfig.cpp
+index 8b6a03b8e..505a5639d 100644
+--- a/plugins/kdecoration/chameleonconfig.cpp
++++ b/plugins/kdecoration/chameleonconfig.cpp
+@@ -141,7 +141,7 @@ void ChameleonConfig::onConfigChanged()
+ }
+ 
+ #define D_KWIN_DEBUG_APP_START_TIME "D_KWIN_DEBUG_APP_START_TIME"
+-void ChameleonConfig::onClientAdded(KWin::Client *client)
++void ChameleonConfig::onClientAdded(KWin::AbstractClient *client)
+ {
+     QObject *c = reinterpret_cast<QObject*>(client);
+ 
+@@ -905,7 +905,7 @@ void ChameleonConfig::init()
+ {
+ #ifndef DISBLE_DDE_KWIN_XCB
+     connect(KWinUtils::workspace(), SIGNAL(configChanged()), this, SLOT(onConfigChanged()));
+-    connect(KWinUtils::workspace(), SIGNAL(clientAdded(KWin::Client*)), this, SLOT(onClientAdded(KWin::Client*)));
++    connect(KWinUtils::workspace(), SIGNAL(clientAdded(KWin::AbstractClient*)), this, SLOT(onClientAdded(KWin::AbstractClient*)));
+     connect(KWinUtils::workspace(), SIGNAL(unmanagedAdded(KWin::Unmanaged*)), this, SLOT(onUnmanagedAdded(KWin::Unmanaged*)));
+     connect(KWinUtils::compositor(), SIGNAL(compositingToggled(bool)), this, SLOT(onCompositingToggled(bool)));
+     connect(KWinUtils::instance(), &KWinUtils::windowPropertyChanged, this, &ChameleonConfig::onWindowPropertyChanged);
+@@ -1225,7 +1225,7 @@ void ChameleonConfig::buildKWinX11Shadow(QObject *window)
+         effect = window->findChild<KWin::EffectWindow*>(QString(), Qt::FindDirectChildrenOnly);
+ 
+         if (effect) {
+-            QRect shape_rect = effect->shape().boundingRect();
++            QRect shape_rect = effect->clientGeometry();
+             const QRect window_rect(QPoint(0, 0), window->property("size").toSize());
+ 
+             // 减去窗口的shape区域
+diff --git a/plugins/kdecoration/chameleonconfig.h b/plugins/kdecoration/chameleonconfig.h
+index b9408267e..be5a48b9a 100644
+--- a/plugins/kdecoration/chameleonconfig.h
++++ b/plugins/kdecoration/chameleonconfig.h
+@@ -38,7 +38,7 @@
+ #define _NET_WM_WINDOW_TYPE "_NET_WM_WINDOW_TYPE"
+ 
+ namespace KWin {
+-class Client;
++class AbstractClient;
+ class Unmanaged;
+ class EffectWindow;
+ class Toplevel;
+@@ -93,7 +93,7 @@ protected:
+ 
+ private slots:
+     void onConfigChanged();
+-    void onClientAdded(KWin::Client *client);
++    void onClientAdded(KWin::AbstractClient *client);
+     // 针对X11BypassWindowManagerHint类型的窗口需要做一些特殊处理
+     void onUnmanagedAdded(KWin::Unmanaged *client);
+     void onCompositingToggled(bool active);
 diff --git a/plugins/kwineffects/CMakeLists.txt b/plugins/kwineffects/CMakeLists.txt
-index 9832df92a..96d95c98d 100644
+index 9832df92a..5a6036896 100644
 --- a/plugins/kwineffects/CMakeLists.txt
 +++ b/plugins/kwineffects/CMakeLists.txt
-@@ -4,7 +4,23 @@ find_package(KF5WindowSystem REQUIRED)
+@@ -1,10 +1,22 @@
+ find_package(Qt5 CONFIG REQUIRED COMPONENTS Core Gui)
++find_package(X11 REQUIRED)
+ find_package(KF5CoreAddons REQUIRED)
+ find_package(KF5WindowSystem REQUIRED)
  
  set(INSTALL_PATH "${QT_INSTALL_PLUGINS}/kwin/effects/plugins")
  
@@ -127,11 +265,6 @@
 -add_subdirectory(blur)
 -add_subdirectory(multitasking)
 -add_subdirectory(black-screen)
-+option(ENABLE_BUILTIN_SCISSOR_WINDOW "enable deepin built-in scissor window plugin" ON)
-+option(ENABLE_BUILTIN_BLUR "enable deepin built-in blur plugin" ON)
-+option(ENABLE_BUILTIN_MULTITASKING "enable deepin built-in multitasking plugin" ON)
-+option(ENABLE_BUILTIN_BLACK_SCREEN "enable deepin built-in black screen plugin" ON)
-+
 +if (ENABLE_BUILTIN_SCISSOR_WINDOW)
 +    add_subdirectory(scissor-window)
 +endif()
@@ -147,6 +280,350 @@
 +if (ENABLE_BUILTIN_BLACK_SCREEN)
 +    add_subdirectory(black-screen)
 +endif()
+diff --git a/plugins/kwineffects/scissor-window/cornermask.frag.140 b/plugins/kwineffects/scissor-window/cornermask.frag
+similarity index 100%
+rename from plugins/kwineffects/scissor-window/cornermask.frag.140
+rename to plugins/kwineffects/scissor-window/cornermask.frag
+diff --git a/plugins/kwineffects/scissor-window/cornermask.frag.110 b/plugins/kwineffects/scissor-window/cornermask_core.frag
+similarity index 100%
+rename from plugins/kwineffects/scissor-window/cornermask.frag.110
+rename to plugins/kwineffects/scissor-window/cornermask_core.frag
+diff --git a/plugins/kwineffects/scissor-window/fullmask.frag.140 b/plugins/kwineffects/scissor-window/fullmask.frag
+similarity index 100%
+rename from plugins/kwineffects/scissor-window/fullmask.frag.140
+rename to plugins/kwineffects/scissor-window/fullmask.frag
+diff --git a/plugins/kwineffects/scissor-window/fullmask.frag.110 b/plugins/kwineffects/scissor-window/fullmask_core.frag
+similarity index 100%
+rename from plugins/kwineffects/scissor-window/fullmask.frag.110
+rename to plugins/kwineffects/scissor-window/fullmask_core.frag
+diff --git a/plugins/kwineffects/scissor-window/glsl.qrc b/plugins/kwineffects/scissor-window/glsl.qrc
+index 8b2ecb6f3..69dd34a7e 100644
+--- a/plugins/kwineffects/scissor-window/glsl.qrc
++++ b/plugins/kwineffects/scissor-window/glsl.qrc
+@@ -1,10 +1,16 @@
+ <RCC>
++    <qresource prefix="/">
++        <file>cornermask_core.frag</file>
++        <file>fullmask_core.frag</file>
++        <file>cornermask.frag</file>
++        <file>fullmask.frag</file>
++    </qresource>
+     <qresource prefix="/effect-shaders-1.10">
+-        <file alias="corner-mask.frag">cornermask.frag.110</file>
+-        <file alias="full-mask.frag">fullmask.frag.110</file>
++        <file alias="corner-mask.frag">cornermask_core.frag</file>
++        <file alias="full-mask.frag">fullmask_core.frag</file>
+     </qresource>
+     <qresource prefix="/effect-shaders-1.40">
+-        <file alias="corner-mask.frag">cornermask.frag.140</file>
+-        <file alias="full-mask.frag">fullmask.frag.140</file>
++        <file alias="cornermask.frag">cornermask.frag</file>
++        <file alias="fullmask.frag">fullmask.frag</file>
+     </qresource>
+ </RCC>
+diff --git a/plugins/kwineffects/scissor-window/main.cpp b/plugins/kwineffects/scissor-window/main.cpp
+index 73544556c..58438b49e 100644
+--- a/plugins/kwineffects/scissor-window/main.cpp
++++ b/plugins/kwineffects/scissor-window/main.cpp
+@@ -23,19 +23,27 @@
+ class ScissorWindowPluginFactory : public KWin::EffectPluginFactory
+ {
+     Q_OBJECT
+-    Q_INTERFACES(KPluginFactory)
++#if defined(KWIN_VERSION) && KWIN_VERSION < KWIN_VERSION_CHECK(5, 23, 4, 0)
+     Q_PLUGIN_METADATA(IID KPluginFactory_iid FILE "scissor-window.json")
+-
++#else
++    Q_PLUGIN_METADATA(IID EffectPluginFactory_iid FILE "scissor-window.json")
++#endif
++    Q_INTERFACES(KPluginFactory)
+ public:
+-    explicit ScissorWindowPluginFactory();
+-    ~ScissorWindowPluginFactory();
++    explicit ScissorWindowPluginFactory() {}
++    ~ScissorWindowPluginFactory() {}
+ 
+-    KWin::Effect *createEffect() const {
+-        return ScissorWindow::supported() ? new ScissorWindow() : nullptr;
++    bool isSupported() const override {
++        return ScissorWindow::supported();
+     }
+-};
+ 
+-K_PLUGIN_FACTORY_DEFINITION(ScissorWindowPluginFactory, registerPlugin<ScissorWindow>();)
+-K_EXPORT_PLUGIN_VERSION(KWIN_EFFECT_API_VERSION)
++    bool enabledByDefault() const override {
++        return true;
++    }
++
++    KWin::Effect *createEffect() const override {
++        return new ScissorWindow;
++    }
++};
+ 
+ #include "main.moc"
+diff --git a/plugins/kwineffects/scissor-window/scissor-window.json b/plugins/kwineffects/scissor-window/scissor-window.json
+index e2ebdc65d..56522ecd1 100644
+--- a/plugins/kwineffects/scissor-window/scissor-window.json
++++ b/plugins/kwineffects/scissor-window/scissor-window.json
+@@ -4,6 +4,10 @@
+             {
+                 "Email": "zccrs at live.com",
+                 "Name": "zccrs"
++            },
++            {
++                "Email": "lxz at mkacg.com",
++                "Name": "justforlxz"
+             }
+         ],
+         "Description": "Allow clip of window content",
+@@ -15,8 +19,15 @@
+         "ServiceTypes": [
+             "KWin/Effect"
+         ],
+-        "org.kde.kwin.effect": {
+-            "exclusiveGroup": "appearance"
+-        }
+-    }
++        "Category": "Appearance",
++        "License": "GPL",
++        "Version": "1.0"
++    },
++    "org.kde.kwin.effect": {
++        "exclusiveGroup": "appearance",
++        "enabledByDefaultMethod": true
++    },
++    "X-KDE-Ordering": "5",
++    "X-Plasma-API": "",
++    "X-Plasma-MainScript": ""
+ }
+diff --git a/plugins/kwineffects/scissor-window/scissorwindow.cpp b/plugins/kwineffects/scissor-window/scissorwindow.cpp
+index a80118421..b250d891a 100644
+--- a/plugins/kwineffects/scissor-window/scissorwindow.cpp
++++ b/plugins/kwineffects/scissor-window/scissorwindow.cpp
+@@ -19,10 +19,6 @@
+  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  */
+ #include "scissorwindow.h"
+-#ifndef DISBLE_DDE_KWIN_XCB
+-#include "kwinutils.h"
+-#endif
+-
+ #include <kwinglutils.h>
+ #include <kwinglplatform.h>
+ #include <kwingltexture.h>
+@@ -32,6 +28,7 @@
+ #include <QExplicitlySharedDataPointer>
+ #include <QSignalBlocker>
+ #include <QPainterPath>
++#include <QScopedPointer>
+ 
+ Q_DECLARE_METATYPE(QPainterPath)
+ 
+@@ -178,16 +175,16 @@ ScissorWindow::ScissorWindow(QObject *, const QVariantList &)
+     : Effect()
+ {
+     // 构建用于窗口圆角特效的着色器
+-    m_shader = KWin::ShaderManager::instance()->generateShaderFromResources(KWin::ShaderTrait::MapTexture, QString(), "corner-mask.frag");
++    m_shader = KWin::ShaderManager::instance()->generateShaderFromFile(KWin::ShaderTrait::MapTexture, QString(), ":/cornermask.frag");
+     // 构建用于自定义窗口形状的着色器
+-    m_fullMaskShader = KWin::ShaderManager::instance()->generateShaderFromResources(KWin::ShaderTrait::MapTexture, QString(), "full-mask.frag");
++    m_fullMaskShader = KWin::ShaderManager::instance()->generateShaderFromFile(KWin::ShaderTrait::MapTexture, QString(), ":/fullmask.frag");
+ 
+     if (!m_shader->isValid()) {
+-        // qWarning() << Q_FUNC_INFO << "Invalid fragment shader of corner mask";
++        qWarning() << Q_FUNC_INFO << "Invalid fragment shader of corner mask";
+     }
+ 
+     if (!m_fullMaskShader->isValid()) {
+-        // qWarning() << Q_FUNC_INFO << "Invalid fragment shader of full mask";
++        qWarning() << Q_FUNC_INFO << "Invalid fragment shader of full mask";
+     }
+ }
+ 
+@@ -205,6 +202,10 @@ void ScissorWindow::drawWindow(KWin::EffectWindow *w, int mask, QRegion region,
+         return Effect::drawWindow(w, mask, region, data);
+     }
+ 
++    if (KWin::effects->hasActiveFullScreenEffect() || w->isFullScreen()) {
++         return Effect::drawWindow(w, mask, region, data);
++    }
++
+     MaskCache::TextureData mask_texture = MaskCache::instance()->getTextureByWindow(w);
+ 
+     if (!mask_texture) {
+@@ -214,7 +215,7 @@ void ScissorWindow::drawWindow(KWin::EffectWindow *w, int mask, QRegion region,
+     QRegion corner_region;
+ 
+     if (!mask_texture->customMask) {
+-        const QRect window_rect = w->geometry();
++        const QRect window_rect = w->frameGeometry();
+         QRect corner_rect(window_rect.topLeft(), mask_texture->size);
+ 
+         // top left
+@@ -241,6 +242,7 @@ void ScissorWindow::drawWindow(KWin::EffectWindow *w, int mask, QRegion region,
+         }
+     }
+ 
++#if !defined(KWIN_VERSION) || KWIN_VERSION < KWIN_VERSION_CHECK(5, 23, 4, 0)
+     KWin::WindowQuadList decoration_quad_list;
+     KWin::WindowQuadList content_quad_list;
+ 
+@@ -257,20 +259,65 @@ void ScissorWindow::drawWindow(KWin::EffectWindow *w, int mask, QRegion region,
+             break;
+         }
+     }
++#endif
+ 
++#ifndef DISBLE_DDE_KWIN_XCB
++     class SetWindowDepth {
++     public:
++         SetWindowDepth(KWin::EffectWindow *w, int depth)
++             : m_window(w)
++         {
++             // 此时正在进行窗口绘制,会有大量的调用,应当避免窗口发射hasAlphaChanged信号
++             QSignalBlocker(w->parent());
++             KWinUtils::setClientDepth(w->parent(), depth);
++         }
++
++         ~SetWindowDepth() {
++             bool ok = false;
++             int depth = m_window->data(WindowDepthRole).toInt(&ok);
++             QObject *client = m_window->parent();
++
++             if (!ok) {
++                 depth = KWinUtils::getWindowDepth(client);
++                 // 保存以便下次使用
++                 m_window->setData(WindowDepthRole, depth);
++             }
++
++             // 此时正在进行窗口绘制,会有大量的调用,应当避免窗口发射hasAlphaChanged信号
++             QSignalBlocker blocker(client);
++             Q_UNUSED(blocker)
++             KWinUtils::setClientDepth(client, depth);
++         }
++
++     private:
++         KWin::EffectWindow *m_window;
++     };
++
++     // 要想窗口裁剪生效,必须要保证窗口材质绘制时开启了alpha通道混合
++     QScopedPointer<SetWindowDepth> setDepth;
++     if (!w->hasAlpha()) {
++         QScopedPointer<SetWindowDepth> alpha(new SetWindowDepth(w, 32));
++         setDepth.swap(alpha);
++     }
++ #endif
++
++#if !defined(KWIN_VERSION) || KWIN_VERSION < KWIN_VERSION_CHECK(5, 23, 4, 0)
+     if (!mask_texture->customMask) {
+         // 此时只允许绘制窗口边框和阴影
+         // 针对设置了自定义裁剪的窗口,则不绘制标题栏和阴影
+         data.quads = decoration_quad_list;
+         Effect::drawWindow(w, mask, region, data);
+     }
++#endif
+ 
+     if (!corner_region.isEmpty()) {
+         QRegion new_region = region - corner_region;
+ 
+         // 先绘制未处于mask区域的窗口材质
+         if (!new_region.isEmpty()) {
++#if !defined(KWIN_VERSION) || KWIN_VERSION < KWIN_VERSION_CHECK(5, 23, 4, 0)
+             data.quads = content_quad_list;
++#endif
+             Effect::drawWindow(w, mask, new_region, data);
+         }
+ 
+@@ -278,6 +325,9 @@ void ScissorWindow::drawWindow(KWin::EffectWindow *w, int mask, QRegion region,
+         region = region - new_region;
+     }
+ 
++    glEnable(GL_BLEND);
++    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
++
+     // 将mask材质绑定到第二个材质
+     glActiveTexture(GL_TEXTURE1);
+     mask_texture->bind();
+@@ -303,52 +353,13 @@ void ScissorWindow::drawWindow(KWin::EffectWindow *w, int mask, QRegion region,
+ 
+     // 此时只允许绘制窗口内容
+     auto old_shader = data.shader;
++#if !defined(KWIN_VERSION) || KWIN_VERSION < KWIN_VERSION_CHECK(5, 23, 4, 0)
+     data.quads = content_quad_list;
++    data.quads = content_quad_list;
++#endif
+     data.shader = shader;
+ 
+-#ifndef DISBLE_DDE_KWIN_XCB
+-    class SetWindowDepth {
+-    public:
+-        SetWindowDepth(KWin::EffectWindow *w, int depth)
+-            : m_window(w)
+-        {
+-            // 此时正在进行窗口绘制,会有大量的调用,应当避免窗口发射hasAlphaChanged信号
+-            QSignalBlocker blocker(w->parent());
+-            Q_UNUSED(blocker)
+-            KWinUtils::setClientDepth(w->parent(), depth);
+-        }
+-
+-        ~SetWindowDepth() {
+-            bool ok = false;
+-            int depth = m_window->data(WindowDepthRole).toInt(&ok);
+-            QObject *client = m_window->parent();
+-
+-            if (!ok) {
+-                depth = KWinUtils::getWindowDepth(client);
+-                // 保存以便下次使用
+-                m_window->setData(WindowDepthRole, depth);
+-            }
+-
+-            // 此时正在进行窗口绘制,会有大量的调用,应当避免窗口发射hasAlphaChanged信号
+-            QSignalBlocker blocker(client);
+-            Q_UNUSED(blocker)
+-            KWinUtils::setClientDepth(client, depth);
+-        }
+-
+-    private:
+-        KWin::EffectWindow *m_window;
+-    };
+-
+-    // 要想窗口裁剪生效,必须要保证窗口材质绘制时开启了alpha通道混合
+-    if (!w->hasAlpha()) {
+-        SetWindowDepth set_depth(w, 32);
+-        Q_UNUSED(set_depth)
+-        Effect::drawWindow(w, mask, region, data);
+-    } else
+-#endif
+-    {
+-        Effect::drawWindow(w, mask, region, data);
+-    }
++    Effect::drawWindow(w, mask, region, data);
+ 
+     data.shader = old_shader;
+ 
+@@ -357,4 +368,6 @@ void ScissorWindow::drawWindow(KWin::EffectWindow *w, int mask, QRegion region,
+     glActiveTexture(GL_TEXTURE1);
+     mask_texture->unbind();
+     glActiveTexture(GL_TEXTURE0);
++
++    glDisable(GL_BLEND);
+ }
+diff --git a/plugins/kwineffects/scissor-window/scissorwindow.h b/plugins/kwineffects/scissor-window/scissorwindow.h
+index 6e12a1adc..a778a1d97 100644
+--- a/plugins/kwineffects/scissor-window/scissorwindow.h
++++ b/plugins/kwineffects/scissor-window/scissorwindow.h
+@@ -23,6 +23,10 @@
+ 
+ #include <kwineffects.h>
+ 
++#ifndef DISBLE_DDE_KWIN_XCB
++#include "kwinutils.h"
++#endif
++
+ class ScissorWindow : public KWin::Effect
+ {
+     Q_OBJECT
 diff --git a/plugins/platforms/lib/CMakeLists.txt b/plugins/platforms/lib/CMakeLists.txt
 index 9dbf2474f..06379d0ab 100644
 --- a/plugins/platforms/lib/CMakeLists.txt
@@ -159,3 +636,112 @@
  find_package(KF5Config REQUIRED)
  find_package(KF5WindowSystem REQUIRED)
  find_package(KF5CoreAddons REQUIRED)
+diff --git a/plugins/platforms/lib/kwinutils.cpp b/plugins/platforms/lib/kwinutils.cpp
+index df1b8ce6b..ee283a60e 100644
+--- a/plugins/platforms/lib/kwinutils.cpp
++++ b/plugins/platforms/lib/kwinutils.cpp
+@@ -87,7 +87,11 @@ public:
+ public Q_SLOTS:
+     void slotWindowMove();
+     void slotWindowMaximize();
+-    bool compositing() const;
++#if !defined(KWIN_VERSION) || KWIN_VERSION < KWIN_VERSION_CHECK(5, 23, 4, 0)
++     // remove by c61085dc2e28cb7d737c9b049499b4433916b194
++     // change to Compositor::compositing()
++     bool compositing() const;
++ #endif
+     void slotTouchPadTomoveWindow(int x, int y);
+     void slotEndTouchPadToMoveWindow();
+ 
+@@ -139,14 +143,23 @@ class Compositor : public QObject
+ public:
+     enum SuspendReason { NoReasonSuspend = 0, UserSuspend = 1<<0, BlockRuleSuspend = 1<<1, ScriptSuspend = 1<<2, AllReasonSuspend = 0xff };
+     static Compositor *s_compositor;
++    bool isActive();
+ };
+ 
+ // 光标管理
++#if defined(KWIN_VERSION) && KWIN_VERSION >= KWIN_VERSION_CHECK(5, 23, 4, 0)
++class Cursors : public QObject
++{
++public:
++    static Cursors *s_self;
++};
++#else
+ class Cursor : public QObject
+ {
+ public:
+     static Cursor *s_self;
+ };
++#endif
+ 
+ class AbstractClient : public QObject {};
+ class Options {
+@@ -613,7 +626,11 @@ QObject *KWinUtils::tabBox()
+ 
+ QObject *KWinUtils::cursor()
+ {
++#if defined(KWIN_VERSION) && KWIN_VERSION >= KWIN_VERSION_CHECK(5, 23, 4, 0)
++    return KWin::Cursors::s_self;
++#else
+     return KWin::Cursor::s_self;
++#endif
+ }
+ 
+ QObject *KWinUtils::virtualDesktop()
+@@ -643,8 +660,8 @@ QObjectList KWinUtils::clientList()
+         return {};
+     }
+ 
+-    QList<KWin::Client*> clients;
+-    bool ok = QMetaObject::invokeMethod(jsWorkspaceWrapper, "clientList", Q_RETURN_ARG(QList<KWin::Client*>, clients));
++    QList<KWin::AbstractClient*> clients;
++    bool ok = QMetaObject::invokeMethod(jsWorkspaceWrapper, "clientList", Q_RETURN_ARG(QList<KWin::AbstractClient*>, clients));
+ 
+     if (!ok) {
+         return {};
+@@ -652,7 +669,7 @@ QObjectList KWinUtils::clientList()
+ 
+     QObjectList list;
+ 
+-    for (KWin::Client *c : clients) {
++    for (KWin::AbstractClient *c : clients) {
+         list << c;
+     }
+ 
+@@ -1057,12 +1074,19 @@ void KWinUtils::removeWindowPropertyMonitor(quint32 property_atom)
+ 
+ bool KWinUtils::isCompositing()
+ {
++  #if defined(KWIN_VERSION) && KWIN_VERSION >= KWIN_VERSION_CHECK(5, 23, 4, 0)
++     if (KWin::Compositor::s_compositor) {
++         return KWin::Compositor::s_compositor->isActive();
++     }
++ #else
+     KWin::Workspace *ws = static_cast<KWin::Workspace *>(workspace());
+     if (ws) {
+         return ws->compositing();
+     } else {
+         return compositorIsActive();
+     }
++#endif
++    return compositorIsActive();
+ }
+ 
+ bool KWinUtils::buildNativeSettings(QObject *baseObject, quint32 windowID)
+diff --git a/plugins/platforms/plugin/libkwinpreload.cpp b/plugins/platforms/plugin/libkwinpreload.cpp
+index 55b509e4b..c8814bd8d 100644
+--- a/plugins/platforms/plugin/libkwinpreload.cpp
++++ b/plugins/platforms/plugin/libkwinpreload.cpp
+@@ -279,9 +279,11 @@ void RuleBook::save()
+ 
+ namespace BuiltInEffects {
+ bool supported(BuiltInEffect effect) {
++#ifdef ENABLE_BUILTIN_BLUR
+     if (effect == BuiltInEffect::Blur) {
+         return false;
+     }
++#endif
+ 
+     typedef bool (*ClientBuiltInEffect)(KWin::BuiltInEffect);
+     ClientBuiltInEffect clientBuildInEffect = (ClientBuiltInEffect)QLibrary::resolve("kwin", qApp->applicationVersion(), "_ZN4KWin14BuiltInEffects9supportedENS_13BuiltInEffectE");

Modified: deepin-kwin-tabbox-chameleon-rename.patch
===================================================================
--- deepin-kwin-tabbox-chameleon-rename.patch	2022-04-07 23:38:24 UTC (rev 1182925)
+++ deepin-kwin-tabbox-chameleon-rename.patch	2022-04-07 23:47:18 UTC (rev 1182926)
@@ -4,10 +4,10 @@
 
     Rename thumbnail_grid to avoid conflict with new kdeplasma-addons
 
-diff --git a/configures/kwinrc b/configures/kwinrc
+diff --git a/configures/kwinrc.in b/configures/kwinrc.in
 index 9551f40ce..d5493c285 100644
---- a/configures/kwinrc
-+++ b/configures/kwinrc
+--- a/configures/kwinrc.in
++++ b/configures/kwinrc.in
 @@ -40,7 +40,7 @@ ActivitiesMode=1
  ApplicationsMode=0
  DesktopMode=1



More information about the arch-commits mailing list