diff --git a/panels/notification/osd/brightness/CMakeLists.txt b/panels/notification/osd/brightness/CMakeLists.txt index 9a1e2b0b8..98a60b822 100644 --- a/panels/notification/osd/brightness/CMakeLists.txt +++ b/panels/notification/osd/brightness/CMakeLists.txt @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -find_package(TreelandProtocols REQUIRED) +find_package(TreelandProtocols 0.6 REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(WaylandClient REQUIRED IMPORTED_TARGET wayland-client) @@ -16,7 +16,7 @@ add_library(osd-brightness SHARED qt_generate_wayland_protocol_client_sources(osd-brightness NO_INCLUDE_CORE_ONLY FILES - ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-output-manager-v1.xml + ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-output-manager-unstable-v2.xml ) target_link_libraries(osd-brightness PRIVATE diff --git a/panels/notification/osd/brightness/treelandbrightness.cpp b/panels/notification/osd/brightness/treelandbrightness.cpp index dd6b99983..1e3046228 100644 --- a/panels/notification/osd/brightness/treelandbrightness.cpp +++ b/panels/notification/osd/brightness/treelandbrightness.cpp @@ -4,7 +4,7 @@ #include "treelandbrightness.h" -#include "wayland-treeland-output-manager-v1-client-protocol.h" +#include "wayland-treeland-output-manager-unstable-v2-client-protocol.h" #include #include @@ -13,9 +13,9 @@ namespace osd { -TreelandColorControl::TreelandColorControl(struct ::treeland_output_color_control_v1 *object, QObject *parent) +TreelandColorControl::TreelandColorControl(struct ::treeland_output_picture_control_v2 *object, QObject *parent) : QObject(parent) - , QtWayland::treeland_output_color_control_v1(object) + , QtWayland::treeland_output_picture_control_v2(object) { } @@ -31,14 +31,14 @@ double TreelandColorControl::brightness() const return m_brightness; } -void TreelandColorControl::treeland_output_color_control_v1_brightness(wl_fixed_t brightness) +void TreelandColorControl::treeland_output_picture_control_v2_brightness(wl_fixed_t brightness) { m_brightness = wl_fixed_to_double(brightness); Q_EMIT brightnessChanged(m_brightness); } TreelandBrightness::TreelandBrightness(QObject *parent) - : QWaylandClientExtensionTemplate(treeland_output_manager_v1_interface.version) + : QWaylandClientExtensionTemplate(treeland_output_manager_v2_interface.version) { setParent(parent); connect(this, &TreelandBrightness::activeChanged, this, &TreelandBrightness::refresh); @@ -76,7 +76,7 @@ void TreelandBrightness::refresh() return; } - auto *raw = get_color_control(output); + auto *raw = get_picture_control(output); if (!raw) { return; } diff --git a/panels/notification/osd/brightness/treelandbrightness.h b/panels/notification/osd/brightness/treelandbrightness.h index ea87d8a92..2b4b9d07b 100644 --- a/panels/notification/osd/brightness/treelandbrightness.h +++ b/panels/notification/osd/brightness/treelandbrightness.h @@ -4,23 +4,23 @@ #pragma once -#include "qwayland-treeland-output-manager-v1.h" +#include "qwayland-treeland-output-manager-unstable-v2.h" #include #include #include struct wl_output; -struct treeland_output_color_control_v1; +struct treeland_output_picture_control_v2; namespace osd { -class TreelandColorControl : public QObject, public QtWayland::treeland_output_color_control_v1 +class TreelandColorControl : public QObject, public QtWayland::treeland_output_picture_control_v2 { Q_OBJECT public: - explicit TreelandColorControl(struct ::treeland_output_color_control_v1 *object, QObject *parent = nullptr); + explicit TreelandColorControl(struct ::treeland_output_picture_control_v2 *object, QObject *parent = nullptr); ~TreelandColorControl() override; double brightness() const; @@ -29,18 +29,18 @@ class TreelandColorControl : public QObject, public QtWayland::treeland_output_c void brightnessChanged(double brightness); protected: - void treeland_output_color_control_v1_brightness(wl_fixed_t brightness) override; + void treeland_output_picture_control_v2_brightness(wl_fixed_t brightness) override; private: double m_brightness = 0.0; }; // Read-only Treeland brightness provider for the OSD. It binds a single -// treeland_output_color_control_v1 to the primary wl_output and caches the +// treeland_output_picture_control_v2 to the primary wl_output and caches the // brightness reported by the compositor. It never commits brightness changes; // dde-shortcut-tool is responsible for adjusting brightness, and this provider // only reflects the resulting value. -class TreelandBrightness : public QWaylandClientExtensionTemplate, public QtWayland::treeland_output_manager_v1 +class TreelandBrightness : public QWaylandClientExtensionTemplate, public QtWayland::treeland_output_manager_v2 { Q_OBJECT diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt index 8f6adb1c9..3ffcd2df2 100644 --- a/shell/CMakeLists.txt +++ b/shell/CMakeLists.txt @@ -4,7 +4,7 @@ find_package(Dtk${DTK_VERSION_MAJOR} COMPONENTS Widget REQUIRED) find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Widgets Gui WaylandClient) -find_package(TreelandProtocols REQUIRED) +find_package(TreelandProtocols 0.6 REQUIRED) pkg_check_modules(WaylandClient REQUIRED IMPORTED_TARGET wayland-client) if (NOT DEFINED SYSTEMD_USER_UNIT_DIR) @@ -30,7 +30,7 @@ add_executable(dde-shell qt_generate_wayland_protocol_client_sources(dde-shell FILES - ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-output-manager-v1.xml + ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-output-manager-unstable-v2.xml ) target_compile_definitions(dde-shell diff --git a/shell/treelandoutputwatcher.cpp b/shell/treelandoutputwatcher.cpp index 39954129d..874f2e07f 100644 --- a/shell/treelandoutputwatcher.cpp +++ b/shell/treelandoutputwatcher.cpp @@ -3,7 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "treelandoutputwatcher.h" -#include "wayland-treeland-output-manager-v1-client-protocol.h" +#include "wayland-treeland-output-manager-unstable-v2-client-protocol.h" #include #include @@ -11,7 +11,7 @@ #include TreelandOutputWatcher::TreelandOutputWatcher(QObject *parent) - : QWaylandClientExtensionTemplate(treeland_output_manager_v1_interface.version) + : QWaylandClientExtensionTemplate(treeland_output_manager_v2_interface.version) { setParent(parent); } @@ -21,13 +21,14 @@ TreelandOutputWatcher::~TreelandOutputWatcher() destroy(); } -void TreelandOutputWatcher::treeland_output_manager_v1_primary_output(const QString &output_name) +void TreelandOutputWatcher::treeland_output_manager_v2_primary_output(struct ::wl_output *output) { - if (qApp->primaryScreen()->name() == output_name) + if (!output) return; for (auto screen : qApp->screens()) { - if (screen->name() == output_name) { + auto *waylandScreen = screen->nativeInterface(); + if (waylandScreen && waylandScreen->output() == output) { QWindowSystemInterface::handlePrimaryScreenChanged(screen->handle()); return; } diff --git a/shell/treelandoutputwatcher.h b/shell/treelandoutputwatcher.h index e951de424..3e2b3c7ef 100644 --- a/shell/treelandoutputwatcher.h +++ b/shell/treelandoutputwatcher.h @@ -4,10 +4,12 @@ #pragma once -#include "qwayland-treeland-output-manager-v1.h" +#include "qwayland-treeland-output-manager-unstable-v2.h" #include -class TreelandOutputWatcher : public QWaylandClientExtensionTemplate, public QtWayland::treeland_output_manager_v1 +struct wl_output; + +class TreelandOutputWatcher : public QWaylandClientExtensionTemplate, public QtWayland::treeland_output_manager_v2 { Q_OBJECT public: @@ -15,5 +17,5 @@ class TreelandOutputWatcher : public QWaylandClientExtensionTemplate