From af240b063cd0678dc1739ffa28e93f1ff530bead Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Sun, 13 Oct 2013 20:17:26 +0300 Subject: Migrate backdrop settings from previous versions (Bug 10380) This patch allows for migrating from previous versions (before 4.11). Continuing to use the older format should make it easier for distribution maintainers to apply their own backdrop settings since the newer format uses monitor names rather than numbers. Xfdesktop will search for backdrop settings in the new location, then the old location, and finally fall back to the built-in defaults (DEFAULT_BACKDROP, stretched image style, solid color style, etc). It also fixes issues where xfdesktop ended up trying to use an invalid workspace. --- common/xfdesktop-common.c | 15 +++++++++++++++ common/xfdesktop-common.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'common') diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c index 65f02142..b2fb406f 100644 --- a/common/xfdesktop-common.c +++ b/common/xfdesktop-common.c @@ -51,6 +51,7 @@ #include #include "xfdesktop-common.h" +#include "xfce-backdrop.h" /* for XfceBackdropImageStyle */ #ifndef O_BINARY #define O_BINARY 0 @@ -301,6 +302,20 @@ xfdesktop_send_client_message(Window xid, const gchar *msg) gtk_widget_destroy(win); } +/* The image styles changed from versions prior to 4.11. + * Auto isn't an option anymore, additionally we should handle invalid + * values. Set them to the default of stretched. */ +gint +xfce_translate_image_styles(gint input) +{ + gint style = input; + + if(style <= 0 || style > XFCE_BACKDROP_IMAGE_SPANNING_SCREENS) + style = XFCE_BACKDROP_IMAGE_STRETCHED; + + return style; +} + guint xfce_grab_cursor(GtkWidget *w, GdkEventButton *evt) diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h index 1d6db855..725da4fa 100644 --- a/common/xfdesktop-common.h +++ b/common/xfdesktop-common.h @@ -86,6 +86,8 @@ gchar *xfdesktop_get_file_mimetype(const gchar *file); gboolean xfdesktop_check_is_running(Window *xid); void xfdesktop_send_client_message(Window xid, const gchar *msg); +gint xfce_translate_image_styles(gint input); + guint xfce_grab_cursor(GtkWidget *w, GdkEventButton *evt); gboolean xfdesktop_popup_grab_available(GdkWindow *win, guint32 timestamp); -- cgit v1.2.1