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:
parent
2c0376c150
commit
47ea10b7c9
@ -502,7 +502,8 @@ var CyclerPopup = new Lang.Class({
|
||||
_finish() {
|
||||
let window = this._items[this._selectedIndex];
|
||||
let ws = window.get_workspace();
|
||||
let activeWs = global.screen.get_active_workspace();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWs = workspaceManager.get_active_workspace();
|
||||
|
||||
if (window.minimized) {
|
||||
Main.wm.skipNextEffect(window.get_compositor_private());
|
||||
@ -572,7 +573,14 @@ var WindowSwitcherPopup = new Lang.Class({
|
||||
},
|
||||
|
||||
_getWindowList() {
|
||||
let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
|
||||
let workspace = null;
|
||||
|
||||
if (this._settings.get_boolean('current-workspace-only')) {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
|
||||
workspace = workspaceManager.get_active_workspace();
|
||||
}
|
||||
|
||||
return getWindows(workspace);
|
||||
},
|
||||
|
||||
@ -620,7 +628,14 @@ var WindowCyclerPopup = new Lang.Class({
|
||||
},
|
||||
|
||||
_getWindows() {
|
||||
let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
|
||||
let workspace = null;
|
||||
|
||||
if (this._settings.get_boolean('current-workspace-only')) {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
|
||||
workspace = workspaceManager.get_active_workspace();
|
||||
}
|
||||
|
||||
return getWindows(workspace);
|
||||
},
|
||||
|
||||
@ -669,8 +684,14 @@ var AppSwitcher = new Lang.Class({
|
||||
|
||||
let windowTracker = Shell.WindowTracker.get_default();
|
||||
let settings = new Gio.Settings({ schema_id: 'org.gnome.shell.app-switcher' });
|
||||
let workspace = settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace()
|
||||
: null;
|
||||
|
||||
let workspace = null;
|
||||
if (settings.get_boolean('current-workspace-only')) {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
|
||||
workspace = workspaceManager.get_active_workspace();
|
||||
}
|
||||
|
||||
let allWindows = global.display.get_tab_list(Meta.TabList.NORMAL, workspace);
|
||||
|
||||
// Construct the AppIcons, add to the popup
|
||||
|
@ -1862,7 +1862,8 @@ var AppIconMenu = new Lang.Class({
|
||||
|
||||
// Display the app windows menu items and the separator between windows
|
||||
// of the current desktop and other windows.
|
||||
let activeWorkspace = global.screen.get_active_workspace();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
let separatorShown = windows.length > 0 && windows[0].get_workspace() != activeWorkspace;
|
||||
|
||||
for (let i = 0; i < windows.length; i++) {
|
||||
|
@ -240,7 +240,7 @@ var Background = new Lang.Class({
|
||||
file: null,
|
||||
style: null });
|
||||
|
||||
this.background = new Meta.Background({ meta_screen: global.screen });
|
||||
this.background = new Meta.Background({ meta_display: global.display });
|
||||
this.background._delegate = this;
|
||||
|
||||
this._settings = params.settings;
|
||||
@ -499,12 +499,12 @@ var SystemBackground = new Lang.Class({
|
||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/noise-texture.png');
|
||||
|
||||
if (_systemBackground == null) {
|
||||
_systemBackground = new Meta.Background({ meta_screen: global.screen });
|
||||
_systemBackground = new Meta.Background({ meta_display: global.display });
|
||||
_systemBackground.set_color(DEFAULT_BACKGROUND_COLOR);
|
||||
_systemBackground.set_file(file, GDesktopEnums.BackgroundStyle.WALLPAPER);
|
||||
}
|
||||
|
||||
this.actor = new Meta.BackgroundActor({ meta_screen: global.screen,
|
||||
this.actor = new Meta.BackgroundActor({ meta_display: global.display,
|
||||
monitor: 0,
|
||||
background: _systemBackground });
|
||||
|
||||
@ -538,7 +538,9 @@ var BackgroundSource = new Lang.Class({
|
||||
this._settings = new Gio.Settings({ schema_id: settingsSchema });
|
||||
this._backgrounds = [];
|
||||
|
||||
this._monitorsChangedId = global.screen.connect('monitors-changed',
|
||||
let monitorManager = Meta.MonitorManager.get();
|
||||
this._monitorsChangedId =
|
||||
monitorManager.connect('monitors-changed',
|
||||
this._onMonitorsChanged.bind(this));
|
||||
},
|
||||
|
||||
@ -604,7 +606,8 @@ var BackgroundSource = new Lang.Class({
|
||||
},
|
||||
|
||||
destroy() {
|
||||
global.screen.disconnect(this._monitorsChangedId);
|
||||
let monitorManager = Meta.MonitorManager.get();
|
||||
monitorManager.disconnect(this._monitorsChangedId);
|
||||
|
||||
for (let monitorIndex in this._backgrounds) {
|
||||
let background = this._backgrounds[monitorIndex];
|
||||
@ -751,7 +754,7 @@ var BackgroundManager = new Lang.Class({
|
||||
|
||||
_createBackgroundActor() {
|
||||
let background = this._backgroundSource.getBackground(this._monitorIndex);
|
||||
let backgroundActor = new Meta.BackgroundActor({ meta_screen: global.screen,
|
||||
let backgroundActor = new Meta.BackgroundActor({ meta_display: global.display,
|
||||
monitor: this._monitorIndex,
|
||||
background: background.background,
|
||||
vignette: this._vignette,
|
||||
|
@ -85,9 +85,11 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
|
||||
// And add the windows metacity would show in its Ctrl-Alt-Tab list
|
||||
if (Main.sessionMode.hasWindows && !Main.overview.visible) {
|
||||
let screen = global.screen;
|
||||
let display = screen.get_display();
|
||||
let windows = display.get_tab_list(Meta.TabList.DOCKS, screen.get_active_workspace ());
|
||||
let display = global.display;
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
let windows = display.get_tab_list(Meta.TabList.DOCKS,
|
||||
activeWorkspace);
|
||||
let windowTracker = Shell.WindowTracker.get_default();
|
||||
let textureCache = St.TextureCache.get_default();
|
||||
for (let i = 0; i < windows.length; i++) {
|
||||
@ -131,7 +133,7 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_focusWindows(timestamp) {
|
||||
global.screen.focus_default_window(timestamp);
|
||||
global.display.focus_default_window(timestamp);
|
||||
}
|
||||
});
|
||||
|
||||
|
14
js/ui/dnd.js
14
js/ui/dnd.js
@ -280,7 +280,7 @@ var _Draggable = new Lang.Class({
|
||||
|
||||
this._touchSequence = sequence;
|
||||
this._grabEvents();
|
||||
global.screen.set_cursor(Meta.Cursor.DND_IN_DRAG);
|
||||
global.display.set_cursor(Meta.Cursor.DND_IN_DRAG);
|
||||
|
||||
this._dragX = this._dragStartX = stageX;
|
||||
this._dragY = this._dragStartY = stageY;
|
||||
@ -412,7 +412,7 @@ var _Draggable = new Lang.Class({
|
||||
if (motionFunc) {
|
||||
let result = motionFunc(dragEvent);
|
||||
if (result != DragMotionResult.CONTINUE) {
|
||||
global.screen.set_cursor(DRAG_CURSOR_MAP[result]);
|
||||
global.display.set_cursor(DRAG_CURSOR_MAP[result]);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}
|
||||
}
|
||||
@ -430,13 +430,13 @@ var _Draggable = new Lang.Class({
|
||||
targY,
|
||||
0);
|
||||
if (result != DragMotionResult.CONTINUE) {
|
||||
global.screen.set_cursor(DRAG_CURSOR_MAP[result]);
|
||||
global.display.set_cursor(DRAG_CURSOR_MAP[result]);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}
|
||||
}
|
||||
target = target.get_parent();
|
||||
}
|
||||
global.screen.set_cursor(Meta.Cursor.DND_IN_DRAG);
|
||||
global.display.set_cursor(Meta.Cursor.DND_IN_DRAG);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
||||
@ -509,7 +509,7 @@ var _Draggable = new Lang.Class({
|
||||
}
|
||||
|
||||
this._dragInProgress = false;
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
||||
this.emit('drag-end', event.get_time(), true);
|
||||
this._dragComplete();
|
||||
return true;
|
||||
@ -561,7 +561,7 @@ var _Draggable = new Lang.Class({
|
||||
let [snapBackX, snapBackY, snapBackScale] = this._getRestoreLocation();
|
||||
|
||||
if (this._actorDestroyed) {
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
||||
if (!this._buttonDown)
|
||||
this._dragComplete();
|
||||
this.emit('drag-end', eventTime, false);
|
||||
@ -620,7 +620,7 @@ var _Draggable = new Lang.Class({
|
||||
if (!this._buttonDown)
|
||||
this._dragComplete();
|
||||
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
||||
},
|
||||
|
||||
_onAnimationComplete(dragActor, eventTime) {
|
||||
|
@ -27,9 +27,9 @@ var EdgeDragAction = new Lang.Class({
|
||||
|
||||
_getMonitorRect(x, y) {
|
||||
let rect = new Meta.Rectangle({ x: x - 1, y: y - 1, width: 1, height: 1 });
|
||||
let monitorIndex = global.screen.get_monitor_index_for_rect(rect);
|
||||
let monitorIndex = global.display.get_monitor_index_for_rect(rect);
|
||||
|
||||
return global.screen.get_monitor_geometry(monitorIndex);
|
||||
return global.display.get_monitor_geometry(monitorIndex);
|
||||
},
|
||||
|
||||
vfunc_gesture_prepare(action, actor) {
|
||||
|
@ -568,7 +568,7 @@ var Keyboard = new Lang.Class({
|
||||
this._updateCaretPositionId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
this._updateCaretPositionId = 0;
|
||||
|
||||
let currentWindow = global.screen.get_display().focus_window;
|
||||
let currentWindow = global.display.focus_window;
|
||||
if (!currentWindow) {
|
||||
this.setCursorLocation(null);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
@ -1131,7 +1131,7 @@ var Keyboard = new Lang.Class({
|
||||
return;
|
||||
|
||||
if (this._oskFocusWindow) {
|
||||
let display = global.screen.get_display();
|
||||
let display = global.display;
|
||||
|
||||
if (display.get_grab_op() == Meta.GrabOp.NONE ||
|
||||
display.get_focus_window() != this._oskFocusWindow)
|
||||
|
@ -109,7 +109,7 @@ var MonitorConstraint = new Lang.Class({
|
||||
|
||||
if (!this._workareasChangedId) {
|
||||
this._workareasChangedId =
|
||||
global.screen.connect('workareas-changed', () => {
|
||||
global.display.connect('workareas-changed', () => {
|
||||
if (this._workArea)
|
||||
this.actor.queue_relayout();
|
||||
});
|
||||
@ -120,7 +120,7 @@ var MonitorConstraint = new Lang.Class({
|
||||
this._monitorsChangedId = 0;
|
||||
|
||||
if (this._workareasChangedId)
|
||||
global.screen.disconnect(this._workareasChangedId);
|
||||
global.display.disconnect(this._workareasChangedId);
|
||||
this._workareasChangedId = 0;
|
||||
}
|
||||
|
||||
@ -142,7 +142,8 @@ var MonitorConstraint = new Lang.Class({
|
||||
|
||||
let rect;
|
||||
if (this._workArea) {
|
||||
let ws = global.screen.get_workspace_by_index(0);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let ws = workspaceManager.get_workspace_by_index(0);
|
||||
rect = ws.get_work_area_for_monitor(index);
|
||||
} else {
|
||||
rect = Main.layoutManager.monitors[index];
|
||||
@ -164,7 +165,7 @@ var Monitor = new Lang.Class({
|
||||
},
|
||||
|
||||
get inFullscreen() {
|
||||
return global.screen.get_monitor_in_fullscreen(this.index);
|
||||
return global.display.get_monitor_in_fullscreen(this.index);
|
||||
}
|
||||
})
|
||||
|
||||
@ -259,7 +260,7 @@ var LayoutManager = new Lang.Class({
|
||||
global.stage.remove_actor(global.top_window_group);
|
||||
this.uiGroup.add_actor(global.top_window_group);
|
||||
|
||||
let feedbackGroup = Meta.get_feedback_group_for_screen(global.screen);
|
||||
let feedbackGroup = Meta.get_feedback_group_for_display(global.display);
|
||||
global.stage.remove_actor(feedbackGroup);
|
||||
this.uiGroup.add_actor(feedbackGroup);
|
||||
|
||||
@ -269,14 +270,19 @@ var LayoutManager = new Lang.Class({
|
||||
this._bgManagers = [];
|
||||
|
||||
// Need to update struts on new workspaces when they are added
|
||||
global.screen.connect('notify::n-workspaces',
|
||||
let workspaceManager = global.workspace_manager;
|
||||
workspaceManager.connect('notify::n-workspaces',
|
||||
this._queueUpdateRegions.bind(this));
|
||||
global.screen.connect('restacked',
|
||||
|
||||
let display = global.display;
|
||||
display.connect('restacked',
|
||||
this._windowsRestacked.bind(this));
|
||||
global.screen.connect('monitors-changed',
|
||||
this._monitorsChanged.bind(this));
|
||||
global.screen.connect('in-fullscreen-changed',
|
||||
display.connect('in-fullscreen-changed',
|
||||
this._updateFullscreen.bind(this));
|
||||
|
||||
let monitorManager = Meta.MonitorManager.get();
|
||||
monitorManager.connect('monitors-changed',
|
||||
this._monitorsChanged.bind(this));
|
||||
this._monitorsChanged();
|
||||
|
||||
// NVIDIA drivers don't preserve FBO contents across
|
||||
@ -319,12 +325,12 @@ var LayoutManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_updateMonitors() {
|
||||
let screen = global.screen;
|
||||
let display = global.display;
|
||||
|
||||
this.monitors = [];
|
||||
let nMonitors = screen.get_n_monitors();
|
||||
let nMonitors = display.get_n_monitors();
|
||||
for (let i = 0; i < nMonitors; i++)
|
||||
this.monitors.push(new Monitor(i, screen.get_monitor_geometry(i)));
|
||||
this.monitors.push(new Monitor(i, display.get_monitor_geometry(i)));
|
||||
|
||||
if (nMonitors == 0) {
|
||||
this.primaryIndex = this.bottomIndex = -1;
|
||||
@ -333,7 +339,7 @@ var LayoutManager = new Lang.Class({
|
||||
} else {
|
||||
// If there are monitors below the primary, then we need
|
||||
// to split primary from bottom.
|
||||
this.primaryIndex = this.bottomIndex = screen.get_primary_monitor();
|
||||
this.primaryIndex = this.bottomIndex = display.get_primary_monitor();
|
||||
for (let i = 0; i < this.monitors.length; i++) {
|
||||
let monitor = this.monitors[i];
|
||||
if (this._isAboveOrBelowPrimary(monitor)) {
|
||||
@ -538,7 +544,7 @@ var LayoutManager = new Lang.Class({
|
||||
},
|
||||
|
||||
get currentMonitor() {
|
||||
let index = global.screen.get_current_monitor();
|
||||
let index = global.display.get_current_monitor();
|
||||
return this.monitors[index];
|
||||
},
|
||||
|
||||
@ -911,7 +917,8 @@ var LayoutManager = new Lang.Class({
|
||||
getWorkAreaForMonitor(monitorIndex) {
|
||||
// Assume that all workspaces will have the same
|
||||
// struts and pick the first one.
|
||||
let ws = global.screen.get_workspace_by_index(0);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let ws = workspaceManager.get_workspace_by_index(0);
|
||||
return ws.get_work_area_for_monitor(monitorIndex);
|
||||
},
|
||||
|
||||
@ -921,7 +928,7 @@ var LayoutManager = new Lang.Class({
|
||||
let [x, y] = actor.get_transformed_position();
|
||||
let [w, h] = actor.get_transformed_size();
|
||||
let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h });
|
||||
return global.screen.get_monitor_index_for_rect(rect);
|
||||
return global.display.get_monitor_index_for_rect(rect);
|
||||
},
|
||||
|
||||
findMonitorForActor(actor) {
|
||||
@ -1054,9 +1061,9 @@ var LayoutManager = new Lang.Class({
|
||||
global.set_stage_input_region(rects);
|
||||
this._isPopupWindowVisible = isPopupMenuVisible;
|
||||
|
||||
let screen = global.screen;
|
||||
for (let w = 0; w < screen.n_workspaces; w++) {
|
||||
let workspace = screen.get_workspace_by_index(w);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
for (let w = 0; w < workspaceManager.n_workspaces; w++) {
|
||||
let workspace = workspaceManager.get_workspace_by_index(w);
|
||||
workspace.set_builtin_struts(struts);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ var Magnifier = new Lang.Class({
|
||||
this._zoomRegions = [];
|
||||
|
||||
// Create small clutter tree for the magnified mouse.
|
||||
let cursorTracker = Meta.CursorTracker.get_for_screen(global.screen);
|
||||
let cursorTracker = Meta.CursorTracker.get_for_display(global.display);
|
||||
this._mouseSprite = new Clutter.Texture();
|
||||
Shell.util_cursor_tracker_to_clutter(cursorTracker, this._mouseSprite);
|
||||
this._cursorRoot = new Clutter.Actor();
|
||||
@ -116,10 +116,10 @@ var Magnifier = new Lang.Class({
|
||||
|
||||
if (isActive != activate) {
|
||||
if (activate) {
|
||||
Meta.disable_unredirect_for_screen(global.screen);
|
||||
Meta.disable_unredirect_for_display(global.display);
|
||||
this.startTrackingMouse();
|
||||
} else {
|
||||
Meta.enable_unredirect_for_screen(global.screen);
|
||||
Meta.enable_unredirect_for_display(global.display);
|
||||
this.stopTrackingMouse();
|
||||
}
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ function pushModal(actor, params) {
|
||||
log('pushModal: invocation of begin_modal failed');
|
||||
return false;
|
||||
}
|
||||
Meta.disable_unredirect_for_screen(global.screen);
|
||||
Meta.disable_unredirect_for_display(global.display);
|
||||
}
|
||||
|
||||
modalCount += 1;
|
||||
@ -528,7 +528,7 @@ function popModal(actor, timestamp) {
|
||||
|
||||
layoutManager.modalEnded();
|
||||
global.end_modal(timestamp);
|
||||
Meta.enable_unredirect_for_screen(global.screen);
|
||||
Meta.enable_unredirect_for_display(global.display);
|
||||
actionMode = Shell.ActionMode.NORMAL;
|
||||
}
|
||||
|
||||
@ -556,14 +556,15 @@ function openRunDialog() {
|
||||
* and switching out of the overview if it's currently active
|
||||
*/
|
||||
function activateWindow(window, time, workspaceNum) {
|
||||
let activeWorkspaceNum = global.screen.get_active_workspace_index();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspaceNum = workspaceManager.get_active_workspace_index();
|
||||
let windowWorkspaceNum = (workspaceNum !== undefined) ? workspaceNum : window.get_workspace().index();
|
||||
|
||||
if (!time)
|
||||
time = global.get_current_time();
|
||||
|
||||
if (windowWorkspaceNum != activeWorkspaceNum) {
|
||||
let workspace = global.screen.get_workspace_by_index(windowWorkspaceNum);
|
||||
let workspace = workspaceManager.get_workspace_by_index(windowWorkspaceNum);
|
||||
workspace.activate_with_focus(window, time);
|
||||
} else {
|
||||
window.activate(time);
|
||||
|
@ -96,10 +96,10 @@ var URLHighlighter = new Lang.Class({
|
||||
|
||||
let urlId = this._findUrlAtPos(event);
|
||||
if (urlId != -1 && !this._cursorChanged) {
|
||||
global.screen.set_cursor(Meta.Cursor.POINTING_HAND);
|
||||
global.display.set_cursor(Meta.Cursor.POINTING_HAND);
|
||||
this._cursorChanged = true;
|
||||
} else if (urlId == -1) {
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
||||
this._cursorChanged = false;
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
@ -110,7 +110,7 @@ var URLHighlighter = new Lang.Class({
|
||||
|
||||
if (this._cursorChanged) {
|
||||
this._cursorChanged = false;
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
|
@ -917,7 +917,7 @@ var MessageTray = new Lang.Class({
|
||||
Main.layoutManager.addChrome(this.actor, { affectsInputRegion: false });
|
||||
Main.layoutManager.trackChrome(this._bannerBin, { affectsInputRegion: true });
|
||||
|
||||
global.screen.connect('in-fullscreen-changed', this._updateState.bind(this));
|
||||
global.display.connect('in-fullscreen-changed', this._updateState.bind(this));
|
||||
|
||||
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
|
||||
|
||||
|
@ -116,7 +116,7 @@ var ModalDialog = new Lang.Class({
|
||||
if (onPrimary)
|
||||
this._monitorConstraint.primary = true;
|
||||
else
|
||||
this._monitorConstraint.index = global.screen.get_current_monitor();
|
||||
this._monitorConstraint.index = global.display.get_current_monitor();
|
||||
|
||||
this.state = State.OPENING;
|
||||
|
||||
|
@ -32,7 +32,7 @@ var OsdMonitorLabel = new Lang.Class({
|
||||
Main.uiGroup.set_child_above_sibling(this._actor, null);
|
||||
this._position();
|
||||
|
||||
Meta.disable_unredirect_for_screen(global.screen);
|
||||
Meta.disable_unredirect_for_display(global.display);
|
||||
},
|
||||
|
||||
_position() {
|
||||
@ -48,7 +48,7 @@ var OsdMonitorLabel = new Lang.Class({
|
||||
|
||||
destroy() {
|
||||
this._actor.destroy();
|
||||
Meta.enable_unredirect_for_screen(global.screen);
|
||||
Meta.enable_unredirect_for_display(global.display);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -145,7 +145,7 @@ var OsdWindow = new Lang.Class({
|
||||
return;
|
||||
|
||||
if (!this.actor.visible) {
|
||||
Meta.disable_unredirect_for_screen(global.screen);
|
||||
Meta.disable_unredirect_for_display(global.display);
|
||||
this.actor.show();
|
||||
this.actor.opacity = 0;
|
||||
this.actor.get_parent().set_child_above_sibling(this.actor, null);
|
||||
@ -179,7 +179,7 @@ var OsdWindow = new Lang.Class({
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: () => {
|
||||
this._reset();
|
||||
Meta.enable_unredirect_for_screen(global.screen);
|
||||
Meta.enable_unredirect_for_display(global.display);
|
||||
}
|
||||
});
|
||||
return GLib.SOURCE_REMOVE;
|
||||
|
@ -157,7 +157,7 @@ var Overview = new Lang.Class({
|
||||
Main.xdndHandler.connect('drag-begin', this._onDragBegin.bind(this));
|
||||
Main.xdndHandler.connect('drag-end', this._onDragEnd.bind(this));
|
||||
|
||||
global.screen.connect('restacked', this._onRestacked.bind(this));
|
||||
global.display.connect('restacked', this._onRestacked.bind(this));
|
||||
|
||||
this._windowSwitchTimeoutId = 0;
|
||||
this._windowSwitchTimestamp = 0;
|
||||
@ -286,7 +286,8 @@ var Overview = new Lang.Class({
|
||||
|
||||
DND.addDragMonitor(this._dragMonitor);
|
||||
// Remember the workspace we started from
|
||||
this._lastActiveWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
this._lastActiveWorkspaceIndex = workspaceManager.get_active_workspace_index();
|
||||
},
|
||||
|
||||
_onDragEnd(time) {
|
||||
@ -296,7 +297,8 @@ var Overview = new Lang.Class({
|
||||
// we have to go back to where we started and hide
|
||||
// the overview
|
||||
if (this._shown) {
|
||||
global.screen.get_workspace_by_index(this._lastActiveWorkspaceIndex).activate(time);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
workspaceManager.get_workspace_by_index(this._lastActiveWorkspaceIndex).activate(time);
|
||||
this.hide();
|
||||
}
|
||||
this._resetWindowSwitchTimeout();
|
||||
@ -317,9 +319,9 @@ var Overview = new Lang.Class({
|
||||
let display = Gdk.Display.get_default();
|
||||
let deviceManager = display.get_device_manager();
|
||||
let pointer = deviceManager.get_client_pointer();
|
||||
let [screen, pointerX, pointerY] = pointer.get_position();
|
||||
let [gdkScreen, pointerX, pointerY] = pointer.get_position();
|
||||
|
||||
pointer.warp(screen, pointerX, pointerY);
|
||||
pointer.warp(gdkScreen, pointerX, pointerY);
|
||||
},
|
||||
|
||||
_onDragMotion(dragEvent) {
|
||||
@ -550,7 +552,7 @@ var Overview = new Lang.Class({
|
||||
this.visibleTarget = true;
|
||||
this._activationTime = GLib.get_monotonic_time() / GLib.USEC_PER_SEC;
|
||||
|
||||
Meta.disable_unredirect_for_screen(global.screen);
|
||||
Meta.disable_unredirect_for_display(global.display);
|
||||
this.viewSelector.show();
|
||||
|
||||
this._overview.opacity = 0;
|
||||
@ -635,7 +637,7 @@ var Overview = new Lang.Class({
|
||||
|
||||
_hideDone() {
|
||||
// Re-enable unredirection
|
||||
Meta.enable_unredirect_for_screen(global.screen);
|
||||
Meta.enable_unredirect_for_display(global.display);
|
||||
|
||||
this.viewSelector.hide();
|
||||
this._desktopFade.hide();
|
||||
|
@ -265,7 +265,8 @@ var AppMenuButton = new Lang.Class({
|
||||
},
|
||||
|
||||
_findTargetApp() {
|
||||
let workspace = global.screen.get_active_workspace();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let workspace = workspaceManager.get_active_workspace();
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
let focusedApp = tracker.focus_app;
|
||||
if (focusedApp && focusedApp.is_on_workspace(workspace))
|
||||
@ -818,7 +819,7 @@ var Panel = new Lang.Class({
|
||||
global.window_group.connect('actor-removed', this._onWindowActorRemoved.bind(this));
|
||||
global.window_manager.connect('switch-workspace', this._updateSolidStyle.bind(this));
|
||||
|
||||
global.screen.connect('workareas-changed', () => { this.actor.queue_relayout(); });
|
||||
global.display.connect('workareas-changed', () => { this.actor.queue_relayout(); });
|
||||
this._updatePanel();
|
||||
},
|
||||
|
||||
@ -961,8 +962,7 @@ var Panel = new Lang.Class({
|
||||
if (!allowDrag)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
global.display.begin_grab_op(global.screen,
|
||||
dragWindow,
|
||||
global.display.begin_grab_op(dragWindow,
|
||||
Meta.GrabOp.MOVING,
|
||||
false, /* pointer grab */
|
||||
true, /* frame action */
|
||||
@ -977,7 +977,7 @@ var Panel = new Lang.Class({
|
||||
_onKeyPress(actor, event) {
|
||||
let symbol = event.get_key_symbol();
|
||||
if (symbol == Clutter.KEY_Escape) {
|
||||
global.screen.focus_default_window(event.get_time());
|
||||
global.display.focus_default_window(event.get_time());
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
|
||||
@ -1075,7 +1075,8 @@ var Panel = new Lang.Class({
|
||||
return;
|
||||
|
||||
/* Get all the windows in the active workspace that are in the primary monitor and visible */
|
||||
let activeWorkspace = global.screen.get_active_workspace();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
let windows = activeWorkspace.list_windows().filter(metaWindow => {
|
||||
return metaWindow.is_on_primary_monitor() &&
|
||||
metaWindow.showing_on_its_workspace() &&
|
||||
|
@ -570,7 +570,7 @@ var ScreenShield = new Lang.Class({
|
||||
this._shortLightbox.connect('shown', this._onShortLightboxShown.bind(this));
|
||||
|
||||
this.idleMonitor = Meta.IdleMonitor.get_core();
|
||||
this._cursorTracker = Meta.CursorTracker.get_for_screen(global.screen);
|
||||
this._cursorTracker = Meta.CursorTracker.get_for_display(global.display);
|
||||
|
||||
this._syncInhibitor();
|
||||
},
|
||||
|
@ -56,7 +56,7 @@ var ScreencastService = new Lang.Class({
|
||||
let recorder = this._recorders.get(sender);
|
||||
if (!recorder) {
|
||||
recorder = new Shell.Recorder({ stage: global.stage,
|
||||
screen: global.screen });
|
||||
display: global.display });
|
||||
recorder._watchNameId =
|
||||
Gio.bus_watch_name(Gio.BusType.SESSION, sender, 0, null,
|
||||
this._onNameVanished.bind(this));
|
||||
|
@ -261,7 +261,7 @@ var SelectArea = new Lang.Class({
|
||||
onUngrab: this._onUngrab.bind(this) }))
|
||||
return;
|
||||
|
||||
global.screen.set_cursor(Meta.Cursor.CROSSHAIR);
|
||||
global.display.set_cursor(Meta.Cursor.CROSSHAIR);
|
||||
Main.uiGroup.set_child_above_sibling(this._group, null);
|
||||
this._group.visible = true;
|
||||
},
|
||||
@ -330,7 +330,7 @@ var SelectArea = new Lang.Class({
|
||||
},
|
||||
|
||||
_onUngrab() {
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
global.display.set_cursor(Meta.Cursor.DEFAULT);
|
||||
this.emit('finished', this._result);
|
||||
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||
|
@ -398,7 +398,7 @@ var InputSourceManager = new Lang.Class({
|
||||
return true;
|
||||
},
|
||||
|
||||
_switchInputSource(display, screen, window, binding) {
|
||||
_switchInputSource(display, window, binding) {
|
||||
if (this._mruSources.length < 2)
|
||||
return;
|
||||
|
||||
|
@ -200,12 +200,18 @@ var WorkspaceTracker = new Lang.Class({
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
tracker.connect('startup-sequence-changed', this._queueCheckWorkspaces.bind(this));
|
||||
|
||||
global.screen.connect('notify::n-workspaces', this._nWorkspacesChanged.bind(this));
|
||||
global.window_manager.connect('switch-workspace', this._queueCheckWorkspaces.bind(this));
|
||||
let workspaceManager = global.workspace_manager;
|
||||
workspaceManager.connect('notify::n-workspaces',
|
||||
this._nWorkspacesChanged.bind(this));
|
||||
global.window_manager.connect('switch-workspace',
|
||||
this._queueCheckWorkspaces.bind(this));
|
||||
|
||||
global.screen.connect('window-entered-monitor', this._windowEnteredMonitor.bind(this));
|
||||
global.screen.connect('window-left-monitor', this._windowLeftMonitor.bind(this));
|
||||
global.screen.connect('restacked', this._windowsRestacked.bind(this));
|
||||
global.display.connect('window-entered-monitor',
|
||||
this._windowEnteredMonitor.bind(this));
|
||||
global.display.connect('window-left-monitor',
|
||||
this._windowLeftMonitor.bind(this));
|
||||
global.display.connect('restacked',
|
||||
this._windowsRestacked.bind(this));
|
||||
|
||||
this._workspaceSettings = this._getWorkspaceSettings();
|
||||
this._workspaceSettings.connect('changed::dynamic-workspaces', this._queueCheckWorkspaces.bind(this));
|
||||
@ -230,6 +236,7 @@ var WorkspaceTracker = new Lang.Class({
|
||||
},
|
||||
|
||||
_checkWorkspaces() {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let i;
|
||||
let emptyWorkspaces = [];
|
||||
|
||||
@ -257,7 +264,7 @@ var WorkspaceTracker = new Lang.Class({
|
||||
let sequences = Shell.WindowTracker.get_default().get_startup_sequences();
|
||||
for (i = 0; i < sequences.length; i++) {
|
||||
let index = sequences[i].get_workspace();
|
||||
if (index >= 0 && index <= global.screen.n_workspaces)
|
||||
if (index >= 0 && index <= workspaceManager.n_workspaces)
|
||||
emptyWorkspaces[index] = false;
|
||||
}
|
||||
|
||||
@ -275,17 +282,17 @@ var WorkspaceTracker = new Lang.Class({
|
||||
|
||||
// If we don't have an empty workspace at the end, add one
|
||||
if (!emptyWorkspaces[emptyWorkspaces.length -1]) {
|
||||
global.screen.append_new_workspace(false, global.get_current_time());
|
||||
workspaceManager.append_new_workspace(false, global.get_current_time());
|
||||
emptyWorkspaces.push(false);
|
||||
}
|
||||
|
||||
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
|
||||
emptyWorkspaces[activeWorkspaceIndex] = false;
|
||||
|
||||
// Delete other empty workspaces; do it from the end to avoid index changes
|
||||
for (i = emptyWorkspaces.length - 2; i >= 0; i--) {
|
||||
if (emptyWorkspaces[i])
|
||||
global.screen.remove_workspace(this._workspaces[i], global.get_current_time());
|
||||
workspaceManager.remove_workspace(this._workspaces[i], global.get_current_time());
|
||||
}
|
||||
|
||||
this._checkWorkspacesId = 0;
|
||||
@ -317,14 +324,14 @@ var WorkspaceTracker = new Lang.Class({
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this._queueCheckWorkspaces');
|
||||
},
|
||||
|
||||
_windowLeftMonitor(metaScreen, monitorIndex, metaWin) {
|
||||
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
|
||||
// If the window left the primary monitor, that
|
||||
// might make that workspace empty
|
||||
if (monitorIndex == Main.layoutManager.primaryIndex)
|
||||
this._queueCheckWorkspaces();
|
||||
},
|
||||
|
||||
_windowEnteredMonitor(metaScreen, monitorIndex, metaWin) {
|
||||
_windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) {
|
||||
// If the window entered the primary monitor, that
|
||||
// might make that workspace non-empty
|
||||
if (monitorIndex == Main.layoutManager.primaryIndex)
|
||||
@ -344,8 +351,9 @@ var WorkspaceTracker = new Lang.Class({
|
||||
},
|
||||
|
||||
_nWorkspacesChanged() {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let oldNumWorkspaces = this._workspaces.length;
|
||||
let newNumWorkspaces = global.screen.n_workspaces;
|
||||
let newNumWorkspaces = workspaceManager.n_workspaces;
|
||||
|
||||
if (oldNumWorkspaces == newNumWorkspaces)
|
||||
return false;
|
||||
@ -356,7 +364,7 @@ var WorkspaceTracker = new Lang.Class({
|
||||
|
||||
// Assume workspaces are only added at the end
|
||||
for (w = oldNumWorkspaces; w < newNumWorkspaces; w++)
|
||||
this._workspaces[w] = global.screen.get_workspace_by_index(w);
|
||||
this._workspaces[w] = workspaceManager.get_workspace_by_index(w);
|
||||
|
||||
for (w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
|
||||
let workspace = this._workspaces[w];
|
||||
@ -370,7 +378,7 @@ var WorkspaceTracker = new Lang.Class({
|
||||
let removedIndex;
|
||||
let removedNum = oldNumWorkspaces - newNumWorkspaces;
|
||||
for (let w = 0; w < oldNumWorkspaces; w++) {
|
||||
let workspace = global.screen.get_workspace_by_index(w);
|
||||
let workspace = workspaceManager.get_workspace_by_index(w);
|
||||
if (this._workspaces[w] != workspace) {
|
||||
removedIndex = w;
|
||||
break;
|
||||
@ -714,7 +722,7 @@ var WindowManager = new Lang.Class({
|
||||
this._shellwm.connect('confirm-display-change', this._confirmDisplayChange.bind(this));
|
||||
this._shellwm.connect('create-close-dialog', this._createCloseDialog.bind(this));
|
||||
this._shellwm.connect('create-inhibit-shortcuts-dialog', this._createInhibitShortcutsDialog.bind(this));
|
||||
global.screen.connect('restacked', this._syncStacking.bind(this));
|
||||
global.display.connect('restacked', this._syncStacking.bind(this));
|
||||
|
||||
this._workspaceSwitcherPopup = null;
|
||||
this._tilePreview = null;
|
||||
@ -970,7 +978,7 @@ var WindowManager = new Lang.Class({
|
||||
if (Main.sessionMode.hasWorkspaces)
|
||||
this._workspaceTracker = new WorkspaceTracker(this);
|
||||
|
||||
global.screen.override_workspace_layout(Meta.ScreenCorner.TOPLEFT,
|
||||
global.workspace_manager.override_workspace_layout(Meta.DisplayCorner.TOPLEFT,
|
||||
false, -1, 1);
|
||||
|
||||
let gesture = new WorkspaceSwitchAction();
|
||||
@ -1001,7 +1009,9 @@ var WindowManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_actionSwitchWorkspace(action, direction) {
|
||||
let newWs = global.screen.get_active_workspace().get_neighbor(direction);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
let newWs = activeWorkspace.get_neighbor(direction);
|
||||
this.actionMoveWorkspace(newWs);
|
||||
},
|
||||
|
||||
@ -1017,8 +1027,10 @@ var WindowManager = new Lang.Class({
|
||||
_switchApp() {
|
||||
let windows = global.get_window_actors().filter(actor => {
|
||||
let win = actor.metaWindow;
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
return (!win.is_override_redirect() &&
|
||||
win.located_on_workspace(global.screen.get_active_workspace()));
|
||||
win.located_on_workspace(activeWorkspace));
|
||||
});
|
||||
|
||||
if (windows.length == 0)
|
||||
@ -1042,10 +1054,12 @@ var WindowManager = new Lang.Class({
|
||||
},
|
||||
|
||||
insertWorkspace(pos) {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
|
||||
if (!Meta.prefs_get_dynamic_workspaces())
|
||||
return;
|
||||
|
||||
global.screen.append_new_workspace(false, global.get_current_time());
|
||||
workspaceManager.append_new_workspace(false, global.get_current_time());
|
||||
|
||||
let windows = global.get_window_actors().map(a => a.meta_window);
|
||||
|
||||
@ -1069,9 +1083,9 @@ var WindowManager = new Lang.Class({
|
||||
|
||||
// If the new workspace was inserted before the active workspace,
|
||||
// activate the workspace to which its windows went
|
||||
let activeIndex = global.screen.get_active_workspace_index();
|
||||
let activeIndex = workspaceManager.get_active_workspace_index();
|
||||
if (activeIndex >= pos) {
|
||||
let newWs = global.screen.get_workspace_by_index(activeIndex + 1);
|
||||
let newWs = workspaceManager.get_workspace_by_index(activeIndex + 1);
|
||||
this._blockAnimations = true;
|
||||
newWs.activate(global.get_current_time());
|
||||
this._blockAnimations = false;
|
||||
@ -1829,7 +1843,7 @@ var WindowManager = new Lang.Class({
|
||||
this._windowMenuManager.showWindowMenuForWindow(window, menu, rect);
|
||||
},
|
||||
|
||||
_startSwitcher(display, screen, window, binding) {
|
||||
_startSwitcher(display, window, binding) {
|
||||
let constructor = null;
|
||||
switch (binding.get_name()) {
|
||||
case 'switch-applications':
|
||||
@ -1868,15 +1882,15 @@ var WindowManager = new Lang.Class({
|
||||
tabPopup.destroy();
|
||||
},
|
||||
|
||||
_startA11ySwitcher(display, screen, window, binding) {
|
||||
_startA11ySwitcher(display, window, binding) {
|
||||
Main.ctrlAltTabManager.popup(binding.is_reversed(), binding.get_name(), binding.get_mask());
|
||||
},
|
||||
|
||||
_toggleAppMenu(display, screen, window, event, binding) {
|
||||
_toggleAppMenu(display, window, event, binding) {
|
||||
Main.panel.toggleAppMenu();
|
||||
},
|
||||
|
||||
_toggleCalendar(display, screen, window, event, binding) {
|
||||
_toggleCalendar(display, window, event, binding) {
|
||||
Main.panel.toggleCalendar();
|
||||
},
|
||||
|
||||
@ -1889,11 +1903,13 @@ var WindowManager = new Lang.Class({
|
||||
OrigTweener.resumeAllTweens();
|
||||
},
|
||||
|
||||
_showWorkspaceSwitcher(display, screen, window, binding) {
|
||||
_showWorkspaceSwitcher(display, window, binding) {
|
||||
let workspaceManager = display.get_workspace_manager();
|
||||
|
||||
if (!Main.sessionMode.hasWorkspaces)
|
||||
return;
|
||||
|
||||
if (screen.n_workspaces == 1)
|
||||
if (workspaceManager.n_workspaces == 1)
|
||||
return;
|
||||
|
||||
let [action,,,target] = binding.get_name().split('-');
|
||||
@ -1912,22 +1928,22 @@ var WindowManager = new Lang.Class({
|
||||
|
||||
if (target == 'last') {
|
||||
direction = Meta.MotionDirection.DOWN;
|
||||
newWs = screen.get_workspace_by_index(screen.n_workspaces - 1);
|
||||
newWs = workspaceManager.get_workspace_by_index(workspaceManager.n_workspaces - 1);
|
||||
} else if (isNaN(target)) {
|
||||
// Prepend a new workspace dynamically
|
||||
if (screen.get_active_workspace_index() == 0 &&
|
||||
if (workspaceManager.get_active_workspace_index() == 0 &&
|
||||
action == 'move' && target == 'up' && this._isWorkspacePrepended == false) {
|
||||
this.insertWorkspace(0);
|
||||
this._isWorkspacePrepended = true;
|
||||
}
|
||||
|
||||
direction = Meta.MotionDirection[target.toUpperCase()];
|
||||
newWs = screen.get_active_workspace().get_neighbor(direction);
|
||||
newWs = workspaceManager.get_active_workspace().get_neighbor(direction);
|
||||
} else if (target > 0) {
|
||||
target--;
|
||||
newWs = screen.get_workspace_by_index(target);
|
||||
newWs = workspaceManager.get_workspace_by_index(target);
|
||||
|
||||
if (screen.get_active_workspace().index() > target)
|
||||
if (workspaceManager.get_active_workspace().index() > target)
|
||||
direction = Meta.MotionDirection.UP;
|
||||
else
|
||||
direction = Meta.MotionDirection.DOWN;
|
||||
@ -1960,7 +1976,8 @@ var WindowManager = new Lang.Class({
|
||||
if (!Main.sessionMode.hasWorkspaces)
|
||||
return;
|
||||
|
||||
let activeWorkspace = global.screen.get_active_workspace();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
|
||||
if (activeWorkspace != workspace)
|
||||
workspace.activate(global.get_current_time());
|
||||
@ -1970,7 +1987,8 @@ var WindowManager = new Lang.Class({
|
||||
if (!Main.sessionMode.hasWorkspaces)
|
||||
return;
|
||||
|
||||
let activeWorkspace = global.screen.get_active_workspace();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
|
||||
if (activeWorkspace != workspace) {
|
||||
// This won't have any effect for "always sticky" windows
|
||||
|
@ -126,15 +126,15 @@ var WindowMenu = new Lang.Class({
|
||||
}
|
||||
}
|
||||
|
||||
let screen = global.screen;
|
||||
let nMonitors = screen.get_n_monitors();
|
||||
let display = global.display;
|
||||
let nMonitors = display.get_n_monitors();
|
||||
let monitorIndex = window.get_monitor();
|
||||
if (nMonitors > 1 && monitorIndex >= 0) {
|
||||
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||
|
||||
let dir = Meta.ScreenDirection.UP;
|
||||
let upMonitorIndex =
|
||||
screen.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
display.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
if (upMonitorIndex != -1) {
|
||||
this.addAction(_("Move to Monitor Up"), () => {
|
||||
window.move_to_monitor(upMonitorIndex);
|
||||
@ -143,7 +143,7 @@ var WindowMenu = new Lang.Class({
|
||||
|
||||
dir = Meta.ScreenDirection.DOWN;
|
||||
let downMonitorIndex =
|
||||
screen.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
display.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
if (downMonitorIndex != -1) {
|
||||
this.addAction(_("Move to Monitor Down"), () => {
|
||||
window.move_to_monitor(downMonitorIndex);
|
||||
@ -152,7 +152,7 @@ var WindowMenu = new Lang.Class({
|
||||
|
||||
dir = Meta.ScreenDirection.LEFT;
|
||||
let leftMonitorIndex =
|
||||
screen.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
display.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
if (leftMonitorIndex != -1) {
|
||||
this.addAction(_("Move to Monitor Left"), () => {
|
||||
window.move_to_monitor(leftMonitorIndex);
|
||||
@ -161,7 +161,7 @@ var WindowMenu = new Lang.Class({
|
||||
|
||||
dir = Meta.ScreenDirection.RIGHT;
|
||||
let rightMonitorIndex =
|
||||
screen.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
display.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
if (rightMonitorIndex != -1) {
|
||||
this.addAction(_("Move to Monitor Right"), () => {
|
||||
window.move_to_monitor(rightMonitorIndex);
|
||||
|
@ -1156,9 +1156,9 @@ 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._windowEnteredMonitorId = global.display.connect('window-entered-monitor',
|
||||
this._windowEnteredMonitor.bind(this));
|
||||
this._windowLeftMonitorId = global.screen.connect('window-left-monitor',
|
||||
this._windowLeftMonitorId = global.display.connect('window-left-monitor',
|
||||
this._windowLeftMonitor.bind(this));
|
||||
this._repositionWindowsId = 0;
|
||||
|
||||
@ -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) {
|
||||
|
@ -47,9 +47,12 @@ var WorkspaceSwitcherPopup = new Lang.Class({
|
||||
|
||||
this.actor.hide();
|
||||
|
||||
this._globalSignals = [];
|
||||
this._globalSignals.push(global.screen.connect('workspace-added', this._redisplay.bind(this)));
|
||||
this._globalSignals.push(global.screen.connect('workspace-removed', this._redisplay.bind(this)));
|
||||
let workspaceManager = global.workspace_manager;
|
||||
this._workspaceManagerSignals = [];
|
||||
this._workspaceManagerSignals.push(workspaceManager.connect('workspace-added',
|
||||
this._redisplay.bind(this)));
|
||||
this._workspaceManagerSignals.push(workspaceManager.connect('workspace-removed',
|
||||
this._redisplay.bind(this)));
|
||||
},
|
||||
|
||||
_getPreferredHeight(actor, forWidth, alloc) {
|
||||
@ -68,11 +71,12 @@ var WorkspaceSwitcherPopup = new Lang.Class({
|
||||
height += childNaturalHeight * workArea.width / workArea.height;
|
||||
}
|
||||
|
||||
let spacing = this._itemSpacing * (global.screen.n_workspaces - 1);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let spacing = this._itemSpacing * (workspaceManager.n_workspaces - 1);
|
||||
height += spacing;
|
||||
height = Math.min(height, availHeight);
|
||||
|
||||
this._childHeight = (height - spacing) / global.screen.n_workspaces;
|
||||
this._childHeight = (height - spacing) / workspaceManager.n_workspaces;
|
||||
|
||||
alloc.min_size = height;
|
||||
alloc.natural_size = height;
|
||||
@ -104,9 +108,11 @@ var WorkspaceSwitcherPopup = new Lang.Class({
|
||||
},
|
||||
|
||||
_redisplay() {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
|
||||
this._list.destroy_all_children();
|
||||
|
||||
for (let i = 0; i < global.screen.n_workspaces; i++) {
|
||||
for (let i = 0; i < workspaceManager.n_workspaces; i++) {
|
||||
let indicator = null;
|
||||
|
||||
if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.UP)
|
||||
@ -164,8 +170,9 @@ var WorkspaceSwitcherPopup = new Lang.Class({
|
||||
Mainloop.source_remove(this._timeoutId);
|
||||
this._timeoutId = 0;
|
||||
|
||||
for (let i = 0; i < this._globalSignals.length; i++)
|
||||
global.screen.disconnect(this._globalSignals[i]);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
for (let i = 0; i < this._workspaceManagerSignals.length; i++)
|
||||
workspaceManager.disconnect(this._workspaceManagerSignals[i]);
|
||||
|
||||
this.actor.destroy();
|
||||
|
||||
|
@ -304,9 +304,9 @@ var WorkspaceThumbnail = new Lang.Class({
|
||||
this._windowAdded.bind(this));
|
||||
this._windowRemovedId = this.metaWorkspace.connect('window-removed',
|
||||
this._windowRemoved.bind(this));
|
||||
this._windowEnteredMonitorId = global.screen.connect('window-entered-monitor',
|
||||
this._windowEnteredMonitorId = global.display.connect('window-entered-monitor',
|
||||
this._windowEnteredMonitor.bind(this));
|
||||
this._windowLeftMonitorId = global.screen.connect('window-left-monitor',
|
||||
this._windowLeftMonitorId = global.display.connect('window-left-monitor',
|
||||
this._windowLeftMonitor.bind(this));
|
||||
|
||||
this.state = ThumbnailState.NORMAL;
|
||||
@ -455,13 +455,13 @@ var WorkspaceThumbnail = 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);
|
||||
}
|
||||
@ -487,8 +487,8 @@ var WorkspaceThumbnail = 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);
|
||||
|
||||
for (let i = 0; i < this._allWindows.length; i++)
|
||||
this._allWindows[i].disconnect(this._minimizedChangedIds[i]);
|
||||
@ -552,7 +552,9 @@ var WorkspaceThumbnail = new Lang.Class({
|
||||
return;
|
||||
|
||||
// a click on the already current workspace should go back to the main view
|
||||
if (this.metaWorkspace == global.screen.get_active_workspace())
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
if (this.metaWorkspace == activeWorkspace)
|
||||
Main.overview.hide();
|
||||
else
|
||||
this.metaWorkspace.activate(time);
|
||||
@ -682,9 +684,11 @@ var ThumbnailsBox = new Lang.Class({
|
||||
},
|
||||
|
||||
_updateSwitcherVisibility() {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
|
||||
this.actor.visible =
|
||||
this._settings.get_boolean('dynamic-workspaces') ||
|
||||
global.screen.n_workspaces > 1;
|
||||
workspaceManager.n_workspaces > 1;
|
||||
},
|
||||
|
||||
_activateThumbnailAtPoint(stageX, stageY, time) {
|
||||
@ -842,7 +846,8 @@ var ThumbnailsBox = new Lang.Class({
|
||||
// to open its first window within some time, as tracked by Shell.WindowTracker.
|
||||
// Here, we only add a very brief timeout to avoid the _immediate_ removal of the
|
||||
// workspace while we wait for the startup sequence to load.
|
||||
Main.wm.keepWorkspaceAlive(global.screen.get_workspace_by_index(newWorkspaceIndex),
|
||||
let workspaceManager = global.workspace_manager;
|
||||
Main.wm.keepWorkspaceAlive(workspaceManager.get_workspace_by_index(newWorkspaceIndex),
|
||||
WORKSPACE_KEEP_ALIVE_TIME);
|
||||
}
|
||||
|
||||
@ -861,18 +866,21 @@ var ThumbnailsBox = new Lang.Class({
|
||||
},
|
||||
|
||||
_createThumbnails() {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
|
||||
this._switchWorkspaceNotifyId =
|
||||
global.window_manager.connect('switch-workspace',
|
||||
this._activeWorkspaceChanged.bind(this));
|
||||
this._nWorkspacesNotifyId =
|
||||
global.screen.connect('notify::n-workspaces',
|
||||
workspaceManager.connect('notify::n-workspaces',
|
||||
this._workspacesChanged.bind(this));
|
||||
this._syncStackingId =
|
||||
Main.overview.connect('windows-restacked',
|
||||
this._syncStacking.bind(this));
|
||||
|
||||
this._workareasChangedId =
|
||||
global.screen.connect('workareas-changed', this._rebuildThumbnails.bind(this));
|
||||
global.display.connect('workareas-changed',
|
||||
this._rebuildThumbnails.bind(this));
|
||||
|
||||
this._targetScale = 0;
|
||||
this._scale = 0;
|
||||
@ -883,7 +891,7 @@ var ThumbnailsBox = new Lang.Class({
|
||||
for (let key in ThumbnailState)
|
||||
this._stateCounts[ThumbnailState[key]] = 0;
|
||||
|
||||
this.addThumbnails(0, global.screen.n_workspaces);
|
||||
this.addThumbnails(0, workspaceManager.n_workspaces);
|
||||
|
||||
this._updateSwitcherVisibility();
|
||||
},
|
||||
@ -897,7 +905,8 @@ var ThumbnailsBox = new Lang.Class({
|
||||
this._switchWorkspaceNotifyId = 0;
|
||||
}
|
||||
if (this._nWorkspacesNotifyId > 0) {
|
||||
global.screen.disconnect(this._nWorkspacesNotifyId);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
workspaceManager.disconnect(this._nWorkspacesNotifyId);
|
||||
this._nWorkspacesNotifyId = 0;
|
||||
}
|
||||
|
||||
@ -907,7 +916,7 @@ var ThumbnailsBox = new Lang.Class({
|
||||
}
|
||||
|
||||
if (this._workareasChangedId > 0) {
|
||||
global.screen.disconnect(this._workareasChangedId);
|
||||
global.display.disconnect(this._workareasChangedId);
|
||||
this._workareasChangedId = 0;
|
||||
}
|
||||
|
||||
@ -927,9 +936,10 @@ var ThumbnailsBox = new Lang.Class({
|
||||
_workspacesChanged() {
|
||||
let validThumbnails =
|
||||
this._thumbnails.filter(t => t.state <= ThumbnailState.NORMAL);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let oldNumWorkspaces = validThumbnails.length;
|
||||
let newNumWorkspaces = global.screen.n_workspaces;
|
||||
let active = global.screen.get_active_workspace_index();
|
||||
let newNumWorkspaces = workspaceManager.n_workspaces;
|
||||
let active = workspaceManager.get_active_workspace_index();
|
||||
|
||||
if (newNumWorkspaces > oldNumWorkspaces) {
|
||||
this.addThumbnails(oldNumWorkspaces, newNumWorkspaces - oldNumWorkspaces);
|
||||
@ -937,7 +947,7 @@ var ThumbnailsBox = new Lang.Class({
|
||||
let removedIndex;
|
||||
let removedNum = oldNumWorkspaces - newNumWorkspaces;
|
||||
for (let w = 0; w < oldNumWorkspaces; w++) {
|
||||
let metaWorkspace = global.screen.get_workspace_by_index(w);
|
||||
let metaWorkspace = workspaceManager.get_workspace_by_index(w);
|
||||
if (this._thumbnails[w].metaWorkspace != metaWorkspace) {
|
||||
removedIndex = w;
|
||||
break;
|
||||
@ -951,10 +961,12 @@ var ThumbnailsBox = new Lang.Class({
|
||||
},
|
||||
|
||||
addThumbnails(start, count) {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
|
||||
if (!this._ensurePorthole())
|
||||
return;
|
||||
for (let k = start; k < start + count; k++) {
|
||||
let metaWorkspace = global.screen.get_workspace_by_index(k);
|
||||
let metaWorkspace = workspaceManager.get_workspace_by_index(k);
|
||||
let thumbnail = new WorkspaceThumbnail(metaWorkspace);
|
||||
thumbnail.setPorthole(this._porthole.x, this._porthole.y,
|
||||
this._porthole.width, this._porthole.height);
|
||||
@ -1140,10 +1152,11 @@ var ThumbnailsBox = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let themeNode = this.actor.get_theme_node();
|
||||
|
||||
let spacing = themeNode.get_length('spacing');
|
||||
let nWorkspaces = global.screen.n_workspaces;
|
||||
let nWorkspaces = workspaceManager.n_workspaces;
|
||||
let totalSpacing = (nWorkspaces - 1) * spacing;
|
||||
|
||||
alloc.min_size = totalSpacing;
|
||||
@ -1157,10 +1170,11 @@ var ThumbnailsBox = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let themeNode = this.actor.get_theme_node();
|
||||
|
||||
let spacing = this.actor.get_theme_node().get_length('spacing');
|
||||
let nWorkspaces = global.screen.n_workspaces;
|
||||
let nWorkspaces = workspaceManager.n_workspaces;
|
||||
let totalSpacing = (nWorkspaces - 1) * spacing;
|
||||
|
||||
let avail = forHeight - totalSpacing;
|
||||
@ -1191,6 +1205,7 @@ var ThumbnailsBox = new Lang.Class({
|
||||
if (this._thumbnails.length == 0) // not visible
|
||||
return;
|
||||
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let themeNode = this.actor.get_theme_node();
|
||||
|
||||
let portholeWidth = this._porthole.width;
|
||||
@ -1198,7 +1213,7 @@ var ThumbnailsBox = new Lang.Class({
|
||||
let spacing = themeNode.get_length('spacing');
|
||||
|
||||
// Compute the scale we'll need once everything is updated
|
||||
let nWorkspaces = global.screen.n_workspaces;
|
||||
let nWorkspaces = workspaceManager.n_workspaces;
|
||||
let totalSpacing = (nWorkspaces - 1) * spacing;
|
||||
let avail = (box.y2 - box.y1) - totalSpacing;
|
||||
|
||||
@ -1232,7 +1247,8 @@ var ThumbnailsBox = new Lang.Class({
|
||||
let indicatorY1 = this._indicatorY;
|
||||
let indicatorY2;
|
||||
// when not animating, the workspace position overrides this._indicatorY
|
||||
let indicatorWorkspace = !this._animatingIndicator ? global.screen.get_active_workspace() : null;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
let indicatorWorkspace = !this._animatingIndicator ? activeWorkspace : null;
|
||||
let indicatorThemeNode = this._indicator.get_theme_node();
|
||||
|
||||
let indicatorTopFullBorder = indicatorThemeNode.get_padding(St.Side.TOP) + indicatorThemeNode.get_border_width(St.Side.TOP);
|
||||
@ -1323,7 +1339,8 @@ var ThumbnailsBox = new Lang.Class({
|
||||
|
||||
_activeWorkspaceChanged(wm, from, to, direction) {
|
||||
let thumbnail;
|
||||
let activeWorkspace = global.screen.get_active_workspace();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspace = workspaceManager.get_active_workspace();
|
||||
for (let i = 0; i < this._thumbnails.length; i++) {
|
||||
if (this._thumbnails[i].metaWorkspace == activeWorkspace) {
|
||||
thumbnail = this._thumbnails[i];
|
||||
|
@ -91,25 +91,29 @@ var WorkspacesView = new Lang.Class({
|
||||
Extends: WorkspacesViewBase,
|
||||
|
||||
_init(monitorIndex) {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
|
||||
this.parent(monitorIndex);
|
||||
|
||||
this._animating = false; // tweening
|
||||
this._scrolling = false; // swipe-scrolling
|
||||
this._animatingScroll = false; // programatically updating the adjustment
|
||||
|
||||
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
|
||||
this.scrollAdjustment = new St.Adjustment({ value: activeWorkspaceIndex,
|
||||
lower: 0,
|
||||
page_increment: 1,
|
||||
page_size: 1,
|
||||
step_increment: 0,
|
||||
upper: global.screen.n_workspaces });
|
||||
upper: workspaceManager.n_workspaces });
|
||||
this.scrollAdjustment.connect('notify::value',
|
||||
this._onScroll.bind(this));
|
||||
|
||||
this._workspaces = [];
|
||||
this._updateWorkspaces();
|
||||
this._updateWorkspacesId = global.screen.connect('notify::n-workspaces', this._updateWorkspaces.bind(this));
|
||||
this._updateWorkspacesId =
|
||||
workspaceManager.connect('notify::n-workspaces',
|
||||
this._updateWorkspaces.bind(this));
|
||||
|
||||
this._overviewShownId =
|
||||
Main.overview.connect('shown', () => {
|
||||
@ -138,7 +142,8 @@ var WorkspacesView = new Lang.Class({
|
||||
},
|
||||
|
||||
getActiveWorkspace() {
|
||||
let active = global.screen.get_active_workspace_index();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let active = workspaceManager.get_active_workspace_index();
|
||||
return this._workspaces[active];
|
||||
},
|
||||
|
||||
@ -169,7 +174,8 @@ var WorkspacesView = new Lang.Class({
|
||||
},
|
||||
|
||||
_scrollToActive() {
|
||||
let active = global.screen.get_active_workspace_index();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let active = workspaceManager.get_active_workspace_index();
|
||||
|
||||
this._updateWorkspaceActors(true);
|
||||
this._updateScrollAdjustment(active);
|
||||
@ -178,7 +184,8 @@ var WorkspacesView = new Lang.Class({
|
||||
// Update workspace actors parameters
|
||||
// @showAnimation: iff %true, transition between states
|
||||
_updateWorkspaceActors(showAnimation) {
|
||||
let active = global.screen.get_active_workspace_index();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let active = workspaceManager.get_active_workspace_index();
|
||||
|
||||
this._animating = showAnimation;
|
||||
|
||||
@ -214,7 +221,8 @@ var WorkspacesView = new Lang.Class({
|
||||
},
|
||||
|
||||
_updateVisibility() {
|
||||
let active = global.screen.get_active_workspace_index();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let active = workspaceManager.get_active_workspace_index();
|
||||
|
||||
for (let w = 0; w < this._workspaces.length; w++) {
|
||||
let workspace = this._workspaces[w];
|
||||
@ -246,13 +254,14 @@ var WorkspacesView = new Lang.Class({
|
||||
},
|
||||
|
||||
_updateWorkspaces() {
|
||||
let newNumWorkspaces = global.screen.n_workspaces;
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let newNumWorkspaces = workspaceManager.n_workspaces;
|
||||
|
||||
this.scrollAdjustment.upper = newNumWorkspaces;
|
||||
|
||||
let needsUpdate = false;
|
||||
for (let j = 0; j < newNumWorkspaces; j++) {
|
||||
let metaWorkspace = global.screen.get_workspace_by_index(j);
|
||||
let metaWorkspace = workspaceManager.get_workspace_by_index(j);
|
||||
let workspace;
|
||||
|
||||
if (j >= this._workspaces.length) { /* added */
|
||||
@ -290,7 +299,8 @@ var WorkspacesView = new Lang.Class({
|
||||
this.scrollAdjustment.run_dispose();
|
||||
Main.overview.disconnect(this._overviewShownId);
|
||||
global.window_manager.disconnect(this._switchWorkspaceNotifyId);
|
||||
global.screen.disconnect(this._updateWorkspacesId);
|
||||
let workspaceManager = global.workspace_manager;
|
||||
workspaceManager.disconnect(this._updateWorkspacesId);
|
||||
},
|
||||
|
||||
startSwipeScroll() {
|
||||
@ -311,7 +321,8 @@ var WorkspacesView = new Lang.Class({
|
||||
if (this._animatingScroll)
|
||||
return;
|
||||
|
||||
let active = global.screen.get_active_workspace_index();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let active = workspaceManager.get_active_workspace_index();
|
||||
let current = Math.round(adj.value);
|
||||
|
||||
if (active != current) {
|
||||
@ -593,7 +604,7 @@ var WorkspacesDisplay = new Lang.Class({
|
||||
_getMonitorIndexForEvent(event) {
|
||||
let [x, y] = event.get_coords();
|
||||
let rect = new Meta.Rectangle({ x: x, y: y, width: 1, height: 1 });
|
||||
return global.screen.get_monitor_index_for_rect(rect);
|
||||
return global.display.get_monitor_index_for_rect(rect);
|
||||
},
|
||||
|
||||
_getPrimaryView() {
|
||||
@ -679,7 +690,8 @@ var WorkspacesDisplay = new Lang.Class({
|
||||
this._getMonitorIndexForEvent(event) != this._primaryIndex)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
let activeWs = global.screen.get_active_workspace();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWs = workspaceManager.get_active_workspace();
|
||||
let ws;
|
||||
switch (event.get_scroll_direction()) {
|
||||
case Clutter.ScrollDirection.UP:
|
||||
@ -698,7 +710,8 @@ var WorkspacesDisplay = new Lang.Class({
|
||||
_onKeyPressEvent(actor, event) {
|
||||
if (!this.actor.mapped)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
let activeWs = global.screen.get_active_workspace();
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWs = workspaceManager.get_active_workspace();
|
||||
let ws;
|
||||
switch (event.get_key_symbol()) {
|
||||
case Clutter.KEY_Page_Up:
|
||||
|
@ -6,7 +6,7 @@ project('gnome-shell', 'c',
|
||||
|
||||
# We depend on a specific version of the libmutter API. The mutter variants of
|
||||
# the Cogl and Clutter libraries also use this API version.
|
||||
mutter_api_version = '2'
|
||||
mutter_api_version = '3'
|
||||
|
||||
clutter_pc = 'mutter-clutter-' + mutter_api_version
|
||||
cogl_pc = 'mutter-cogl-' + mutter_api_version
|
||||
|
@ -167,22 +167,19 @@ gnome_shell_plugin_init (GnomeShellPlugin *shell_plugin)
|
||||
static gboolean
|
||||
gnome_shell_plugin_has_swap_event (GnomeShellPlugin *shell_plugin)
|
||||
{
|
||||
MetaPlugin *plugin = META_PLUGIN (shell_plugin);
|
||||
CoglDisplay *cogl_display =
|
||||
cogl_context_get_display (shell_plugin->cogl_context);
|
||||
CoglRenderer *renderer = cogl_display_get_renderer (cogl_display);
|
||||
const char * (* query_extensions_string) (Display *dpy, int screen);
|
||||
Bool (* query_extension) (Display *dpy, int *error, int *event);
|
||||
MetaScreen *screen;
|
||||
Display *xdisplay;
|
||||
int screen_number;
|
||||
const char *glx_extensions;
|
||||
|
||||
/* We will only get swap events if Cogl is using GLX */
|
||||
if (cogl_renderer_get_winsys_id (renderer) != COGL_WINSYS_ID_GLX)
|
||||
return FALSE;
|
||||
|
||||
screen = meta_plugin_get_screen (plugin);
|
||||
|
||||
xdisplay = clutter_x11_get_default_display ();
|
||||
|
||||
query_extensions_string =
|
||||
@ -194,9 +191,8 @@ gnome_shell_plugin_has_swap_event (GnomeShellPlugin *shell_plugin)
|
||||
&shell_plugin->glx_error_base,
|
||||
&shell_plugin->glx_event_base);
|
||||
|
||||
glx_extensions =
|
||||
query_extensions_string (xdisplay,
|
||||
meta_screen_get_screen_number (screen));
|
||||
screen_number = XDefaultScreen (xdisplay);
|
||||
glx_extensions = query_extensions_string (xdisplay, screen_number);
|
||||
|
||||
return strstr (glx_extensions, "GLX_INTEL_swap_event") != NULL;
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <meta/display.h>
|
||||
#include <meta/meta-workspace-manager.h>
|
||||
#include <meta/meta-x11-display.h>
|
||||
|
||||
#include "shell-app-private.h"
|
||||
#include "shell-enum-types.h"
|
||||
@ -358,6 +360,17 @@ find_most_recent_transient_on_same_workspace (MetaDisplay *display,
|
||||
return result;
|
||||
}
|
||||
|
||||
static MetaWorkspace *
|
||||
get_active_workspace (void)
|
||||
{
|
||||
ShellGlobal *global = shell_global_get ();
|
||||
MetaDisplay *display = shell_global_get_display (global);
|
||||
MetaWorkspaceManager *workspace_manager =
|
||||
meta_display_get_workspace_manager (display);
|
||||
|
||||
return meta_workspace_manager_get_active_workspace (workspace_manager);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_app_activate_window:
|
||||
* @app: a #ShellApp
|
||||
@ -391,9 +404,8 @@ shell_app_activate_window (ShellApp *app,
|
||||
{
|
||||
GSList *windows_reversed, *iter;
|
||||
ShellGlobal *global = shell_global_get ();
|
||||
MetaScreen *screen = shell_global_get_screen (global);
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaWorkspace *active = meta_screen_get_active_workspace (screen);
|
||||
MetaDisplay *display = shell_global_get_display (global);
|
||||
MetaWorkspace *active = get_active_workspace ();
|
||||
MetaWorkspace *workspace = meta_window_get_workspace (window);
|
||||
guint32 last_user_timestamp = meta_display_get_last_user_time (display);
|
||||
MetaWindow *most_recent_transient;
|
||||
@ -686,7 +698,7 @@ shell_app_get_windows (ShellApp *app)
|
||||
{
|
||||
CompareWindowsData data;
|
||||
data.app = app;
|
||||
data.active_workspace = meta_screen_get_active_workspace (shell_global_get_screen (shell_global_get ()));
|
||||
data.active_workspace = get_active_workspace ();
|
||||
app->running_state->windows = g_slist_sort_with_data (app->running_state->windows, shell_app_compare_windows, &data);
|
||||
app->running_state->window_sort_stale = FALSE;
|
||||
}
|
||||
@ -922,7 +934,7 @@ shell_app_on_skip_taskbar_changed (MetaWindow *window,
|
||||
}
|
||||
|
||||
static void
|
||||
shell_app_on_ws_switch (MetaScreen *screen,
|
||||
shell_app_on_ws_switch (MetaWorkspaceManager *workspace_manager,
|
||||
int from,
|
||||
int to,
|
||||
MetaMotionDirection direction,
|
||||
@ -1115,11 +1127,11 @@ _shell_app_handle_startup_sequence (ShellApp *app,
|
||||
*/
|
||||
if (starting && shell_app_get_state (app) == SHELL_APP_STATE_STOPPED)
|
||||
{
|
||||
MetaScreen *screen = shell_global_get_screen (shell_global_get ());
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
||||
MetaX11Display *x11_display = meta_display_get_x11_display (display);
|
||||
|
||||
shell_app_state_transition (app, SHELL_APP_STATE_STARTING);
|
||||
meta_display_focus_the_no_focus_window (display, screen,
|
||||
meta_x11_display_focus_the_no_focus_window (x11_display,
|
||||
sn_startup_sequence_get_timestamp (sequence));
|
||||
app->started_on_workspace = sn_startup_sequence_get_workspace (sequence);
|
||||
}
|
||||
@ -1290,15 +1302,17 @@ shell_app_get_app_info (ShellApp *app)
|
||||
static void
|
||||
create_running_state (ShellApp *app)
|
||||
{
|
||||
MetaScreen *screen;
|
||||
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
||||
MetaWorkspaceManager *workspace_manager =
|
||||
meta_display_get_workspace_manager (display);
|
||||
|
||||
g_assert (app->running_state == NULL);
|
||||
|
||||
screen = shell_global_get_screen (shell_global_get ());
|
||||
app->running_state = g_slice_new0 (ShellAppRunningState);
|
||||
app->running_state->refcount = 1;
|
||||
app->running_state->workspace_switch_id =
|
||||
g_signal_connect (screen, "workspace-switched", G_CALLBACK(shell_app_on_ws_switch), app);
|
||||
g_signal_connect (workspace_manager, "workspace-switched",
|
||||
G_CALLBACK (shell_app_on_ws_switch), app);
|
||||
|
||||
app->running_state->session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
|
||||
g_assert (app->running_state->session != NULL);
|
||||
@ -1349,7 +1363,9 @@ shell_app_update_app_menu (ShellApp *app,
|
||||
static void
|
||||
unref_running_state (ShellAppRunningState *state)
|
||||
{
|
||||
MetaScreen *screen;
|
||||
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
||||
MetaWorkspaceManager *workspace_manager =
|
||||
meta_display_get_workspace_manager (display);
|
||||
|
||||
g_assert (state->refcount > 0);
|
||||
|
||||
@ -1357,8 +1373,7 @@ unref_running_state (ShellAppRunningState *state)
|
||||
if (state->refcount > 0)
|
||||
return;
|
||||
|
||||
screen = shell_global_get_screen (shell_global_get ());
|
||||
g_signal_handler_disconnect (screen, state->workspace_switch_id);
|
||||
g_signal_handler_disconnect (workspace_manager, state->workspace_switch_id);
|
||||
|
||||
g_clear_object (&state->application_proxy);
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include <meta/meta-shaped-texture.h>
|
||||
#include <meta/meta-cursor-tracker.h>
|
||||
#include <meta/meta-settings.h>
|
||||
#include <meta/meta-workspace-manager.h>
|
||||
#include <meta/meta-x11-display.h>
|
||||
|
||||
#ifdef HAVE_SYSTEMD
|
||||
#include <systemd/sd-journal.h>
|
||||
@ -60,9 +62,10 @@ struct _ShellGlobal {
|
||||
Window stage_xwindow;
|
||||
|
||||
MetaDisplay *meta_display;
|
||||
MetaWorkspaceManager *workspace_manager;
|
||||
GdkDisplay *gdk_display;
|
||||
MetaX11Display *x11_display;
|
||||
Display *xdisplay;
|
||||
MetaScreen *meta_screen;
|
||||
|
||||
char *session_mode;
|
||||
|
||||
@ -96,8 +99,8 @@ enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_SESSION_MODE,
|
||||
PROP_SCREEN,
|
||||
PROP_DISPLAY,
|
||||
PROP_WORKSPACE_MANAGER,
|
||||
PROP_SCREEN_WIDTH,
|
||||
PROP_SCREEN_HEIGHT,
|
||||
PROP_STAGE,
|
||||
@ -163,17 +166,17 @@ shell_global_get_property(GObject *object,
|
||||
case PROP_SESSION_MODE:
|
||||
g_value_set_string (value, shell_global_get_session_mode (global));
|
||||
break;
|
||||
case PROP_SCREEN:
|
||||
g_value_set_object (value, global->meta_screen);
|
||||
break;
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_object (value, global->meta_display);
|
||||
break;
|
||||
case PROP_WORKSPACE_MANAGER:
|
||||
g_value_set_object (value, global->workspace_manager);
|
||||
break;
|
||||
case PROP_SCREEN_WIDTH:
|
||||
{
|
||||
int width, height;
|
||||
|
||||
meta_screen_get_size (global->meta_screen, &width, &height);
|
||||
meta_display_get_size (global->meta_display, &width, &height);
|
||||
g_value_set_int (value, width);
|
||||
}
|
||||
break;
|
||||
@ -181,7 +184,7 @@ shell_global_get_property(GObject *object,
|
||||
{
|
||||
int width, height;
|
||||
|
||||
meta_screen_get_size (global->meta_screen, &width, &height);
|
||||
meta_display_get_size (global->meta_display, &width, &height);
|
||||
g_value_set_int (value, height);
|
||||
}
|
||||
break;
|
||||
@ -189,10 +192,10 @@ shell_global_get_property(GObject *object,
|
||||
g_value_set_object (value, global->stage);
|
||||
break;
|
||||
case PROP_WINDOW_GROUP:
|
||||
g_value_set_object (value, meta_get_window_group_for_screen (global->meta_screen));
|
||||
g_value_set_object (value, meta_get_window_group_for_display (global->meta_display));
|
||||
break;
|
||||
case PROP_TOP_WINDOW_GROUP:
|
||||
g_value_set_object (value, meta_get_top_window_group_for_screen (global->meta_screen));
|
||||
g_value_set_object (value, meta_get_top_window_group_for_display (global->meta_display));
|
||||
break;
|
||||
case PROP_WINDOW_MANAGER:
|
||||
g_value_set_object (value, global->wm);
|
||||
@ -370,13 +373,6 @@ shell_global_class_init (ShellGlobalClass *klass)
|
||||
"The session mode to use",
|
||||
"user",
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SCREEN,
|
||||
g_param_spec_object ("screen",
|
||||
"Screen",
|
||||
"Metacity screen object for the shell",
|
||||
META_TYPE_SCREEN,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SCREEN_WIDTH,
|
||||
@ -401,6 +397,14 @@ shell_global_class_init (ShellGlobalClass *klass)
|
||||
META_TYPE_DISPLAY,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_WORKSPACE_MANAGER,
|
||||
g_param_spec_object ("workspace-manager",
|
||||
"Workspace manager",
|
||||
"Workspace manager",
|
||||
META_TYPE_WORKSPACE_MANAGER,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_STAGE,
|
||||
g_param_spec_object ("stage",
|
||||
@ -564,7 +568,7 @@ focus_window_changed (MetaDisplay *display,
|
||||
|
||||
/* If the stage window became unfocused, drop the key focus
|
||||
* on Clutter's side. */
|
||||
if (!meta_stage_is_focused (global->meta_screen))
|
||||
if (!meta_stage_is_focused (global->meta_display))
|
||||
clutter_stage_set_key_focus (global->stage, NULL);
|
||||
}
|
||||
|
||||
@ -594,13 +598,13 @@ sync_stage_window_focus (ShellGlobal *global)
|
||||
actor = get_key_focused_actor (global);
|
||||
|
||||
/* An actor got key focus and the stage needs to be focused. */
|
||||
if (actor != NULL && !meta_stage_is_focused (global->meta_screen))
|
||||
meta_focus_stage_window (global->meta_screen,
|
||||
if (actor != NULL && !meta_stage_is_focused (global->meta_display))
|
||||
meta_focus_stage_window (global->meta_display,
|
||||
get_current_time_maybe_roundtrip (global));
|
||||
|
||||
/* An actor dropped key focus. Focus the default window. */
|
||||
else if (actor == NULL && meta_stage_is_focused (global->meta_screen))
|
||||
meta_screen_focus_default_window (global->meta_screen,
|
||||
else if (actor == NULL && meta_stage_is_focused (global->meta_display))
|
||||
meta_display_focus_default_window (global->meta_display,
|
||||
get_current_time_maybe_roundtrip (global));
|
||||
}
|
||||
|
||||
@ -616,12 +620,12 @@ focus_actor_changed (ClutterStage *stage,
|
||||
static void
|
||||
sync_input_region (ShellGlobal *global)
|
||||
{
|
||||
MetaScreen *screen = global->meta_screen;
|
||||
MetaDisplay *display = global->meta_display;
|
||||
|
||||
if (global->has_modal)
|
||||
meta_set_stage_input_region (screen, None);
|
||||
meta_set_stage_input_region (display, None);
|
||||
else
|
||||
meta_set_stage_input_region (screen, global->input_region);
|
||||
meta_set_stage_input_region (display, global->input_region);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -675,17 +679,6 @@ shell_global_get_stage (ShellGlobal *global)
|
||||
return global->stage;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_screen:
|
||||
*
|
||||
* Return value: (transfer none): The default #MetaScreen
|
||||
*/
|
||||
MetaScreen *
|
||||
shell_global_get_screen (ShellGlobal *global)
|
||||
{
|
||||
return global->meta_screen;
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_global_get_display:
|
||||
*
|
||||
@ -712,7 +705,7 @@ shell_global_get_window_actors (ShellGlobal *global)
|
||||
|
||||
g_return_val_if_fail (SHELL_IS_GLOBAL (global), NULL);
|
||||
|
||||
for (l = meta_get_window_actors (global->meta_screen); l; l = l->next)
|
||||
for (l = meta_get_window_actors (global->meta_display); l; l = l->next)
|
||||
if (!meta_window_actor_is_destroyed (l->data))
|
||||
filtered = g_list_prepend (filtered, l->data);
|
||||
|
||||
@ -838,13 +831,15 @@ entry_cursor_func (StEntry *entry,
|
||||
{
|
||||
ShellGlobal *global = user_data;
|
||||
|
||||
meta_screen_set_cursor (global->meta_screen, use_ibeam ? META_CURSOR_IBEAM : META_CURSOR_DEFAULT);
|
||||
meta_display_set_cursor (global->meta_display,
|
||||
use_ibeam ? META_CURSOR_IBEAM : META_CURSOR_DEFAULT);
|
||||
}
|
||||
|
||||
void
|
||||
_shell_global_set_plugin (ShellGlobal *global,
|
||||
MetaPlugin *plugin)
|
||||
{
|
||||
MetaDisplay *display;
|
||||
MetaBackend *backend;
|
||||
MetaSettings *settings;
|
||||
|
||||
@ -854,13 +849,15 @@ _shell_global_set_plugin (ShellGlobal *global,
|
||||
global->plugin = plugin;
|
||||
global->wm = shell_wm_new (plugin);
|
||||
|
||||
global->meta_screen = meta_plugin_get_screen (plugin);
|
||||
global->meta_display = meta_screen_get_display (global->meta_screen);
|
||||
global->xdisplay = meta_display_get_xdisplay (global->meta_display);
|
||||
display = meta_plugin_get_display (plugin);
|
||||
global->meta_display = display;
|
||||
global->workspace_manager = meta_display_get_workspace_manager (display);
|
||||
global->x11_display = meta_display_get_x11_display (display);
|
||||
global->xdisplay = meta_x11_display_get_xdisplay (global->x11_display);
|
||||
|
||||
global->gdk_display = gdk_x11_lookup_xdisplay (global->xdisplay);
|
||||
|
||||
global->stage = CLUTTER_STAGE (meta_get_stage_for_screen (global->meta_screen));
|
||||
global->stage = CLUTTER_STAGE (meta_get_stage_for_display (display));
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
@ -972,12 +969,12 @@ shell_global_end_modal (ShellGlobal *global,
|
||||
|
||||
/* If the stage window is unfocused, ensure that there's no
|
||||
* actor focused on Clutter's side. */
|
||||
if (!meta_stage_is_focused (global->meta_screen))
|
||||
if (!meta_stage_is_focused (global->meta_display))
|
||||
clutter_stage_set_key_focus (global->stage, NULL);
|
||||
|
||||
/* An actor dropped key focus. Focus the default window. */
|
||||
else if (get_key_focused_actor (global) && meta_stage_is_focused (global->meta_screen))
|
||||
meta_screen_focus_default_window (global->meta_screen,
|
||||
else if (get_key_focused_actor (global) && meta_stage_is_focused (global->meta_display))
|
||||
meta_display_focus_default_window (global->meta_display,
|
||||
get_current_time_maybe_roundtrip (global));
|
||||
|
||||
sync_input_region (global);
|
||||
@ -1159,8 +1156,7 @@ shell_global_reexec_self (ShellGlobal *global)
|
||||
*/
|
||||
pre_exec_close_fds ();
|
||||
|
||||
meta_display_unmanage_screen (shell_global_get_display (global),
|
||||
shell_global_get_screen (global),
|
||||
meta_display_close (shell_global_get_display (global),
|
||||
shell_global_get_current_time (global));
|
||||
|
||||
execvp (arr->pdata[0], (char**)arr->pdata);
|
||||
@ -1246,7 +1242,7 @@ shell_global_notify_error (ShellGlobal *global,
|
||||
*/
|
||||
void shell_global_init_xdnd (ShellGlobal *global)
|
||||
{
|
||||
Window output_window = meta_get_overlay_window (global->meta_screen);
|
||||
Window output_window = meta_get_overlay_window (global->meta_display);
|
||||
long xdnd_version = 5;
|
||||
|
||||
XChangeProperty (global->xdisplay, global->stage_xwindow,
|
||||
@ -1284,7 +1280,7 @@ shell_global_get_pointer (ShellGlobal *global,
|
||||
ClutterModifierType raw_mods;
|
||||
MetaCursorTracker *tracker;
|
||||
|
||||
tracker = meta_cursor_tracker_get_for_screen (global->meta_screen);
|
||||
tracker = meta_cursor_tracker_get_for_display (global->meta_display);
|
||||
meta_cursor_tracker_get_pointer (tracker, x, y, &raw_mods);
|
||||
|
||||
*mods = raw_mods & CLUTTER_MODIFIER_MASK;
|
||||
@ -1432,7 +1428,12 @@ shell_global_create_app_launch_context (ShellGlobal *global,
|
||||
gdk_app_launch_context_set_timestamp (context, timestamp);
|
||||
|
||||
if (workspace < 0)
|
||||
workspace = meta_screen_get_active_workspace_index (global->meta_screen);
|
||||
{
|
||||
MetaWorkspaceManager *workspace_manager = global->workspace_manager;
|
||||
|
||||
workspace =
|
||||
meta_workspace_manager_get_active_workspace_index (workspace_manager);
|
||||
}
|
||||
gdk_app_launch_context_set_desktop (context, workspace);
|
||||
|
||||
return (GAppLaunchContext *)context;
|
||||
|
@ -16,7 +16,6 @@ G_DECLARE_FINAL_TYPE (ShellGlobal, shell_global, SHELL, GLOBAL, GObject)
|
||||
ShellGlobal *shell_global_get (void);
|
||||
|
||||
ClutterStage *shell_global_get_stage (ShellGlobal *global);
|
||||
MetaScreen *shell_global_get_screen (ShellGlobal *global);
|
||||
MetaDisplay *shell_global_get_display (ShellGlobal *global);
|
||||
GList *shell_global_get_window_actors (ShellGlobal *global);
|
||||
GSettings *shell_global_get_settings (ShellGlobal *global);
|
||||
|
@ -15,8 +15,8 @@
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
#include <meta/screen.h>
|
||||
#include <meta/meta-cursor-tracker.h>
|
||||
#include <meta/display.h>
|
||||
#include <meta/compositor-mutter.h>
|
||||
|
||||
#include "shell-global.h"
|
||||
@ -112,7 +112,7 @@ static void recorder_remove_redraw_timeout (ShellRecorder *recorder);
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_SCREEN,
|
||||
PROP_DISPLAY,
|
||||
PROP_STAGE,
|
||||
PROP_FRAMERATE,
|
||||
PROP_PIPELINE,
|
||||
@ -670,12 +670,12 @@ recorder_set_stage (ShellRecorder *recorder,
|
||||
}
|
||||
|
||||
static void
|
||||
recorder_set_screen (ShellRecorder *recorder,
|
||||
MetaScreen *screen)
|
||||
recorder_set_display (ShellRecorder *recorder,
|
||||
MetaDisplay *display)
|
||||
{
|
||||
MetaCursorTracker *tracker;
|
||||
|
||||
tracker = meta_cursor_tracker_get_for_screen (screen);
|
||||
tracker = meta_cursor_tracker_get_for_display (display);
|
||||
|
||||
if (tracker == recorder->cursor_tracker)
|
||||
return;
|
||||
@ -760,8 +760,8 @@ shell_recorder_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SCREEN:
|
||||
recorder_set_screen (recorder, g_value_get_object (value));
|
||||
case PROP_DISPLAY:
|
||||
recorder_set_display (recorder, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_STAGE:
|
||||
recorder_set_stage (recorder, g_value_get_object (value));
|
||||
@ -825,11 +825,11 @@ shell_recorder_class_init (ShellRecorderClass *klass)
|
||||
gobject_class->set_property = shell_recorder_set_property;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SCREEN,
|
||||
g_param_spec_object ("screen",
|
||||
"Screen",
|
||||
"Screen to record",
|
||||
META_TYPE_SCREEN,
|
||||
PROP_DISPLAY,
|
||||
g_param_spec_object ("display",
|
||||
"Display",
|
||||
"Display to record",
|
||||
META_TYPE_DISPLAY,
|
||||
G_PARAM_WRITABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
@ -1551,7 +1551,7 @@ shell_recorder_record (ShellRecorder *recorder,
|
||||
recorder_add_update_pointer_timeout (recorder);
|
||||
|
||||
/* Disable unredirection while we are recoring */
|
||||
meta_disable_unredirect_for_screen (shell_global_get_screen (shell_global_get ()));
|
||||
meta_disable_unredirect_for_display (shell_global_get_display (shell_global_get ()));
|
||||
|
||||
/* Set up repaint hook */
|
||||
recorder->repaint_hook_id = clutter_threads_add_repaint_func(recorder_repaint_hook, recorder->stage, NULL);
|
||||
@ -1602,7 +1602,7 @@ shell_recorder_close (ShellRecorder *recorder)
|
||||
recorder->state = RECORDER_STATE_CLOSED;
|
||||
|
||||
/* Reenable after the recording */
|
||||
meta_enable_unredirect_for_screen (shell_global_get_screen (shell_global_get ()));
|
||||
meta_enable_unredirect_for_display (shell_global_get_display (shell_global_get ()));
|
||||
|
||||
/* Release the refcount we took when we started recording */
|
||||
g_object_unref (recorder);
|
||||
|
@ -76,7 +76,7 @@ on_screenshot_written (GObject *source,
|
||||
g_clear_pointer (&priv->filename_used, g_free);
|
||||
g_clear_pointer (&priv->datetime, g_date_time_unref);
|
||||
|
||||
meta_enable_unredirect_for_screen (shell_global_get_screen (priv->global));
|
||||
meta_enable_unredirect_for_display (shell_global_get_display (priv->global));
|
||||
}
|
||||
|
||||
/* called in an I/O thread */
|
||||
@ -315,19 +315,19 @@ static void
|
||||
grab_screenshot (ClutterActor *stage,
|
||||
ShellScreenshot *screenshot)
|
||||
{
|
||||
MetaScreen *screen;
|
||||
MetaDisplay *display;
|
||||
MetaCursorTracker *tracker;
|
||||
int width, height;
|
||||
GTask *result;
|
||||
GSettings *settings;
|
||||
ShellScreenshotPrivate *priv = screenshot->priv;
|
||||
|
||||
screen = shell_global_get_screen (priv->global);
|
||||
meta_screen_get_size (screen, &width, &height);
|
||||
display = shell_global_get_display (priv->global);
|
||||
meta_display_get_size (display, &width, &height);
|
||||
|
||||
do_grab_screenshot (screenshot, CLUTTER_STAGE (stage), 0, 0, width, height);
|
||||
|
||||
if (meta_screen_get_n_monitors (screen) > 1)
|
||||
if (meta_display_get_n_monitors (display) > 1)
|
||||
{
|
||||
cairo_region_t *screen_region = cairo_region_create ();
|
||||
cairo_region_t *stage_region;
|
||||
@ -336,10 +336,11 @@ grab_screenshot (ClutterActor *stage,
|
||||
int i;
|
||||
cairo_t *cr;
|
||||
|
||||
for (i = meta_screen_get_n_monitors (screen) - 1; i >= 0; i--)
|
||||
for (i = meta_display_get_n_monitors (display) - 1; i >= 0; i--)
|
||||
{
|
||||
meta_screen_get_monitor_geometry (screen, i, &monitor_rect);
|
||||
cairo_region_union_rectangle (screen_region, (const cairo_rectangle_int_t *) &monitor_rect);
|
||||
meta_display_get_monitor_geometry (display, i, &monitor_rect);
|
||||
cairo_region_union_rectangle (screen_region,
|
||||
(const cairo_rectangle_int_t *) &monitor_rect);
|
||||
}
|
||||
|
||||
stage_rect.x = 0;
|
||||
@ -374,7 +375,7 @@ grab_screenshot (ClutterActor *stage,
|
||||
if (priv->include_cursor &&
|
||||
!g_settings_get_boolean (settings, MAGNIFIER_ACTIVE_KEY))
|
||||
{
|
||||
tracker = meta_cursor_tracker_get_for_screen (screen);
|
||||
tracker = meta_cursor_tracker_get_for_display (display);
|
||||
_draw_cursor_image (tracker, priv->image, priv->screenshot_area);
|
||||
}
|
||||
g_object_unref (settings);
|
||||
@ -413,9 +414,8 @@ grab_window_screenshot (ClutterActor *stage,
|
||||
ShellScreenshotPrivate *priv = screenshot->priv;
|
||||
GTask *result;
|
||||
GSettings *settings;
|
||||
MetaScreen *screen = shell_global_get_screen (priv->global);
|
||||
MetaDisplay *display = shell_global_get_display (priv->global);
|
||||
MetaCursorTracker *tracker;
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaWindow *window = meta_display_get_focus_window (display);
|
||||
ClutterActor *window_actor;
|
||||
gfloat actor_x, actor_y;
|
||||
@ -446,7 +446,7 @@ grab_window_screenshot (ClutterActor *stage,
|
||||
settings = g_settings_new (A11Y_APPS_SCHEMA);
|
||||
if (priv->include_cursor && !g_settings_get_boolean (settings, MAGNIFIER_ACTIVE_KEY))
|
||||
{
|
||||
tracker = meta_cursor_tracker_get_for_screen (screen);
|
||||
tracker = meta_cursor_tracker_get_for_display (display);
|
||||
_draw_cursor_image (tracker, priv->image, priv->screenshot_area);
|
||||
}
|
||||
g_object_unref (settings);
|
||||
@ -490,7 +490,7 @@ shell_screenshot_screenshot (ShellScreenshot *screenshot,
|
||||
|
||||
stage = CLUTTER_ACTOR (shell_global_get_stage (priv->global));
|
||||
|
||||
meta_disable_unredirect_for_screen (shell_global_get_screen (priv->global));
|
||||
meta_disable_unredirect_for_display (shell_global_get_display (priv->global));
|
||||
|
||||
g_signal_connect_after (stage, "paint", G_CALLBACK (grab_screenshot), (gpointer)screenshot);
|
||||
|
||||
@ -539,7 +539,7 @@ shell_screenshot_screenshot_area (ShellScreenshot *screenshot,
|
||||
|
||||
stage = CLUTTER_ACTOR (shell_global_get_stage (priv->global));
|
||||
|
||||
meta_disable_unredirect_for_screen (shell_global_get_screen (shell_global_get ()));
|
||||
meta_disable_unredirect_for_display (shell_global_get_display (shell_global_get ()));
|
||||
|
||||
g_signal_connect_after (stage, "paint", G_CALLBACK (grab_area_screenshot), (gpointer)screenshot);
|
||||
|
||||
@ -567,9 +567,8 @@ shell_screenshot_screenshot_window (ShellScreenshot *screenshot,
|
||||
ShellScreenshotCallback callback)
|
||||
{
|
||||
ShellScreenshotPrivate *priv = screenshot->priv;
|
||||
MetaScreen *screen = shell_global_get_screen (priv->global);
|
||||
MetaDisplay *display = shell_global_get_display (priv->global);
|
||||
ClutterActor *stage;
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaWindow *window = meta_display_get_focus_window (display);
|
||||
|
||||
if (priv->filename != NULL || !window) {
|
||||
@ -585,7 +584,7 @@ shell_screenshot_screenshot_window (ShellScreenshot *screenshot,
|
||||
|
||||
stage = CLUTTER_ACTOR (shell_global_get_stage (priv->global));
|
||||
|
||||
meta_disable_unredirect_for_screen (shell_global_get_screen (shell_global_get ()));
|
||||
meta_disable_unredirect_for_display (shell_global_get_display (shell_global_get ()));
|
||||
|
||||
g_signal_connect_after (stage, "paint", G_CALLBACK (grab_window_screenshot), (gpointer)screenshot);
|
||||
|
||||
|
@ -210,16 +210,13 @@ shell_tray_manager_style_changed (StWidget *theme_widget,
|
||||
|
||||
void
|
||||
shell_tray_manager_manage_screen (ShellTrayManager *manager,
|
||||
MetaScreen *screen,
|
||||
StWidget *theme_widget)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkScreen *gdk_screen;
|
||||
int screen_number;
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
screen_number = meta_screen_get_screen_number (screen);
|
||||
gdk_screen = gdk_display_get_screen (display, screen_number);
|
||||
gdk_screen = gdk_display_get_default_screen (display);
|
||||
|
||||
na_tray_manager_manage_screen (manager->priv->na_manager, gdk_screen);
|
||||
|
||||
|
@ -14,7 +14,6 @@ G_DECLARE_FINAL_TYPE (ShellTrayManager, shell_tray_manager,
|
||||
|
||||
ShellTrayManager *shell_tray_manager_new (void);
|
||||
void shell_tray_manager_manage_screen (ShellTrayManager *manager,
|
||||
MetaScreen *screen,
|
||||
StWidget *theme_widget);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <meta/group.h>
|
||||
#include <meta/util.h>
|
||||
#include <meta/window.h>
|
||||
#include <meta/meta-workspace-manager.h>
|
||||
|
||||
#define SN_API_NOT_YET_FROZEN 1
|
||||
#include <libsn/sn.h>
|
||||
@ -587,13 +588,16 @@ shell_window_tracker_on_window_removed (MetaWorkspace *workspace,
|
||||
static void
|
||||
load_initial_windows (ShellWindowTracker *tracker)
|
||||
{
|
||||
GList *workspaces, *iter;
|
||||
MetaScreen *screen = shell_global_get_screen (shell_global_get ());
|
||||
workspaces = meta_screen_get_workspaces (screen);
|
||||
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
||||
MetaWorkspaceManager *workspace_manager =
|
||||
meta_display_get_workspace_manager (display);
|
||||
GList *workspaces;
|
||||
GList *l;
|
||||
|
||||
for (iter = workspaces; iter; iter = iter->next)
|
||||
workspaces = meta_workspace_manager_get_workspaces (workspace_manager);
|
||||
for (l = workspaces; l; l = l->next)
|
||||
{
|
||||
MetaWorkspace *workspace = iter->data;
|
||||
MetaWorkspace *workspace = l->data;
|
||||
GList *windows = meta_workspace_list_windows (workspace);
|
||||
GList *window_iter;
|
||||
|
||||
@ -608,18 +612,18 @@ load_initial_windows (ShellWindowTracker *tracker)
|
||||
}
|
||||
|
||||
static void
|
||||
shell_window_tracker_on_n_workspaces_changed (MetaScreen *screen,
|
||||
shell_window_tracker_on_n_workspaces_changed (MetaWorkspaceManager *workspace_manager,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
ShellWindowTracker *self = SHELL_WINDOW_TRACKER (user_data);
|
||||
GList *workspaces, *iter;
|
||||
GList *workspaces;
|
||||
GList *l;
|
||||
|
||||
workspaces = meta_screen_get_workspaces (screen);
|
||||
|
||||
for (iter = workspaces; iter; iter = iter->next)
|
||||
workspaces = meta_workspace_manager_get_workspaces (workspace_manager);
|
||||
for (l = workspaces; l; l = l->next)
|
||||
{
|
||||
MetaWorkspace *workspace = iter->data;
|
||||
MetaWorkspace *workspace = l->data;
|
||||
|
||||
/* This pair of disconnect/connect is idempotent if we were
|
||||
* already connected, while ensuring we get connected for
|
||||
@ -642,20 +646,20 @@ shell_window_tracker_on_n_workspaces_changed (MetaScreen *screen,
|
||||
static void
|
||||
init_window_tracking (ShellWindowTracker *self)
|
||||
{
|
||||
MetaDisplay *display;
|
||||
MetaScreen *screen = shell_global_get_screen (shell_global_get ());
|
||||
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
||||
MetaWorkspaceManager *workspace_manager =
|
||||
meta_display_get_workspace_manager (display);
|
||||
|
||||
g_signal_connect (screen, "notify::n-workspaces",
|
||||
g_signal_connect (workspace_manager, "notify::n-workspaces",
|
||||
G_CALLBACK (shell_window_tracker_on_n_workspaces_changed), self);
|
||||
display = meta_screen_get_display (screen);
|
||||
g_signal_connect (display, "notify::focus-window",
|
||||
G_CALLBACK (on_focus_window_changed), self);
|
||||
|
||||
shell_window_tracker_on_n_workspaces_changed (screen, NULL, self);
|
||||
shell_window_tracker_on_n_workspaces_changed (workspace_manager, NULL, self);
|
||||
}
|
||||
|
||||
static void
|
||||
on_startup_sequence_changed (MetaScreen *screen,
|
||||
on_startup_sequence_changed (MetaDisplay *display,
|
||||
SnStartupSequence *sequence,
|
||||
ShellWindowTracker *self)
|
||||
{
|
||||
@ -671,14 +675,13 @@ on_startup_sequence_changed (MetaScreen *screen,
|
||||
static void
|
||||
shell_window_tracker_init (ShellWindowTracker *self)
|
||||
{
|
||||
MetaScreen *screen;
|
||||
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
||||
|
||||
self->window_to_app = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||
NULL, (GDestroyNotify) g_object_unref);
|
||||
|
||||
screen = shell_global_get_screen (shell_global_get ());
|
||||
|
||||
g_signal_connect (G_OBJECT (screen), "startup-sequence-changed",
|
||||
g_signal_connect (display, "startup-sequence-changed",
|
||||
G_CALLBACK (on_startup_sequence_changed), self);
|
||||
|
||||
load_initial_windows (self);
|
||||
@ -795,8 +798,9 @@ GSList *
|
||||
shell_window_tracker_get_startup_sequences (ShellWindowTracker *self)
|
||||
{
|
||||
ShellGlobal *global = shell_global_get ();
|
||||
MetaScreen *screen = shell_global_get_screen (global);
|
||||
return meta_screen_get_startup_sequences (screen);
|
||||
MetaDisplay *display = shell_global_get_display (global);
|
||||
|
||||
return meta_display_get_startup_sequences (display);
|
||||
}
|
||||
|
||||
/* sn_startup_sequence_ref returns void, so make a
|
||||
|
Loading…
Reference in New Issue
Block a user