shell/global: Add 'backend' property
Replace all Meta.get_backend() with global.backend. Maybe sooner or later we can further decrease the amount of singletons handled by libmutter. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210
This commit is contained in:
parent
c90910731f
commit
772df91762
@ -1,7 +1,7 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
/* exported getKeyboardManager, holdKeyboard, releaseKeyboard */
|
||||
|
||||
const { GLib, GnomeDesktop, Meta } = imports.gi;
|
||||
const { GLib, GnomeDesktop } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
|
||||
@ -62,11 +62,11 @@ var KeyboardManager = class {
|
||||
return;
|
||||
|
||||
this._currentKeymap = { layouts, variants, options };
|
||||
Meta.get_backend().set_keymap(layouts, variants, options);
|
||||
global.backend.set_keymap(layouts, variants, options);
|
||||
}
|
||||
|
||||
_applyLayoutGroupIndex(idx) {
|
||||
Meta.get_backend().lock_layout_group(idx);
|
||||
global.backend.lock_layout_group(idx);
|
||||
}
|
||||
|
||||
apply(id) {
|
||||
|
@ -1119,7 +1119,7 @@ var KeyboardManager = class KeyBoardManager {
|
||||
this._seat.connect('notify::touch-mode', this._syncEnabled.bind(this));
|
||||
|
||||
this._lastDevice = null;
|
||||
Meta.get_backend().connect('last-device-changed', (backend, device) => {
|
||||
global.backend.connect('last-device-changed', (backend, device) => {
|
||||
if (device.device_type === Clutter.InputDeviceType.KEYBOARD_DEVICE)
|
||||
return;
|
||||
|
||||
|
@ -802,7 +802,7 @@ function showRestartMessage(message) {
|
||||
|
||||
var AnimationsSettings = class {
|
||||
constructor() {
|
||||
let backend = Meta.get_backend();
|
||||
let backend = global.backend;
|
||||
if (!backend.is_rendering_hardware_accelerated()) {
|
||||
St.Settings.get().inhibit_animations();
|
||||
return;
|
||||
|
@ -11,8 +11,7 @@ class RemoteAccessApplet extends PanelMenu.SystemIndicator {
|
||||
_init() {
|
||||
super._init();
|
||||
|
||||
let backend = Meta.get_backend();
|
||||
let controller = backend.get_remote_access_controller();
|
||||
let controller = global.backend.get_remote_access_controller();
|
||||
|
||||
if (!controller)
|
||||
return;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
|
||||
const { Clutter, Meta } = imports.gi;
|
||||
const { Clutter } = imports.gi;
|
||||
const Signals = imports.signals;
|
||||
|
||||
const DND = imports.ui.dnd;
|
||||
@ -17,7 +17,7 @@ var XdndHandler = class {
|
||||
Main.uiGroup.add_actor(this._dummy);
|
||||
this._dummy.hide();
|
||||
|
||||
var dnd = Meta.get_backend().get_dnd();
|
||||
var dnd = global.backend.get_dnd();
|
||||
dnd.connect('dnd-enter', this._onEnter.bind(this));
|
||||
dnd.connect('dnd-position-change', this._onPositionChanged.bind(this));
|
||||
dnd.connect('dnd-leave', this._onLeave.bind(this));
|
||||
|
@ -57,6 +57,7 @@ struct _ShellGlobal {
|
||||
|
||||
ClutterStage *stage;
|
||||
|
||||
MetaBackend *backend;
|
||||
MetaDisplay *meta_display;
|
||||
MetaWorkspaceManager *workspace_manager;
|
||||
Display *xdisplay;
|
||||
@ -95,6 +96,7 @@ enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_SESSION_MODE,
|
||||
PROP_BACKEND,
|
||||
PROP_DISPLAY,
|
||||
PROP_WORKSPACE_MANAGER,
|
||||
PROP_SCREEN_WIDTH,
|
||||
@ -230,6 +232,9 @@ shell_global_get_property(GObject *object,
|
||||
case PROP_SESSION_MODE:
|
||||
g_value_set_string (value, shell_global_get_session_mode (global));
|
||||
break;
|
||||
case PROP_BACKEND:
|
||||
g_value_set_object (value, global->backend);
|
||||
break;
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_object (value, global->meta_display);
|
||||
break;
|
||||
@ -472,6 +477,13 @@ shell_global_class_init (ShellGlobalClass *klass)
|
||||
"Screen height, in pixels",
|
||||
0, G_MAXINT, 1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BACKEND,
|
||||
g_param_spec_object ("backend",
|
||||
"Backend",
|
||||
"MetaBackend object",
|
||||
META_TYPE_BACKEND,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DISPLAY,
|
||||
g_param_spec_object ("display",
|
||||
@ -947,6 +959,7 @@ _shell_global_set_plugin (ShellGlobal *global,
|
||||
g_return_if_fail (SHELL_IS_GLOBAL (global));
|
||||
g_return_if_fail (global->plugin == NULL);
|
||||
|
||||
global->backend = meta_get_backend ();
|
||||
global->plugin = plugin;
|
||||
global->wm = shell_wm_new (plugin);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user