From d1ab27dd534564e7f9e750e89728b82351361b63 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 8 Dec 2023 11:43:55 +0100 Subject: [PATCH 01/10] Update Qt version requirement to 6.6.0 GIT_SILENT --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba2ba1d..2d217a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ set(PROJECT_VERSION_MAJOR 6) set(CMAKE_C_STANDARD 99) -set(QT_MIN_VERSION "6.5.0") +set(QT_MIN_VERSION "6.6.0") set(KF6_MIN_VERSION "5.240.0") set(KDE_COMPILERSETTINGS_LEVEL "5.82") From 6f0bca5593278fc801700437c9143adc8bcb9e24 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 6 Nov 2023 15:50:19 +0200 Subject: [PATCH 02/10] Revert "Add a (temporary) way to attach popups to layer surfaces" This reverts commit fdab1544fb0dc1af245d36927fe4ab830b0ef2c0. Qt 6.6 is out with all the necessary multi-shell apis. --- src/interfaces/window.cpp | 18 ------------------ src/interfaces/window.h | 8 -------- 2 files changed, 26 deletions(-) diff --git a/src/interfaces/window.cpp b/src/interfaces/window.cpp index 4f56bfc..5dbd8cc 100644 --- a/src/interfaces/window.cpp +++ b/src/interfaces/window.cpp @@ -6,9 +6,6 @@ #include "window.h" #include "../qwaylandlayershellintegration_p.h" -#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0) -#include "../qwaylandlayersurface_p.h" -#endif #include @@ -141,21 +138,6 @@ void Window::setCloseOnDismissed(bool close) d->closeOnDismissed = close; } -#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0) -void Window::attachPopup(QWindow *window, xdg_popup *popup) -{ - auto waylandWindow = dynamic_cast(window->handle()); - if (!waylandWindow) { - return; - } - - auto shellSurface = dynamic_cast(waylandWindow->shellSurface()); - if (shellSurface) { - shellSurface->get_popup(popup); - } -} -#endif - Window::Window(QWindow *window) : QObject(window) , d(new WindowPrivate(window)) diff --git a/src/interfaces/window.h b/src/interfaces/window.h index 3f3ae80..8a5bf95 100644 --- a/src/interfaces/window.h +++ b/src/interfaces/window.h @@ -14,10 +14,6 @@ #include "layershellqt_export.h" -#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0) -struct xdg_popup; -#endif - namespace LayerShellQt { class WindowPrivate; @@ -120,10 +116,6 @@ public: */ static Window *get(QWindow *window); -#if QT_VERSION < QT_VERSION_CHECK(6, 6, 0) - static void attachPopup(QWindow *window, xdg_popup *popup); -#endif - static Window *qmlAttachedProperties(QObject *object); Q_SIGNALS: From 8ae3b0aef85be924c0856458c081f06b0d592abf Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Fri, 15 Dec 2023 21:44:24 +0100 Subject: [PATCH 03/10] Qt6 check code as apps is qt6 only. --- src/qwaylandlayersurface.cpp | 2 -- src/qwaylandlayersurface_p.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index ed57f4a..520aa2d 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -100,7 +100,6 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint } } -#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0) void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *popup) { std::any anyRole = popup->surfaceRole(); @@ -111,7 +110,6 @@ void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *po qCWarning(LAYERSHELLQT) << "Cannot attach popup of unknown type"; } } -#endif void QWaylandLayerSurface::applyConfigure() { diff --git a/src/qwaylandlayersurface_p.h b/src/qwaylandlayersurface_p.h index 4b5940c..9ccf819 100644 --- a/src/qwaylandlayersurface_p.h +++ b/src/qwaylandlayersurface_p.h @@ -32,9 +32,7 @@ public: { return m_configured; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0) void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override; -#endif void setAnchor(uint32_t anchor); void setExclusiveZone(int32_t zone); From 715e629dd88d98ed37dda93a82c122fc1b797de5 Mon Sep 17 00:00:00 2001 From: Jonathan Esk-Riddell Date: Wed, 20 Dec 2023 12:02:54 +0000 Subject: [PATCH 04/10] Update version number for 5.91.0 GIT_SILENT --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d217a0..98340d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) project(layershellqt) -set(PROJECT_VERSION "5.90.90") +set(PROJECT_VERSION "5.91.0") set(PROJECT_VERSION_MAJOR 6) set(CMAKE_C_STANDARD 99) From d379bc8d8e72d9c9f648183d9e68cb80ae60df56 Mon Sep 17 00:00:00 2001 From: Jonathan Esk-Riddell Date: Wed, 20 Dec 2023 18:54:50 +0000 Subject: [PATCH 05/10] Update version number for 5.91.90 GIT_SILENT --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98340d8..736b433 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) project(layershellqt) -set(PROJECT_VERSION "5.91.0") +set(PROJECT_VERSION "5.91.90") set(PROJECT_VERSION_MAJOR 6) set(CMAKE_C_STANDARD 99) From e3098a660a287021fb343ee4f237a67aac9de660 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 21 Dec 2023 13:58:24 +0000 Subject: [PATCH 06/10] Fix constrained check The value in parantheses was always zero. --- src/qwaylandlayersurface.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index 520aa2d..89f47ef 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -119,6 +119,7 @@ void QWaylandLayerSurface::applyConfigure() void QWaylandLayerSurface::setAnchor(uint anchor) { set_anchor(anchor); + setWindowGeometry(window()->windowContentGeometry()); } void QWaylandLayerSurface::setExclusiveZone(int32_t zone) @@ -144,8 +145,8 @@ void QWaylandLayerSurface::setLayer(uint32_t layer) void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry) { - const bool horizontallyConstrained = m_interface->anchors() & (Window::AnchorLeft & Window::AnchorRight); - const bool verticallyConstrained = m_interface->anchors() & (Window::AnchorTop & Window::AnchorBottom); + const bool horizontallyConstrained = m_interface->anchors().testFlags({Window::AnchorLeft, Window::AnchorRight}); + const bool verticallyConstrained = m_interface->anchors().testFlags({Window::AnchorTop, Window::AnchorBottom}); QSize size = geometry.size(); if (horizontallyConstrained) { From 7d3194034cb587d2abd733e2f19196859e5d8286 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 4 Jan 2024 14:42:17 -0500 Subject: [PATCH 07/10] Use ECM QML module so the module can be used outside of repository --- CMakeLists.txt | 1 + src/declarative/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 736b433..edebfcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ include(FeatureSummary) include(GenerateExportHeader) include(KDEClangFormat) include(ECMQtDeclareLoggingCategory) +include(ECMQmlModule) find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS WaylandClient Qml) diff --git a/src/declarative/CMakeLists.txt b/src/declarative/CMakeLists.txt index f9ea9fe..07bcda9 100644 --- a/src/declarative/CMakeLists.txt +++ b/src/declarative/CMakeLists.txt @@ -1,9 +1,10 @@ # SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez # SPDX-License-Identifier: BSD-3-Clause -qt_add_qml_module(LayerShellQtQml +ecm_add_qml_module(LayerShellQtQml URI "org.kde.layershell" VERSION 1.0 SOURCES layershellqtplugin.cpp) target_link_libraries(LayerShellQtQml PRIVATE Qt::Qml LayerShellQtInterface) +ecm_finalize_qml_module(LayerShellQtQml DESTINATION ${KDE_INSTALL_QMLDIR}) \ No newline at end of file From 078f36f8f3df9284f20fac8233362afe819b5b0e Mon Sep 17 00:00:00 2001 From: Jonathan Esk-Riddell Date: Wed, 10 Jan 2024 12:29:03 +0000 Subject: [PATCH 08/10] Update version number for 5.92.0 GIT_SILENT --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edebfcd..f2539f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) project(layershellqt) -set(PROJECT_VERSION "5.91.90") +set(PROJECT_VERSION "5.92.0") set(PROJECT_VERSION_MAJOR 6) set(CMAKE_C_STANDARD 99) From f1e50306f846b1d80c6573404bbfb35cf0c6e3ef Mon Sep 17 00:00:00 2001 From: Jonathan Esk-Riddell Date: Wed, 10 Jan 2024 14:04:04 +0000 Subject: [PATCH 09/10] Update version number for 6.0.80 GIT_SILENT --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2539f6..57fd740 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) project(layershellqt) -set(PROJECT_VERSION "5.92.0") +set(PROJECT_VERSION "6.0.80") set(PROJECT_VERSION_MAJOR 6) set(CMAKE_C_STANDARD 99) From 6e03dc5b5d93c3d699d1a6e57df401db0766f6a2 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Tue, 23 Jan 2024 05:12:40 -0800 Subject: [PATCH 10/10] Minor changes to reduce kde build deps --- CMakeLists.txt | 14 ++++++++------ README.md | 2 ++ default.nix | 23 +++++++++++++++++++++++ shell.nix | 33 +++++++++++++++++++++++++++++++++ src/declarative/CMakeLists.txt | 4 +++- 5 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 default.nix create mode 100644 shell.nix diff --git a/CMakeLists.txt b/CMakeLists.txt index 57fd740..462ef9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ set(PROJECT_VERSION_MAJOR 6) set(CMAKE_C_STANDARD 99) set(QT_MIN_VERSION "6.6.0") -set(KF6_MIN_VERSION "5.240.0") -set(KDE_COMPILERSETTINGS_LEVEL "5.82") +#set(KF6_MIN_VERSION "5.240.0") +#set(KDE_COMPILERSETTINGS_LEVEL "5.82") set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -26,9 +26,9 @@ include(ECMSetupVersion) include(ECMDeprecationSettings) include(ECMGenerateHeaders) include(CMakePackageConfigHelpers) -include(FeatureSummary) +#include(FeatureSummary) include(GenerateExportHeader) -include(KDEClangFormat) +#include(KDEClangFormat) include(ECMQtDeclareLoggingCategory) include(ECMQmlModule) @@ -45,20 +45,22 @@ set_package_properties(Wayland PROPERTIES TYPE REQUIRED) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90") +set(CMAKE_AUTOMOC ON) + ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX LAYERSHELLQT VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/layershellqt_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LayerShellQtConfigVersion.cmake" SOVERSION ${PROJECT_VERSION_MAJOR}) file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) -kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) +#kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) ecm_set_disabled_deprecation_versions(QT 6.5 KF 5.240 ) add_subdirectory(src) -add_subdirectory(tests) +#add_subdirectory(tests) set(CMAKECONFIG_INSTALL_DIR ${KDE_INSTALL_CMAKEPACKAGEDIR}/LayerShellQt) install(EXPORT LayerShellQtTargets diff --git a/README.md b/README.md index 4e5367e..50dc5a2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Forked to reduce kde deps / build for qt6 as its not stable in nixpkgs, really only minor cmake patches + # LayerShellQt This component is meant for applications to be able to easily use clients based on wlr-layer-shell. diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..b6093a9 --- /dev/null +++ b/default.nix @@ -0,0 +1,23 @@ +{ stdenv, cmake, qt6, wayland, wayland-scanner, wayland-protocols, pkg-config, libsForQt5 }: stdenv.mkDerivation { + pname = "layer-shell-qt-nokde"; + version = "6.0.80"; + + src = ./.; + + nativeBuildInputs = [ + cmake + pkg-config + wayland-scanner + libsForQt5.extra-cmake-modules + ]; + + dontWrapQtApps = true; + + buildInputs = [ + qt6.qtbase + qt6.qtdeclarative + qt6.qtwayland + wayland + wayland-protocols + ]; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..f4c3863 --- /dev/null +++ b/shell.nix @@ -0,0 +1,33 @@ +{ pkgs ? import {} }: pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + cmake + wayland-scanner + libsForQt5.extra-cmake-modules + + clang-tools_17 + ]; + + buildInputs = with pkgs; [ + qt6.qtbase + qt6.qtdeclarative + qt6.qtwayland + wayland + wayland-protocols + ]; + + shellHook = '' + export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) + + # Add Qt-related environment variables. + # https://discourse.nixos.org/t/qt-development-environment-on-a-flake-system/23707/5 + setQtEnvironment=$(mktemp) + random=$(openssl rand -base64 20 | sed "s/[^a-zA-Z0-9]//g") + makeWrapper "$(type -p sh)" "$setQtEnvironment" "''${qtWrapperArgs[@]}" --argv0 "$random" + sed "/$random/d" -i "$setQtEnvironment" + source "$setQtEnvironment" + + # qmlls does not account for the import path and bases its search off qtbase's path. + # The actual imports come from qtdeclarative. This directs qmlls to the correct imports. + export QMLLS_BUILD_DIRS=$(pwd)/build:$QML2_IMPORT_PATH + ''; +} diff --git a/src/declarative/CMakeLists.txt b/src/declarative/CMakeLists.txt index 07bcda9..1bf3a99 100644 --- a/src/declarative/CMakeLists.txt +++ b/src/declarative/CMakeLists.txt @@ -1,10 +1,12 @@ # SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez # SPDX-License-Identifier: BSD-3-Clause +set(BUILD_SHARED_LIBS OFF) + ecm_add_qml_module(LayerShellQtQml URI "org.kde.layershell" VERSION 1.0 SOURCES layershellqtplugin.cpp) target_link_libraries(LayerShellQtQml PRIVATE Qt::Qml LayerShellQtInterface) -ecm_finalize_qml_module(LayerShellQtQml DESTINATION ${KDE_INSTALL_QMLDIR}) \ No newline at end of file +ecm_finalize_qml_module(LayerShellQtQml DESTINATION ${KDE_INSTALL_QMLDIR})