From 9f828de605acc4b2469f449f1ee3deec7c58b6f24f51b8860e379ca4dd77a0a6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 22 Aug 2025 14:23:12 +0200 Subject: [PATCH] Fix the monitor name pickup on Wayland, which resulted in broken background picture setup (bsc#1247542) xfdesktop-wayland-get-proper-monitor-name.patch Fix missing backslash for building in non-git mode --- ...ktop-wayland-get-proper-monitor-name.patch | 63 +++++++++++++++++++ xfdesktop.changes | 8 +++ xfdesktop.spec | 6 +- 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 xfdesktop-wayland-get-proper-monitor-name.patch diff --git a/xfdesktop-wayland-get-proper-monitor-name.patch b/xfdesktop-wayland-get-proper-monitor-name.patch new file mode 100644 index 0000000..c56c8f9 --- /dev/null +++ b/xfdesktop-wayland-get-proper-monitor-name.patch @@ -0,0 +1,63 @@ +Subject: Fix the broken background picture setup on Wayland + +The xfdesktop-settings picks up the backdrop prefix with the monitor +name returned from xfdesktop_get_monitor_name_from_gtk_widget(), where +it tries to get the monitor name from gdk. On Wayland, this returns +the actual monitor name or model, not the connector name. +Meanwhile, the xfdesktop itself uses the backdrop prefix with the +connector name (e.g. "eDP-1" or "Virtual-1"). This difference made +the setup done by xfdesktop-settings ignored. + +Instead of deducing the prefix name from gdk, try to guess from the +given XfwWindow. + +--- + settings/xfdesktop-background-settings.c | 23 +++++++++++++++++++++-- + 1 file changed, 21 insertions(+), 2 deletions(-) + +--- a/settings/xfdesktop-background-settings.c ++++ b/settings/xfdesktop-background-settings.c +@@ -1451,6 +1451,25 @@ xfdesktop_settings_get_active_workspace( + return workspace_num; + } + ++static gchar *get_monitor_name(XfdesktopBackgroundSettings *background_settings, ++ int monitor_num) ++{ ++ GList *monitors = xfw_window_get_monitors(background_settings->xfw_window); ++ ++ if (monitors) { ++ gpointer p = g_list_nth_data(monitors, monitor_num); ++ ++ if (p) { ++ const gchar *name = xfw_monitor_get_connector(XFW_MONITOR(p)); ++ if (name) ++ return g_strdup(name); ++ } ++ } ++ ++ /* fallback */ ++ return xfdesktop_get_monitor_name_from_gtk_widget(background_settings->image_iconview, monitor_num); ++} ++ + static void + cb_update_background_tab(XfwWindow *xfw_window, XfdesktopBackgroundSettings *background_settings) { + /* If we haven't found our window return now and wait for that */ +@@ -1468,7 +1487,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS + GdkDisplay *display = gdk_window_get_display(window); + GdkMonitor *monitor = gdk_display_get_monitor_at_window(display, window); + gint monitor_num = xfdesktop_get_monitor_num(display, monitor); +- gchar *monitor_name = xfdesktop_get_monitor_name_from_gtk_widget(background_settings->image_iconview, monitor_num); ++ gchar *monitor_name = get_monitor_name(background_settings, monitor_num); + + /* Most of the time we won't change monitor, screen, or workspace so try + * to bail out now if we can */ +@@ -1498,7 +1517,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS + background_settings->screen = screen_num; + background_settings->monitor = monitor_num; + g_free(background_settings->monitor_name); +- background_settings->monitor_name = xfdesktop_get_monitor_name_from_gtk_widget(background_settings->image_iconview, monitor_num); ++ background_settings->monitor_name = get_monitor_name(background_settings, monitor_num); + + /* The first monitor has the option of doing the "spanning screens" style, + * but only if there's multiple monitors attached. Remove it in all other cases. diff --git a/xfdesktop.changes b/xfdesktop.changes index 108ad0a..a2ef3cc 100644 --- a/xfdesktop.changes +++ b/xfdesktop.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Aug 15 14:33:48 UTC 2025 - Takashi Iwai + +- Fix the monitor name pickup on Wayland, which resulted in broken + background picture setup (bsc#1247542): + xfdesktop-wayland-get-proper-monitor-name.patch +- Fix missing backslash for building in non-git mode + ------------------------------------------------------------------- Mon Feb 17 10:27:20 UTC 2025 - Manfred Hollstein diff --git a/xfdesktop.spec b/xfdesktop.spec index 05315cf..08bd8c2 100644 --- a/xfdesktop.spec +++ b/xfdesktop.spec @@ -1,7 +1,7 @@ # # spec file for package xfdesktop # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -29,6 +29,8 @@ Source0: https://archive.xfce.org/src/xfce/xfdesktop/4.20/%{name}-%{versi Patch0: xfdesktop-backgrounds-path.patch # PATCH-FIX-OPENSUSE 0002-relax-libyaml-version.patch -- Allow build for Leap with its ancient but sufficient libyaml packages. Patch2: 0002-relax-libyaml-version.patch +# PATCH-FIX-OPENSUSE xfdesktop-wayland-get-proper-monitor-name.patch -- Fix xfdesktop monitor name on Wayland +Patch3: xfdesktop-wayland-get-proper-monitor-name.patch %if 0%{?suse_version} && 0%{?suse_version} < 1550 # Default gcc7 is too old for new C20 features BuildRequires: gcc13 @@ -105,7 +107,7 @@ export CC=gcc-13 %if %{with git} NOCONFIGURE=1 ./autogen.sh %configure \ - --enable-maintainer-mode + --enable-maintainer-mode \ --with-default-backdrop-filename=%{_datadir}/wallpapers/xfce/default.wallpaper %else xdt-autogen -- 2.51.1