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
3 changes: 2 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Build-Depends: debhelper-compat (= 12),
libgmock-dev,
libdtkcommon-dev,
librsvg2-dev,
treeland-protocols (>>0.5.8),
treeland-protocols (>= 0.7.0),
wayland-protocols (>= 1.45),
extra-cmake-modules,
libdtkdata,
libdtkcore-dev <!nodtk5>,
Expand Down
12 changes: 12 additions & 0 deletions src/kernel/dplatformhandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,12 @@ bool DPlatformHandle::setWindowBlurAreaByWM(QWindow *window, const QVector<DPlat
if (auto impl = dynamic_cast<DXCBPlatformWindowInterface *>(platformWindowImpl(&handle))) {
return impl->setWindowBlurArea(area);
}
#endif
#ifndef DTK_DISABLE_TREELAND
if (auto impl = dynamic_cast<DTreeLandPlatformWindowInterface *>(platformWindowImpl(&handle))) {
impl->setWindowBlurAreas(area);
return true;
}
Comment on lines +613 to +615

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ Low · Platform support documentation is outdated

The new Treeland routing makes some DPlatformHandle operations effective outside the DXCB/X11 platform, contradicting the class description that says its functionality is implemented by DXCB and the class has no effect on other platforms. Consumers relying on that description are misled about Treeland support.

Update the class description to identify the Treeland-supported operations and distinguish them from DXCB-only functionality.

Prompt for AI agents
In `src/kernel/dplatformhandle.cpp` at lines 613-615:

**Platform support documentation is outdated**

The new Treeland routing makes some `DPlatformHandle` operations effective outside the DXCB/X11 platform, contradicting the class description that says its functionality is implemented by DXCB and the class has no effect on other platforms. Consumers relying on that description are misled about Treeland support.

Update the class description to identify the Treeland-supported operations and distinguish them from DXCB-only functionality.

#endif
handle.setEnableBlurWindow(true);
return true;
Expand Down Expand Up @@ -663,6 +669,12 @@ bool DPlatformHandle::setWindowBlurAreaByWM(QWindow *window, const QList<QPainte
if (auto impl = dynamic_cast<DXCBPlatformWindowInterface *>(platformWindowImpl(&handle))) {
return impl->setWindowBlurArea(paths);
}
#endif
#ifndef DTK_DISABLE_TREELAND
if (auto impl = dynamic_cast<DTreeLandPlatformWindowInterface *>(platformWindowImpl(&handle))) {
impl->setWindowBlurPaths(paths);
return true;
}
#endif
handle.setEnableBlurWindow(true);
return true;
Expand Down
29 changes: 20 additions & 9 deletions src/plugins/platform/config.tests/treeland_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
# SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

Expand All @@ -19,14 +19,19 @@ endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)

find_package(TreelandProtocols)
find_package(TreelandProtocols 0.7.0 REQUIRED)
set(TreelandProtocols_FOUND ${TreelandProtocols_FOUND})
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${ECM_MODULE_PATH}")
find_package(WaylandProtocols 1.45 REQUIRED)

add_executable(${PROJECT_NAME} main.cpp)

if("${QT_VERSION_MAJOR}" STREQUAL "6")
qt6_generate_wayland_protocol_client_sources(${PROJECT_NAME} FILES
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-personalization-manager-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-appearance-unstable-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-decoration-unstable-v1.xml
${WaylandProtocols_DATADIR}/staging/ext-background-effect/ext-background-effect-v1.xml
)

if (${Qt6Core_VERSION} VERSION_GREATER_EQUAL "6.10.0")
Expand All @@ -36,14 +41,20 @@ if("${QT_VERSION_MAJOR}" STREQUAL "6")
else()
# ECM setup
include(FeatureSummary)
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${ECM_MODULE_PATH}")
find_package(QtWaylandScanner)
ecm_add_qtwayland_client_protocol(TABLET_SRCS
PROTOCOL ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-personalization-manager-v1.xml
BASENAME treeland-personalization-manager-v1
ecm_add_qtwayland_client_protocol(CLIENT_SRCS
PROTOCOL ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-appearance-unstable-v1.xml
BASENAME treeland-appearance-unstable-v1
)
target_sources(${PROJECT_NAME} PRIVATE ${TABLET_SRCS})
ecm_add_qtwayland_client_protocol(CLIENT_SRCS
PROTOCOL ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-decoration-unstable-v1.xml
BASENAME treeland-decoration-unstable-v1
)
ecm_add_qtwayland_client_protocol(CLIENT_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/staging/ext-background-effect/ext-background-effect-v1.xml
BASENAME ext-background-effect-v1
)
target_sources(${PROJECT_NAME} PRIVATE ${CLIENT_SRCS})

target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::XkbCommonSupportPrivate
Expand Down
16 changes: 8 additions & 8 deletions src/plugins/platform/config.tests/treeland_test/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

Expand All @@ -6,26 +6,26 @@

#include <QtWaylandClient/QWaylandClientExtension>
#include <QtWaylandClient/private/qwaylandsurface_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>

Check warning on line 9 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 9 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

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

#include <wayland-client-core.h>

Check warning on line 11 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wayland-client-core.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 11 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <wayland-client-core.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include "qwayland-treeland-personalization-manager-v1.h"
#include "qwayland-treeland-decoration-unstable-v1.h"

Check warning on line 12 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 12 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: "qwayland-treeland-decoration-unstable-v1.h" not found.
#include <qwaylandclientextension.h>

Check warning on line 13 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 13 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

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

#include <private/qguiapplication_p.h>

Check warning on line 15 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 15 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <private/qguiapplication_p.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <private/qwaylandintegration_p.h>
#include <private/qwaylandwindow_p.h>

Check warning on line 17 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 17 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <private/qwaylandwindow_p.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <private/qwaylanddisplay_p.h>

Check warning on line 18 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

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

Check warning on line 18 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

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

class PersonalizationWindowContext : public QWaylandClientExtensionTemplate<PersonalizationWindowContext>,
public QtWayland::treeland_personalization_window_context_v1
class TreelandDecorationContext : public QWaylandClientExtensionTemplate<TreelandDecorationContext>,
public QtWayland::treeland_decoration_context_v1
{
public:
PersonalizationWindowContext(struct ::treeland_personalization_window_context_v1 *context)
: QWaylandClientExtensionTemplate<PersonalizationWindowContext>(1)
, QtWayland::treeland_personalization_window_context_v1(context)
TreelandDecorationContext(struct ::treeland_decoration_context_v1 *context)

Check warning on line 24 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Class 'TreelandDecorationContext' has a constructor with 1 argument that is not explicit. Such, so called "Converting constructors", should in general be explicit for type safety reasons as that prevents unintended implicit conversions.

Check warning on line 24 in src/plugins/platform/config.tests/treeland_test/main.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Class 'TreelandDecorationContext' has a constructor with 1 argument that is not explicit. Such, so called "Converting constructors", should in general be explicit for type safety reasons as that prevents unintended implicit conversions.
: QWaylandClientExtensionTemplate<TreelandDecorationContext>(1)
, QtWayland::treeland_decoration_context_v1(context)
{
set_titlebar(enable_mode::enable_mode_disable);
set_titlebar_mode(titlebar_mode_hide);
}
};

Expand Down
47 changes: 10 additions & 37 deletions src/plugins/platform/treeland/dtreelandplatforminterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include "dtreelandplatforminterface.h"

#include "dplatformtheme.h"

Check warning on line 7 in src/plugins/platform/treeland/dtreelandplatforminterface.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "dplatformtheme.h" not found.

Check warning on line 7 in src/plugins/platform/treeland/dtreelandplatforminterface.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: "dplatformtheme.h" not found.
#include "private/dplatforminterface_p.h"

Check warning on line 8 in src/plugins/platform/treeland/dtreelandplatforminterface.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "private/dplatforminterface_p.h" not found.

Check warning on line 8 in src/plugins/platform/treeland/dtreelandplatforminterface.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: "private/dplatforminterface_p.h" not found.
#include "personalizationwaylandclientextension.h"
#include "treelandappearanceclientextension.h"

#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QtWaylandClient/private/qwaylandsurface_p.h>
Expand All @@ -16,7 +16,6 @@

DTreelandPlatformInterface::DTreelandPlatformInterface(DPlatformTheme *platformTheme)
: DPlatformInterface(platformTheme)
, m_manager(nullptr)
, m_activeColor(QColor())
, m_titleHeight(0)
, m_fontName(QByteArray())
Expand All @@ -27,25 +26,12 @@
, m_windowRadius(0)
, m_scrollBarPolicy(0)
, m_themeName(QByteArray())
, m_blurOpacity(0)
, m_blurOpacity(0.0)
{
m_manager = PersonalizationManager::instance();
connect(m_manager, &PersonalizationManager::activeChanged, this, [this](){
if (m_manager->isActive()) {
initContext();
}
});
new TreelandAppearance(this);
}

void DTreelandPlatformInterface::initContext()
{
if (m_appearanceContext.isNull()) {
m_appearanceContext.reset(new PersonalizationAppearanceContext(m_manager->get_appearance_context(), this));
}
if (m_fontContext.isNull()) {
m_fontContext.reset(new PersonalizationFontContext(m_manager->get_font_context(), this));
}
}
DTreelandPlatformInterface::~DTreelandPlatformInterface() = default;

QByteArray DTreelandPlatformInterface::iconThemeName() const
{
Expand Down Expand Up @@ -74,7 +60,6 @@

QColor DTreelandPlatformInterface::darkActiveColor() const
{
// treeland does not provide dark active color, return active color as fallback
return m_activeColor;
}

Expand All @@ -95,44 +80,32 @@

void DTreelandPlatformInterface::setWindowRadius(int windowRadius)
{
if (m_appearanceContext) {
m_appearanceContext->set_round_corner_radius(windowRadius);
}
Q_UNUSED(windowRadius)
}

void DTreelandPlatformInterface::setIconThemeName(const QByteArray &iconThemeName)
{
if (m_appearanceContext) {
m_appearanceContext->set_icon_theme(iconThemeName);
}
Q_UNUSED(iconThemeName)
}

void DTreelandPlatformInterface::setFontName(const QByteArray &fontName)
{
if (m_fontContext) {
m_fontContext->set_font(fontName);
}
Q_UNUSED(fontName)
}

void DTreelandPlatformInterface::setMonoFontName(const QByteArray &monoFontName)
{
if (m_fontContext) {
m_fontContext->set_monospace_font(monoFontName);
}
Q_UNUSED(monoFontName)
}

void DTreelandPlatformInterface::setFontPointSize(qreal fontPointSize)
{
if (m_fontContext) {
m_fontContext->set_font_size(fontPointSize);
}
Q_UNUSED(fontPointSize)
}

void DTreelandPlatformInterface::setActiveColor(const QColor activeColor)
{
if (m_appearanceContext) {
m_appearanceContext->set_active_color(activeColor.name());
}
Q_UNUSED(activeColor)
}

DGUI_END_NAMESPACE
19 changes: 4 additions & 15 deletions src/plugins/platform/treeland/dtreelandplatforminterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@
DGUI_BEGIN_NAMESPACE

class DTreelandPlatformInterfacePrivate;
class PersonalizationManager;
class PersonalizationFontContext;
class PersonalizationAppearanceContext;
class PersonalizationWindowContext;
class TreelandAppearance;

class DTreelandPlatformInterface : public QObject, public DPlatformInterface, public DCORE_NAMESPACE::DObject
{
Q_OBJECT
friend PersonalizationFontContext;
friend PersonalizationAppearanceContext;
friend PersonalizationWindowContext;
friend TreelandAppearance;
public:
explicit DTreelandPlatformInterface(DPlatformTheme *platformTheme);
~DTreelandPlatformInterface() override;

QByteArray iconThemeName() const override;
QByteArray fontName() const override;
Expand All @@ -48,13 +44,6 @@ class DTreelandPlatformInterface : public QObject, public DPlatformInterface, pu
void setActiveColor(const QColor activeColor) override;

private:
void initContext();

private:
PersonalizationManager *m_manager;
QScopedPointer<PersonalizationAppearanceContext> m_appearanceContext;
QScopedPointer<PersonalizationFontContext> m_fontContext;

QColor m_activeColor;
int m_titleHeight;
QByteArray m_fontName;
Expand All @@ -65,7 +54,7 @@ class DTreelandPlatformInterface : public QObject, public DPlatformInterface, pu
int m_windowRadius;
int m_scrollBarPolicy;
QByteArray m_themeName;
uint32_t m_blurOpacity;
qreal m_blurOpacity;
};

DGUI_END_NAMESPACE
Expand Down
Loading
Loading