From 2b8544f5a03b83f18873b884878bea57fc71dcee Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 16 Oct 2025 14:02:29 +0200 Subject: [PATCH] Drop obsolete code for Qt versions lower than 6.9 --- src/declarative/CMakeLists.txt | 2 +- src/declarative/types.cpp | 49 ---------------------------------- src/declarative/types.h | 36 ------------------------- src/qwaylandlayersurface.cpp | 26 ------------------ src/qwaylandlayersurface_p.h | 7 ----- 5 files changed, 1 insertion(+), 119 deletions(-) delete mode 100644 src/declarative/types.cpp diff --git a/src/declarative/CMakeLists.txt b/src/declarative/CMakeLists.txt index e8a13b3..0a6c126 100644 --- a/src/declarative/CMakeLists.txt +++ b/src/declarative/CMakeLists.txt @@ -4,7 +4,7 @@ ecm_add_qml_module(LayerShellQtQml URI "org.kde.layershell" VERSION 1.0 - SOURCES types.h types.cpp + SOURCES types.h GENERATE_PLUGIN_SOURCE) target_link_libraries(LayerShellQtQml PRIVATE Qt::Qml LayerShellQtInterface) diff --git a/src/declarative/types.cpp b/src/declarative/types.cpp deleted file mode 100644 index bd9447e..0000000 --- a/src/declarative/types.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 Aleix Pol Gonzalez - * - * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL - */ - -#include "types.h" - -#if QT_VERSION < QT_VERSION_CHECK(6, 8, 1) -int QQmlMarginsValueType::left() const -{ - return m.left(); -} - -int QQmlMarginsValueType::top() const -{ - return m.top(); -} - -int QQmlMarginsValueType::right() const -{ - return m.right(); -} - -int QQmlMarginsValueType::bottom() const -{ - return m.bottom(); -} - -void QQmlMarginsValueType::setLeft(int left) -{ - m.setLeft(left); -} - -void QQmlMarginsValueType::setTop(int top) -{ - m.setTop(top); -} - -void QQmlMarginsValueType::setRight(int right) -{ - m.setRight(right); -} - -void QQmlMarginsValueType::setBottom(int bottom) -{ - m.setBottom(bottom); -} -#endif diff --git a/src/declarative/types.h b/src/declarative/types.h index f10a1ed..14fa3e8 100644 --- a/src/declarative/types.h +++ b/src/declarative/types.h @@ -17,39 +17,3 @@ class WindowForeign QML_UNCREATABLE("") QML_ATTACHED(LayerShellQt::Window) }; - -// available upstream since https://invent.kde.org/qt/qt/qtdeclarative/-/commit/a398101f715bfc447aa889fc9c58b13bfe75ab47 -#if QT_VERSION < QT_VERSION_CHECK(6, 8, 1) -struct Q_QML_EXPORT QQmlMarginsValueType { - QMargins m; - Q_PROPERTY(int left READ left WRITE setLeft FINAL) - Q_PROPERTY(int right READ right WRITE setRight FINAL) - Q_PROPERTY(int top READ top WRITE setTop FINAL) - Q_PROPERTY(int bottom READ bottom WRITE setBottom FINAL) - Q_GADGET - QML_ANONYMOUS - QML_FOREIGN(QMargins) - QML_EXTENDED(QQmlMarginsValueType) - QML_STRUCTURED_VALUE - -public: - QQmlMarginsValueType() = default; - Q_INVOKABLE QQmlMarginsValueType(const QMarginsF &margins) - : m(margins.toMargins()) - { - } - int left() const; - int right() const; - int top() const; - int bottom() const; - void setLeft(int); - void setRight(int); - void setTop(int); - void setBottom(int); - - operator QMargins() const - { - return m; - } -}; -#endif diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index 2a38456..fd8851c 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -124,13 +124,7 @@ void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *po void QWaylandLayerSurface::applyConfigure() { -#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0) - m_configuring = true; -#endif window()->resizeFromApplyConfigure(m_pendingSize); -#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0) - m_configuring = false; -#endif } void QWaylandLayerSurface::setDesiredSize(const QSize &size) @@ -181,25 +175,12 @@ void QWaylandLayerSurface::setLayer(uint32_t layer) set_layer(layer); } -#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0) -void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry) -{ - if (m_configuring) { - return; - } - - if (m_interface->desiredSize().isNull()) { - setDesiredSize(geometry.size()); - } -} -#else void QWaylandLayerSurface::setWindowSize(const QSize &size) { if (m_interface->desiredSize().isNull()) { setDesiredSize(size); } } -#endif bool QWaylandLayerSurface::requestActivate() { @@ -268,13 +249,6 @@ void QWaylandLayerSurface::requestXdgActivationToken(quint32 serial) void QWaylandLayerSurface::sendExpose() { -#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) - window()->handleExpose(QRect(QPoint(), m_pendingSize)); -#elif QT_VERSION < QT_VERSION_CHECK(6, 9, 0) - window()->sendRecursiveExposeEvent(); -#else window()->updateExposure(); -#endif } - } diff --git a/src/qwaylandlayersurface_p.h b/src/qwaylandlayersurface_p.h index acf502b..a48e522 100644 --- a/src/qwaylandlayersurface_p.h +++ b/src/qwaylandlayersurface_p.h @@ -43,11 +43,7 @@ public: void setLayer(uint32_t layer); void applyConfigure() override; -#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0) - void setWindowGeometry(const QRect &geometry) override; -#else void setWindowSize(const QSize &size) override; -#endif bool requestActivate() override; bool requestActivateOnShow() override; @@ -66,9 +62,6 @@ private: QString m_activationToken; bool m_configured = false; -#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0) - bool m_configuring = false; -#endif }; }