Skip to content

Commit

Permalink
fix: crash in Treeland
Browse files Browse the repository at this point in the history
Used outdated protocol XML files,Now we rely on package <treeland-protocols> and use the protocol files provided by it

pms: BUG-294459
  • Loading branch information
mhduiy committed Jan 7, 2025
1 parent 84f08fa commit 2c55f23
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 436 deletions.
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Build-Depends:
wlr-protocols,
libdtk6widget-dev,
libdtk6core-dev,
treeland-protocols,
Standards-Version: 4.5.0

Package: xdg-desktop-portal-dde
Expand Down
193 changes: 0 additions & 193 deletions protocol/treeland-personalization-manager-v1.xml

This file was deleted.

3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ find_package(
WaylandClient)
find_package(Qt6WaylandScannerTools REQUIRED)
find_package(Dtk6 REQUIRED COMPONENTS Core Widget)
find_package(TreelandProtocols REQUIRED)

set_source_files_properties(
${CMAKE_SOURCE_DIR}/misc/org.freedesktop.Notifications.xml
Expand Down Expand Up @@ -77,7 +78,7 @@ add_executable(${PROJECT_NAME}

qt6_generate_wayland_protocol_client_sources(${PROJECT_NAME}
FILES
${CMAKE_SOURCE_DIR}/protocol/treeland-personalization-manager-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-personalization-manager-v1.xml
)

target_link_libraries(${PROJECT_NAME} PUBLIC
Expand Down
14 changes: 7 additions & 7 deletions src/personalization_manager_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ void PersonalizationManager::onActiveChanged()
return;

if (!m_wallpaperContext) {
m_wallpaperContext = new PersonalizationWallpaper(get_wallpaper_context());
m_wallpaperContext = new PersonalizationWallpaperContext(get_wallpaper_context());
}
}

PersonalizationWallpaper::PersonalizationWallpaper(
struct ::personalization_wallpaper_context_v1 *object)
: QWaylandClientExtensionTemplate<PersonalizationWallpaper>(1)
, QtWayland::personalization_wallpaper_context_v1(object)
PersonalizationWallpaperContext::PersonalizationWallpaperContext(struct ::treeland_personalization_wallpaper_context_v1 *context)
: QWaylandClientExtensionTemplate<PersonalizationWallpaperContext>(1)
, QtWayland::treeland_personalization_wallpaper_context_v1(context)
{

}

void PersonalizationWallpaper::personalization_wallpaper_context_v1_metadata(
const QString &metadata)
void PersonalizationWallpaperContext::treeland_personalization_wallpaper_context_v1_metadata(
const QString &metadata)
{
Q_EMIT metadataChanged(metadata);
}
22 changes: 11 additions & 11 deletions src/personalization_manager_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <QScreen>
#include <QtWaylandClient/QWaylandClientExtension>

class PersonalizationWallpaper;
class PersonalizationWallpaperContext;
class PersonalizationManager : public QWaylandClientExtensionTemplate<PersonalizationManager>,
public QtWayland::treeland_personalization_manager_v1
{
Expand All @@ -16,30 +16,30 @@ class PersonalizationManager : public QWaylandClientExtensionTemplate<Personaliz
~PersonalizationManager();
void onActiveChanged();

PersonalizationWallpaper *wallpaper() { return m_wallpaperContext; }
PersonalizationWallpaperContext *wallpaper() { return m_wallpaperContext; }

private:
PersonalizationWallpaper *m_wallpaperContext = nullptr;
PersonalizationWallpaperContext *m_wallpaperContext = nullptr;
};

class PersonalizationWindow : public QWaylandClientExtensionTemplate<PersonalizationWindow>,
public QtWayland::personalization_window_context_v1
class PersonalizationWindowContext : public QWaylandClientExtensionTemplate<PersonalizationWindowContext>,
public QtWayland::treeland_personalization_window_context_v1
{
Q_OBJECT
public:
explicit PersonalizationWindow(struct ::personalization_window_context_v1 *object);
explicit PersonalizationWindowContext(struct ::treeland_personalization_window_context_v1 *context);
};

class PersonalizationWallpaper : public QWaylandClientExtensionTemplate<PersonalizationWallpaper>,
public QtWayland::personalization_wallpaper_context_v1
class PersonalizationWallpaperContext : public QWaylandClientExtensionTemplate<PersonalizationWallpaperContext>,
public QtWayland::treeland_personalization_wallpaper_context_v1
{
Q_OBJECT
public:
explicit PersonalizationWallpaper(struct ::personalization_wallpaper_context_v1 *object);
explicit PersonalizationWallpaperContext(struct ::treeland_personalization_wallpaper_context_v1 *context);

signals:
Q_SIGNALS:
void metadataChanged(const QString &meta);

protected:
void personalization_wallpaper_context_v1_metadata(const QString &metadata) override;
void treeland_personalization_wallpaper_context_v1_metadata(const QString &metadata) override;
};
10 changes: 5 additions & 5 deletions src/wallpaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ uint32_t WallPaperPortal::setOn2Int(const QVariantMap &options)
QString set_on = options.value("set-on").toString();
uint32_t op = 0;
if (set_on == "background")
op = personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_BACKGROUND;
op = PersonalizationWallpaperContext::options_background;
else if (set_on == "lockscreen")
op = personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_LOCKSCREEN;
op = PersonalizationWallpaperContext::options_lockscreen;
else if (set_on == "both")
op = personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_LOCKSCREEN |
personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_BACKGROUND;
op = PersonalizationWallpaperContext::options_lockscreen |
PersonalizationWallpaperContext::options_background;

if (options.value("show-preview").toBool())
op = op | personalization_wallpaper_context_v1_options::PERSONALIZATION_WALLPAPER_CONTEXT_V1_OPTIONS_PREVIEW;
op = op | PersonalizationWallpaperContext::options_preview;

return op;
}
6 changes: 4 additions & 2 deletions src/wayland/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
find_package(PkgConfig REQUIRED)
pkg_get_variable(WlrProtocols_PKGDATADIR wlr-protocols pkgdatadir)
find_package(Qt6 COMPONENTS REQUIRED Core DBus WaylandClient WaylandScannerTools)
find_package(TreelandProtocols REQUIRED)


add_library(xdg-desktop-portal-dde-wayland SHARED
portalwaylandcontext.h
Expand All @@ -15,9 +17,9 @@ add_library(xdg-desktop-portal-dde-wayland SHARED
protocols/treelandcapture.cpp
)

qt_generate_wayland_protocol_client_sources(xdg-desktop-portal-dde-wayland FILES
qt6_generate_wayland_protocol_client_sources(xdg-desktop-portal-dde-wayland FILES
${WlrProtocols_PKGDATADIR}/unstable/wlr-screencopy-unstable-v1.xml
${CMAKE_CURRENT_LIST_DIR}/protocols/treeland-capture-unstable-v1.xml
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-capture-unstable-v1.xml
)

target_include_directories(xdg-desktop-portal-dde-wayland
Expand Down
Loading

0 comments on commit 2c55f23

Please sign in to comment.