js: Get monitor manager from backend

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2557>
This commit is contained in:
Jonas Ådahl 2022-09-07 20:24:44 +02:00
parent 8d68bdaaa1
commit c1d66af4b9
9 changed files with 14 additions and 13 deletions

View File

@ -54,7 +54,7 @@ var IntrospectService = class {
this._syncAnimationsEnabled.bind(this)); this._syncAnimationsEnabled.bind(this));
this._syncAnimationsEnabled(); this._syncAnimationsEnabled();
const monitorManager = Meta.MonitorManager.get(); const monitorManager = global.backend.get_monitor_manager();
monitorManager.connect('monitors-changed', monitorManager.connect('monitors-changed',
this._syncScreenSize.bind(this)); this._syncScreenSize.bind(this));
this._syncScreenSize(); this._syncScreenSize();

View File

@ -1,5 +1,5 @@
/* exported getDefault */ /* exported getDefault */
const { AccountsService, Clutter, Gdm, Gio, GLib, GObject, Meta } = imports.gi; const {AccountsService, Clutter, Gdm, Gio, GLib, GObject} = imports.gi;
const GnomeSession = imports.misc.gnomeSession; const GnomeSession = imports.misc.gnomeSession;
const LoginManager = imports.misc.loginManager; const LoginManager = imports.misc.loginManager;
@ -149,7 +149,7 @@ const SystemActions = GObject.registerClass({
this._session = new GnomeSession.SessionManager(); this._session = new GnomeSession.SessionManager();
this._loginManager = LoginManager.getLoginManager(); this._loginManager = LoginManager.getLoginManager();
this._monitorManager = Meta.MonitorManager.get(); this._monitorManager = global.backend.get_monitor_manager();
this._userManager = AccountsService.UserManager.get_default(); this._userManager = AccountsService.UserManager.get_default();

View File

@ -555,7 +555,7 @@ var BackgroundSource = class BackgroundSource {
this._settings = new Gio.Settings({ schema_id: settingsSchema }); this._settings = new Gio.Settings({ schema_id: settingsSchema });
this._backgrounds = []; this._backgrounds = [];
let monitorManager = Meta.MonitorManager.get(); const monitorManager = global.backend.get_monitor_manager();
this._monitorsChangedId = this._monitorsChangedId =
monitorManager.connect('monitors-changed', monitorManager.connect('monitors-changed',
this._onMonitorsChanged.bind(this)); this._onMonitorsChanged.bind(this));
@ -630,7 +630,7 @@ var BackgroundSource = class BackgroundSource {
} }
destroy() { destroy() {
let monitorManager = Meta.MonitorManager.get(); const monitorManager = global.backend.get_monitor_manager();
monitorManager.disconnect(this._monitorsChangedId); monitorManager.disconnect(this._monitorsChangedId);
for (let monitorIndex in this._backgrounds) { for (let monitorIndex in this._backgrounds) {

View File

@ -329,7 +329,7 @@ var LayoutManager = GObject.registerClass({
display.connect('in-fullscreen-changed', display.connect('in-fullscreen-changed',
this._updateFullscreen.bind(this)); this._updateFullscreen.bind(this));
let monitorManager = Meta.MonitorManager.get(); const monitorManager = global.backend.get_monitor_manager();
monitorManager.connect('monitors-changed', monitorManager.connect('monitors-changed',
this._monitorsChanged.bind(this)); this._monitorsChanged.bind(this));
this._monitorsChanged(); this._monitorsChanged();

View File

@ -47,7 +47,7 @@ class OsdMonitorLabel extends St.Widget {
var OsdMonitorLabeler = class { var OsdMonitorLabeler = class {
constructor() { constructor() {
this._monitorManager = Meta.MonitorManager.get(); this._monitorManager = global.backend.get_monitor_manager();
this._client = null; this._client = null;
this._clientWatchId = 0; this._clientWatchId = 0;
this._osdLabels = []; this._osdLabels = [];

View File

@ -127,7 +127,7 @@ var GnomeShell = class {
let monitorIndex = -1; let monitorIndex = -1;
if (connector) { if (connector) {
let monitorManager = Meta.MonitorManager.get(); const monitorManager = global.backend.get_monitor_manager();
monitorIndex = monitorManager.get_monitor_for_connector(connector); monitorIndex = monitorManager.get_monitor_for_connector(connector);
} }

View File

@ -55,14 +55,14 @@ class SwitchMonitorPopup extends SwitcherPopup.SwitcherPopup {
} }
show(backward, binding, mask) { show(backward, binding, mask) {
if (!Meta.MonitorManager.get().can_switch_config()) if (!global.backend.get_monitor_manager().can_switch_config())
return false; return false;
return super.show(backward, binding, mask); return super.show(backward, binding, mask);
} }
_initialSelection() { _initialSelection() {
let currentConfig = Meta.MonitorManager.get().get_switch_config(); let currentConfig = global.backend.get_monitor_manager().get_switch_config();
let selectConfig = (currentConfig + 1) % this._items.length; let selectConfig = (currentConfig + 1) % this._items.length;
this._select(selectConfig); this._select(selectConfig);
} }

View File

@ -3,7 +3,7 @@
const { const {
AccountsService, Atk, Clutter, Gdm, Gio, AccountsService, Atk, Clutter, Gdm, Gio,
GnomeDesktop, GLib, GObject, Meta, Shell, St, GnomeDesktop, GLib, GObject, Shell, St,
} = imports.gi; } = imports.gi;
const Background = imports.ui.background; const Background = imports.ui.background;
@ -337,7 +337,7 @@ class UnlockDialogClock extends St.BoxLayout {
this._seat.connectObject('notify::touch-mode', this._seat.connectObject('notify::touch-mode',
this._updateHint.bind(this), this); this._updateHint.bind(this), this);
this._monitorManager = Meta.MonitorManager.get(); this._monitorManager = global.backend.get_monitor_manager();
this._monitorManager.connectObject('power-save-mode-changed', this._monitorManager.connectObject('power-save-mode-changed',
() => (this._hint.opacity = 0), this); () => (this._hint.opacity = 0), this);

View File

@ -56,7 +56,8 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
this._wm = wm; this._wm = wm;
this._countDown = Meta.MonitorManager.get_display_configuration_timeout(); const monitorManager = global.backend.get_monitor_manager();
this._countDown = monitorManager.get_display_configuration_timeout();
// Translators: This string should be shorter than 30 characters // Translators: This string should be shorter than 30 characters
let title = _('Keep these display settings?'); let title = _('Keep these display settings?');