diff --git a/CMakeLists.txt b/CMakeLists.txt index 07393160..4a676289 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,6 @@ add_subdirectory(src/gioutils) add_subdirectory(src/utils) add_subdirectory(src/quick) add_subdirectory(src/ddeintegration) -add_subdirectory(src/treelandintegration) add_subdirectory(src/models) add_subdirectory(qml/windowed) @@ -147,7 +146,6 @@ target_link_libraries(launchpadcommon PUBLIC launcher-qml-utils launcher-models dde-integration-dbus - treeland-integration Dde::Shell ) diff --git a/src/treelandintegration/CMakeLists.txt b/src/treelandintegration/CMakeLists.txt deleted file mode 100644 index 011be40c..00000000 --- a/src/treelandintegration/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. -# -# SPDX-License-Identifier: CC0-1.0 - -find_package(Qt6 REQUIRED GLOBAL COMPONENTS WaylandClient) -if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10) - find_package(Qt6 COMPONENTS WaylandClientPrivate REQUIRED) -endif() - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -add_library(treeland-integration OBJECT - personalizationmanager.cpp - personalizationwindow.cpp -) - -qt_generate_wayland_protocol_client_sources(treeland-integration - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/treeland-personalization-manager-v1.xml -) - -target_sources(treeland-integration PUBLIC -FILE_SET HEADERS -FILES - personalizationmanager.h - personalizationwindow.h -) - -target_link_libraries(treeland-integration -PRIVATE - Qt6::WaylandClient - Qt6::WaylandClientPrivate -) diff --git a/src/treelandintegration/personalizationmanager.cpp b/src/treelandintegration/personalizationmanager.cpp deleted file mode 100644 index e6c19c09..00000000 --- a/src/treelandintegration/personalizationmanager.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "personalizationmanager.h" -#include "personalizationwindow.h" - -#include "qwayland-treeland-personalization-manager-v1.h" - -#include -#include -#include - -#include - -Q_LOGGING_CATEGORY(logTreeland, "org.deepin.dde.launchpad.treeland") - - -class PersonalizationManagerPrivate : public QWaylandClientExtensionTemplate, - public QtWayland::treeland_personalization_manager_v1 -{ - Q_OBJECT -public: - explicit PersonalizationManagerPrivate(); - bool personalizeWindow(QWindow * window, PersonalizationManager::BgState state); - -private: - bool doPersonalizeWindow(QWindow * window, PersonalizationManager::BgState state); - QList > m_queue; -}; - - -PersonalizationManagerPrivate::PersonalizationManagerPrivate() - : QWaylandClientExtensionTemplate(1) -{ - connect(this, &PersonalizationManagerPrivate::activeChanged, this, [this](){ - if (!isActive()) return; - for (std::pair task_pair : std::as_const(m_queue)) { - doPersonalizeWindow(task_pair.first, task_pair.second); - } - m_queue.clear(); - }); -} - -// return if the window is "personalized" right away. -bool PersonalizationManagerPrivate::personalizeWindow(QWindow * window, PersonalizationManager::BgState state) -{ - if (!isActive()) { - m_queue.append(std::make_pair(window, state)); - return false; - } else { - doPersonalizeWindow(window, state); - return true; - } -} - -// return if success -bool PersonalizationManagerPrivate::doPersonalizeWindow(QWindow * window, PersonalizationManager::BgState state) -{ - Q_ASSERT(isActive()); - if (window && window->handle()) { - QtWaylandClient::QWaylandWindow *waylandWindow = - static_cast(window->handle()); - struct wl_surface *surface = waylandWindow->wlSurface(); - if (surface) { - PersonalizationWindow *context = - new PersonalizationWindow(get_window_context(surface)); - context->set_background_type(state); - qCInfo(logTreeland) << "Applied background type" << state << "to window" << window; - return true; - } else { - qCWarning(logTreeland) << "No Wayland surface available for window" << window; - } - } else { - qCWarning(logTreeland) << "Invalid window or handle for personalization"; - } - return false; -} - -// ---------------------------------------------------- - -PersonalizationManager::PersonalizationManager(QObject * parent) - : QObject(parent), m_dptr(nullptr) -{ - if (QGuiApplication::platformName() == "wayland") { - m_dptr = new PersonalizationManagerPrivate; - } -} - -PersonalizationManager::~PersonalizationManager() -{ - if (m_dptr) { - qCDebug(logTreeland) << "Cleaning up PersonalizationManagerPrivate"; - delete m_dptr; - } -} - -// return if the window is "personalized" right away. -bool PersonalizationManager::personalizeWindow(QWindow * window, PersonalizationManager::BgState state) -{ - qCDebug(logTreeland) << "PersonalizationManager::personalizeWindow called for" << window << "state:" << state; - Q_UNUSED(window) - Q_UNUSED(state) - // temporary do nothing for now, since TreeLand plans to update the related protocol - return true; - // return m_dptr ? m_dptr->personalizeWindow(window, state) : true; -} - -#include "personalizationmanager.moc" diff --git a/src/treelandintegration/personalizationmanager.h b/src/treelandintegration/personalizationmanager.h deleted file mode 100644 index c08992f8..00000000 --- a/src/treelandintegration/personalizationmanager.h +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include - -class QWindow; -class PersonalizationManagerPrivate; -class PersonalizationManager : public QObject -{ - Q_OBJECT -public: - enum BgState { - BgNormal = 0, - BgWallpaper = 1, - BgBlurredWallpaper = 2, - }; - - explicit PersonalizationManager(QObject * parent = nullptr); - ~PersonalizationManager(); - bool personalizeWindow(QWindow * window, BgState state); - -private: - PersonalizationManagerPrivate * m_dptr = nullptr; -}; diff --git a/src/treelandintegration/personalizationwindow.cpp b/src/treelandintegration/personalizationwindow.cpp deleted file mode 100644 index 5cd8af11..00000000 --- a/src/treelandintegration/personalizationwindow.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "personalizationwindow.h" - -#include - -Q_DECLARE_LOGGING_CATEGORY(logTreeland) - -PersonalizationWindow::PersonalizationWindow(struct ::personalization_window_context_v1 *object) - : QWaylandClientExtensionTemplate(1) - , QtWayland::personalization_window_context_v1(object) -{ -} diff --git a/src/treelandintegration/personalizationwindow.h b/src/treelandintegration/personalizationwindow.h deleted file mode 100644 index 358d194a..00000000 --- a/src/treelandintegration/personalizationwindow.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#pragma once - -#include "qwayland-treeland-personalization-manager-v1.h" - -#include - -class PersonalizationWindow : public QWaylandClientExtensionTemplate, - public QtWayland::personalization_window_context_v1 -{ - Q_OBJECT -public: - explicit PersonalizationWindow(struct ::personalization_window_context_v1 *object); -}; diff --git a/src/treelandintegration/treeland-personalization-manager-v1.xml b/src/treelandintegration/treeland-personalization-manager-v1.xml deleted file mode 100644 index 8c602e7f..00000000 --- a/src/treelandintegration/treeland-personalization-manager-v1.xml +++ /dev/null @@ -1,195 +0,0 @@ - - - - SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. - SPDX-License-Identifier: MIT - - 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. - - - -