mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
MetaBackgroundActor: stop waiting synchronously on the first frame
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.
This commit is contained in:
parent
db7fa793b0
commit
4f56cfb1e6
@ -113,6 +113,8 @@ static void meta_background_actor_screen_size_changed (MetaScreen *scre
|
|||||||
static void meta_background_actor_constructed (GObject *object);
|
static void meta_background_actor_constructed (GObject *object);
|
||||||
|
|
||||||
static void clear_state (MetaBackgroundState *state);
|
static void clear_state (MetaBackgroundState *state);
|
||||||
|
static void init_state_from_settings (MetaBackgroundState *state,
|
||||||
|
GSettings *settings);
|
||||||
static void set_texture (MetaBackground *background,
|
static void set_texture (MetaBackground *background,
|
||||||
CoglHandle texture,
|
CoglHandle texture,
|
||||||
MetaBackgroundSlideshow *slideshow);
|
MetaBackgroundSlideshow *slideshow);
|
||||||
@ -176,6 +178,8 @@ meta_background_get (MetaScreen *screen,
|
|||||||
|
|
||||||
g_signal_connect (settings, "changed",
|
g_signal_connect (settings, "changed",
|
||||||
G_CALLBACK (on_settings_changed), background);
|
G_CALLBACK (on_settings_changed), background);
|
||||||
|
|
||||||
|
init_state_from_settings (&background->state, settings);
|
||||||
on_settings_changed (settings, "picture-uri", background);
|
on_settings_changed (settings, "picture-uri", background);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,6 +230,18 @@ get_color_from_settings (GSettings *settings,
|
|||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
set_texture (MetaBackground *background,
|
set_texture (MetaBackground *background,
|
||||||
CoglHandle texture,
|
CoglHandle texture,
|
||||||
@ -244,14 +260,10 @@ set_texture (MetaBackground *background,
|
|||||||
background->old_state = background->state;
|
background->old_state = background->state;
|
||||||
|
|
||||||
background->state.texture = cogl_handle_ref (texture);
|
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_width = cogl_texture_get_width (background->state.texture);
|
||||||
background->state.texture_height = cogl_texture_get_height (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);
|
background->state.slideshow = g_object_ref (slideshow);
|
||||||
|
|
||||||
timeout = meta_background_slideshow_get_next_timeout (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
|
static void
|
||||||
meta_background_actor_dispose (GObject *object)
|
meta_background_actor_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -481,6 +483,9 @@ paint_background_box (MetaBackgroundState *state,
|
|||||||
if (state->style == G_DESKTOP_BACKGROUND_STYLE_NONE)
|
if (state->style == G_DESKTOP_BACKGROUND_STYLE_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (state->texture == COGL_INVALID_HANDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
vertices[0].s = 1.0;
|
vertices[0].s = 1.0;
|
||||||
vertices[0].t = 0.0;
|
vertices[0].t = 0.0;
|
||||||
vertices[1].s = 0.0;
|
vertices[1].s = 0.0;
|
||||||
@ -726,8 +731,6 @@ meta_background_actor_paint (ClutterActor *actor)
|
|||||||
float first_color_factor, first_alpha_factor,
|
float first_color_factor, first_alpha_factor,
|
||||||
second_color_factor, second_alpha_factor;
|
second_color_factor, second_alpha_factor;
|
||||||
|
|
||||||
meta_background_ensure_rendered (priv->background);
|
|
||||||
|
|
||||||
if (priv->is_crossfading)
|
if (priv->is_crossfading)
|
||||||
crossfade_progress = priv->crossfade_progress;
|
crossfade_progress = priv->crossfade_progress;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user