Skip to content
Draft
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
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Build-Depends: debhelper-compat (= 12),
libgmock-dev,
libdtkcommon-dev,
librsvg2-dev,
treeland-protocols (>>0.5.8),
treeland-protocols (>= 0.6.0),
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;
}
#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
25 changes: 18 additions & 7 deletions src/plugins/platform/config.tests/treeland_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)

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

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
14 changes: 7 additions & 7 deletions src/plugins/platform/config.tests/treeland_test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
45 changes: 14 additions & 31 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,24 +26,21 @@
, 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()) {
connect(TreelandAppearance::instance(), &TreelandAppearance::activeChanged, this, [this](){
if (TreelandAppearance::instance()->isSupported()) {
initContext();
}
});
if (TreelandAppearance::instance()->isSupported()) {
initContext();
}
}

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));
}
TreelandAppearance::instance()->m_interface = this;
}

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

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

Expand All @@ -95,44 +90,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
15 changes: 3 additions & 12 deletions src/plugins/platform/treeland/dtreelandplatforminterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@
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);

Expand All @@ -51,10 +46,6 @@ class DTreelandPlatformInterface : public QObject, public DPlatformInterface, pu
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 +56,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