Redo tabs => spaces indentation change to not lose manual indentation

Revert most JS changes in commit:

    Fri Nov 28 20:12:20 2008 +0000
    Convert all JS style to be uniform, add Eclipse settings bits

Instead, just add 'indent-tabs-mode: nil' to the mode lines and convert
tabs to spaces. The indentation no longer exactly matches the Eclipse
settings, since they differ in some ways from the style we are trying
to achieve.

svn path=/trunk/; revision=97
This commit is contained in:
Owen Taylor 2008-12-01 19:51:43 +00:00
parent 12720e2c90
commit 7b471645f4
7 changed files with 1049 additions and 1045 deletions

View File

@ -1,4 +1,4 @@
/* -*- mode: js2; js2-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- */ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Signals = imports.signals; const Signals = imports.signals;
const Clutter = imports.gi.Clutter; const Clutter = imports.gi.Clutter;
@ -10,11 +10,11 @@ const Tidy = imports.gi.Tidy;
const Meta = imports.gi.Meta; const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell; const Shell = imports.gi.Shell;
//TODO - move this into GConf once we're not a plugin anymore // TODO - move this into GConf once we're not a plugin anymore
//but have taken over metacity // but have taken over metacity
//This list is taken from GNOME Online popular applications // This list is taken from GNOME Online popular applications
//http://online.gnome.org/applications // http://online.gnome.org/applications
//but with nautilus removed // but with nautilus removed
const DEFAULT_APPLICATIONS = [ const DEFAULT_APPLICATIONS = [
'mozilla-firefox.desktop', 'mozilla-firefox.desktop',
'gnome-terminal.desktop', 'gnome-terminal.desktop',
@ -34,7 +34,7 @@ const DEFAULT_APPLICATIONS = [
'eclipse.desktop', 'eclipse.desktop',
'openoffice.org-1.9-impress.desktop', 'openoffice.org-1.9-impress.desktop',
'vncviewer.desktop' 'vncviewer.desktop'
]; ];
const APPDISPLAY_NAME_COLOR = new Clutter.Color(); const APPDISPLAY_NAME_COLOR = new Clutter.Color();
APPDISPLAY_NAME_COLOR.from_pixel(0xffffffff); APPDISPLAY_NAME_COLOR.from_pixel(0xffffffff);
@ -53,7 +53,7 @@ function AppDisplayItem(node, width) {
} }
AppDisplayItem.prototype = { AppDisplayItem.prototype = {
_init: function(appinfo, width) { _init: function(appinfo, width) {
let me = this; let me = this;
this._appinfo = appinfo; this._appinfo = appinfo;
@ -69,7 +69,8 @@ _init: function(appinfo, width) {
return true; return true;
}); });
this._bg = new Clutter.Rectangle({ color: APPDISPLAY_BACKGROUND_COLOR, this._bg = new Clutter.Rectangle({ color: APPDISPLAY_BACKGROUND_COLOR,
x: 0, y: 0, width: width, height: APPDISPLAY_HEIGHT }); x: 0, y: 0,
width: width, height: APPDISPLAY_HEIGHT });
this._group.add_actor(this._bg); this._group.add_actor(this._bg);
this._icon = new Clutter.Texture({ width: 48, height: 48, x: 0, y: 0 }); this._icon = new Clutter.Texture({ width: 48, height: 48, x: 0, y: 0 });
@ -104,22 +105,23 @@ _init: function(appinfo, width) {
y: this._name.height + 4}) y: this._name.height + 4})
this._group.add_actor(this._comment); this._group.add_actor(this._comment);
this.actor = this._group; this.actor = this._group;
}, },
launch: function() { launch: function() {
this._appinfo.launch([], null); this._appinfo.launch([], null);
}, },
appinfo: function () { appinfo: function () {
return this._appinfo; return this._appinfo;
}, },
markSelected: function(isSelected) { markSelected: function(isSelected) {
let color; let color;
if (isSelected) if (isSelected)
color = APPDISPLAY_SELECTED_BACKGROUND_COLOR; color = APPDISPLAY_SELECTED_BACKGROUND_COLOR;
else else
color = APPDISPLAY_BACKGROUND_COLOR; color = APPDISPLAY_BACKGROUND_COLOR;
this._bg.color = color; this._bg.color = color;
} }
} };
Signals.addSignalMethods(AppDisplayItem.prototype); Signals.addSignalMethods(AppDisplayItem.prototype);
function AppDisplay(x, y, width, height) { function AppDisplay(x, y, width, height) {
@ -127,7 +129,7 @@ function AppDisplay(x, y, width, height) {
} }
AppDisplay.prototype = { AppDisplay.prototype = {
_init : function(x, y, width, height) { _init : function(x, y, width, height) {
let me = this; let me = this;
let global = Shell.Global.get(); let global = Shell.Global.get();
this._search = ''; this._search = '';
@ -143,12 +145,12 @@ _init : function(x, y, width, height) {
this._grid = new Tidy.Grid({x: x, y: y, width: width, height: height}); this._grid = new Tidy.Grid({x: x, y: y, width: width, height: height});
global.stage.add_actor(this._grid); global.stage.add_actor(this._grid);
this._appset = {}; // Map<appid, appinfo> this._appset = {}; // Map<appid, appinfo>
this._displayed = {} // Map<appid, AppDisplay> this._displayed = {}; // Map<appid, AppDisplay>
this._selectedIndex = -1; this._selectedIndex = -1;
this._max_items = this._height / (APPDISPLAY_HEIGHT + APPDISPLAY_PADDING); this._max_items = this._height / (APPDISPLAY_HEIGHT + APPDISPLAY_PADDING);
}, },
_refreshCache: function() { _refreshCache: function() {
let me = this; let me = this;
if (!this._appsStale) if (!this._appsStale)
@ -165,22 +167,21 @@ _refreshCache: function() {
this._appset[appid] = appinfo; this._appset[appid] = appinfo;
} }
this._appsStale = false; this._appsStale = false;
}, },
_removeItem: function(appid) { _removeItem: function(appid) {
let item = this._displayed[appid]; let item = this._displayed[appid];
let group = item.actor; let group = item.actor;
group.destroy(); group.destroy();
delete this._displayed[appid]; delete this._displayed[appid];
},
}, _removeAll: function() {
_removeAll: function() {
for (appid in this._displayed) for (appid in this._displayed)
this._removeItem(appid); this._removeItem(appid);
}, },
_setDefaultList: function() { _setDefaultList: function() {
this._removeAll(); this._removeAll();
let added = 0; let added = 0;
for (let i = 0; i < DEFAULT_APPLICATIONS.length && added < this._max_items; i++) { for (let i = 0; i < DEFAULT_APPLICATIONS.length && added < this._max_items; i++) {
@ -191,15 +192,15 @@ _setDefaultList: function() {
added += 1; added += 1;
} }
} }
}, },
_getNDisplayed: function() { _getNDisplayed: function() {
// Is there a better way to do .size() ? // Is there a better way to do .size() ?
let c = 0; for (i in this._displayed) { c += 1; }; let c = 0; for (i in this._displayed) { c += 1; };
return c; return c;
}, },
_filterAdd: function(appid) { _filterAdd: function(appid) {
let me = this; let me = this;
let appinfo = this._appset[appid]; let appinfo = this._appset[appid];
@ -214,15 +215,15 @@ _filterAdd: function(appid) {
let group = appdisplay.actor; let group = appdisplay.actor;
this._grid.add_actor(group); this._grid.add_actor(group);
this._displayed[appid] = appdisplay; this._displayed[appid] = appdisplay;
}, },
_filterRemove: function(appid) { _filterRemove: function(appid) {
// In the future, do some sort of fade out or other effect here // In the future, do some sort of fade out or other effect here
let item = this._displayed[appid]; let item = this._displayed[appid];
this._removeItem(item); this._removeItem(item);
}, },
_appinfoMatches: function(appinfo, search) { _appinfoMatches: function(appinfo, search) {
if (search == null || search == '') if (search == null || search == '')
return true; return true;
let name = appinfo.get_name().toLowerCase(); let name = appinfo.get_name().toLowerCase();
@ -238,18 +239,18 @@ _appinfoMatches: function(appinfo, search) {
if (exec.indexOf(search) >= 0) if (exec.indexOf(search) >= 0)
return true; return true;
return false; return false;
}, },
_sortApps: function(appids) { _sortApps: function(appids) {
let me = this; let me = this;
return appids.sort(function (a,b) { return appids.sort(function (a,b) {
let appA = me._appset[a]; let appA = me._appset[a];
let appB = me._appset[b]; let appB = me._appset[b];
return appA.get_name().localeCompare(appB.get_name()); return appA.get_name().localeCompare(appB.get_name());
}); });
}, },
_doSearchFilter: function() { _doSearchFilter: function() {
this._removeAll(); this._removeAll();
let matchedApps = []; let matchedApps = [];
for (appid in this._appset) { for (appid in this._appset) {
@ -265,28 +266,28 @@ _doSearchFilter: function() {
for (let i = 0; i < matchedApps.length; i++) { for (let i = 0; i < matchedApps.length; i++) {
this._filterAdd(matchedApps[i]); this._filterAdd(matchedApps[i]);
} }
}, },
_redisplay: function() { _redisplay: function() {
this._refreshCache(); this._refreshCache();
if (!this._search) if (!this._search)
this._setDefaultList(); this._setDefaultList();
else else
this._doSearchFilter(); this._doSearchFilter();
}, },
setSearch: function(text) { setSearch: function(text) {
this._search = text.toLowerCase(); this._search = text.toLowerCase();
this._redisplay(); this._redisplay();
}, },
_findDisplayedByIndex: function(index) { _findDisplayedByIndex: function(index) {
let displayedActors = this._grid.get_children(); let displayedActors = this._grid.get_children();
let actor = displayedActors[index]; let actor = displayedActors[index];
return this._findDisplayedByActor(actor); return this._findDisplayedByActor(actor);
}, },
_findDisplayedByActor: function(actor) { _findDisplayedByActor: function(actor) {
for (appid in this._displayed) { for (appid in this._displayed) {
let item = this._displayed[appid]; let item = this._displayed[appid];
if (item.actor == actor) { if (item.actor == actor) {
@ -294,9 +295,9 @@ _findDisplayedByActor: function(actor) {
} }
} }
return null; return null;
}, },
searchActivate: function() { searchActivate: function() {
if (this._selectedIndex != -1) { if (this._selectedIndex != -1) {
let selected = this._findDisplayedByIndex(this._selectedIndex); let selected = this._findDisplayedByIndex(this._selectedIndex);
selected.launch(); selected.launch();
@ -310,9 +311,9 @@ searchActivate: function() {
let selectedMenuItem = this._findDisplayedByActor(selectedActor); let selectedMenuItem = this._findDisplayedByActor(selectedActor);
selectedMenuItem.launch(); selectedMenuItem.launch();
this.emit('activated'); this.emit('activated');
}, },
_selectIndex: function(index) { _selectIndex: function(index) {
if (this._selectedIndex != -1) { if (this._selectedIndex != -1) {
let prev = this._findDisplayedByIndex(this._selectedIndex); let prev = this._findDisplayedByIndex(this._selectedIndex);
log("demarking " + prev); log("demarking " + prev);
@ -322,31 +323,31 @@ _selectIndex: function(index) {
let item = this._findDisplayedByIndex(index); let item = this._findDisplayedByIndex(index);
log("marking " + item); log("marking " + item);
item.markSelected(true); item.markSelected(true);
}, },
selectUp: function() { selectUp: function() {
let prev = this._selectedIndex-1; let prev = this._selectedIndex-1;
if (prev < 0) if (prev < 0)
return; return;
this._selectIndex(prev); this._selectIndex(prev);
}, },
selectDown: function() { selectDown: function() {
let next = this._selectedIndex+1; let next = this._selectedIndex+1;
let nDisplayed = this._getNDisplayed(); let nDisplayed = this._getNDisplayed();
if (next >= nDisplayed) if (next >= nDisplayed)
return; return;
this._selectIndex(next); this._selectIndex(next);
}, },
show: function() { show: function() {
this._redisplay(); this._redisplay();
this._grid.show(); this._grid.show();
}, },
hide: function() { hide: function() {
this._grid.hide(); this._grid.hide();
} }
} };
Signals.addSignalMethods(AppDisplay.prototype);
Signals.addSignalMethods(AppDisplay.prototype);

View File

@ -1,4 +1,4 @@
/* -*- mode: js2; js2-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- */ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter; const Clutter = imports.gi.Clutter;
const Tweener = imports.tweener.tweener; const Tweener = imports.tweener.tweener;
@ -9,7 +9,7 @@ DEFAULT_BUTTON_COLOR.from_pixel(0xeeddccff);
const DEFAULT_PRESSED_BUTTON_COLOR = new Clutter.Color(); const DEFAULT_PRESSED_BUTTON_COLOR = new Clutter.Color();
DEFAULT_PRESSED_BUTTON_COLOR.from_pixel(0xccbbaaff); DEFAULT_PRESSED_BUTTON_COLOR.from_pixel(0xccbbaaff);
//Time for animation making the button darker // Time for animation making the button darker
const ANIMATION_TIME = 0.3; const ANIMATION_TIME = 0.3;
const NO_OPACITY = 0; const NO_OPACITY = 0;
@ -23,8 +23,9 @@ function Button(text, buttonColor, pressedButtonColor, staysPressed, minWidth, m
} }
Button.prototype = { Button.prototype = {
_init : function(text, buttonColor, pressedButtonColor, staysPressed, minWidth, minHeight) { _init : function(text, buttonColor, pressedButtonColor, staysPressed, minWidth, minHeight) {
let me = this; let me = this;
this._buttonColor = buttonColor this._buttonColor = buttonColor
if (buttonColor == null) if (buttonColor == null)
this._buttonColor = DEFAULT_BUTTON_COLOR; this._buttonColor = DEFAULT_BUTTON_COLOR;
@ -100,9 +101,9 @@ _init : function(text, buttonColor, pressedButtonColor, staysPressed, minWidth,
} }
return false; return false;
}); });
}, },
release : function() { release : function() {
if (!this._isBetweenPressAndRelease) { if (!this._isBetweenPressAndRelease) {
this._active = false; this._active = false;
Tweener.removeTweens(this._pressedBackground); Tweener.removeTweens(this._pressedBackground);
@ -112,6 +113,5 @@ release : function() {
this._pressedBackground.set_opacity(NO_OPACITY); this._pressedBackground.set_opacity(NO_OPACITY);
} }
} }
} }
} };

View File

@ -1,4 +1,4 @@
/* -*- mode: js2; js2-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- */ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter; const Clutter = imports.gi.Clutter;
const Shell = imports.gi.Shell; const Shell = imports.gi.Shell;
@ -18,26 +18,26 @@ let overlay = null;
let run_dialog = null; let run_dialog = null;
let wm = null; let wm = null;
//The "FrameTicker" object is an object used to feed new frames to Tweener // The "FrameTicker" object is an object used to feed new frames to Tweener
//so it can update values and redraw. The default frame ticker for // so it can update values and redraw. The default frame ticker for
//Tweener just uses a simple timeout at a fixed frame rate and has no idea // Tweener just uses a simple timeout at a fixed frame rate and has no idea
//of "catching up" by dropping frames. // of "catching up" by dropping frames.
//
//We substitute it with custom frame ticker here that connects Tweener to // We substitute it with custom frame ticker here that connects Tweener to
//a Clutter.TimeLine. Now, Clutter.Timeline itself isn't a whole lot more // a Clutter.TimeLine. Now, Clutter.Timeline itself isn't a whole lot more
//sophisticated than a simple timeout at a fixed frame rate, but at least // sophisticated than a simple timeout at a fixed frame rate, but at least
//it knows how to drop frames. (See HippoAnimationManager for a more // it knows how to drop frames. (See HippoAnimationManager for a more
//sophisticated view of continous time updates; even better is to pay // sophisticated view of continous time updates; even better is to pay
//attention to the vertical vblank and sync to that when possible.) // attention to the vertical vblank and sync to that when possible.)
//
function ClutterFrameTicker() { function ClutterFrameTicker() {
this._init(); this._init();
} }
ClutterFrameTicker.prototype = { ClutterFrameTicker.prototype = {
TARGET_FRAME_RATE : 60, TARGET_FRAME_RATE : 60,
_init : function() { _init : function() {
// We don't have a finite duration; tweener will tell us to stop // We don't have a finite duration; tweener will tell us to stop
// when we need to stop, so use 1000 seconds as "infinity" // when we need to stop, so use 1000 seconds as "infinity"
this._timeline = new Clutter.Timeline({ fps: this.TARGET_FRAME_RATE, this._timeline = new Clutter.Timeline({ fps: this.TARGET_FRAME_RATE,
@ -49,9 +49,9 @@ _init : function() {
function(timeline, frame) { function(timeline, frame) {
me._onNewFrame(frame); me._onNewFrame(frame);
}); });
}, },
_onNewFrame : function(frame) { _onNewFrame : function(frame) {
// Unfortunately the interface to to send a new frame to tweener // Unfortunately the interface to to send a new frame to tweener
// is a simple "next frame" and there is no provision for signaling // is a simple "next frame" and there is no provision for signaling
// that frames have been skipped or just telling it the new time. // that frames have been skipped or just telling it the new time.
@ -69,16 +69,16 @@ _onNewFrame : function(frame) {
this.FRAME_RATE = this.TARGET_FRAME_RATE / delta; this.FRAME_RATE = this.TARGET_FRAME_RATE / delta;
this._frame = frame; this._frame = frame;
this.emit('prepare-frame'); this.emit('prepare-frame');
}, },
start : function() { start : function() {
this._timeline.start(); this._timeline.start();
}, },
stop : function() { stop : function() {
this._timeline.stop(); this._timeline.stop();
this._frame = 0; this._frame = 0;
} }
}; };
Signals.addSignalMethods(ClutterFrameTicker.prototype); Signals.addSignalMethods(ClutterFrameTicker.prototype);
@ -121,9 +121,9 @@ function start() {
wm = new WindowManager.WindowManager(); wm = new WindowManager.WindowManager();
} }
//Used to go into a mode where all keyboard and mouse input goes to // Used to go into a mode where all keyboard and mouse input goes to
//the stage. Returns true if we successfully grabbed the keyboard and // the stage. Returns true if we successfully grabbed the keyboard and
//went modal, false otherwise // went modal, false otherwise
function startModal() { function startModal() {
let global = Shell.Global.get(); let global = Shell.Global.get();

View File

@ -1,4 +1,4 @@
/* -*- mode: js2; js2-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- */ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Signals = imports.signals; const Signals = imports.signals;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
@ -23,21 +23,21 @@ SIDESHOW_SEARCH_BG_COLOR.from_pixel(0xffffffff);
const SIDESHOW_TEXT_COLOR = new Clutter.Color(); const SIDESHOW_TEXT_COLOR = new Clutter.Color();
SIDESHOW_TEXT_COLOR.from_pixel(0xffffffff); SIDESHOW_TEXT_COLOR.from_pixel(0xffffffff);
//Time for initial animation going into overlay mode // Time for initial animation going into overlay mode
const ANIMATION_TIME = 0.5; const ANIMATION_TIME = 0.5;
//How much to scale the desktop down by in overlay mode // How much to scale the desktop down by in overlay mode
const DESKTOP_SCALE = 0.75; const DESKTOP_SCALE = 0.75;
//Windows are slightly translucent in the overlay mode // Windows are slightly translucent in the overlay mode
const WINDOW_OPACITY = 0.9 * 255; const WINDOW_OPACITY = 0.9 * 255;
//Define a layout scheme for small window counts. For larger // Define a layout scheme for small window counts. For larger
//counts we fall back to an algorithm. We need more schemes here // counts we fall back to an algorithm. We need more schemes here
//unless we have a really good algorithm. // unless we have a really good algorithm.
//
//Each triplet is [xCenter, yCenter, scale] where the scale // Each triplet is [xCenter, yCenter, scale] where the scale
//is relative to the width of the desktop. // is relative to the width of the desktop.
const POSITIONS = { const POSITIONS = {
1: [[0.5, 0.5, 0.8]], 1: [[0.5, 0.5, 0.8]],
2: [[0.25, 0.5, 0.4], [0.75, 0.5, 0.4]], 2: [[0.25, 0.5, 0.4], [0.75, 0.5, 0.4]],
@ -51,7 +51,7 @@ function Sideshow(width) {
} }
Sideshow.prototype = { Sideshow.prototype = {
_init : function(width) { _init : function(width) {
let me = this; let me = this;
let global = Shell.Global.get(); let global = Shell.Global.get();
@ -129,17 +129,17 @@ _init : function(width) {
this._appdisplay.connect('activated', function(appdisplay) { this._appdisplay.connect('activated', function(appdisplay) {
me.emit('activated'); me.emit('activated');
}); });
}, },
show: function() { show: function() {
this._group.show(); this._group.show();
this._appdisplay.show(); this._appdisplay.show();
}, },
hide: function() { hide: function() {
this._group.hide(); this._group.hide();
this._appdisplay.hide(); this._appdisplay.hide();
} }
}; };
Signals.addSignalMethods(Sideshow.prototype); Signals.addSignalMethods(Sideshow.prototype);
@ -148,7 +148,7 @@ function Overlay() {
} }
Overlay.prototype = { Overlay.prototype = {
_init : function() { _init : function() {
let me = this; let me = this;
let global = Shell.Global.get(); let global = Shell.Global.get();
@ -179,9 +179,9 @@ _init : function() {
// startup-notification integration at least. // startup-notification integration at least.
me._deactivate(); me._deactivate();
}); });
}, },
_recalculateSize: function () { _recalculateSize: function () {
let global = Shell.Global.get(); let global = Shell.Global.get();
let screenWidth = global.screen_width; let screenWidth = global.screen_width;
let screenHeight = global.screen_height; let screenHeight = global.screen_height;
@ -191,11 +191,12 @@ _recalculateSize: function () {
this._desktopHeight = screenHeight * DESKTOP_SCALE; this._desktopHeight = screenHeight * DESKTOP_SCALE;
this._desktopX = screenWidth - this._desktopWidth - 10; this._desktopX = screenWidth - this._desktopWidth - 10;
this._desktopY = Panel.PANEL_HEIGHT + (screenHeight - this._desktopHeight - Panel.PANEL_HEIGHT) / 2; this._desktopY = Panel.PANEL_HEIGHT + (screenHeight - this._desktopHeight - Panel.PANEL_HEIGHT) / 2;
}, },
show : function() { show : function() {
if (this.visible) if (this.visible)
return; return;
this.visible = true; this.visible = true;
let global = Shell.Global.get(); let global = Shell.Global.get();
@ -252,11 +253,12 @@ show : function() {
// clones of them, this would obviously no longer be necessary. // clones of them, this would obviously no longer be necessary.
global.window_group.hide() global.window_group.hide()
this._group.show(); this._group.show();
}, },
hide : function() { hide : function() {
if (!this.visible) if (!this.visible)
return; return;
let global = Shell.Global.get(); let global = Shell.Global.get();
this.visible = false; this.visible = false;
@ -270,17 +272,17 @@ hide : function() {
this._sideshow.hide(); this._sideshow.hide();
this._windowClones = []; this._windowClones = [];
}, },
_createDesktopClone : function(w) { _createDesktopClone : function(w) {
let clone = new Clutter.CloneTexture({ parent_texture: w.get_texture(), let clone = new Clutter.CloneTexture({ parent_texture: w.get_texture(),
reactive: true, reactive: true,
x: 0, x: 0,
y: 0 }); y: 0 });
this._addDesktop(clone); this._addDesktop(clone);
}, },
_createDesktopRectangle : function() { _createDesktopRectangle : function() {
let global = Shell.Global.get(); let global = Shell.Global.get();
// In the case when we have a desktop window from the file manager, its height is // In the case when we have a desktop window from the file manager, its height is
// full-screen, i.e. it includes the height of the panel, so we should not subtract // full-screen, i.e. it includes the height of the panel, so we should not subtract
@ -295,9 +297,9 @@ _createDesktopRectangle : function() {
width: global.screen_width, width: global.screen_width,
height: global.screen_height }); height: global.screen_height });
this._addDesktop(desktopRectangle); this._addDesktop(desktopRectangle);
}, },
_addDesktop : function(desktop) { _addDesktop : function(desktop) {
let me = this; let me = this;
this._windowClones.push(desktop); this._windowClones.push(desktop);
@ -319,10 +321,10 @@ _addDesktop : function(desktop) {
function() { function() {
me._deactivate(); me._deactivate();
}); });
}, },
//windowIndex == 0 => top in stacking order // windowIndex == 0 => top in stacking order
_computeWindowPosition : function(windowIndex, numberOfWindows) { _computeWindowPosition : function(windowIndex, numberOfWindows) {
if (numberOfWindows in POSITIONS) if (numberOfWindows in POSITIONS)
return POSITIONS[numberOfWindows][windowIndex]; return POSITIONS[numberOfWindows][windowIndex];
@ -338,9 +340,9 @@ _computeWindowPosition : function(windowIndex, numberOfWindows) {
let yCenter = xCenter; let yCenter = xCenter;
return [xCenter, yCenter, fraction]; return [xCenter, yCenter, fraction];
}, },
_createWindowClone : function(w, windowIndex, numberOfWindows) { _createWindowClone : function(w, windowIndex, numberOfWindows) {
let me = this; let me = this;
// We show the window using "clones" of the texture .. separate // We show the window using "clones" of the texture .. separate
@ -386,14 +388,14 @@ _createWindowClone : function(w, windowIndex, numberOfWindows) {
function(clone, event) { function(clone, event) {
me._activateWindow(w, event.get_time()); me._activateWindow(w, event.get_time());
}); });
}, },
_activateWindow : function(w, time) { _activateWindow : function(w, time) {
this._deactivate(); this._deactivate();
w.get_meta_window().activate(time); w.get_meta_window().activate(time);
}, },
_deactivate : function() { _deactivate : function() {
Main.hide_overlay(); Main.hide_overlay();
} }
}; };

View File

@ -1,4 +1,4 @@
/* -*- mode: js2; js2-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- */ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter; const Clutter = imports.gi.Clutter;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
@ -21,7 +21,7 @@ function Panel() {
} }
Panel.prototype = { Panel.prototype = {
_init : function() { _init : function() {
let global = Shell.Global.get(); let global = Shell.Global.get();
this._group = new Clutter.Group(); this._group = new Clutter.Group();
@ -96,11 +96,11 @@ _init : function() {
this._updateClock(); this._updateClock();
this._startClock(); this._startClock();
}, },
// Struts determine the area along each side of the screen that is reserved // Struts determine the area along each side of the screen that is reserved
// and not available to applications // and not available to applications
_setStruts: function() { _setStruts: function() {
let global = Shell.Global.get(); let global = Shell.Global.get();
let struts = [ let struts = [
@ -120,9 +120,9 @@ _setStruts: function() {
let workspace = screen.get_workspace_by_index(i); let workspace = screen.get_workspace_by_index(i);
workspace.set_builtin_struts(struts); workspace.set_builtin_struts(struts);
} }
}, },
_startClock: function() { _startClock: function() {
let me = this; let me = this;
// TODO: this makes the clock updated every 60 seconds, but not necessarily on the minute, so it is inaccurate // TODO: this makes the clock updated every 60 seconds, but not necessarily on the minute, so it is inaccurate
Mainloop.timeout_add_seconds(60, Mainloop.timeout_add_seconds(60,
@ -130,14 +130,14 @@ _startClock: function() {
me._updateClock(); me._updateClock();
return true; return true;
}); });
}, },
_updateClock: function() { _updateClock: function() {
this._clock.set_text(new Date().toLocaleFormat("%H:%M")); this._clock.set_text(new Date().toLocaleFormat("%H:%M"));
return true; return true;
}, },
overlayHidden: function() { overlayHidden: function() {
this.button.release(); this.button.release();
} }
}; };

View File

@ -1,4 +1,4 @@
/* -*- mode: js2; js2-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- */ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Signals = imports.signals; const Signals = imports.signals;
const Shell = imports.gi.Shell; const Shell = imports.gi.Shell;
@ -75,9 +75,9 @@ RunDialog.prototype = {
return false; return false;
}); });
}, },
_run : function(command) { _run : function(command) {
if (command) { if (command) {
var p = new Shell.Process({'args' : [command]}); var p = new Shell.Process({'args' : [command]});
try { try {
@ -89,10 +89,11 @@ _run : function(command) {
} }
this.emit('run'); this.emit('run');
}, },
show : function() { show : function() {
let me = this; let me = this;
if (this._group.visible) // Already shown if (this._group.visible) // Already shown
return false; return false;
@ -114,19 +115,19 @@ show : function() {
global.stage.set_key_focus(this._entry); global.stage.set_key_focus(this._entry);
return true; return true;
}, },
hide : function() { hide : function() {
if (!this._group.visible) if (!this._group.visible)
return; return;
this._group.hide(); this._group.hide();
Main.endModal(); Main.endModal();
}, },
destroy : function(){ destroy : function(){
this.hide(); this.hide();
this._group.destroy(); this._group.destroy();
} }
}; };
Signals.addSignalMethods(RunDialog.prototype); Signals.addSignalMethods(RunDialog.prototype);

View File

@ -1,4 +1,4 @@
/* -*- mode: js2; js2-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- */ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter; const Clutter = imports.gi.Clutter;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
@ -15,7 +15,7 @@ function WindowManager() {
} }
WindowManager.prototype = { WindowManager.prototype = {
_init : function() { _init : function() {
let me = this; let me = this;
this._global = Shell.Global.get(); this._global = Shell.Global.get();
@ -31,9 +31,9 @@ _init : function() {
function(o) { function(o) {
me.switchWorkspaceDone(); me.switchWorkspaceDone();
}); });
}, },
switchWorkspace : function(windows, from, to, direction) { switchWorkspace : function(windows, from, to, direction) {
/* @direction is the direction that the "camera" moves, so the /* @direction is the direction that the "camera" moves, so the
* screen contents have to move one screen's worth in the * screen contents have to move one screen's worth in the
* opposite direction. * opposite direction.
@ -98,9 +98,9 @@ switchWorkspace : function(windows, from, to, direction) {
time: SWITCH_ANIMATION_TIME, time: SWITCH_ANIMATION_TIME,
transition: "easeOutBack" transition: "easeOutBack"
}); });
}, },
switchWorkspaceDone : function() { switchWorkspaceDone : function() {
let switchData = this._switchData; let switchData = this._switchData;
if (!switchData) if (!switchData)
return; return;
@ -120,6 +120,6 @@ switchWorkspaceDone : function() {
switchData.outGroup.destroy(); switchData.outGroup.destroy();
this._shellwm.completed_switch_workspace(); this._shellwm.completed_switch_workspace();
} }
}; };