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

@ -17,7 +17,7 @@ class KbdA11yDialog extends GObject.Object {
this._a11ySettings = new Gio.Settings({schema_id: KEYBOARD_A11Y_SCHEMA});
let seat = Clutter.get_default_backend().get_default_seat();
const seat = global.stage.context.get_backend().get_default_seat();
seat.connect('kbd-a11y-flags-changed',
this._showKbdA11yDialog.bind(this));
}

View File

@ -1059,7 +1059,7 @@ export class KeyboardManager extends Signals.EventEmitter {
this._a11yApplicationsSettings = new Gio.Settings({schema_id: A11Y_APPLICATIONS_SCHEMA});
this._a11yApplicationsSettings.connect('changed', this._syncEnabled.bind(this));
this._seat = Clutter.get_default_backend().get_default_seat();
this._seat = global.stage.context.get_backend().get_default_seat();
this._seat.connect('notify::touch-mode', this._syncEnabled.bind(this));
this._lastDevice = null;
@ -1984,7 +1984,7 @@ class KeyboardController extends Signals.EventEmitter {
constructor() {
super();
let seat = Clutter.get_default_backend().get_default_seat();
let seat = global.stage.context.get_backend().get_default_seat();
this._virtualDevice = seat.create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE);
this._inputSourceManager = InputSourceManager.getInputSourceManager();

View File

@ -236,9 +236,9 @@ async function _initializeUI() {
screenShield = new ScreenShield.ScreenShield();
inputMethod = new InputMethod.InputMethod();
Clutter.get_default_backend().set_input_method(inputMethod);
global.stage.context.get_backend().set_input_method(inputMethod);
global.connect('shutdown',
() => Clutter.get_default_backend().set_input_method(null));
() => global.stage.context.get_backend().set_input_method(null));
screenshotUI = new Screenshot.ScreenshotUI();

View File

@ -950,7 +950,7 @@ export class PadOsdService extends Signals.EventEmitter {
ShowAsync(params, invocation) {
let [deviceNode, editionMode] = params;
let seat = Clutter.get_default_backend().get_default_seat();
const seat = global.stage.context.get_backend().get_default_seat();
let devices = seat.list_devices();
let padDevice = null;

View File

@ -110,7 +110,7 @@ const PieTimer = GObject.registerClass({
export class PointerA11yTimeout {
constructor() {
let seat = Clutter.get_default_backend().get_default_seat();
const seat = global.stage.context.get_backend().get_default_seat();
seat.connect('ptr-a11y-timeout-started', (o, device, type, timeout) => {
let [x, y] = global.get_pointer();

View File

@ -21,6 +21,7 @@
#include <mtk/mtk.h>
#include "shell-blur-effect.h"
#include "shell-global.h"
#include "shell-enum-types.h"
@ -107,8 +108,13 @@ create_base_pipeline (void)
if (G_UNLIKELY (base_pipeline == NULL))
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
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);
base_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_layer_null_texture (base_pipeline, 0);
@ -187,8 +193,13 @@ update_fbo (FramebufferData *data,
unsigned int height,
float downscale_factor)
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
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);
g_clear_object (&data->texture);
g_clear_object (&data->framebuffer);

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);

View File

@ -116,7 +116,13 @@ shell_invert_lightness_effect_init (ShellInvertLightnessEffect *self)
if (G_UNLIKELY (klass->base_pipeline == NULL))
{
CoglSnippet *snippet;
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
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);

View File

@ -12,7 +12,7 @@ export async function run() {
/* Make created windows remain visible during exit. */
await Scripting.disableHelperAutoExit();
const seat = Clutter.get_default_backend().get_default_seat();
const seat = global.stage.context.get_backend().get_default_seat();
const virtualDevice_ =
seat.create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE);