xfdesktop4: Use consistent monitor identifiers for wallpaper

The settings dialog used gdk_monitor_get_model() which often returns
NULL, generating invalid property paths. The main daemon uses
xfw_monitor_get_connector(), causing a mismatch that prevented wallpaper
changes.

Fix by using GDK APIs to obtain a valid monitor model name, aligning
with the daemon's identification logic.
This commit is contained in:
Wei Zhang 2025-12-12 06:49:02 +00:00 committed by Tate, Hongliang Tian
parent 29aa359440
commit 8df2129c39
2 changed files with 55 additions and 2 deletions

View File

@ -45,8 +45,12 @@ self: super:
xfce = super.xfce // {
xfwm4 = super.xfce.xfwm4.overrideAttrs (oldAttrs: { version = "4.16.1"; });
xfdesktop =
super.xfce.xfdesktop.overrideAttrs (oldAttrs: { version = "4.16.0"; });
xfdesktop = super.xfce.xfdesktop.overrideAttrs (oldAttrs: {
version = "4.16.0";
patches = (oldAttrs.patches or [ ]) ++ [
./patches/xfdesktop4/0001-Fix-not-using-consistent-monitor-identifiers.patch
];
});
};
}

View File

@ -0,0 +1,49 @@
From 7910c57b0862ab8b81af895d9aaddaadbe3109d9 Mon Sep 17 00:00:00 2001
From: Wei Zhang <ruoyuan.zw@antgroup.com>
Date: Thu, 28 Aug 2025 16:58:42 +0800
Subject: [PATCH] Fix not using consistent monitor identifiers
The settings dialog was using gdk_monitor_get_model() which often returns
NULL, causing it to generate invalid property paths. The main daemon uses
connector names via xfw_monitor_get_connector(). This mismatch prevented
wallpaper changes from taking effect.
Changed settings dialog to use gdk_monitor_get_model() with a fallback to
"default" when NULL, ensuring both processes use compatible monitor
identifiers for XfConf property paths.
Signed-off-by: Wei Zhang <ruoyuan.zw@antgroup.com>
---
common/xfdesktop-common.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index c846c05..101025d 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -114,12 +114,21 @@ xfdesktop_get_monitor_name_from_gtk_widget(GtkWidget *widget, gint monitor_num)
GdkWindow *window = NULL;
GdkDisplay *display = NULL;
GdkMonitor *monitor = NULL;
+ const gchar *model = NULL;
window = gtk_widget_get_window(widget);
display = gdk_window_get_display(window);
monitor = gdk_display_get_monitor(display, monitor_num);
- return g_strdup(gdk_monitor_get_model(monitor));
+ // Get monitor model name (this is what GDK provides)
+ model = gdk_monitor_get_model(monitor);
+
+ // For consistency, if model is NULL, fall back to a default identifier
+ if (model == NULL || strlen(model) == 0) {
+ return g_strdup("default");
+ }
+
+ return g_strdup(model);
}
gint
--
2.43.0