From 290f7d59d57fc817f643a30df1eab69efaee25bb Mon Sep 17 00:00:00 2001 From: winston Date: Fri, 24 Oct 2025 23:23:29 +0200 Subject: [PATCH] qgnomeplatform: fix build with qt 6.10 --- .../libraries/qgnomeplatform/default.nix | 3 + .../libraries/qgnomeplatform/qt6_10.patch | 140 ++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 pkgs/development/libraries/qgnomeplatform/qt6_10.patch diff --git a/pkgs/development/libraries/qgnomeplatform/default.nix b/pkgs/development/libraries/qgnomeplatform/default.nix index 22ba9ead8c96..7bae9ca2c6e2 100644 --- a/pkgs/development/libraries/qgnomeplatform/default.nix +++ b/pkgs/development/libraries/qgnomeplatform/default.nix @@ -36,6 +36,9 @@ stdenv.mkDerivation rec { # Backport cursor fix for Qt6 apps # Adjusted from https://github.com/FedoraQt/QGnomePlatform/pull/138 ./qt6-cursor-fix.patch + + # fixing build with Qt>=6.10 + ./qt6_10.patch ]; nativeBuildInputs = [ diff --git a/pkgs/development/libraries/qgnomeplatform/qt6_10.patch b/pkgs/development/libraries/qgnomeplatform/qt6_10.patch new file mode 100644 index 000000000000..93466e80ef28 --- /dev/null +++ b/pkgs/development/libraries/qgnomeplatform/qt6_10.patch @@ -0,0 +1,140 @@ +diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt +index e6dcf06..287824c 100644 +--- a/src/common/CMakeLists.txt ++++ b/src/common/CMakeLists.txt +@@ -3,6 +3,10 @@ set(common_SRCS + gnomesettings.cpp + ) + ++if(QT_VERSION_MAJOR EQUAL 6) ++ find_package(Qt6 REQUIRED COMPONENTS GuiPrivate) ++endif() ++ + add_library(qgnomeplatform${LIBQGNOMEPLATFORM_SUFFIX} SHARED ${common_SRCS}) + target_link_libraries(qgnomeplatform${LIBQGNOMEPLATFORM_SUFFIX} + Qt${QT_VERSION_MAJOR}::Core +diff --git a/src/decoration/CMakeLists.txt b/src/decoration/CMakeLists.txt +index a6fb227..7b6647c 100644 +--- a/src/decoration/CMakeLists.txt ++++ b/src/decoration/CMakeLists.txt +@@ -8,6 +8,11 @@ set(decoration_SRCS + qgnomeplatformdecoration.cpp + ) + ++if(QT_VERSION_MAJOR EQUAL 6) ++ find_package(Qt6 REQUIRED COMPONENTS GuiPrivate) ++ find_package(Qt6 REQUIRED COMPONENTS WaylandClientPrivate) ++endif() ++ + add_library(qgnomeplatformdecoration MODULE ${decoration_SRCS}) + target_link_libraries(qgnomeplatformdecoration + qgnomeplatform${LIBQGNOMEPLATFORM_SUFFIX} +diff --git a/src/decoration/qgnomeplatformdecoration.cpp b/src/decoration/qgnomeplatformdecoration.cpp +index a719cb3..79c0be0 100644 +--- a/src/decoration/qgnomeplatformdecoration.cpp ++++ b/src/decoration/qgnomeplatformdecoration.cpp +@@ -616,8 +616,12 @@ void QGnomePlatformDecoration::processMouseTop(QWaylandInputDevice *inputDevice, + if (local.x() <= margins().left()) { + //top left bit + #if QT_CONFIG(cursor) ++#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)) ++ waylandWindow()->applyCursor(inputDevice, Qt::SizeFDiagCursor); ++#else + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); + #endif ++#endif + #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_TOP_LEFT, b); + #else +@@ -626,8 +630,12 @@ void QGnomePlatformDecoration::processMouseTop(QWaylandInputDevice *inputDevice, + } else if (local.x() > window()->width() + margins().left()) { + //top right bit + #if QT_CONFIG(cursor) ++#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)) ++ waylandWindow()->applyCursor(inputDevice, Qt::SizeBDiagCursor); ++#else + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); + #endif ++#endif + #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_TOP_RIGHT, b); + #else +@@ -636,8 +644,12 @@ void QGnomePlatformDecoration::processMouseTop(QWaylandInputDevice *inputDevice, + } else { + //top resize bit + #if QT_CONFIG(cursor) ++#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)) ++ waylandWindow()->applyCursor(inputDevice, Qt::SplitVCursor); ++#else + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); + #endif ++#endif + #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_TOP, b); + #else +@@ -682,8 +694,12 @@ void QGnomePlatformDecoration::processMouseBottom(QWaylandInputDevice *inputDevi + if (local.x() <= margins().left()) { + //bottom left bit + #if QT_CONFIG(cursor) ++#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)) ++ waylandWindow()->applyCursor(inputDevice, Qt::SizeBDiagCursor); ++#else + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor); + #endif ++#endif + #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT, b); + #else +@@ -692,8 +708,12 @@ void QGnomePlatformDecoration::processMouseBottom(QWaylandInputDevice *inputDevi + } else if (local.x() > window()->width() + margins().right()) { + //bottom right bit + #if QT_CONFIG(cursor) ++#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)) ++ waylandWindow()->applyCursor(inputDevice, Qt::SizeFDiagCursor); ++#else + waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor); + #endif ++#endif + #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT, b); + #else +@@ -702,8 +722,12 @@ void QGnomePlatformDecoration::processMouseBottom(QWaylandInputDevice *inputDevi + } else { + //bottom bit + #if QT_CONFIG(cursor) ++#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)) ++ waylandWindow()->applyCursor(inputDevice, Qt::SplitVCursor); ++#else + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor); + #endif ++#endif + #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM, b); + #else +@@ -717,8 +741,12 @@ void QGnomePlatformDecoration::processMouseLeft(QWaylandInputDevice *inputDevice + Q_UNUSED(local) + Q_UNUSED(mods) + #if QT_CONFIG(cursor) ++#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)) ++ waylandWindow()->applyCursor(inputDevice, Qt::SplitHCursor); ++#else + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); + #endif ++#endif + #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_LEFT, b); + #else +@@ -731,8 +759,12 @@ void QGnomePlatformDecoration::processMouseRight(QWaylandInputDevice *inputDevic + Q_UNUSED(local) + Q_UNUSED(mods) + #if QT_CONFIG(cursor) ++#if (QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)) ++ waylandWindow()->applyCursor(inputDevice, Qt::SplitHCursor); ++#else + waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor); + #endif ++#endif + #if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) + startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT, b); + #else +