summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2013-02-13 22:19:54 +0100
committerGiovanni Campagna <gcampagna@src.gnome.org>2013-02-13 22:30:15 +0100
commit4f56cfb1e62475434d025fee1c56a23458243f0a (patch)
treebae5cbe18673866080c72f92b986f9548a3ce25c
parentdb7fa793b035d042ecfbd29eec10f2c4925fa018 (diff)
downloadmutter-wip/gcampax/background.tar.gz
MetaBackgroundActor: stop waiting synchronously on the first framewip/gcampax/background
We can draw the gradient while we wait for the wallpaper to load. This also removes the dependency on g_task_wait_sync(), which may never appear in glib.
-rw-r--r--src/compositor/meta-background-actor.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index 1e0981da3..99663a4b6 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -113,6 +113,8 @@ static void meta_background_actor_screen_size_changed (MetaScreen *scre
static void meta_background_actor_constructed (GObject *object);
static void clear_state (MetaBackgroundState *state);
+static void init_state_from_settings (MetaBackgroundState *state,
+ GSettings *settings);
static void set_texture (MetaBackground *background,
CoglHandle texture,
MetaBackgroundSlideshow *slideshow);
@@ -176,6 +178,8 @@ meta_background_get (MetaScreen *screen,
g_signal_connect (settings, "changed",
G_CALLBACK (on_settings_changed), background);
+
+ init_state_from_settings (&background->state, settings);
on_settings_changed (settings, "picture-uri", background);
}
@@ -227,6 +231,18 @@ get_color_from_settings (GSettings *settings,
}
static void
+init_state_from_settings (MetaBackgroundState *state,
+ GSettings *settings)
+{
+ get_color_from_settings (settings, "primary-color",
+ &state->colors[0]);
+ get_color_from_settings (settings, "secondary-color",
+ &state->colors[1]);
+ state->style = g_settings_get_enum (settings, "picture-options");
+ state->shading = g_settings_get_enum (settings, "color-shading-type");
+}
+
+static void
set_texture (MetaBackground *background,
CoglHandle texture,
MetaBackgroundSlideshow *slideshow)
@@ -244,14 +260,10 @@ set_texture (MetaBackground *background,
background->old_state = background->state;
background->state.texture = cogl_handle_ref (texture);
- get_color_from_settings (background->settings, "primary-color",
- &background->state.colors[0]);
- get_color_from_settings (background->settings, "secondary-color",
- &background->state.colors[1]);
- background->state.style = g_settings_get_enum (background->settings, "picture-options");
- background->state.shading = g_settings_get_enum (background->settings, "color-shading-type");
background->state.texture_width = cogl_texture_get_width (background->state.texture);
background->state.texture_height = cogl_texture_get_height (background->state.texture);
+ init_state_from_settings (&background->state,
+ background->settings);
background->state.slideshow = g_object_ref (slideshow);
timeout = meta_background_slideshow_get_next_timeout (slideshow);
@@ -305,16 +317,6 @@ set_texture (MetaBackground *background,
}
}
-static inline void
-meta_background_ensure_rendered (MetaBackground *background)
-{
- if (G_LIKELY (background->rendering_task == NULL ||
- background->state.texture != COGL_INVALID_HANDLE))
- return;
-
- g_task_wait_sync (background->rendering_task);
-}
-
static void
meta_background_actor_dispose (GObject *object)
{
@@ -481,6 +483,9 @@ paint_background_box (MetaBackgroundState *state,
if (state->style == G_DESKTOP_BACKGROUND_STYLE_NONE)
return;
+ if (state->texture == COGL_INVALID_HANDLE)
+ return;
+
vertices[0].s = 1.0;
vertices[0].t = 0.0;
vertices[1].s = 0.0;
@@ -726,8 +731,6 @@ meta_background_actor_paint (ClutterActor *actor)
float first_color_factor, first_alpha_factor,
second_color_factor, second_alpha_factor;
- meta_background_ensure_rendered (priv->background);
-
if (priv->is_crossfading)
crossfade_progress = priv->crossfade_progress;
else