Skip to content
Open
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
11 changes: 11 additions & 0 deletions misc/dconfig/org.deepin.dde.treeland.user.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,17 @@
"description[zh_CN]": "多任务视图加载因子",
"permissions": "readonly",
"visibility": "private"
},
"wallpaperConfig": {
"value": "",
"serial": 0,
"flags": ["global"],
"name": "Wallpaper Config",
"name[zh_CN]": "壁纸配置",
"description": "A configuration to manage wallpapers used by the system, including desktop and lockscreen wallpapers for each screen and workspace.",
"description[zh_CN]": "用于管理系统当前使用的壁纸配置,包括每个屏幕和工作区的桌面壁纸和锁屏壁纸。",
"permissions": "readwrite",
"visibility": "public"
}
}
}
1 change: 1 addition & 0 deletions misc/systemd/treeland.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Environment=DSG_APP_ID=org.deepin.dde.treeland
Environment=ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer
# For Debug: if enable asan, you can't get it's log from journalctl, so ensure the log to a file
Environment=ASAN_OPTIONS=log_path=/tmp/treeland-asan:detect_leaks=0:abort_on_error=1:symbolize=1
Environment=DDM_DISPLAY_MANAGER=1
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/treeland.sh --lockscreen
Restart=on-failure
RestartSec=1s
Expand Down
12 changes: 8 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,16 @@ qt_add_qml_module(libtreeland
utils/loginddbustypes.cpp
utils/fpsdisplaymanager.cpp
utils/fpsdisplaymanager.h
wallpaper/wallpapercontroller.cpp
wallpaper/wallpapercontroller.h
wallpaper/wallpaperimage.cpp
wallpaper/wallpaperimage.h
wallpaper/wallpapersurface.h
wallpaper/wallpapersurface.cpp
wallpaper/wallpaperitem.cpp
wallpaper/wallpaperitem.h
wallpaper/wallpapermanager.cpp
wallpaper/wallpapermanager.h
wallpaper/wallpaperconfig.h
wallpaper/wallpaperconfig.cpp
wallpaper/wallpaperlauncher.h
wallpaper/wallpaperlauncher.cpp
workspace/workspace.cpp
workspace/workspace.h
workspace/workspaceanimationcontroller.cpp
Expand Down
21 changes: 12 additions & 9 deletions src/core/qml/Effects/LaunchpadCover.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ Item {
z: (wrapper.z ?? 0) - 1
anchors.fill: wrapper

WallpaperController {
id: wallpaperController
Wallpaper {
id: wallpaper
output: root.output
lock: true
type: mapped ? WallpaperController.Scale : WallpaperController.Normal
workspace: Helper.workspace.current
}

ShaderEffectSource {
id: wallpaper
sourceItem: wallpaperController.proxy
id: wallpaperSource
sourceItem: wallpaper
recursive: true
live: true
smooth: true
Expand All @@ -38,14 +37,14 @@ Item {
State {
name: "Normal"
PropertyChanges {
target: wallpaper
target: wallpaperSource
scale: 1
}
},
State {
name: "Scale"
PropertyChanges {
target: wallpaper
target: wallpaperSource
scale: 1.4
}
}
Expand Down Expand Up @@ -75,7 +74,7 @@ Item {

Blur {
anchors.fill: parent
z: wallpaper.z + 1
z: wallpaperSource.z + 1
}

Rectangle {
Expand All @@ -92,4 +91,8 @@ Item {
easing.type: Easing.OutExpo
}
}

onMappedChanged: {
Helper.setLaunchpadMapped(root.output, root.mapped)
}
}
49 changes: 46 additions & 3 deletions src/core/qml/PrimaryOutput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Treeland
OutputItem {
id: rootOutputItem
readonly property OutputViewport screenViewport: outputViewport
property alias wallpaperVisible: wallpaper.visible
property bool forceSoftwareCursor: false

devicePixelRatio: output?.scale ?? devicePixelRatio
Expand Down Expand Up @@ -102,8 +101,6 @@ OutputItem {
output: rootOutputItem.output
workspace: Helper.workspace.current
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
retainWhileLoading: true
clip: true

states: [
Expand All @@ -121,6 +118,13 @@ OutputItem {
scale: 1.4
}
},
State {
name: "ScaleTo1.2"
PropertyChanges {
target: wallpaper
scale: 1.2
}
},
State {
name: "ScaleWithoutAnimation"
PropertyChanges {
Expand Down Expand Up @@ -149,6 +153,15 @@ OutputItem {
easing.type: Easing.OutExpo
}
},
Transition {
from: "*"
to: "ScaleTo1.2"
PropertyAnimation {
property: "scale"
duration: 1000
easing.type: Easing.OutExpo
}
},
Transition {
from: "*"
to: "ScaleWithoutAnimation"
Expand All @@ -158,6 +171,36 @@ OutputItem {
}
}
]

Connections {
target: Helper
function onLaunchpadMappedChanged(output, mapped) {
if (output !== rootOutputItem.output) {
return;
}

wallpaper.state = mapped ? "Scale" : "Normal"
}

function onShowDesktopRequested(output) {
if (output !== rootOutputItem.output) {
return;
}

wallpaper.state = "Normal"
wallpaper.play = true
wallpaper.slowDown()
}

function onStartLockscreened(output, showAnimation) {
if (output !== rootOutputItem.output) {
return;
}

wallpaper.play = false
wallpaper.state = showAnimation ? "ScaleTo1.2" : "ScaleWithoutAnimation"
}
}
}
}

Expand Down
16 changes: 4 additions & 12 deletions src/core/qml/WorkspaceSwitcher.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ Item {
width: output.outputItem.width
height: output.outputItem.height

WallpaperController {
id: wpCtrl
output: animationDelegate.output.outputItem.output
type: WallpaperController.Normal
lock: true
}

Row {
x: - Helper.workspace.animationController.viewportPos * animationDelegate.localAnimationScaleFactor
spacing: Helper.workspace.animationController.refGap * animationDelegate.localAnimationScaleFactor
Expand All @@ -44,12 +37,11 @@ Item {
height: animationDelegate.output.outputItem.height
id: workspaceDelegate
required property WorkspaceModel workspace
ShaderEffectSource {
id: wallpaperShot
sourceItem: wpCtrl.proxy
hideSource: false
anchors.fill: parent
Wallpaper {
workspace: workspaceDelegate.workspace
output: animationDelegate.output.outputItem.output
}

WorkspaceProxy {
workspace: workspaceDelegate.workspace
output: animationDelegate.output
Expand Down
11 changes: 11 additions & 0 deletions src/core/shellhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
#include "rootsurfacecontainer.h"
#include "seat/helper.h"
#include "surface/surfacewrapper.h"
#include "treelandconfig.hpp"

Check warning on line 15 in src/core/shellhandler.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "treelandconfig.hpp" not found.
#include "treelanduserconfig.hpp"

Check warning on line 16 in src/core/shellhandler.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "treelanduserconfig.hpp" not found.
#include "workspace/workspace.h"

Check warning on line 17 in src/core/shellhandler.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "workspace/workspace.h" not found.
#include "session/session.h"

Check warning on line 18 in src/core/shellhandler.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "session/session.h" not found.
#include "wallpapershellinterfacev1.h"

Check warning on line 19 in src/core/shellhandler.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "wallpapershellinterfacev1.h" not found.

#include <xcb/xcb.h>

Check warning on line 21 in src/core/shellhandler.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

#include <winputmethodhelper.h>
#include <winputpopupsurface.h>
Expand Down Expand Up @@ -248,6 +250,15 @@
connect(m_layerShell, &WLayerShell::surfaceRemoved, this, &ShellHandler::onLayerSurfaceRemoved);
}

void ShellHandler::initWallpaperShell(Waylib::Server::WServer *server)
{
Q_ASSERT_X(!m_wallpaperShell, Q_FUNC_INFO, "Only init once!");
m_wallpaperShell = server->attach<TreelandWallpaperShellInterfaceV1>(m_wallpaperShell);
if (qEnvironmentVariableIsSet("DDM_DISPLAY_MANAGER")) {
m_wallpaperShell->setFilter([this](WClient *client) { return Helper::instance()->sessionManager()->isDDEUserClient(client); });
}
}

WXWayland *ShellHandler::createXWayland(WServer *server,
WSeat *seat,
qw_compositor *compositor,
Expand Down
7 changes: 7 additions & 0 deletions src/core/shellhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ QT_END_NAMESPACE

class AppIdResolverManager; // forward declare new protocol manager
class WindowConfigStore; // forward declare config store
class TreelandWallpaperShellInterfaceV1;
class TreelandWallpaperSurfaceInterfaceV1;

class ShellHandler : public QObject
{
Expand All @@ -68,6 +70,7 @@ class ShellHandler : public QObject
void createComponent(QmlEngine *engine);
void initXdgShell(WAYLIB_SERVER_NAMESPACE::WServer *server);
void initLayerShell(WAYLIB_SERVER_NAMESPACE::WServer *server);
void initWallpaperShell(WAYLIB_SERVER_NAMESPACE::WServer *server);
[[nodiscard]] WAYLIB_SERVER_NAMESPACE::WXWayland *createXWayland(
WAYLIB_SERVER_NAMESPACE::WServer *server,
WAYLIB_SERVER_NAMESPACE::WSeat *seat,
Expand All @@ -79,6 +82,9 @@ class ShellHandler : public QObject
WAYLIB_SERVER_NAMESPACE::WSeat *seat);

WAYLIB_SERVER_NAMESPACE::WXWayland *defaultXWaylandSocket() const;
TreelandWallpaperShellInterfaceV1 *wallpaperShell() const {
return m_wallpaperShell;
}
Q_SIGNALS:
void surfaceWrapperAdded(SurfaceWrapper *wrapper);
void surfaceWrapperAboutToRemove(SurfaceWrapper *wrapper);
Expand Down Expand Up @@ -129,6 +135,7 @@ private Q_SLOTS:

WAYLIB_SERVER_NAMESPACE::WXdgShell *m_xdgShell = nullptr;
WAYLIB_SERVER_NAMESPACE::WLayerShell *m_layerShell = nullptr;
TreelandWallpaperShellInterfaceV1 *m_wallpaperShell = nullptr;
WAYLIB_SERVER_NAMESPACE::WInputMethodHelper *m_inputMethodHelper = nullptr;
QList<WAYLIB_SERVER_NAMESPACE::WXWayland *> m_xwaylands;

Expand Down
27 changes: 26 additions & 1 deletion src/modules/wallpaper/wallpapershellinterfacev1.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright (C) 2026 UnionTech Software Technology Co., Ltd.
// SPDX-License-Identifier: Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "wallpapersurface.h"

Check warning on line 4 in src/modules/wallpaper/wallpapershellinterfacev1.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "wallpapersurface.h" not found.
#include "wallpapershellinterfacev1.h"
#include "qwayland-server-treeland-wallpaper-shell-unstable-v1.h"

Check warning on line 6 in src/modules/wallpaper/wallpapershellinterfacev1.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "qwayland-server-treeland-wallpaper-shell-unstable-v1.h" not found.

#include <qwcompositor.h>
#include <qwdisplay.h>
Expand All @@ -18,6 +19,7 @@
wl_global *global() const;

TreelandWallpaperShellInterfaceV1 *q = nullptr;
QList<QString> producedWallpapers;

protected:
void treeland_wallpaper_shell_v1_destroy_global() override;
Expand Down Expand Up @@ -58,6 +60,7 @@
return;
}

producedWallpapers.append(file_source);
wl_resource *surfaceResource = wl_resource_create(resource->client(),
&treeland_wallpaper_surface_v1_interface,
resource->version(),
Expand All @@ -70,8 +73,9 @@
auto wallpaperSurface = new TreelandWallpaperSurfaceInterfaceV1(surface, file_source, surfaceResource);
s_wallpaperSurfaces.append(wallpaperSurface);

QObject::connect(wallpaperSurface, &QObject::destroyed, [wallpaperSurface]() {
QObject::connect(wallpaperSurface, &QObject::destroyed, [wallpaperSurface, this]() {
s_wallpaperSurfaces.removeOne(wallpaperSurface);
producedWallpapers.removeOne(wallpaperSurface->source());
});

Q_EMIT q->wallpaperSurfaceAdded(wallpaperSurface);
Expand All @@ -83,6 +87,11 @@
{
}

QList<QString> TreelandWallpaperShellInterfaceV1::producedWallpapers() const

Check warning on line 90 in src/modules/wallpaper/wallpapershellinterfacev1.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'producedWallpapers' is never used.
{
return d->producedWallpapers;
}

TreelandWallpaperShellInterfaceV1::~TreelandWallpaperShellInterfaceV1() = default;

void TreelandWallpaperShellInterfaceV1::create(WServer *server)
Expand Down Expand Up @@ -116,6 +125,7 @@
TreelandWallpaperSurfaceInterfaceV1 *q;
wl_resource *surfaceResource = nullptr;
wl_resource *resource = nullptr;
WallpaperSurface *surface = nullptr;
QString wallpaperSource;

protected:
Expand Down Expand Up @@ -198,9 +208,24 @@
return nullptr;
}

void TreelandWallpaperSurfaceInterfaceV1::setPlay(bool value)

Check warning on line 211 in src/modules/wallpaper/wallpapershellinterfacev1.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'setPlay' is never used.
{
if (value) {
d->send_play();
} else {
d->send_pause();
}
}

void TreelandWallpaperSurfaceInterfaceV1::slowDown()
{
d->send_slow_down(3000);
}

TreelandWallpaperSurfaceInterfaceV1::TreelandWallpaperSurfaceInterfaceV1(wl_resource *surface,
const QString &source,
wl_resource *resource)
: d(new TreelandWallpaperSurfaceInterfaceV1Private(this, source, surface, resource))
{
d->surface = new WallpaperSurface(this, this);
}
3 changes: 3 additions & 0 deletions src/modules/wallpaper/wallpapershellinterfacev1.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TreelandWallpaperShellInterfaceV1 : public QObject , public WServerInterfa
~TreelandWallpaperShellInterfaceV1() override;

static constexpr int InterfaceVersion = 1;
QList<QString> producedWallpapers() const;

Q_SIGNALS:
void wallpaperSurfaceAdded(TreelandWallpaperSurfaceInterfaceV1 *interface);
Expand Down Expand Up @@ -50,6 +51,8 @@ class TreelandWallpaperSurfaceInterfaceV1 : public QObject

static TreelandWallpaperSurfaceInterfaceV1 *get(WSurface *surface);
static TreelandWallpaperSurfaceInterfaceV1 *get(const QString &source);
void setPlay(bool value);
void slowDown();

Q_SIGNALS:
void failed(uint32_t error);
Expand Down
Loading
Loading