Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions applets/dde-shutdown/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
# SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: GPL-3.0-or-later
find_package(TreelandProtocols REQUIRED)
find_package(TreelandProtocols 0.7.0 REQUIRED)

add_library(dde-shutdown SHARED
shutdownapplet.cpp
Expand All @@ -11,9 +11,8 @@ add_library(dde-shutdown SHARED
)

qt_generate_wayland_protocol_client_sources(dde-shutdown
NO_INCLUDE_CORE_ONLY
FILES
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-dde-shell-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-compositor-action-unstable-v1.xml
)

target_link_libraries(dde-shutdown PRIVATE
Expand Down
43 changes: 18 additions & 25 deletions applets/dde-shutdown/treelandlockscreen.cpp
Original file line number Diff line number Diff line change
@@ -1,51 +1,44 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "treelandlockscreen.h"
#include "wayland-treeland-compositor-action-unstable-v1-client-protocol.h"

Check warning on line 6 in applets/dde-shutdown/treelandlockscreen.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "wayland-treeland-compositor-action-unstable-v1-client-protocol.h" not found.

DS_BEGIN_NAMESPACE
namespace shutdown
{
TreeLandLockScreen::TreeLandLockScreen()
: QWaylandClientExtensionTemplate<TreeLandLockScreen>(treeland_dde_shell_manager_v1_interface.version)
: QWaylandClientExtensionTemplate<TreeLandLockScreen>(treeland_compositor_action_v1_interface.version)
{
}

void TreeLandLockScreen::lock()
TreeLandLockScreen::~TreeLandLockScreen()
{
if (auto impl = workder())
impl->lock();
}

void TreeLandLockScreen::shutdown()
{
if (auto impl = workder())
impl->shutdown();
if (isActive()) {
destroy();
}
}

void TreeLandLockScreen::switchUser()
void TreeLandLockScreen::lock()

Check warning on line 23 in applets/dde-shutdown/treelandlockscreen.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'lock' is never used.
{
if (auto impl = workder())
impl->switch_user();
if (isActive()) {
trigger(action_lockscreen);
}
}

TreeLandLockScreenWorker *TreeLandLockScreen::workder()
void TreeLandLockScreen::shutdown()
{
if (!isActive()) {
return nullptr;
if (isActive()) {
trigger(action_shutdown_menu);
}

if (m_worker.isNull()) {
m_worker.reset(new TreeLandLockScreenWorker(get_treeland_lockscreen()));
}
return m_worker.get();
}

TreeLandLockScreenWorker::TreeLandLockScreenWorker(struct ::treeland_lockscreen_v1 *object)
: QWaylandClientExtensionTemplate<TreeLandLockScreenWorker>(treeland_lockscreen_v1_interface.version)
, QtWayland::treeland_lockscreen_v1(object)
void TreeLandLockScreen::switchUser()

Check warning on line 37 in applets/dde-shutdown/treelandlockscreen.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'switchUser' is never used.
{
if (isActive()) {
trigger(action_show_user_switch);
}
}
}
DS_END_NAMESPACE
22 changes: 4 additions & 18 deletions applets/dde-shutdown/treelandlockscreen.h
Original file line number Diff line number Diff line change
@@ -1,41 +1,27 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include "dsglobal.h"

Check warning on line 7 in applets/dde-shutdown/treelandlockscreen.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "dsglobal.h" not found.
#include "qwayland-treeland-dde-shell-v1.h"
#include "qwayland-treeland-compositor-action-unstable-v1.h"

Check warning on line 8 in applets/dde-shutdown/treelandlockscreen.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "qwayland-treeland-compositor-action-unstable-v1.h" not found.

#include <QtWaylandClient/QWaylandClientExtension>

Check warning on line 10 in applets/dde-shutdown/treelandlockscreen.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtWaylandClient/QWaylandClientExtension> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DS_BEGIN_NAMESPACE
namespace shutdown
{
class TreeLandLockScreenWorker;
class TreeLandLockScreen : public QWaylandClientExtensionTemplate<TreeLandLockScreen>, public QtWayland::treeland_dde_shell_manager_v1
class TreeLandLockScreen : public QWaylandClientExtensionTemplate<TreeLandLockScreen>, public QtWayland::treeland_compositor_action_v1
{
Q_OBJECT

public:
explicit TreeLandLockScreen();
~TreeLandLockScreen();
void lock();
void shutdown();
void switchUser();

private:
TreeLandLockScreenWorker *workder();

private:
QScopedPointer<TreeLandLockScreenWorker> m_worker;
};

class TreeLandLockScreenWorker : public QWaylandClientExtensionTemplate<TreeLandLockScreenWorker>, public QtWayland::treeland_lockscreen_v1
{
Q_OBJECT

public:
explicit TreeLandLockScreenWorker(struct ::treeland_lockscreen_v1 *object);
};
}
DS_END_NAMESPACE
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Build-Depends:
qt6-wayland-dev-tools,
qt6-wayland-private-dev,
systemd,
treeland-protocols (>= 0.6.0),
treeland-protocols (>= 0.7.0),
wayland-protocols,
Standards-Version: 4.6.2
Homepage: https://github.com/linuxdeepin/dde-shell
Expand Down
1 change: 0 additions & 1 deletion panels/dock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ qt_generate_wayland_protocol_client_sources(dockpanel
NO_INCLUDE_CORE_ONLY
FILES
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-wallpaper-color-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-dde-shell-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-xwindow-control-unstable-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-region-watch-unstable-v1.xml
)
Expand Down
9 changes: 4 additions & 5 deletions panels/dock/multitaskview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

find_package(PkgConfig REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} COMPONENTS WaylandClient)
find_package(TreelandProtocols REQUIRED)
find_package(TreelandProtocols 0.7.0 REQUIRED)
pkg_check_modules(WaylandClient REQUIRED IMPORTED_TARGET wayland-client)

add_library(dock-multitaskview SHARED
multitaskview.cpp
multitaskview.h
treelandmultitaskview.cpp
treelandmultitaskview.h
treelandcompositoraction.cpp
treelandcompositoraction.h
)

target_include_directories(dock-multitaskview PRIVATE
Expand All @@ -20,9 +20,8 @@ target_include_directories(dock-multitaskview PRIVATE
)

qt_generate_wayland_protocol_client_sources(dock-multitaskview
NO_INCLUDE_CORE_ONLY
FILES
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-dde-shell-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-compositor-action-unstable-v1.xml
)

target_link_libraries(dock-multitaskview PRIVATE
Expand Down
6 changes: 3 additions & 3 deletions panels/dock/multitaskview/multitaskview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ MultiTaskView::MultiTaskView(QObject *parent)
});
auto platformName = QGuiApplication::platformName();
if (QStringLiteral("wayland") == platformName) {
m_multitaskview.reset(new TreeLandMultitaskview);
m_compositorAction.reset(new TreelandCompositorAction);
} else {
m_kWinCompositingConfig = DConfig::create("org.kde.kwin", "org.kde.kwin.compositing", QString(), this);
m_kWinEffect = m_kWinCompositingConfig->value(windowEffectTypeKey).toInt() != KWinOptimalPerformance;
Expand Down Expand Up @@ -87,8 +87,8 @@ void MultiTaskView::openWorkspace()
{QStringLiteral("kwin_version"), m_kwinVersion}
}));
#endif
if (m_multitaskview) {
m_multitaskview->toggle();
if (m_compositorAction) {
m_compositorAction->toggle();
return;
}

Expand Down
4 changes: 2 additions & 2 deletions panels/dock/multitaskview/multitaskview.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

#include "../frame/dappletdock.h"
#include "../frame/dockiteminfo.h"
#include "applet.h"

Check warning on line 9 in panels/dock/multitaskview/multitaskview.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "applet.h" not found.
#include "dsglobal.h"

Check warning on line 10 in panels/dock/multitaskview/multitaskview.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "dsglobal.h" not found.
#include "treelandmultitaskview.h"
#include "treelandcompositoraction.h"

#include <DConfig>

Check warning on line 13 in panels/dock/multitaskview/multitaskview.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DConfig> not found. Please note: Cppcheck does not need standard library headers to get proper results.

namespace dock {

Expand Down Expand Up @@ -38,7 +38,7 @@
bool m_kWinEffect = true;
QString m_kwinVersion;
QString m_iconName;
QScopedPointer<TreeLandMultitaskview> m_multitaskview;
QScopedPointer<TreelandCompositorAction> m_compositorAction;
Dtk::Core::DConfig *m_kWinCompositingConfig = nullptr;
};

Expand Down
29 changes: 29 additions & 0 deletions panels/dock/multitaskview/treelandcompositoraction.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include "treelandcompositoraction.h"
#include "wayland-treeland-compositor-action-unstable-v1-client-protocol.h"

Check warning on line 6 in panels/dock/multitaskview/treelandcompositoraction.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "wayland-treeland-compositor-action-unstable-v1-client-protocol.h" not found.

namespace dock
{
TreelandCompositorAction::TreelandCompositorAction(QObject *parent)
: QWaylandClientExtensionTemplate<TreelandCompositorAction>(treeland_compositor_action_v1_interface.version)
{
setParent(parent);
}

TreelandCompositorAction::~TreelandCompositorAction()
{
if (isActive()) {
destroy();
}
}

void TreelandCompositorAction::toggle()
{
if (isActive()) {
trigger(action_toggle_multitask_view);
}
}
}
20 changes: 20 additions & 0 deletions panels/dock/multitaskview/treelandcompositoraction.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include "qwayland-treeland-compositor-action-unstable-v1.h"
#include <QtWaylandClient/QWaylandClientExtension>

namespace dock
{

class TreelandCompositorAction : public QWaylandClientExtensionTemplate<TreelandCompositorAction>, public QtWayland::treeland_compositor_action_v1
{
public:
explicit TreelandCompositorAction(QObject *parent = nullptr);
~TreelandCompositorAction();
void toggle();
};
}
31 changes: 0 additions & 31 deletions panels/dock/multitaskview/treelandmultitaskview.cpp

This file was deleted.

33 changes: 0 additions & 33 deletions panels/dock/multitaskview/treelandmultitaskview.h

This file was deleted.

8 changes: 4 additions & 4 deletions panels/dock/showdesktop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

find_package(PkgConfig REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} ${REQUIRED_QT_VERSION} COMPONENTS WaylandClient)
find_package(TreelandProtocols 0.6.0 REQUIRED)
find_package(TreelandProtocols 0.7.0 REQUIRED)
pkg_check_modules(WaylandClient REQUIRED IMPORTED_TARGET wayland-client)

