diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index 4b848b4d0..058114b14 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -1081,8 +1081,8 @@ meta_compositor_sync_screen_size (MetaCompositor *compositor, g_return_if_fail (info); clutter_actor_set_size (info->stage, width, height); - /* Background actor always requests the screen size */ - clutter_actor_queue_relayout (info->background_actor); + + meta_background_actor_screen_size_changed (META_BACKGROUND_ACTOR (info->background_actor)); meta_verbose ("Changed size for stage on screen %d to %dx%d\n", meta_screen_get_screen_number (screen), diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c index af8677803..d26fa8a6e 100644 --- a/src/compositor/meta-background-actor.c +++ b/src/compositor/meta-background-actor.c @@ -55,6 +55,26 @@ struct _MetaBackgroundActor G_DEFINE_TYPE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR); +static void +update_wrap_mode (MetaBackgroundActor *self) +{ + int width, height; + CoglMaterialWrapMode wrap_mode; + + meta_screen_get_size (self->screen, &width, &height); + + /* We turn off repeating when we have a full-screen pixmap to keep from + * getting artifacts from one side of the image sneaking into the other + * side of the image via bilinear filtering. + */ + if (width == self->texture_width && height == self->texture_height) + wrap_mode = COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE; + else + wrap_mode = COGL_PIPELINE_WRAP_MODE_REPEAT; + + cogl_material_set_layer_wrap_mode (self->material, 0, wrap_mode); +} + static void set_texture (MetaBackgroundActor *self, CoglHandle texture) @@ -73,6 +93,8 @@ set_texture (MetaBackgroundActor *self, self->texture_width = cogl_texture_get_width (texture); self->texture_height = cogl_texture_get_height (texture); + update_wrap_mode (self); + clutter_actor_queue_redraw (CLUTTER_ACTOR (self)); } @@ -378,3 +400,15 @@ meta_background_actor_set_visible_region (MetaBackgroundActor *self, } } +/** + * meta_background_actor_screen_size_changed: + * @self: a #MetaBackgroundActor + * + * Called by the compositor when the size of the #MetaScreen changes + */ +void +meta_background_actor_screen_size_changed (MetaBackgroundActor *self) +{ + update_wrap_mode (self); + clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); +} diff --git a/src/compositor/meta-background-actor.h b/src/compositor/meta-background-actor.h index b211c4b64..448171aa2 100644 --- a/src/compositor/meta-background-actor.h +++ b/src/compositor/meta-background-actor.h @@ -50,8 +50,9 @@ GType meta_background_actor_get_type (void); ClutterActor *meta_background_actor_new (MetaScreen *screen); -void meta_background_actor_update (MetaBackgroundActor *actor); -void meta_background_actor_set_visible_region (MetaBackgroundActor *self, - cairo_region_t *visible_region); +void meta_background_actor_update (MetaBackgroundActor *actor); +void meta_background_actor_set_visible_region (MetaBackgroundActor *self, + cairo_region_t *visible_region); +void meta_background_actor_screen_size_changed (MetaBackgroundActor *self); #endif /* META_BACKGROUND_ACTOR_H */