Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37880994
en ru br
Репозитории ALT
S:5.24.3.1.9-alt2
www.altlinux.org/Changes

Группа :: Графические оболочки/Прочее
Пакет: deepin-kwin2

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: 0001-chore-compatible-with-older-versions.patch
Скачать


From 98c9085670938937e2a1ce964f6acddc5c1d6eb5 Mon Sep 17 00:00:00 2001
From: Zhang Dingyuan <zhangdingyuan@deepin.org>
Date: Fri, 24 Feb 2023 15:31:15 +0800
Subject: [PATCH] chore: compatible with older versions
- v23 (check)
- archlinux (check)
- nix (check)
---
 CMakeLists.txt                                                  | 30 +++++++++++++++++++++++++++++-
 src/decorations/decoratedclient.cpp                             |  2 ++
 src/decorations/decoratedclient.h                               |  3 +++
 src/kcmkwin/kwindecoration/declarative-plugin/CMakeLists.txt    |  1 +
 src/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp |  2 ++
 src/kcmkwin/kwindecoration/declarative-plugin/previewclient.h   |  3 +++
 src/utils/version.h                                             |  8 ++++++++
 7 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 src/utils/version.h
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f5db5c..9f0cd0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -136,7 +136,35 @@ set_package_properties(KF5Kirigami2 PROPERTIES
     TYPE RUNTIME
 )
 
-find_package(KDecoration2 ${PROJECT_VERSION} CONFIG REQUIRED)
+find_package(KDecoration2 CONFIG REQUIRED)
+if (KDecoration2_VERSION)
+    string(REPLACE "." ";" KDECORATION_VERSION_LIST ${KDecoration2_VERSION})
+    list(APPEND KDECORATION_VERSION_LIST 0 0 0 0)
+
+    if (NOT KDECORATION_VER_MAJ)
+        list(GET KDECORATION_VERSION_LIST 0 KDECORATION_VER_MAJ)
+    endif()
+
+    if (NOT KDECORATION_VER_MIN)
+        list(GET KDECORATION_VERSION_LIST 1 KDECORATION_VER_MIN)
+    endif()
+
+    if (NOT KDECORATION_VER_PAT)
+        list(GET KDECORATION_VERSION_LIST 2 KDECORATION_VER_PAT)
+    endif()
+
+    if (NOT KDECORATION_VER_BUI)
+        list(GET KDECORATION_VERSION_LIST 3 KDECORATION_VER_BUI)
+    endif()
+
+    add_definitions(
+        -DKDECORATION_VERSION_STR="${KDecoration2_VERSION}"
+        -DKDECORATION_VERSION_MAJ=${KDECORATION_VER_MAJ}
+        -DKDECORATION_VERSION_MIN=${KDECORATION_VER_MIN}
+        -DKDECORATION_VERSION_PAT=${KDECORATION_VER_PAT}
+        -DKDECORATION_VERSION_BUI=${KDECORATION_VER_BUI}
+    )
+endif()
 
 find_package(KScreenLocker CONFIG REQUIRED)
 set_package_properties(KScreenLocker PROPERTIES
diff --git a/src/decorations/decoratedclient.cpp b/src/decorations/decoratedclient.cpp
index 23c0e9a..4cb22bd 100644
--- a/src/decorations/decoratedclient.cpp
+++ b/src/decorations/decoratedclient.cpp
@@ -302,10 +302,12 @@ bool DecoratedClientImpl::isApplicationMenuActive() const
     return m_client->applicationMenuActive();
 }
 
+#if !defined(KDECORATION_VERSION) || KDECORATION_VERSION >= KDECORATION_VERSION_CHECK(5, 27, 1, 0)
 QString DecoratedClientImpl::windowClass() const
 {
     return m_client->resourceName() + QLatin1Char(' ') + m_client->resourceClass();
 }
+#endif
 
 }
 }
