From 3d06d8b6dd1a26c26f34816a347524aeff3430b2 Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Fri, 15 Dec 2023 02:06:53 -0500 Subject: Manage desktop backgrounds when running in wayland *Draw the background on the desktop window, using the same code as on navigation windows to bypass the no-root-window issue. *Works from caja's "Change Desktop Background" menu item, from caja-extensions "set as wallpaper" and with changing the background in dconf-editor. *All background options available in x11 supported in wayland, UI is new for wayland *Apply changes immediately, keep the dialog open until closed by user *Let users see changes in realtime while keeping the dialog open *Preview both colors and pictures *Add ability to apply changes from either combobox including using any image saved from when dialog was opened *Add tooltips to the buttons, filepicker, and comboboxes --- libcaja-private/caja-icon-container.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libcaja-private') diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c index 18ca2054..4c4c084c 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -4606,6 +4606,19 @@ draw (GtkWidget *widget, cairo_t *cr) { eel_background_draw (widget, cr); } + /*If this is the desktop on wayland, we must draw it from here + *Calling eel_background_draw() from caja_desktop_window_class_init() + *as we do in x11 gives a black background on wayland + *Wayland is always composited but never has a root window + *We don't have a root window to draw on + *the code used for x11 without compositing somehow fails too + *But we can get caja's toplevel window from here and draw on it + */ + if ((!(GDK_IS_X11_DISPLAY (gdk_display_get_default()))) && (CAJA_ICON_CONTAINER (widget)->details->is_desktop)) + { + GtkWidget *toplevel = gtk_widget_get_toplevel(widget); + eel_background_draw (toplevel, cr); + } return GTK_WIDGET_CLASS (caja_icon_container_parent_class)->draw (widget, cr); -- cgit v1.2.1