More global-ization
This commit is contained in:
parent
3029a4086b
commit
d8cabbee0b
@ -507,8 +507,6 @@ WellMenu.prototype = {
|
|||||||
}));
|
}));
|
||||||
this.actor.add_actor(this._arrow);
|
this.actor.add_actor(this._arrow);
|
||||||
|
|
||||||
let stage = Shell.Global.get().stage;
|
|
||||||
|
|
||||||
// Chain our visibility and lifecycle to that of the source
|
// Chain our visibility and lifecycle to that of the source
|
||||||
source.actor.connect('notify::mapped', Lang.bind(this, function () {
|
source.actor.connect('notify::mapped', Lang.bind(this, function () {
|
||||||
if (!source.actor.mapped)
|
if (!source.actor.mapped)
|
||||||
@ -516,7 +514,7 @@ WellMenu.prototype = {
|
|||||||
}));
|
}));
|
||||||
source.actor.connect('destroy', Lang.bind(this, function () { this.actor.destroy(); }));
|
source.actor.connect('destroy', Lang.bind(this, function () { this.actor.destroy(); }));
|
||||||
|
|
||||||
stage.add_actor(this.actor);
|
global.stage.add_actor(this.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredWidth: function(actor, forHeight, alloc) {
|
_getPreferredWidth: function(actor, forHeight, alloc) {
|
||||||
@ -568,7 +566,7 @@ WellMenu.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let activeWorkspace = Shell.Global.get().screen.get_active_workspace();
|
let activeWorkspace = global.screen.get_active_workspace();
|
||||||
|
|
||||||
let currentWorkspaceWindows = windows.filter(function (w) {
|
let currentWorkspaceWindows = windows.filter(function (w) {
|
||||||
return w.get_workspace() == activeWorkspace;
|
return w.get_workspace() == activeWorkspace;
|
||||||
|
@ -58,7 +58,7 @@ AppIcon.prototype = {
|
|||||||
text: appInfo.get_name() });
|
text: appInfo.get_name() });
|
||||||
nameBox.add_actor(this._name);
|
nameBox.add_actor(this._name);
|
||||||
this._glowBox = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL });
|
this._glowBox = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL });
|
||||||
let glowPath = GLib.filename_to_uri(Shell.Global.get().imagedir + 'app-well-glow.png', '');
|
let glowPath = GLib.filename_to_uri(global.imagedir + 'app-well-glow.png', '');
|
||||||
for (let i = 0; i < this._windows.length && i < 3; i++) {
|
for (let i = 0; i < this._windows.length && i < 3; i++) {
|
||||||
let glow = Shell.TextureCache.get_default().load_uri_sync(Shell.TextureCachePolicy.FOREVER,
|
let glow = Shell.TextureCache.get_default().load_uri_sync(Shell.TextureCachePolicy.FOREVER,
|
||||||
glowPath, -1, -1);
|
glowPath, -1, -1);
|
||||||
|
@ -102,7 +102,7 @@ DocDisplayItem.prototype = {
|
|||||||
_resetTimeDisplay: function(currentSecs) {
|
_resetTimeDisplay: function(currentSecs) {
|
||||||
let lastSecs = this._docInfo.timestamp;
|
let lastSecs = this._docInfo.timestamp;
|
||||||
let timeDelta = currentSecs - lastSecs;
|
let timeDelta = currentSecs - lastSecs;
|
||||||
let [text, nextUpdate] = Shell.Global.get().format_time_relative_pretty(timeDelta);
|
let [text, nextUpdate] = global.format_time_relative_pretty(timeDelta);
|
||||||
this._timeoutTime = currentSecs + nextUpdate;
|
this._timeoutTime = currentSecs + nextUpdate;
|
||||||
this._setDescriptionText(text);
|
this._setDescriptionText(text);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ var commandHeader = "const Clutter = imports.gi.Clutter; " +
|
|||||||
"const Tweener = imports.ui.tweener; " +
|
"const Tweener = imports.ui.tweener; " +
|
||||||
/* Utility functions...we should probably be able to use these
|
/* Utility functions...we should probably be able to use these
|
||||||
* in the shell core code too. */
|
* in the shell core code too. */
|
||||||
"const global = Shell.Global.get(); " +
|
|
||||||
"const stage = global.stage; " +
|
"const stage = global.stage; " +
|
||||||
"const color = function(pixel) { let c= new Clutter.Color(); c.from_pixel(pixel); return c; }; " +
|
"const color = function(pixel) { let c= new Clutter.Color(); c.from_pixel(pixel); return c; }; " +
|
||||||
/* Special lookingGlass functions */
|
/* Special lookingGlass functions */
|
||||||
@ -519,8 +518,7 @@ LookingGlass.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_resizeTo: function(actor) {
|
_resizeTo: function(actor) {
|
||||||
let stage = Shell.Global.get().stage;
|
let stage = global.stage;
|
||||||
let stageWidth = stage.width;
|
|
||||||
let myWidth = stage.width * 0.7;
|
let myWidth = stage.width * 0.7;
|
||||||
let myHeight = stage.height * 0.7;
|
let myHeight = stage.height * 0.7;
|
||||||
let [srcX, srcY] = actor.get_transformed_position();
|
let [srcX, srcY] = actor.get_transformed_position();
|
||||||
|
@ -66,7 +66,7 @@ function AppPanelMenu() {
|
|||||||
|
|
||||||
AppPanelMenu.prototype = {
|
AppPanelMenu.prototype = {
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._metaDisplay = Shell.Global.get().screen.get_display();
|
this._metaDisplay = global.screen.get_display();
|
||||||
|
|
||||||
this._focusedApp = null;
|
this._focusedApp = null;
|
||||||
this._activeSequence = null;
|
this._activeSequence = null;
|
||||||
|
@ -21,13 +21,6 @@ const SIDEBAR_PADDING = 4;
|
|||||||
const SIDEBAR_COLLAPSED_WIDTH = Widget.COLLAPSED_WIDTH + 3 * WidgetBox.WIDGETBOX_PADDING + SIDEBAR_PADDING;
|
const SIDEBAR_COLLAPSED_WIDTH = Widget.COLLAPSED_WIDTH + 3 * WidgetBox.WIDGETBOX_PADDING + SIDEBAR_PADDING;
|
||||||
const SIDEBAR_EXPANDED_WIDTH = Widget.EXPANDED_WIDTH + 3 * WidgetBox.WIDGETBOX_PADDING + SIDEBAR_PADDING;
|
const SIDEBAR_EXPANDED_WIDTH = Widget.EXPANDED_WIDTH + 3 * WidgetBox.WIDGETBOX_PADDING + SIDEBAR_PADDING;
|
||||||
|
|
||||||
// The maximum height of the sidebar would be extending from just
|
|
||||||
// below the panel to just above the taskbar. Since the taskbar is
|
|
||||||
// just a temporary hack and it would be too hard to do this the right
|
|
||||||
// way, we just hardcode its size.
|
|
||||||
const HARDCODED_TASKBAR_HEIGHT = 24;
|
|
||||||
const MAXIMUM_SIDEBAR_HEIGHT = Shell.Global.get().screen_height - Panel.PANEL_HEIGHT - HARDCODED_TASKBAR_HEIGHT;
|
|
||||||
|
|
||||||
function Sidebar() {
|
function Sidebar() {
|
||||||
this._init();
|
this._init();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
const Shell = imports.gi.Shell;
|
|
||||||
|
|
||||||
const AltTab = imports.ui.altTab;
|
const AltTab = imports.ui.altTab;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
@ -19,8 +18,7 @@ WindowManager.prototype = {
|
|||||||
_init : function() {
|
_init : function() {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
|
||||||
this._global = Shell.Global.get();
|
this._shellwm = global.window_manager;
|
||||||
this._shellwm = this._global.window_manager;
|
|
||||||
this._minimizing = [];
|
this._minimizing = [];
|
||||||
this._maximizing = [];
|
this._maximizing = [];
|
||||||
this._unmaximizing = [];
|
this._unmaximizing = [];
|
||||||
@ -255,20 +253,20 @@ WindowManager.prototype = {
|
|||||||
if (direction == Meta.MotionDirection.UP ||
|
if (direction == Meta.MotionDirection.UP ||
|
||||||
direction == Meta.MotionDirection.UP_LEFT ||
|
direction == Meta.MotionDirection.UP_LEFT ||
|
||||||
direction == Meta.MotionDirection.UP_RIGHT)
|
direction == Meta.MotionDirection.UP_RIGHT)
|
||||||
yDest = this._global.screen_height;
|
yDest = global.screen_height;
|
||||||
else if (direction == Meta.MotionDirection.DOWN ||
|
else if (direction == Meta.MotionDirection.DOWN ||
|
||||||
direction == Meta.MotionDirection.DOWN_LEFT ||
|
direction == Meta.MotionDirection.DOWN_LEFT ||
|
||||||
direction == Meta.MotionDirection.DOWN_RIGHT)
|
direction == Meta.MotionDirection.DOWN_RIGHT)
|
||||||
yDest = -this._global.screen_height;
|
yDest = -global.screen_height;
|
||||||
|
|
||||||
if (direction == Meta.MotionDirection.LEFT ||
|
if (direction == Meta.MotionDirection.LEFT ||
|
||||||
direction == Meta.MotionDirection.UP_LEFT ||
|
direction == Meta.MotionDirection.UP_LEFT ||
|
||||||
direction == Meta.MotionDirection.DOWN_LEFT)
|
direction == Meta.MotionDirection.DOWN_LEFT)
|
||||||
xDest = this._global.screen_width;
|
xDest = global.screen_width;
|
||||||
else if (direction == Meta.MotionDirection.RIGHT ||
|
else if (direction == Meta.MotionDirection.RIGHT ||
|
||||||
direction == Meta.MotionDirection.UP_RIGHT ||
|
direction == Meta.MotionDirection.UP_RIGHT ||
|
||||||
direction == Meta.MotionDirection.DOWN_RIGHT)
|
direction == Meta.MotionDirection.DOWN_RIGHT)
|
||||||
xDest = -this._global.screen_width;
|
xDest = -global.screen_width;
|
||||||
|
|
||||||
let switchData = {};
|
let switchData = {};
|
||||||
this._switchData = switchData;
|
this._switchData = switchData;
|
||||||
@ -276,7 +274,7 @@ WindowManager.prototype = {
|
|||||||
switchData.outGroup = new Clutter.Group();
|
switchData.outGroup = new Clutter.Group();
|
||||||
switchData.windows = [];
|
switchData.windows = [];
|
||||||
|
|
||||||
let wgroup = this._global.window_group;
|
let wgroup = global.window_group;
|
||||||
wgroup.add_actor(switchData.inGroup);
|
wgroup.add_actor(switchData.inGroup);
|
||||||
wgroup.add_actor(switchData.outGroup);
|
wgroup.add_actor(switchData.outGroup);
|
||||||
|
|
||||||
|
@ -1102,7 +1102,7 @@ Workspaces.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
activeWorkspace.actor.raise_top();
|
activeWorkspace.actor.raise_top();
|
||||||
this._positionWorkspaces(global);
|
this._positionWorkspaces();
|
||||||
|
|
||||||
let lastWorkspace = this._workspaces[this._workspaces.length - 1];
|
let lastWorkspace = this._workspaces[this._workspaces.length - 1];
|
||||||
lastWorkspace.updateRemovable(true);
|
lastWorkspace.updateRemovable(true);
|
||||||
@ -1196,7 +1196,7 @@ Workspaces.prototype = {
|
|||||||
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||||
let activeWorkspace = this._workspaces[activeWorkspaceIndex];
|
let activeWorkspace = this._workspaces[activeWorkspaceIndex];
|
||||||
|
|
||||||
this._positionWorkspaces(global);
|
this._positionWorkspaces();
|
||||||
activeWorkspace.actor.raise_top();
|
activeWorkspace.actor.raise_top();
|
||||||
|
|
||||||
for (let w = 0; w < this._workspaces.length; w++)
|
for (let w = 0; w < this._workspaces.length; w++)
|
||||||
@ -1237,7 +1237,7 @@ Workspaces.prototype = {
|
|||||||
// first row.)
|
// first row.)
|
||||||
//
|
//
|
||||||
// FIXME: need to make the metacity internal layout agree with this!
|
// FIXME: need to make the metacity internal layout agree with this!
|
||||||
_positionWorkspaces : function(global) {
|
_positionWorkspaces : function() {
|
||||||
let gridWidth = Math.ceil(Math.sqrt(this._workspaces.length));
|
let gridWidth = Math.ceil(Math.sqrt(this._workspaces.length));
|
||||||
let gridHeight = Math.ceil(this._workspaces.length / gridWidth);
|
let gridHeight = Math.ceil(this._workspaces.length / gridWidth);
|
||||||
|
|
||||||
@ -1307,7 +1307,7 @@ Workspaces.prototype = {
|
|||||||
newLastWorkspace.updateRemovable();
|
newLastWorkspace.updateRemovable();
|
||||||
|
|
||||||
// Figure out the new layout
|
// Figure out the new layout
|
||||||
this._positionWorkspaces(global);
|
this._positionWorkspaces();
|
||||||
let newScale = this._workspaces[0].scale;
|
let newScale = this._workspaces[0].scale;
|
||||||
let newGridWidth = Math.ceil(Math.sqrt(newNumWorkspaces));
|
let newGridWidth = Math.ceil(Math.sqrt(newNumWorkspaces));
|
||||||
let newGridHeight = Math.ceil(newNumWorkspaces / newGridWidth);
|
let newGridHeight = Math.ceil(newNumWorkspaces / newGridWidth);
|
||||||
|
Loading…
Reference in New Issue
Block a user