diff --git a/src/decorations/decoratedclient.h b/src/decorations/decoratedclient.h
index b4012bb..36dc077 100644
--- a/src/decorations/decoratedclient.h
+++ b/src/decorations/decoratedclient.h
@@ -9,6 +9,7 @@
 #ifndef KWIN_DECORATED_CLIENT_H
 #define KWIN_DECORATED_CLIENT_H
 #include "options.h"
+#include "utils/version.h"
 
 #include <KDecoration2/Private/DecoratedClientPrivate>
 
@@ -55,7 +56,9 @@ public:
     bool providesContextHelp() const override;
     QSize size() const override;
     int width() const override;
+#if !defined(KDECORATION_VERSION) || KDECORATION_VERSION >= KDECORATION_VERSION_CHECK(5, 27, 1, 0)
     QString windowClass() const override;
+#endif
     WId windowId() const override;
 
     Qt::Edges adjacentScreenEdges() const override;
diff --git a/src/kcmkwin/kwindecoration/declarative-plugin/CMakeLists.txt b/src/kcmkwin/kwindecoration/declarative-plugin/CMakeLists.txt
index 5597049..f5d9f5a 100644
--- a/src/kcmkwin/kwindecoration/declarative-plugin/CMakeLists.txt
+++ b/src/kcmkwin/kwindecoration/declarative-plugin/CMakeLists.txt
@@ -8,6 +8,7 @@ set(plugin_SRCS
     buttonsmodel.cpp
     ../../../decorations/decorationpalette.cpp
     ../../../decorations/decorations_logging.cpp
+    ../../../utils/version.h
 )
 
 add_library(kdecorationprivatedeclarative SHARED ${plugin_SRCS})
diff --git a/src/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp b/src/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp
index 3e85f9c..ce7daf2 100644
--- a/src/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp
+++ b/src/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp
@@ -246,10 +246,12 @@ bool PreviewClient::providesContextHelp() const
     return m_providesContextHelp;
 }
 
+#if !defined(KDECORATION_VERSION) || KDECORATION_VERSION >= KDECORATION_VERSION_CHECK(5, 27, 1, 0)
 QString PreviewClient::windowClass() const
 {
     return {};
 }
+#endif
 
 WId PreviewClient::windowId() const
 {
diff --git a/src/kcmkwin/kwindecoration/declarative-plugin/previewclient.h b/src/kcmkwin/kwindecoration/declarative-plugin/previewclient.h
index dddc99a..304ed59 100644
--- a/src/kcmkwin/kwindecoration/declarative-plugin/previewclient.h
+++ b/src/kcmkwin/kwindecoration/declarative-plugin/previewclient.h
@@ -7,6 +7,7 @@
 #define KDECOARTIONS_PREVIEW_CLIENT_H
 
 #include "../../../decorations/decorationpalette.h"
+#include "../../../utils/version.h"
 
 #include <KDecoration2/Private/DecoratedClientPrivate>
 #include <QObject>
@@ -73,7 +74,9 @@ public:
     bool isShadeable() const override;
     bool isShaded() const override;
     bool providesContextHelp() const override;
+#if !defined(KDECORATION_VERSION) || KDECORATION_VERSION >= KDECORATION_VERSION_CHECK(5, 27, 1, 0)
     QString windowClass() const override;
+#endif
 
     int width() const override;
     int height() const override;
diff --git a/src/utils/version.h b/src/utils/version.h
new file mode 100644
index 0000000..37924f6
--- /dev/null
+++ b/src/utils/version.h
@@ -0,0 +1,8 @@
+// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#define KDECORATION_VERSION_CHECK(major, minor, patch, build) ((major<<24)|(minor<<16)|(patch<<8)|build)
+#ifdef KDECORATION_VERSION_STR
+#define KDECORATION_VERSION KDECORATION_VERSION_CHECK(KDECORATION_VERSION_MAJ, KDECORATION_VERSION_MIN, KDECORATION_VERSION_PAT, KDECORATION_VERSION_BUI)
+#endif
--
libgit2 1.3.2
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin