[Xfce4-commits] [apps/xfce4-screensaver] 365/425: Use background information from Xfdesktop
noreply at xfce.org
noreply at xfce.org
Mon Oct 15 01:53:32 CEST 2018
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-screensaver.
commit 49c3db8cb658179c3c2236b14e2a515c04321b79
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sat Oct 6 18:01:53 2018 -0400
Use background information from Xfdesktop
---
configure.ac | 2 +
data/Makefile.am | 2 +-
data/org.xfce.background.gschema.xml.in | 62 ------
po/POTFILES.in | 1 -
src/gs-manager.c | 26 ++-
src/xfce-bg.c | 326 +++++++++++++++-----------------
src/xfce-bg.h | 28 +--
src/xfce4-screensaver.c | 10 +
8 files changed, 195 insertions(+), 262 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3e4fcf2..9c667a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,6 +49,7 @@ GTK_REQUIRED_VERSION=3.22.0
X11_REQUIRED_VERSION=1.0
LIBXKLAVIER_REQUIRED=5.2
XRANDR_REQUIRED=1.3
+LIBXFCONF_REQUIRED=4.13.0
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(crypt.h sys/select.h)
@@ -82,6 +83,7 @@ PKG_CHECK_MODULES(XFCE_SCREENSAVER,
dbus-glib-1 >= $DBUS_REQUIRED_VERSION
gio-2.0 >= $GLIB_REQUIRED_VERSION
libxklavier >= $LIBXKLAVIER_REQUIRED
+ libxfconf-0 >= $LIBXFCONF_REQUIRED
$RANDR_PACKAGE)
AC_SUBST(XFCE_SCREENSAVER_CFLAGS)
AC_SUBST(XFCE_SCREENSAVER_LIBS)
diff --git a/data/Makefile.am b/data/Makefile.am
index c8f6d3f..3d1daf3 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -43,7 +43,7 @@ dbussessionservice_DATA = org.xfce.ScreenSaver.service
@GSETTINGS_RULES@
@INTLTOOL_XML_NOMERGE_RULE@
-gsettingsschema_in_files = org.xfce.screensaver.gschema.xml.in org.xfce.lockdown.gschema.xml.in org.xfce.session.gschema.xml.in org.xfce.background.gschema.xml.in
+gsettingsschema_in_files = org.xfce.screensaver.gschema.xml.in org.xfce.lockdown.gschema.xml.in org.xfce.session.gschema.xml.in
gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
EXTRA_DIST = \
diff --git a/data/org.xfce.background.gschema.xml.in b/data/org.xfce.background.gschema.xml.in
deleted file mode 100644
index b355b30..0000000
--- a/data/org.xfce.background.gschema.xml.in
+++ /dev/null
@@ -1,62 +0,0 @@
-<schemalist gettext-domain="@GETTEXT_PACKAGE@">
- <enum id="org.xfce.background.picture-options-enum">
- <value nick="wallpaper" value="0"/>
- <value nick="zoom" value="1"/>
- <value nick="centered" value="2"/>
- <value nick="scaled" value="3"/>
- <value nick="stretched" value="4"/>
- <value nick="spanned" value="5"/>
- </enum>
- <enum id="org.xfce.background.color-shading-type-enum">
- <value nick="solid" value="0"/>
- <value nick="horizontal-gradient" value="1"/>
- <value nick="vertical-gradient" value="2"/>
- </enum>
- <schema id="org.xfce.background" path="/org/xfce/desktop/background/">
- <key name="draw-background" type="b">
- <default>true</default>
- <summary>Draw Desktop Background</summary>
- <description>Have xfce draw the desktop background.</description>
- </key>
- <key name="show-desktop-icons" type="b">
- <default>true</default>
- <summary>Show Desktop Icons</summary>
- <description>Have xfce file manager (Thunar) draw the desktop icons.</description>
- </key>
- <key name="background-fade" type="b">
- <default>true</default>
- <summary>Fade the background on change</summary>
- <description>If set to true, then xfce will change the desktop background with a fading effect.</description>
- </key>
- <key name="picture-options" enum="org.xfce.background.picture-options-enum">
- <default>'zoom'</default>
- <summary>Picture Options</summary>
- <description>Determines how the image set by wallpaper_filename is rendered. Possible values are "wallpaper", "centered", "scaled", "stretched", "zoom", "spanned".</description>
- </key>
- <key name="picture-filename" type="s">
- <default>'@datadir@/backgrounds/xfce/desktop/Stripes.png'</default>
- <summary>Picture Filename</summary>
- <description>File to use for the background image.</description>
- </key>
- <key name="picture-opacity" type="i">
- <default>100</default>
- <summary>Picture Opacity</summary>
- <description>Opacity with which to draw the background picture.</description>
- </key>
- <key name="primary-color" type="s">
- <default>'#5891BC'</default>
- <summary>Primary Color</summary>
- <description>Left or Top color when drawing gradients, or the solid color.</description>
- </key>
- <key name="secondary-color" type="s">
- <default>'#3C8F25'</default>
- <summary>Secondary Color</summary>
- <description>Right or Bottom color when drawing gradients, not used for solid color.</description>
- </key>
- <key name="color-shading-type" enum="org.xfce.background.color-shading-type-enum">
- <default>'vertical-gradient'</default>
- <summary>Color Shading Type</summary>
- <description>How to shade the background color. Possible values are "horizontal-gradient", "vertical-gradient", and "solid".</description>
- </key>
- </schema>
-</schemalist>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 176aaaa..76d6b42 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,7 +2,6 @@
# Please keep this file sorted alphabetically.
data/images/cosmos/cosmos.xml.in.in
[type: gettext/glade]data/lock-dialog-default.ui
-[type: gettext/gsettings]data/org.xfce.background.gschema.xml.in
[type: gettext/gsettings]data/org.xfce.lockdown.gschema.xml.in
[type: gettext/gsettings]data/org.xfce.screensaver.gschema.xml.in
[type: gettext/gsettings]data/org.xfce.session.gschema.xml.in
diff --git a/src/gs-manager.c b/src/gs-manager.c
index 6d9aa5a..e4e2082 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -1054,7 +1054,7 @@ gs_manager_init (GSManager *manager)
G_CALLBACK (on_bg_changed),
manager);
- xfce_bg_load_from_preferences (manager->priv->bg);
+ xfce_bg_load_from_preferences (manager->priv->bg, NULL);
}
static void
@@ -1270,11 +1270,18 @@ apply_background_to_window (GSManager *manager,
cairo_surface_t *surface;
GdkDisplay *display;
GdkScreen *screen;
- int width;
- int height;
+ GdkMonitor *monitor;
+ GdkRectangle geometry;
+ int width, m_width;
+ int height, m_height;
gint scale;
- xfce_bg_load_from_preferences (manager->priv->bg);
+ display = gs_window_get_display (window);
+ screen = gdk_display_get_default_screen (display);
+ scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
+ monitor = gs_window_get_monitor (window);
+
+ xfce_bg_load_from_preferences (manager->priv->bg, monitor);
if (manager->priv->bg == NULL)
{
@@ -1282,17 +1289,18 @@ apply_background_to_window (GSManager *manager,
gs_window_set_background_surface (window, NULL);
}
- display = gs_window_get_display (window);
- screen = gdk_display_get_default_screen (display);
- scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
+ gdk_monitor_get_geometry (monitor, &geometry);
+ m_width = geometry.width / scale;
+ m_height = geometry.height / scale;
width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
- gs_debug ("Creating background w:%d h:%d", width, height);
+ gs_debug ("Creating background (Screen: w:%d h:%d, Monitor: w:%d h: %d)", width, height, m_width, m_height);
surface = xfce_bg_create_surface (manager->priv->bg,
gs_window_get_gdk_window (window),
width,
height,
- FALSE);
+ m_width,
+ m_height);
gs_window_set_background_surface (window, surface);
cairo_surface_destroy (surface);
}
diff --git a/src/xfce-bg.c b/src/xfce-bg.c
index a12722a..77ce925 100644
--- a/src/xfce-bg.c
+++ b/src/xfce-bg.c
@@ -44,10 +44,12 @@ Authors: Soren Sandmann <sandmann at redhat.com>
#include <cairo.h>
#include <xfce-bg.h>
+#include <xfconf/xfconf.h>
-# include <cairo-xlib.h>
+#include <cairo-xlib.h>
#define XFCE_BG_CACHE_DIR "xfce/background"
+#define XFCE_BG_FALLBACK_IMG "/usr/share/backgrounds/xfce/xfce-teal.jpg"
/* We keep the large pixbufs around if the next update
in the slideshow is less than 60 seconds away */
@@ -121,10 +123,6 @@ static guint signals[N_SIGNALS] = {0};
G_DEFINE_TYPE(XfceBG, xfce_bg, G_TYPE_OBJECT)
-static cairo_surface_t *make_root_pixmap (GdkWindow *window,
- gint width,
- gint height);
-
/* Pixbuf utils */
static GdkPixbuf *pixbuf_scale_to_fit (GdkPixbuf *src,
int max_width,
@@ -179,15 +177,17 @@ static void xfce_bg_set_color(XfceBG *bg,
GdkRGBA *primary,
GdkRGBA *secondary);
-static void xfce_bg_load_from_gsettings (XfceBG *bg,
- GSettings *settings);
+static void xfce_bg_load_from_xfconf (XfceBG *bg,
+ XfconfChannel *channel,
+ GdkMonitor *monitor);
static cairo_surface_t * xfce_bg_create_surface_scale (XfceBG *bg,
GdkWindow *window,
- int width,
- int height,
- int scale,
- gboolean root);
+ int screen_width,
+ int screen_height,
+ int monitor_width,
+ int monitor_height,
+ int scale);
static void xfce_bg_set_placement (XfceBG *bg,
XfceBGPlacement placement);
@@ -195,16 +195,30 @@ static void xfce_bg_set_placement (XfceBG *bg,
static void xfce_bg_set_filename (XfceBG *bg,
const char *filename);
-static void color_from_string(const char *string,
- GdkRGBA *colorp)
+static void color_from_array(XfconfChannel *channel,
+ const gchar *property,
+ GdkRGBA *colorp)
{
+ gdouble r, g, b, a;
+
/* If all else fails use black */
gdk_rgba_parse (colorp, "#000000");
- if (!string)
+ if (!xfconf_channel_has_property (channel, property))
return;
- gdk_rgba_parse (colorp, string);
+ xfconf_channel_get_array(channel,
+ property,
+ G_TYPE_DOUBLE, &r,
+ G_TYPE_DOUBLE, &g,
+ G_TYPE_DOUBLE, &b,
+ G_TYPE_DOUBLE, &a,
+ G_TYPE_INVALID);
+
+ colorp->red = r;
+ colorp->green = g;
+ colorp->blue = b;
+ colorp->alpha = a;
}
static gboolean
@@ -262,36 +276,95 @@ queue_transitioned (XfceBG *bg)
/* This function loads the user's preferences */
void
-xfce_bg_load_from_preferences (XfceBG *bg)
+xfce_bg_load_from_preferences (XfceBG *bg,
+ GdkMonitor *monitor)
{
- GSettings *settings;
- settings = g_settings_new (XFCE_BG_SCHEMA);
+ XfconfChannel *channel;
- xfce_bg_load_from_gsettings (bg, settings);
- g_object_unref (settings);
+ channel = xfconf_channel_get ("xfce4-desktop");
+ xfce_bg_load_from_xfconf (bg, channel, monitor);
/* Queue change to force background redraw */
queue_changed (bg);
}
+static gchar*
+xfce_bg_get_property_prefix (XfconfChannel *channel,
+ const gchar *monitor_name)
+{
+ gchar *prefix;
+
+ /* Check for workspace usage */
+ prefix = g_strconcat("/backdrop/screen0/monitor", monitor_name, "/workspace0", NULL);
+ if (xfconf_channel_has_property (channel, prefix)) {
+ return prefix;
+ }
+ g_free(prefix);
+
+ /* Check for non-workspace usage */
+ prefix = g_strconcat("/backdrop/screen0/monitor", monitor_name, NULL);
+ if (xfconf_channel_has_property(channel, prefix))
+ {
+ return prefix;
+ }
+ g_free(prefix);
+
+ /* Check defaults */
+ prefix = g_strdup("/backdrop/screen0/monitor0/workspace0");
+ if (xfconf_channel_has_property(channel, prefix))
+ {
+ return prefix;
+ }
+ g_free(prefix);
+
+ prefix = g_strdup("/backdrop/screen0/monitor0");
+ return prefix;
+}
+
static void
-xfce_bg_load_from_gsettings (XfceBG *bg,
- GSettings *settings)
+xfce_bg_load_from_xfconf (XfceBG *bg,
+ XfconfChannel *channel,
+ GdkMonitor *monitor)
{
char *tmp;
char *filename;
XfceBGColorType ctype;
GdkRGBA c1, c2;
XfceBGPlacement placement;
+ GdkMonitor *mon;
+ const gchar *monitor_name;
+ gchar *prop_prefix;
+ gchar *property;
+
+ g_return_if_fail(XFCE_IS_BG(bg));
+ //g_return_if_fail (G_IS_SETTINGS (settings));
+
+ if (monitor == NULL)
+ {
+ GdkDisplay *display = gdk_display_get_default();
+ mon = gdk_display_get_primary_monitor(display);
+ if (mon == NULL)
+ {
+ mon = gdk_display_get_monitor(display, 0);
+ }
+ }
+ else
+ {
+ mon = monitor;
+ }
- g_return_if_fail (XFCE_IS_BG (bg));
- g_return_if_fail (G_IS_SETTINGS (settings));
+ monitor_name = gdk_monitor_get_model(mon);
+ prop_prefix = xfce_bg_get_property_prefix (channel, monitor_name);
- bg->is_enabled = g_settings_get_boolean (settings, XFCE_BG_KEY_DRAW_BACKGROUND);
+ property = g_strconcat(prop_prefix, "/image-style", NULL);
+ placement = xfconf_channel_get_int(channel, property, XFCE_BG_PLACEMENT_NONE);
+ bg->is_enabled = placement != XFCE_BG_PLACEMENT_NONE;
/* Filename */
+ g_free(property);
+ property = g_strconcat(prop_prefix, "/image-path", NULL);
filename = NULL;
- tmp = g_settings_get_string (settings, XFCE_BG_KEY_PICTURE_FILENAME);
+ tmp = xfconf_channel_get_string(channel, property, XFCE_BG_FALLBACK_IMG);
if (tmp && *tmp != '\0') {
/* FIXME: UTF-8 checks should go away.
* picture-filename is of type string, which can only be used for
@@ -309,13 +382,8 @@ xfce_bg_load_from_gsettings (XfceBG *bg,
/* Fallback to default BG if the filename set is non-existent */
if (filename != NULL && !g_file_test (filename, G_FILE_TEST_EXISTS)) {
-
g_free (filename);
-
- g_settings_delay (settings);
- g_settings_reset (settings, XFCE_BG_KEY_PICTURE_FILENAME);
- filename = g_settings_get_string (settings, XFCE_BG_KEY_PICTURE_FILENAME);
- g_settings_revert (settings);
+ filename = g_strdup(XFCE_BG_FALLBACK_IMG);
//* Check if default background exists, also */
if (filename != NULL && !g_file_test (filename, G_FILE_TEST_EXISTS)) {
@@ -327,19 +395,20 @@ xfce_bg_load_from_gsettings (XfceBG *bg,
g_free (tmp);
/* Colors */
- tmp = g_settings_get_string (settings, XFCE_BG_KEY_PRIMARY_COLOR);
- color_from_string (tmp, &c1);
- g_free (tmp);
+ g_free(property);
+ property = g_strconcat(prop_prefix, "/workspace0/rgba1", NULL);
+ color_from_array(channel, property, &c1);
- tmp = g_settings_get_string (settings, XFCE_BG_KEY_SECONDARY_COLOR);
- color_from_string (tmp, &c2);
- g_free (tmp);
+ g_free(property);
+ property = g_strconcat(prop_prefix, "/workspace0/rgba2", NULL);
+ color_from_array(channel, property, &c2);
/* Color type */
- ctype = g_settings_get_enum (settings, XFCE_BG_KEY_COLOR_TYPE);
+ g_free(property);
+ property = g_strconcat(prop_prefix, "/workspace0/color-style", NULL);
+ ctype = xfconf_channel_get_int(channel, property, XFCE_BG_COLOR_SOLID);
- /* Placement */
- placement = g_settings_get_enum (settings, XFCE_BG_KEY_PICTURE_PLACEMENT);
+ g_free(property);
xfce_bg_set_color (bg, ctype, &c1, &c2);
xfce_bg_set_placement (bg, placement);
@@ -694,24 +763,6 @@ draw_color (XfceBG *bg,
draw_color_area (bg, dest, &rect);
}
-static void
-draw_color_each_monitor (XfceBG *bg,
- GdkPixbuf *dest,
- GdkScreen *screen)
-{
- GdkDisplay *display;
- GdkRectangle rect;
- gint num_monitors;
- int monitor;
-
- display = gdk_screen_get_display (screen);
- num_monitors = gdk_display_get_n_monitors (display);
- for (monitor = 0; monitor < num_monitors; monitor++) {
- gdk_monitor_get_geometry (gdk_display_get_monitor (display, monitor), &rect);
- draw_color_area (bg, dest, &rect);
- }
-}
-
static GdkPixbuf *
pixbuf_clip_to_fit (GdkPixbuf *src,
int max_width,
@@ -762,7 +813,7 @@ get_scaled_pixbuf (XfceBGPlacement placement,
switch (placement) {
case XFCE_BG_PLACEMENT_SPANNED:
- new = pixbuf_scale_to_fit (pixbuf, width, height);
+ new = pixbuf_scale_to_fit (pixbuf, width, height);
break;
case XFCE_BG_PLACEMENT_ZOOMED:
new = pixbuf_scale_to_min (pixbuf, width, height);
@@ -835,15 +886,13 @@ draw_image_area (XfceBG *bg,
static void
draw_once (XfceBG *bg,
- GdkPixbuf *dest,
- gboolean is_root)
+ GdkPixbuf *dest)
{
GdkRectangle rect;
GdkPixbuf *pixbuf;
gint monitor;
- /* whether we're drawing on root window or normal (Thunar) window */
- monitor = (is_root) ? 0 : -1;
+ monitor = -1;
rect.x = 0;
rect.y = 0;
@@ -859,50 +908,16 @@ draw_once (XfceBG *bg,
}
static void
-draw_each_monitor (XfceBG *bg,
- GdkPixbuf *dest,
- GdkScreen *screen)
-{
- GdkDisplay *display;
-
- display = gdk_screen_get_display (screen);
- gint num_monitors = gdk_display_get_n_monitors (display);
- gint monitor = 0;
-
- for (; monitor < num_monitors; monitor++) {
- GdkRectangle rect;
- GdkPixbuf *pixbuf;
-
- gdk_monitor_get_geometry (gdk_display_get_monitor (display, monitor), &rect);
-
- pixbuf = get_pixbuf_for_size (bg, monitor, rect.width, rect.height);
- if (pixbuf) {
- draw_image_area (bg, monitor, pixbuf, dest, &rect);
-
- g_object_unref (pixbuf);
- }
- }
-}
-
-static void
xfce_bg_draw (XfceBG *bg,
GdkPixbuf *dest,
- GdkScreen *screen,
- gboolean is_root)
+ GdkScreen *screen)
{
if (!bg)
return;
- if (is_root && (bg->placement != XFCE_BG_PLACEMENT_SPANNED)) {
- draw_color_each_monitor (bg, dest, screen);
- if (bg->filename) {
- draw_each_monitor (bg, dest, screen);
- }
- } else {
- draw_color (bg, dest);
- if (bg->filename) {
- draw_once (bg, dest, is_root);
- }
+ draw_color (bg, dest);
+ if (bg->filename) {
+ draw_once (bg, dest);
}
}
@@ -926,6 +941,7 @@ xfce_bg_get_pixmap_size (XfceBG *bg,
if (!bg->filename) {
switch (bg->color_type) {
case XFCE_BG_COLOR_SOLID:
+ case XFCE_BG_COLOR_TRANSPARENT:
*pixmap_width = 1;
*pixmap_height = 1;
break;
@@ -945,26 +961,24 @@ xfce_bg_get_pixmap_size (XfceBG *bg,
* @window:
* @width:
* @height:
- * @root:
*
- * Create a surface that can be set as background for @window. If @is_root is
- * TRUE, the surface created will be created by a temporary X server connection
- * so that if someone calls XKillClient on it, it won't affect the application
- * who created it.
+ * Create a surface that can be set as background for @window.
**/
cairo_surface_t *
xfce_bg_create_surface (XfceBG *bg,
- GdkWindow *window,
- int width,
- int height,
- gboolean root)
+ GdkWindow *window,
+ int screen_width,
+ int screen_height,
+ int monitor_width,
+ int monitor_height)
{
return xfce_bg_create_surface_scale (bg,
window,
- width,
- height,
- 1,
- root);
+ screen_width,
+ screen_height,
+ monitor_width,
+ monitor_height,
+ 1);
}
/**
@@ -974,22 +988,20 @@ xfce_bg_create_surface (XfceBG *bg,
* @width:
* @height:
* @scale:
- * @root:
*
- * Create a scaled surface that can be set as background for @window. If @is_root is
- * TRUE, the surface created will be created by a temporary X server connection
- * so that if someone calls XKillClient on it, it won't affect the application
- * who created it.
+ * Create a scaled surface that can be set as background for @window.
**/
static cairo_surface_t *
xfce_bg_create_surface_scale (XfceBG *bg,
GdkWindow *window,
- int width,
- int height,
- int scale,
- gboolean root)
+ int screen_width,
+ int screen_height,
+ int monitor_width,
+ int monitor_height,
+ int scale)
{
int pm_width, pm_height;
+ int width, height;
cairo_surface_t *surface;
cairo_t *cr;
@@ -997,25 +1009,26 @@ xfce_bg_create_surface_scale (XfceBG *bg,
g_return_val_if_fail (bg != NULL, NULL);
g_return_val_if_fail (window != NULL, NULL);
+ if (bg->placement == XFCE_BG_PLACEMENT_SPANNED) {
+ width = screen_width;
+ height = screen_height;
+ } else {
+ width = monitor_width;
+ height = monitor_height;
+ }
+
if (bg->pixbuf_cache &&
- (gdk_pixbuf_get_width (bg->pixbuf_cache) != width ||
- gdk_pixbuf_get_height (bg->pixbuf_cache) != height))
+ (gdk_pixbuf_get_width(bg->pixbuf_cache) != width ||
+ gdk_pixbuf_get_height(bg->pixbuf_cache) != height))
{
- g_object_unref (bg->pixbuf_cache);
+ g_object_unref(bg->pixbuf_cache);
bg->pixbuf_cache = NULL;
}
xfce_bg_get_pixmap_size (bg, width, height, &pm_width, &pm_height);
- if (root)
- {
- surface = make_root_pixmap (window, pm_width * scale, pm_height * scale);
- }
- else
- {
- surface = gdk_window_create_similar_surface (window, CAIRO_CONTENT_COLOR,
- pm_width, pm_height);
- }
+ surface = gdk_window_create_similar_surface (window, CAIRO_CONTENT_COLOR,
+ pm_width, pm_height);
cr = cairo_create (surface);
cairo_scale (cr, (double)scale, (double)scale);
@@ -1029,7 +1042,7 @@ xfce_bg_create_surface_scale (XfceBG *bg,
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
width, height);
- xfce_bg_draw (bg, pixbuf, gdk_window_get_screen (window), root);
+ xfce_bg_draw (bg, pixbuf, gdk_window_get_screen (window));
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
g_object_unref (pixbuf);
}
@@ -1041,45 +1054,6 @@ xfce_bg_create_surface_scale (XfceBG *bg,
return surface;
}
-/*
- * Create a persistent pixmap. We create a separate display
- * and set the closedown mode on it to RetainPermanent.
- */
-static cairo_surface_t *
-make_root_pixmap (GdkWindow *window, gint width, gint height)
-{
- GdkScreen *screen = gdk_window_get_screen(window);
- char *disp_name = DisplayString (GDK_WINDOW_XDISPLAY (window));
- Display *display;
- Pixmap xpixmap;
- cairo_surface_t *surface;
- int depth;
-
- /* Desktop background pixmap should be created from dummy X client since most
- * applications will try to kill it with XKillClient later when changing pixmap
- */
- display = XOpenDisplay (disp_name);
-
- if (display == NULL) {
- g_warning ("Unable to open display '%s' when setting background pixmap\n",
- (disp_name) ? disp_name : "NULL");
- return NULL;
- }
-
- depth = DefaultDepth (display, gdk_x11_screen_get_screen_number (screen));
- xpixmap = XCreatePixmap (display, GDK_WINDOW_XID (window), width, height, depth);
-
- XFlush (display);
- XSetCloseDownMode (display, RetainPermanent);
- XCloseDisplay (display);
-
- surface = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (screen), xpixmap,
- GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen)),
- width, height);
-
- return surface;
-}
-
/* Implementation of the pixbuf cache */
struct _SlideShow
{
diff --git a/src/xfce-bg.h b/src/xfce-bg.h
index 63619f3..435e122 100644
--- a/src/xfce-bg.h
+++ b/src/xfce-bg.h
@@ -40,8 +40,6 @@ G_BEGIN_DECLS
#define XFCE_IS_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_BG))
#define XFCE_BG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_BG, XfceBGClass))
-#define XFCE_BG_SCHEMA "org.xfce.background"
-
/* whether to draw the desktop bg */
#define XFCE_BG_KEY_DRAW_BACKGROUND "draw-background"
@@ -64,28 +62,32 @@ typedef struct _XfceBGClass XfceBGClass;
typedef enum {
XFCE_BG_COLOR_SOLID,
XFCE_BG_COLOR_H_GRADIENT,
- XFCE_BG_COLOR_V_GRADIENT
+ XFCE_BG_COLOR_V_GRADIENT,
+ XFCE_BG_COLOR_TRANSPARENT
} XfceBGColorType;
typedef enum {
- XFCE_BG_PLACEMENT_TILED,
- XFCE_BG_PLACEMENT_ZOOMED,
- XFCE_BG_PLACEMENT_CENTERED,
- XFCE_BG_PLACEMENT_SCALED,
- XFCE_BG_PLACEMENT_FILL_SCREEN,
- XFCE_BG_PLACEMENT_SPANNED
+ XFCE_BG_PLACEMENT_NONE,
+ XFCE_BG_PLACEMENT_CENTERED,
+ XFCE_BG_PLACEMENT_TILED,
+ XFCE_BG_PLACEMENT_FILL_SCREEN,
+ XFCE_BG_PLACEMENT_SCALED,
+ XFCE_BG_PLACEMENT_ZOOMED,
+ XFCE_BG_PLACEMENT_SPANNED
} XfceBGPlacement;
GType xfce_bg_get_type (void);
XfceBG * xfce_bg_new (void);
-void xfce_bg_load_from_preferences (XfceBG *bg);
+void xfce_bg_load_from_preferences (XfceBG *bg,
+ GdkMonitor *monitor);
/* Drawing and thumbnailing */
cairo_surface_t *xfce_bg_create_surface (XfceBG *bg,
GdkWindow *window,
- int width,
- int height,
- gboolean root);
+ int screen_width,
+ int screen_height,
+ int monitor_width,
+ int monitor_height);
G_END_DECLS
diff --git a/src/xfce4-screensaver.c b/src/xfce4-screensaver.c
index eabf423..95342d5 100644
--- a/src/xfce4-screensaver.c
+++ b/src/xfce4-screensaver.c
@@ -37,6 +37,8 @@
#include "gs-monitor.h"
#include "gs-debug.h"
+#include <xfconf/xfconf.h>
+
void xfce4_screensaver_quit(void)
{
gtk_main_quit();
@@ -87,6 +89,14 @@ int main(int argc, char **argv)
exit(1);
}
+ if (!xfconf_init(&error))
+ {
+ g_error("Failed to connect to xfconf daemon: %s.", error->message);
+ g_error_free(error);
+
+ return EXIT_FAILURE;
+ }
+
/* debug to a file if in deamon mode */
gs_debug_init(debug, FALSE);
gs_debug("initializing xfce4-screensaver %s", VERSION);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list