diff --git a/debian/control b/debian/control index 66aaeb1..bf997a0 100644 --- a/debian/control +++ b/debian/control @@ -18,6 +18,7 @@ Build-Depends: wlr-protocols, libdtk6widget-dev, libdtk6core-dev, + treeland-protocols, Standards-Version: 4.5.0 Package: xdg-desktop-portal-dde diff --git a/protocol/treeland-personalization-manager-v1.xml b/protocol/treeland-personalization-manager-v1.xml deleted file mode 100644 index cf6ccb9..0000000 --- a/protocol/treeland-personalization-manager-v1.xml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - Copyright © 2023 Uniontech - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice (including the next - paragraph) shall be included in all copies or substantial portions of the - Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - - - This interface allows a client to customized display effects. - - Warning! The protocol described in this file is currently in the testing - phase. Backward compatible changes may be added together with the - corresponding interface version bump. Backward incompatible changes can - only be done by creating a new major version of the extension. - - - - set window background, shadow based on context - - - - - - - custom user wallpaper - - - - - - custom user cursor - - - - - - - This interface allows a client personalization wallpaper. - - Warning! The protocol described in this file is currently in the testing - phase. Backward compatible changes may be added together with the - corresponding interface version bump. Backward incompatible changes can - only be done by creating a new major version of the extension. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - get the current user's wallpaper - - - - - Destroy the context object. - - - - - Send this signal after getting the user's wallpaper. - - - - - - - This interface allows a client personalization cursor. - - Warning! The protocol described in this file is currently in the testing - phase. Backward compatible changes may be added together with the - corresponding interface version bump. Backward incompatible changes can - only be done by creating a new major version of the extension. - - - - - - - - - - - - - - - - - - if only one commit fails validation, the commit will fail - - - - - Destroy the context object. - - - - - Send this signal after commit cursor configure. - - - - - - Send this signal after system cursor theme changed. - - - - - - Send this signal after system cursor size changed. - - - - - - - This interface allows a client personalization window. - - Warning! The protocol described in this file is currently in the testing - phase. Backward compatible changes may be added together with the - corresponding interface version bump. Backward incompatible changes can - only be done by creating a new major version of the extension. - - - - This will instruct the compositor how to set the background - for the window, desktop. - - - - - - - - Destroy the context object. - - - - - - Destroy the context object. - - - - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb25957..25eff26 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,7 @@ find_package( WaylandClient) find_package(Qt6WaylandScannerTools REQUIRED) find_package(Dtk6 REQUIRED COMPONENTS Core Widget) +find_package(TreelandProtocols REQUIRED) set_source_files_properties( ${CMAKE_SOURCE_DIR}/misc/org.freedesktop.Notifications.xml @@ -77,7 +78,7 @@ add_executable(${PROJECT_NAME} qt6_generate_wayland_protocol_client_sources(${PROJECT_NAME} FILES - ${CMAKE_SOURCE_DIR}/protocol/treeland-personalization-manager-v1.xml + ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-personalization-manager-v1.xml ) target_link_libraries(${PROJECT_NAME} PUBLIC diff --git a/src/personalization_manager_client.cpp b/src/personalization_manager_client.cpp index b288251..f193726 100644 --- a/src/personalization_manager_client.cpp +++ b/src/personalization_manager_client.cpp @@ -25,19 +25,19 @@ void PersonalizationManager::onActiveChanged() return; if (!m_wallpaperContext) { - m_wallpaperContext = new PersonalizationWallpaper(get_wallpaper_context()); + m_wallpaperContext = new PersonalizationWallpaperContext(get_wallpaper_context()); } } -PersonalizationWallpaper::PersonalizationWallpaper( - struct ::personalization_wallpaper_context_v1 *object) - : QWaylandClientExtensionTemplate(1) - , QtWayland::personalization_wallpaper_context_v1(object) +PersonalizationWallpaperContext::PersonalizationWallpaperContext(struct ::treeland_personalization_wallpaper_context_v1 *context) + : QWaylandClientExtensionTemplate(1) + , QtWayland::treeland_personalization_wallpaper_context_v1(context) { + } -void PersonalizationWallpaper::personalization_wallpaper_context_v1_metadata( - const QString &metadata) +void PersonalizationWallpaperContext::treeland_personalization_wallpaper_context_v1_metadata( + const QString &metadata) { Q_EMIT metadataChanged(metadata); } diff --git a/src/personalization_manager_client.h b/src/personalization_manager_client.h index 1882353..f9a57e7 100644 --- a/src/personalization_manager_client.h +++ b/src/personalization_manager_client.h @@ -6,7 +6,7 @@ #include #include -class PersonalizationWallpaper; +class PersonalizationWallpaperContext; class PersonalizationManager : public QWaylandClientExtensionTemplate, public QtWayland::treeland_personalization_manager_v1 { @@ -16,30 +16,30 @@ class PersonalizationManager : public QWaylandClientExtensionTemplate, - public QtWayland::personalization_window_context_v1 +class PersonalizationWindowContext : public QWaylandClientExtensionTemplate, + public QtWayland::treeland_personalization_window_context_v1 { Q_OBJECT public: - explicit PersonalizationWindow(struct ::personalization_window_context_v1 *object); + explicit PersonalizationWindowContext(struct ::treeland_personalization_window_context_v1 *context); }; -class PersonalizationWallpaper : public QWaylandClientExtensionTemplate, - public QtWayland::personalization_wallpaper_context_v1 +class PersonalizationWallpaperContext : public QWaylandClientExtensionTemplate, + public QtWayland::treeland_personalization_wallpaper_context_v1 { Q_OBJECT public: - explicit PersonalizationWallpaper(struct ::personalization_wallpaper_context_v1 *object); + explicit PersonalizationWallpaperContext(struct ::treeland_personalization_wallpaper_context_v1 *context); -signals: +Q_SIGNALS: void metadataChanged(const QString &meta); protected: - void personalization_wallpaper_context_v1_metadata(const QString &metadata) override; + void treeland_personalization_wallpaper_context_v1_metadata(const QString &metadata) override; }; diff --git a/src/wallpaper.cpp b/src/wallpaper.cpp index de84f7f..3261af5 100644 --- a/src/wallpaper.cpp +++ b/src/wallpaper.cpp @@ -103,15 +103,15 @@ uint32_t WallPaperPortal::setOn2Int(const QVariantMap &options) QString set_on = options.value("set-on").toString(); uint32_t op = 0; if (set_on == "background") - op = personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_BACKGROUND; + op = PersonalizationWallpaperContext::options_background; else if (set_on == "lockscreen") - op = personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_LOCKSCREEN; + op = PersonalizationWallpaperContext::options_lockscreen; else if (set_on == "both") - op = personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_LOCKSCREEN | - personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_BACKGROUND; + op = PersonalizationWallpaperContext::options_lockscreen | + PersonalizationWallpaperContext::options_background; if (options.value("show-preview").toBool()) - op = op | personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_PREVIEW; + op = op | PersonalizationWallpaperContext::options_preview; return op; } diff --git a/src/wayland/CMakeLists.txt b/src/wayland/CMakeLists.txt index d6ac3f7..6e406ec 100644 --- a/src/wayland/CMakeLists.txt +++ b/src/wayland/CMakeLists.txt @@ -1,6 +1,8 @@ find_package(PkgConfig REQUIRED) pkg_get_variable(WlrProtocols_PKGDATADIR wlr-protocols pkgdatadir) find_package(Qt6 COMPONENTS REQUIRED Core DBus WaylandClient WaylandScannerTools) +find_package(TreelandProtocols REQUIRED) + add_library(xdg-desktop-portal-dde-wayland SHARED portalwaylandcontext.h @@ -15,9 +17,9 @@ add_library(xdg-desktop-portal-dde-wayland SHARED protocols/treelandcapture.cpp ) -qt_generate_wayland_protocol_client_sources(xdg-desktop-portal-dde-wayland FILES +qt6_generate_wayland_protocol_client_sources(xdg-desktop-portal-dde-wayland FILES ${WlrProtocols_PKGDATADIR}/unstable/wlr-screencopy-unstable-v1.xml - ${CMAKE_CURRENT_LIST_DIR}/protocols/treeland-capture-unstable-v1.xml + ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-capture-unstable-v1.xml ) target_include_directories(xdg-desktop-portal-dde-wayland diff --git a/src/wayland/protocols/treeland-capture-unstable-v1.xml b/src/wayland/protocols/treeland-capture-unstable-v1.xml deleted file mode 100644 index 9f4b86f..0000000 --- a/src/wayland/protocols/treeland-capture-unstable-v1.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - - This protocol allows authorized application to capture output contents or window - contents(useful for window streaming). - - - - - - - - - - - - - - - - - Unreferences the frame. This request must be called as soon as it's no longer valid. - - - - - - Start session and keeps sending frame. - - - - - - Main event supplying the client with information about the frame. If the capture didn't fail, this event is always - emitted first before any other events. - When mask is provided, x and y should be offset relative to mask surface origin. Otherwise offset_x and offset_y should always - be zero. - - - - - - - - - - - - - - - - - - - - - - - - - - - This event is sent as soon as the frame is presented, indicating it is available for reading. This event - includes the time at which presentation happened at. - - - - - - - - - If the capture failed or if the frame is no longer valid after the "frame" event has been emitted, this - event will be used to inform the client to scrap the frame. - - - - - - - - - - Destroys the context. This request can be sent at any time by the client. - - - - - - - - - Inform client to prepare buffer. - - - - - - - - - - Inform client that all buffer formats supported are emitted. - - - - - - Copy capture contents to provided buffer - - - - - - - Provides flags about the frame. This event is sent once before the - "ready" event. - - - - - - - Inform that buffer is ready for reading - - - - - - Inform that frame copy fails. - - - - - - - - - Destroys the context. This request can be sent at any time by the client. - - - - - - - - - - - - - - - - - - - Selector is provided by compositor. Client can provide source hint to hint compositor - to provide certain kinds of source. - - - - - - - - - - This event supplies the client some information about the capture source, including - the capture region relative to mask and source type. - - - - - - - - - - - There could a lot of reasons but the most common one is that selector is busy - - - - - - - This event can be called just once. A second call might result in a protocol error cause - we just provide transient - - - - - - - Often used by a screen recorder. - - - - - - - - - - Destroy the treeland_capture_manager_v1 object. - - - - - - - - - -