Go through global stage for getting ClutterBackend

Instead of using the default backend.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
This commit is contained in:
Bilal Elmoussaoui
2024-12-30 14:10:49 +01:00
committed by Marge Bot
parent fea29eb490
commit b3f5f9601b
9 changed files with 40 additions and 15 deletions

View File

@ -15,6 +15,8 @@
#include <cogl/cogl.h>
#include "shell-glsl-effect.h"
#include "shell-global.h"
typedef struct _ShellGLSLEffectPrivate ShellGLSLEffectPrivate;
struct _ShellGLSLEffectPrivate
{
@ -104,8 +106,6 @@ shell_glsl_effect_constructed (GObject *object)
ShellGLSLEffect *self;
ShellGLSLEffectClass *klass;
ShellGLSLEffectPrivate *priv;
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
G_OBJECT_CLASS (shell_glsl_effect_parent_class)->constructed (object);
@ -119,6 +119,14 @@ shell_glsl_effect_constructed (GObject *object)
if (G_UNLIKELY (klass->base_pipeline == NULL))
{
ShellGlobal *global = shell_global_get ();
ClutterStage *stage = shell_global_get_stage (global);
ClutterContext *clutter_context =
clutter_actor_get_context (CLUTTER_ACTOR (stage));
ClutterBackend *backend =
clutter_context_get_backend (clutter_context);
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
klass->base_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_blend (klass->base_pipeline, "RGB = ADD (SRC_COLOR * (SRC_COLOR[A]), DST_COLOR * (1-SRC_COLOR[A]))", NULL);