Remove usage of MetaScreen

Remove any usage of MetaScreen, as it has been removed from libmutter
in the API version 3. The corresponding functionality has been moved
into three different places: MetaDisplay, MetaX11Display (for X11
specific functionality) and MetaWorkspaceManager.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:
Jonas Ådahl
2018-01-03 15:55:38 +08:00
parent 2c0376c150
commit 47ea10b7c9
37 changed files with 436 additions and 326 deletions

View File

@ -1156,10 +1156,10 @@ var Workspace = new Lang.Class({
this._windowRemovedId = this.metaWorkspace.connect('window-removed',
this._windowRemoved.bind(this));
}
this._windowEnteredMonitorId = global.screen.connect('window-entered-monitor',
this._windowEnteredMonitor.bind(this));
this._windowLeftMonitorId = global.screen.connect('window-left-monitor',
this._windowLeftMonitor.bind(this));
this._windowEnteredMonitorId = global.display.connect('window-entered-monitor',
this._windowEnteredMonitor.bind(this));
this._windowLeftMonitorId = global.display.connect('window-left-monitor',
this._windowLeftMonitor.bind(this));
this._repositionWindowsId = 0;
this.leavingOverview = false;
@ -1305,7 +1305,8 @@ var Workspace = new Lang.Class({
let area = padArea(this._actualGeometry, padding);
let slots = strategy.computeWindowSlots(layout, area);
let currentWorkspace = global.screen.get_active_workspace();
let workspaceManager = global.workspace_manager;
let currentWorkspace = workspaceManager.get_active_workspace();
let isOnCurrentWorkspace = this.metaWorkspace == null || this.metaWorkspace == currentWorkspace;
for (let i = 0; i < slots.length; i++) {
@ -1568,13 +1569,13 @@ var Workspace = new Lang.Class({
this._doRemoveWindow(metaWin);
},
_windowEnteredMonitor(metaScreen, monitorIndex, metaWin) {
_windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) {
if (monitorIndex == this.monitorIndex) {
this._doAddWindow(metaWin);
}
},
_windowLeftMonitor(metaScreen, monitorIndex, metaWin) {
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
if (monitorIndex == this.monitorIndex) {
this._doRemoveWindow(metaWin);
}
@ -1599,7 +1600,9 @@ var Workspace = new Lang.Class({
if (this._windows.length == 0)
return;
if (this.metaWorkspace != null && this.metaWorkspace != global.screen.get_active_workspace())
let workspaceManager = global.workspace_manager;
let activeWorkspace = workspaceManager.get_active_workspace();
if (this.metaWorkspace != null && this.metaWorkspace != activeWorkspace)
return;
// Special case maximized windows, since it doesn't make sense
@ -1655,7 +1658,9 @@ var Workspace = new Lang.Class({
this._repositionWindowsId = 0;
}
if (this.metaWorkspace != null && this.metaWorkspace != global.screen.get_active_workspace())
let workspaceManager = global.workspace_manager;
let activeWorkspace = workspaceManager.get_active_workspace();
if (this.metaWorkspace != null && this.metaWorkspace != activeWorkspace)
return;
// Special case maximized windows, since it doesn't make sense
@ -1725,7 +1730,8 @@ var Workspace = new Lang.Class({
},
zoomFromOverview() {
let currentWorkspace = global.screen.get_active_workspace();
let workspaceManager = global.workspace_manager;
let currentWorkspace = workspaceManager.get_active_workspace();
this.leavingOverview = true;
@ -1793,8 +1799,8 @@ var Workspace = new Lang.Class({
this.metaWorkspace.disconnect(this._windowAddedId);
this.metaWorkspace.disconnect(this._windowRemovedId);
}
global.screen.disconnect(this._windowEnteredMonitorId);
global.screen.disconnect(this._windowLeftMonitorId);
global.display.disconnect(this._windowEnteredMonitorId);
global.display.disconnect(this._windowLeftMonitorId);
if (this._repositionWindowsId > 0) {
Mainloop.source_remove(this._repositionWindowsId);
@ -2015,7 +2021,8 @@ var Workspace = new Lang.Class({
if (metaWindow.get_monitor() != this.monitorIndex)
metaWindow.move_to_monitor(this.monitorIndex);
let index = this.metaWorkspace ? this.metaWorkspace.index() : global.screen.get_active_workspace_index();
let workspaceManager = global.workspace_manager;
let index = this.metaWorkspace ? this.metaWorkspace.index() : workspaceManager.get_active_workspace_index();
metaWindow.change_workspace_by_index(index, false);
return true;
} else if (source.shellWorkspaceLaunch) {