meta-background: Add a function to refresh all background instances

We need to reload the FBOs under some circumstances, this adds a way
to easily do so.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
This commit is contained in:
Rui Matos 2015-03-19 14:58:25 +01:00
parent e76decbcf2
commit 7c5fe42835
2 changed files with 16 additions and 0 deletions

View File

@ -71,6 +71,8 @@ enum
G_DEFINE_TYPE (MetaBackground, meta_background, G_TYPE_OBJECT) G_DEFINE_TYPE (MetaBackground, meta_background, G_TYPE_OBJECT)
static GSList *all_backgrounds = NULL;
static void static void
free_fbos (MetaBackground *self) free_fbos (MetaBackground *self)
{ {
@ -305,6 +307,8 @@ meta_background_dispose (GObject *object)
static void static void
meta_background_finalize (GObject *object) meta_background_finalize (GObject *object)
{ {
all_backgrounds = g_slist_remove (all_backgrounds, object);
G_OBJECT_CLASS (meta_background_parent_class)->finalize (object); G_OBJECT_CLASS (meta_background_parent_class)->finalize (object);
} }
@ -347,6 +351,7 @@ meta_background_init (MetaBackground *self)
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
META_TYPE_BACKGROUND, META_TYPE_BACKGROUND,
MetaBackgroundPrivate); MetaBackgroundPrivate);
all_backgrounds = g_slist_prepend (all_backgrounds, self);
} }
static void static void
@ -913,3 +918,12 @@ meta_background_set_blend (MetaBackground *self,
free_wallpaper_texture (self); free_wallpaper_texture (self);
mark_changed (self); mark_changed (self);
} }
void
meta_background_refresh_all (void)
{
GSList *l;
for (l = all_backgrounds; l; l = l->next)
mark_changed (l->data);
}

View File

@ -57,6 +57,8 @@ struct _MetaBackground
MetaBackgroundPrivate *priv; MetaBackgroundPrivate *priv;
}; };
void meta_background_refresh_all (void);
GType meta_background_get_type (void); GType meta_background_get_type (void);
MetaBackground *meta_background_new (MetaScreen *screen); MetaBackground *meta_background_new (MetaScreen *screen);