add_library(dock-showdesktop SHARED
showdesktop.cpp
showdesktop.h
treelandshowdesktop.cpp
treelandshowdesktop.h
treelandcompositoraction.cpp
treelandcompositoraction.h
)

qt_generate_wayland_protocol_client_sources(dock-showdesktop
FILES
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-show-desktop-unstable-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-compositor-action-unstable-v1.xml
)

target_link_libraries(dock-showdesktop PRIVATE
Expand Down
10 changes: 5 additions & 5 deletions panels/dock/showdesktop/showdesktop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "showdesktop.h"
#include "applet.h"
#include "pluginfactory.h"
#include "treelandshowdesktop.h"
#include "treelandcompositoraction.h"

#include <QProcess>
#include <QGuiApplication>
Expand All @@ -22,7 +22,7 @@ namespace dock {

ShowDesktop::ShowDesktop(QObject *parent)
: DApplet(parent)
, m_showDesktop(nullptr)
, m_compositorAction(nullptr)
, m_dockConfig(nullptr)
, m_visible(true)
{
Expand All @@ -47,7 +47,7 @@ bool ShowDesktop::load()
bool ShowDesktop::init()
{
if (QStringLiteral("wayland") == QGuiApplication::platformName()) {
m_showDesktop = new TreelandShowDesktop(this);
m_compositorAction = new TreelandCompositorAction(this);
}

// 从配置中读取初始的可见性状态
Expand All @@ -61,8 +61,8 @@ bool ShowDesktop::init()

void ShowDesktop::toggleShowDesktop()
{
if (m_showDesktop) {
m_showDesktop->desktopToggle();
if (m_compositorAction) {
m_compositorAction->desktopToggle();
return;
}

Expand Down
Loading
Loading