diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c index 5cbd4b80d..5d79c3e0b 100644 --- a/src/compositor/meta-window-actor-x11.c +++ b/src/compositor/meta-window-actor-x11.c @@ -647,6 +647,12 @@ check_needs_shadow (MetaWindowActorX11 *actor_x11) MetaShadowFactory *factory = actor_x11->shadow_factory; const char *shadow_class = get_shadow_class (actor_x11); MtkRectangle shape_bounds; + ClutterContext *clutter_context = + clutter_actor_get_context (CLUTTER_ACTOR (actor_x11)); + ClutterBackend *clutter_backend = + clutter_context_get_backend (clutter_context); + CoglContext *cogl_context = + clutter_backend_get_cogl_context (clutter_backend); if (!actor_x11->shadow_shape) { @@ -659,7 +665,8 @@ check_needs_shadow (MetaWindowActorX11 *actor_x11) meta_shadow_factory_get_shadow (factory, actor_x11->shadow_shape, shape_bounds.width, shape_bounds.height, - shadow_class, appears_focused); + shadow_class, appears_focused, + cogl_context); } if (old_shadow) diff --git a/src/x11/meta-shadow-factory.c b/src/x11/meta-shadow-factory.c index 7faebc1ab..a7e480067 100644 --- a/src/x11/meta-shadow-factory.c +++ b/src/x11/meta-shadow-factory.c @@ -818,11 +818,10 @@ make_border_region (MtkRegion *region, } static void -make_shadow (MetaShadow *shadow, - MtkRegion *region) +make_shadow (MetaShadow *shadow, + CoglContext *cogl_context, + MtkRegion *region) { - ClutterBackend *backend = clutter_get_default_backend (); - CoglContext *ctx = clutter_backend_get_cogl_context (backend); GError *error = NULL; int d = get_box_filter_size (shadow->key.radius); int spread = get_shadow_spread (shadow->key.radius); @@ -913,7 +912,7 @@ make_shadow (MetaShadow *shadow, * in the case of top_fade >= 0. We also account for padding at the left for symmetry * though that doesn't currently occur. */ - shadow->texture = cogl_texture_2d_new_from_data (ctx, + shadow->texture = cogl_texture_2d_new_from_data (cogl_context, shadow->outer_border_left + extents.width + shadow->outer_border_right, shadow->outer_border_top + extents.height + shadow->outer_border_bottom, COGL_PIXEL_FORMAT_A_8, @@ -931,7 +930,7 @@ make_shadow (MetaShadow *shadow, g_free (buffer); - shadow->pipeline = meta_create_texture_pipeline (ctx, shadow->texture); + shadow->pipeline = meta_create_texture_pipeline (cogl_context, shadow->texture); cogl_pipeline_set_static_name (shadow->pipeline, "MetaShadowFactory"); } @@ -990,7 +989,8 @@ meta_shadow_factory_get_shadow (MetaShadowFactory *factory, int width, int height, const char *class_name, - gboolean focused) + gboolean focused, + CoglContext *cogl_context) { MetaShadowParams *params; MetaShadowCacheKey key; @@ -1096,7 +1096,7 @@ meta_shadow_factory_get_shadow (MetaShadowFactory *factory, g_assert (center_width >= 0 && center_height >= 0); region = meta_window_shape_to_region (shape, center_width, center_height); - make_shadow (shadow, region); + make_shadow (shadow, cogl_context, region); if (cacheable) g_hash_table_insert (factory->shadows, &shadow->key, shadow); diff --git a/src/x11/meta-shadow-factory.h b/src/x11/meta-shadow-factory.h index c29c20abc..337406c56 100644 --- a/src/x11/meta-shadow-factory.h +++ b/src/x11/meta-shadow-factory.h @@ -112,4 +112,5 @@ MetaShadow *meta_shadow_factory_get_shadow (MetaShadowFactory *factory, int width, int height, const char *class_name, - gboolean focused); + gboolean focused, + CoglContext *cogl_context);