summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-11-29 16:22:04 +0200
committerJasmine Hassan <[email protected]>2012-12-01 18:55:56 +0200
commitd7ed4e67e748117787810a021c8e15a7a97fe169 (patch)
treef9ed08d0be84d50d0b81d682b8d83a673f262e36
parentd3d2f7ef7e49cc56f96c2ea6512390393c4e1e41 (diff)
downloadmate-settings-daemon-d7ed4e67e748117787810a021c8e15a7a97fe169.tar.bz2
mate-settings-daemon-d7ed4e67e748117787810a021c8e15a7a97fe169.tar.xz
[background] stop pending fades if new ones initiated
prevents some strange flicker when quickly selecting multiple backgrounds http://git.gnome.org/browse/gnome-settings-daemon/commit/?id=5cb80995b6899c6ed185797333b709ea9342de42
-rw-r--r--plugins/background/msd-background-manager.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/plugins/background/msd-background-manager.c b/plugins/background/msd-background-manager.c
index 6c692b4..234dc4a 100644
--- a/plugins/background/msd-background-manager.c
+++ b/plugins/background/msd-background-manager.c
@@ -64,6 +64,8 @@ struct MsdBackgroundManagerPrivate {
MateBG *bg;
guint timeout_id;
+ MateBGCrossfade *fade;
+
GDBusProxy *proxy;
guint proxy_signal_id;
};
@@ -195,6 +197,13 @@ caja_is_drawing_background (MsdBackgroundManager *manager)
}
static void
+on_crossfade_finished (MsdBackgroundManager *manager)
+{
+ g_object_unref (manager->priv->fade);
+ manager->priv->fade = NULL;
+}
+
+static void
draw_background (MsdBackgroundManager *manager,
gboolean use_crossfade)
{
@@ -215,30 +224,27 @@ draw_background (MsdBackgroundManager *manager,
for (i = 0; i < n_screens; ++i)
{
GdkScreen *screen;
- GdkWindow *root_window;
cairo_surface_t *surface;
screen = gdk_display_get_screen(display, i);
- root_window = gdk_screen_get_root_window(screen);
-
surface = mate_bg_create_surface (manager->priv->bg,
- root_window,
- gdk_screen_get_width(screen),
- gdk_screen_get_height(screen),
- TRUE);
+ gdk_screen_get_root_window (screen),
+ gdk_screen_get_width (screen),
+ gdk_screen_get_height (screen),
+ TRUE);
if (use_crossfade)
{
- MateBGCrossfade* fade;
-
- fade = mate_bg_set_surface_as_root_with_crossfade (screen, surface);
- g_signal_connect(fade,
- "finished",
- G_CALLBACK (g_object_unref), NULL);
- }
- else
- {
+ if (manager->priv->fade != NULL)
+ g_object_unref (manager->priv->fade);
+
+ manager->priv->fade = mate_bg_set_surface_as_root_with_crossfade (screen,
+ surface);
+ g_signal_connect_swapped (manager->priv->fade, "finished",
+ G_CALLBACK (on_crossfade_finished),
+ manager);
+ } else {
mate_bg_set_surface_as_root (screen, surface);
}