2008-12-01 14:51:43 -05:00
|
|
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2008-10-31 19:09:46 -04:00
|
|
|
|
2008-11-20 19:53:11 -05:00
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const Gio = imports.gi.Gio;
|
|
|
|
const Gtk = imports.gi.Gtk;
|
2009-02-02 18:02:16 -05:00
|
|
|
const Mainloop = imports.mainloop;
|
2008-11-20 19:53:11 -05:00
|
|
|
const Shell = imports.gi.Shell;
|
2009-02-02 18:02:16 -05:00
|
|
|
const Signals = imports.signals;
|
2009-04-13 14:45:58 -04:00
|
|
|
const Lang = imports.lang;
|
2010-01-21 21:33:48 -05:00
|
|
|
const St = imports.gi.St;
|
2010-02-08 17:50:50 -05:00
|
|
|
const Gettext = imports.gettext.domain('gnome-shell');
|
|
|
|
const _ = Gettext.gettext;
|
2009-02-02 18:02:16 -05:00
|
|
|
|
2008-12-09 17:10:43 -05:00
|
|
|
const AppDisplay = imports.ui.appDisplay;
|
2008-12-19 23:27:57 -05:00
|
|
|
const DocDisplay = imports.ui.docDisplay;
|
2009-02-03 17:58:33 -05:00
|
|
|
const GenericDisplay = imports.ui.genericDisplay;
|
2009-02-02 18:02:16 -05:00
|
|
|
const Main = imports.ui.main;
|
|
|
|
const Panel = imports.ui.panel;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
const Dash = imports.ui.dash;
|
2009-02-10 11:12:58 -05:00
|
|
|
const Tweener = imports.ui.tweener;
|
2010-01-21 21:33:48 -05:00
|
|
|
const WorkspacesView = imports.ui.workspacesView;
|
2008-10-31 19:09:46 -04:00
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
// Time for initial animation going into Overview mode
|
2009-06-02 13:43:34 -04:00
|
|
|
const ANIMATION_TIME = 0.25;
|
2008-11-06 09:00:14 -05:00
|
|
|
|
2009-02-10 17:38:06 -05:00
|
|
|
// We divide the screen into a grid of rows and columns, which we use
|
2009-08-11 07:46:10 -04:00
|
|
|
// to help us position the Overview components, such as the side panel
|
2009-02-10 17:38:06 -05:00
|
|
|
// that lists applications and documents, the workspaces display, and
|
|
|
|
// the button for adding additional workspaces.
|
|
|
|
// In the regular mode, the side panel takes up one column on the left,
|
|
|
|
// and the workspaces display takes up the remaining columns.
|
|
|
|
// In the expanded side panel display mode, the side panel takes up two
|
|
|
|
// columns, and the workspaces display slides all the way to the right,
|
|
|
|
// being visible only in the last quarter of the right-most column.
|
|
|
|
// In the future, this mode will have more components, such as a display
|
|
|
|
// of documents which were recently opened with a given application, which
|
|
|
|
// will take up the remaining sections of the display.
|
|
|
|
|
|
|
|
const WIDE_SCREEN_CUT_OFF_RATIO = 1.4;
|
2009-09-25 16:59:38 -04:00
|
|
|
// A common netbook resolution is 1024x600, which trips the widescreen
|
|
|
|
// ratio. However that leaves way too few pixels for the dash. So
|
|
|
|
// just treat this as a regular screen.
|
|
|
|
const WIDE_SCREEN_MINIMUM_HEIGHT = 768;
|
2009-02-10 17:38:06 -05:00
|
|
|
|
|
|
|
const COLUMNS_REGULAR_SCREEN = 4;
|
|
|
|
const ROWS_REGULAR_SCREEN = 8;
|
|
|
|
const COLUMNS_WIDE_SCREEN = 5;
|
|
|
|
const ROWS_WIDE_SCREEN = 10;
|
2009-02-03 17:58:33 -05:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
const DEFAULT_PADDING = 4;
|
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
// Padding around workspace grid / Spacing between Dash and Workspaces
|
2009-02-10 17:38:06 -05:00
|
|
|
const WORKSPACE_GRID_PADDING = 12;
|
|
|
|
|
|
|
|
const COLUMNS_FOR_WORKSPACES_REGULAR_SCREEN = 3;
|
|
|
|
const ROWS_FOR_WORKSPACES_REGULAR_SCREEN = 6;
|
|
|
|
|
|
|
|
const COLUMNS_FOR_WORKSPACES_WIDE_SCREEN = 4;
|
|
|
|
const ROWS_FOR_WORKSPACES_WIDE_SCREEN = 8;
|
|
|
|
|
2009-04-01 15:51:17 -04:00
|
|
|
// A multi-state; PENDING is used during animations
|
|
|
|
const STATE_ACTIVE = true;
|
|
|
|
const STATE_PENDING_INACTIVE = false;
|
|
|
|
const STATE_INACTIVE = false;
|
|
|
|
|
2009-06-08 19:04:52 -04:00
|
|
|
const SHADOW_COLOR = new Clutter.Color();
|
|
|
|
SHADOW_COLOR.from_pixel(0x00000033);
|
|
|
|
const TRANSPARENT_COLOR = new Clutter.Color();
|
|
|
|
TRANSPARENT_COLOR.from_pixel(0x00000000);
|
|
|
|
|
|
|
|
const SHADOW_WIDTH = 6;
|
|
|
|
|
2009-06-24 18:24:48 -04:00
|
|
|
const NUMBER_OF_SECTIONS_IN_SEARCH = 2;
|
|
|
|
|
2010-05-12 16:31:36 -04:00
|
|
|
const INFO_BAR_HIDE_TIMEOUT = 10;
|
2010-02-08 17:50:50 -05:00
|
|
|
|
2009-02-10 17:38:06 -05:00
|
|
|
let wideScreen = false;
|
|
|
|
let displayGridColumnWidth = null;
|
|
|
|
let displayGridRowHeight = null;
|
2008-12-22 16:50:23 -05:00
|
|
|
|
2010-02-08 17:50:50 -05:00
|
|
|
function InfoBar() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
InfoBar.prototype = {
|
|
|
|
_init: function() {
|
|
|
|
this.actor = new St.Bin({ style_class: 'info-bar-panel',
|
|
|
|
x_fill: true,
|
|
|
|
y_fill: false });
|
|
|
|
this._label = new St.Label();
|
2010-03-10 09:14:56 -05:00
|
|
|
this._undo = new St.Button({ style_class: 'info-bar-link-button' });
|
2010-02-08 17:50:50 -05:00
|
|
|
|
2010-02-09 01:28:49 -05:00
|
|
|
let bin = new St.Bin({ x_fill: false,
|
2010-02-08 17:50:50 -05:00
|
|
|
y_fill: false,
|
|
|
|
x_align: St.Align.MIDDLE,
|
|
|
|
y_align: St.Align.MIDDLE });
|
|
|
|
this.actor.set_child(bin);
|
|
|
|
|
2010-02-09 01:28:49 -05:00
|
|
|
let box = new St.BoxLayout({ style_class: 'info-bar' });
|
2010-02-08 17:50:50 -05:00
|
|
|
bin.set_child(box);
|
|
|
|
this._timeoutId = 0;
|
|
|
|
|
|
|
|
box.add(this._label, {'y-fill' : false, 'y-align' : St.Align.MIDDLE});
|
|
|
|
box.add(this._undo);
|
|
|
|
|
|
|
|
this.actor.set_opacity(0);
|
|
|
|
|
|
|
|
this._undoCallback = null;
|
|
|
|
this._undo.connect('clicked', Lang.bind(this, this._onUndoClicked));
|
|
|
|
},
|
|
|
|
|
|
|
|
_onUndoClicked: function() {
|
|
|
|
Mainloop.source_remove(this._timeoutId);
|
|
|
|
this._timeoutId = 0;
|
|
|
|
|
|
|
|
if (this._undoCallback)
|
|
|
|
this._undoCallback();
|
|
|
|
this.actor.set_opacity(0);
|
|
|
|
this._undoCallback = null;
|
|
|
|
},
|
|
|
|
|
|
|
|
_hideDone: function() {
|
|
|
|
this._undoCallback = null;
|
|
|
|
},
|
|
|
|
|
|
|
|
_hide: function() {
|
|
|
|
Tweener.addTween(this.actor,
|
|
|
|
{ opacity: 0,
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
time: ANIMATION_TIME,
|
|
|
|
onComplete: this._hideDone,
|
|
|
|
onCompleteScope: this
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
_onTimeout: function() {
|
|
|
|
this._timeoutId = 0;
|
2010-05-12 16:31:36 -04:00
|
|
|
this._hide();
|
2010-02-08 17:50:50 -05:00
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
2010-03-10 09:14:56 -05:00
|
|
|
setMessage: function(text, undoCallback, undoLabel) {
|
2010-02-08 17:50:50 -05:00
|
|
|
if (this._timeoutId)
|
|
|
|
Mainloop.source_remove(this._timeoutId);
|
|
|
|
|
|
|
|
this._timeout = false;
|
|
|
|
|
2010-02-09 01:28:49 -05:00
|
|
|
this._label.text = text;
|
2010-02-08 17:50:50 -05:00
|
|
|
|
|
|
|
Tweener.addTween(this.actor,
|
|
|
|
{ opacity: 255,
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
time: ANIMATION_TIME
|
|
|
|
});
|
|
|
|
|
|
|
|
this._timeoutId = Mainloop.timeout_add_seconds(INFO_BAR_HIDE_TIMEOUT, Lang.bind(this, this._onTimeout));
|
|
|
|
|
2010-03-10 09:14:56 -05:00
|
|
|
if (undoLabel)
|
|
|
|
this._undo.label = undoLabel;
|
|
|
|
else
|
|
|
|
this._undo.label = _("Undo");
|
|
|
|
|
2010-02-08 17:50:50 -05:00
|
|
|
this._undoCallback = undoCallback;
|
|
|
|
if (undoCallback)
|
|
|
|
this._undo.show();
|
|
|
|
else
|
|
|
|
this._undo.hide();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
function Overview() {
|
2009-03-31 14:12:33 -04:00
|
|
|
this._init();
|
2008-11-20 19:53:11 -05:00
|
|
|
}
|
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
Overview.prototype = {
|
2009-03-31 14:12:33 -04:00
|
|
|
_init : function() {
|
2010-02-09 01:28:08 -05:00
|
|
|
this._group = new St.BoxLayout({ style_class: 'overview' });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._group._delegate = this;
|
2009-06-24 18:24:48 -04:00
|
|
|
|
2010-02-08 17:50:50 -05:00
|
|
|
this.infoBar = new InfoBar();
|
|
|
|
this._group.add_actor(this.infoBar.actor);
|
|
|
|
|
2010-02-14 18:32:57 -05:00
|
|
|
this._workspacesManager = null;
|
2010-01-21 21:33:48 -05:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this.visible = false;
|
2009-08-07 18:22:05 -04:00
|
|
|
this.animationInProgress = false;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._hideInProgress = false;
|
2009-06-24 18:24:48 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._recalculateGridSizes();
|
2009-06-24 18:24:48 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._activeDisplayPane = null;
|
2009-06-24 18:24:48 -04:00
|
|
|
|
2009-09-13 14:54:56 -04:00
|
|
|
// During transitions, we raise this to the top to avoid having the overview
|
|
|
|
// area be reactive; it causes too many issues such as double clicks on
|
|
|
|
// Dash elements, or mouseover handlers in the workspaces.
|
|
|
|
this._coverPane = new Clutter.Rectangle({ opacity: 0,
|
|
|
|
reactive: true });
|
|
|
|
this._group.add_actor(this._coverPane);
|
|
|
|
this._coverPane.connect('event', Lang.bind(this, function (actor, event) { return true; }));
|
|
|
|
|
|
|
|
// Similar to the cover pane but used for dialogs ("panes"); see the comments
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// in addPane below.
|
|
|
|
this._transparentBackground = new Clutter.Rectangle({ opacity: 0,
|
|
|
|
reactive: true });
|
|
|
|
this._group.add_actor(this._transparentBackground);
|
2009-06-24 18:24:48 -04:00
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
// Background color for the Overview
|
2010-02-09 01:28:08 -05:00
|
|
|
this._backOver = new St.Label();
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._group.add_actor(this._backOver);
|
2009-06-24 18:24:48 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._group.hide();
|
|
|
|
global.overlay_group.add_actor(this._group);
|
2009-06-24 18:24:48 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// TODO - recalculate everything when desktop size changes
|
2009-08-09 19:48:54 -04:00
|
|
|
this._dash = new Dash.Dash();
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._group.add_actor(this._dash.actor);
|
2009-06-24 18:24:48 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// Container to hold popup pane chrome.
|
2010-02-15 19:50:36 -05:00
|
|
|
this._paneContainer = new St.BoxLayout({ style_class: 'overview-pane' });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// Note here we explicitly don't set the paneContainer to be reactive yet; that's done
|
|
|
|
// inside the notify::visible handler on panes.
|
|
|
|
this._paneContainer.connect('button-release-event', Lang.bind(this, function(background) {
|
|
|
|
this._activeDisplayPane.close();
|
|
|
|
return true;
|
|
|
|
}));
|
|
|
|
this._group.add_actor(this._paneContainer);
|
2009-07-04 12:46:35 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._transparentBackground.lower_bottom();
|
2010-02-15 19:50:36 -05:00
|
|
|
this._paneContainer.hide();
|
2009-07-04 12:46:35 -04:00
|
|
|
|
2009-09-13 14:54:56 -04:00
|
|
|
this._coverPane.lower_bottom();
|
|
|
|
|
2010-04-14 16:22:41 -04:00
|
|
|
this.workspaces = null;
|
2009-06-24 18:24:48 -04:00
|
|
|
},
|
|
|
|
|
2010-01-21 21:33:48 -05:00
|
|
|
_onViewChanged: function() {
|
|
|
|
if (!this.visible)
|
|
|
|
return;
|
|
|
|
|
2010-04-14 16:22:41 -04:00
|
|
|
this.workspaces = this._workspacesManager.workspacesView;
|
2010-01-21 21:33:48 -05:00
|
|
|
|
2010-02-12 15:12:39 -05:00
|
|
|
// Show new workspacesView
|
2010-04-14 16:22:41 -04:00
|
|
|
this._group.add_actor(this.workspaces.actor);
|
|
|
|
this._workspacesBar.raise(this.workspaces.actor);
|
|
|
|
this._dash.actor.raise(this.workspaces.actor);
|
2010-01-21 21:33:48 -05:00
|
|
|
},
|
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
_recalculateGridSizes: function () {
|
2009-08-25 15:23:53 -04:00
|
|
|
let primary = global.get_primary_monitor();
|
|
|
|
wideScreen = (primary.width/primary.height > WIDE_SCREEN_CUT_OFF_RATIO) &&
|
|
|
|
(primary.height >= WIDE_SCREEN_MINIMUM_HEIGHT);
|
2009-02-10 17:38:06 -05:00
|
|
|
|
|
|
|
// We divide the screen into an imaginary grid which helps us determine the layout of
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// different visual components.
|
2009-02-10 17:38:06 -05:00
|
|
|
if (wideScreen) {
|
2009-11-13 18:51:07 -05:00
|
|
|
displayGridColumnWidth = Math.floor(primary.width / COLUMNS_WIDE_SCREEN);
|
|
|
|
displayGridRowHeight = Math.floor(primary.height / ROWS_WIDE_SCREEN);
|
2009-02-10 17:38:06 -05:00
|
|
|
} else {
|
2009-11-13 18:51:07 -05:00
|
|
|
displayGridColumnWidth = Math.floor(primary.width / COLUMNS_REGULAR_SCREEN);
|
|
|
|
displayGridRowHeight = Math.floor(primary.height / ROWS_REGULAR_SCREEN);
|
2009-02-10 17:38:06 -05:00
|
|
|
}
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
},
|
2009-02-10 17:38:06 -05:00
|
|
|
|
2009-08-11 11:16:25 -04:00
|
|
|
relayout: function () {
|
2009-08-25 15:23:53 -04:00
|
|
|
let primary = global.get_primary_monitor();
|
2009-12-25 06:27:09 -05:00
|
|
|
let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL);
|
2009-08-25 15:23:53 -04:00
|
|
|
|
2010-01-19 12:59:29 -05:00
|
|
|
this._recalculateGridSizes();
|
|
|
|
|
2009-08-25 15:23:53 -04:00
|
|
|
this._group.set_position(primary.x, primary.y);
|
2009-08-09 19:48:54 -04:00
|
|
|
|
2009-09-13 14:54:56 -04:00
|
|
|
let contentY = Panel.PANEL_HEIGHT;
|
2009-08-25 15:23:53 -04:00
|
|
|
let contentHeight = primary.height - contentY;
|
2009-09-13 14:54:56 -04:00
|
|
|
|
|
|
|
this._coverPane.set_position(0, contentY);
|
2009-08-25 15:23:53 -04:00
|
|
|
this._coverPane.set_size(primary.width, contentHeight);
|
2009-08-09 19:48:54 -04:00
|
|
|
|
|
|
|
let workspaceColumnsUsed = wideScreen ? COLUMNS_FOR_WORKSPACES_WIDE_SCREEN : COLUMNS_FOR_WORKSPACES_REGULAR_SCREEN;
|
|
|
|
let workspaceRowsUsed = wideScreen ? ROWS_FOR_WORKSPACES_WIDE_SCREEN : ROWS_FOR_WORKSPACES_REGULAR_SCREEN;
|
|
|
|
|
|
|
|
this._workspacesWidth = displayGridColumnWidth * workspaceColumnsUsed
|
|
|
|
- WORKSPACE_GRID_PADDING * 2;
|
2009-08-25 15:23:53 -04:00
|
|
|
// We scale the vertical padding by (primary.height / primary.width)
|
2009-08-09 19:48:54 -04:00
|
|
|
// so that the workspace preserves its aspect ratio.
|
2009-11-13 18:51:07 -05:00
|
|
|
this._workspacesHeight = Math.floor(displayGridRowHeight * workspaceRowsUsed
|
|
|
|
- WORKSPACE_GRID_PADDING * (primary.height / primary.width) * 2);
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2009-12-25 06:27:09 -05:00
|
|
|
if (rtl) {
|
|
|
|
this._workspacesX = WORKSPACE_GRID_PADDING;
|
|
|
|
} else {
|
|
|
|
this._workspacesX = displayGridColumnWidth + WORKSPACE_GRID_PADDING;
|
|
|
|
}
|
2009-11-13 18:51:07 -05:00
|
|
|
this._workspacesY = Math.floor(displayGridRowHeight + WORKSPACE_GRID_PADDING * (primary.height / primary.width));
|
2009-08-09 19:48:54 -04:00
|
|
|
|
2009-12-25 06:27:09 -05:00
|
|
|
if (rtl) {
|
|
|
|
this._dash.actor.set_position(primary.width - displayGridColumnWidth, contentY);
|
|
|
|
} else {
|
|
|
|
this._dash.actor.set_position(0, contentY);
|
|
|
|
}
|
|
|
|
|
2009-09-13 14:54:56 -04:00
|
|
|
this._dash.actor.set_size(displayGridColumnWidth, contentHeight);
|
|
|
|
this._dash.searchArea.height = this._workspacesY - contentY;
|
2009-08-09 19:48:54 -04:00
|
|
|
this._dash.sectionArea.height = this._workspacesHeight;
|
2009-11-29 17:45:30 -05:00
|
|
|
this._dash.searchResults.actor.height = this._workspacesHeight;
|
2009-08-09 19:48:54 -04:00
|
|
|
|
2010-02-08 17:50:50 -05:00
|
|
|
this.infoBar.actor.set_position(displayGridColumnWidth, Panel.PANEL_HEIGHT);
|
|
|
|
this.infoBar.actor.set_size(primary.width - displayGridColumnWidth, this._workspacesY - Panel.PANEL_HEIGHT);
|
|
|
|
this.infoBar.actor.raise_top();
|
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
// place the 'Add Workspace' button in the bottom row of the grid
|
2010-01-21 21:33:48 -05:00
|
|
|
this._workspacesBarX = this._workspacesX;
|
2010-02-11 14:06:12 -05:00
|
|
|
this._workspacesBarWidth = this._workspacesWidth;
|
2010-01-23 05:22:38 -05:00
|
|
|
this._workspacesBarY = primary.height - displayGridRowHeight;
|
2009-06-08 19:04:52 -04:00
|
|
|
|
2009-10-07 15:25:41 -04:00
|
|
|
// The parent (this._group) is positioned at the top left of the primary monitor
|
|
|
|
// while this._backOver occupies the entire screen.
|
|
|
|
this._backOver.set_position(- primary.x, - primary.y);
|
2009-08-25 15:23:53 -04:00
|
|
|
this._backOver.set_size(global.screen_width, global.screen_height);
|
2009-04-21 20:23:06 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._paneContainer.set_position(this._dash.actor.x + this._dash.actor.width + DEFAULT_PADDING,
|
2009-11-06 17:15:34 -05:00
|
|
|
this._workspacesY);
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// Dynamic width
|
2009-11-06 17:15:34 -05:00
|
|
|
this._paneContainer.height = this._workspacesHeight;
|
2009-12-25 06:27:09 -05:00
|
|
|
if (rtl) {
|
|
|
|
this._paneContainer.connect('notify::width', Lang.bind(this, function (paneContainer) {
|
|
|
|
paneContainer.x = this._dash.actor.x - (DEFAULT_PADDING + paneContainer.width);
|
|
|
|
}));
|
|
|
|
}
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2010-03-03 18:10:16 -05:00
|
|
|
this._transparentBackground.set_position(primary.x, primary.y);
|
|
|
|
this._transparentBackground.set_size(primary.width, primary.height);
|
2009-08-09 19:48:54 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
},
|
|
|
|
|
2010-03-10 10:54:00 -05:00
|
|
|
addPane: function (pane, align) {
|
|
|
|
pane.actor.height = .9 * this._workspacesHeight;
|
|
|
|
this._paneContainer.add(pane.actor, { expand: true,
|
|
|
|
y_fill: false,
|
|
|
|
y_align: align });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// When a pane is displayed, we raise the transparent background to the top
|
|
|
|
// and connect to button-release-event on it, then raise the pane above that.
|
|
|
|
// The idea here is that clicking anywhere outside the pane should close it.
|
|
|
|
// When the active pane is closed, undo the effect.
|
|
|
|
let backgroundEventId = null;
|
|
|
|
pane.connect('open-state-changed', Lang.bind(this, function (pane, isOpen) {
|
|
|
|
if (isOpen) {
|
|
|
|
this._activeDisplayPane = pane;
|
|
|
|
this._transparentBackground.raise_top();
|
|
|
|
this._paneContainer.raise_top();
|
2010-02-15 19:50:36 -05:00
|
|
|
this._paneContainer.show();
|
2010-03-03 18:10:16 -05:00
|
|
|
this._paneReady = false;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
if (backgroundEventId != null)
|
|
|
|
this._transparentBackground.disconnect(backgroundEventId);
|
2010-03-03 18:10:16 -05:00
|
|
|
backgroundEventId = this._transparentBackground.connect('captured-event', Lang.bind(this, function (actor, event) {
|
|
|
|
if (event.get_source() != this._transparentBackground)
|
|
|
|
return false;
|
|
|
|
if (event.type() == Clutter.EventType.BUTTON_PRESS)
|
|
|
|
this._paneReady = true;
|
|
|
|
if (event.type() == Clutter.EventType.BUTTON_RELEASE
|
|
|
|
&& this._paneReady)
|
|
|
|
this._activeDisplayPane.close();
|
2009-06-08 19:04:52 -04:00
|
|
|
return true;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}));
|
2010-04-14 16:22:41 -04:00
|
|
|
this.workspaces.actor.opacity = 64;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
} else if (pane == this._activeDisplayPane) {
|
|
|
|
this._activeDisplayPane = null;
|
|
|
|
if (backgroundEventId != null) {
|
|
|
|
this._transparentBackground.disconnect(backgroundEventId);
|
|
|
|
backgroundEventId = null;
|
|
|
|
}
|
|
|
|
this._transparentBackground.lower_bottom();
|
2010-02-15 19:50:36 -05:00
|
|
|
this._paneContainer.hide();
|
2010-04-14 16:22:41 -04:00
|
|
|
this.workspaces.actor.opacity = 255;
|
2009-02-10 17:38:06 -05:00
|
|
|
}
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}));
|
2008-12-01 14:51:43 -05:00
|
|
|
},
|
|
|
|
|
2009-03-11 15:21:45 -04:00
|
|
|
//// Draggable target interface ////
|
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// Closes any active panes if a GenericDisplayItem is being
|
2009-08-11 07:46:10 -04:00
|
|
|
// dragged over the Overview, i.e. as soon as it starts being dragged.
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// This allows the user to place the item on any workspace.
|
2009-03-11 15:21:45 -04:00
|
|
|
handleDragOver : function(source, actor, x, y, time) {
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
if (source instanceof GenericDisplay.GenericDisplayItem
|
2009-12-08 12:51:05 -05:00
|
|
|
|| source instanceof AppDisplay.AppIcon) {
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
if (this._activeDisplayPane != null)
|
|
|
|
this._activeDisplayPane.close();
|
2009-06-08 19:04:52 -04:00
|
|
|
return true;
|
|
|
|
}
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-03-11 15:21:45 -04:00
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
//// Public methods ////
|
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
// Returns the scale the Overview has when we just start zooming out
|
2009-08-10 18:31:39 -04:00
|
|
|
// to overview mode. That is, when just the active workspace is showing.
|
|
|
|
getZoomedInScale : function() {
|
2010-04-14 16:22:41 -04:00
|
|
|
return 1 / this.workspaces.getScale();
|
2009-08-10 18:31:39 -04:00
|
|
|
},
|
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
// Returns the position the Overview has when we just start zooming out
|
2009-08-10 18:31:39 -04:00
|
|
|
// to overview mode. That is, when just the active workspace is showing.
|
|
|
|
getZoomedInPosition : function() {
|
2010-04-14 16:22:41 -04:00
|
|
|
let [posX, posY] = this.workspaces.getActiveWorkspacePosition();
|
2009-08-10 18:31:39 -04:00
|
|
|
let scale = this.getZoomedInScale();
|
|
|
|
|
|
|
|
return [- posX * scale, - posY * scale];
|
|
|
|
},
|
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
// Returns the current scale of the Overview.
|
2009-08-10 18:31:39 -04:00
|
|
|
getScale : function() {
|
|
|
|
return this._group.scaleX;
|
|
|
|
},
|
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
// Returns the current position of the Overview.
|
2009-08-10 18:31:39 -04:00
|
|
|
getPosition : function() {
|
|
|
|
return [this._group.x, this._group.y];
|
|
|
|
},
|
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
show : function() {
|
|
|
|
if (this.visible)
|
|
|
|
return;
|
2009-09-16 11:37:51 -04:00
|
|
|
if (!Main.pushModal(this._dash.actor))
|
|
|
|
return;
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
this.visible = true;
|
2009-08-07 18:22:05 -04:00
|
|
|
this.animationInProgress = true;
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
this._dash.show();
|
2009-02-20 11:57:30 -05:00
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
/* TODO: make this stuff dynamic */
|
2010-02-14 18:32:57 -05:00
|
|
|
this._workspacesManager =
|
|
|
|
new WorkspacesView.WorkspacesManager(this._workspacesWidth,
|
|
|
|
this._workspacesHeight,
|
|
|
|
this._workspacesX,
|
|
|
|
this._workspacesY);
|
|
|
|
this._workspacesManager.connect('view-changed',
|
|
|
|
Lang.bind(this, this._onViewChanged));
|
2010-04-14 16:22:41 -04:00
|
|
|
this.workspaces = this._workspacesManager.workspacesView;
|
|
|
|
this._group.add_actor(this.workspaces.actor);
|
2008-12-01 14:51:43 -05:00
|
|
|
|
2009-08-12 15:09:56 -04:00
|
|
|
// The workspaces actor is as big as the screen, so we have to raise the dash above it
|
|
|
|
// for drag and drop to work. In the future we should fix the workspaces to not
|
|
|
|
// be as big as the screen.
|
2010-04-14 16:22:41 -04:00
|
|
|
this._dash.actor.raise(this.workspaces.actor);
|
2009-08-12 15:09:56 -04:00
|
|
|
|
2010-02-14 18:32:57 -05:00
|
|
|
this._workspacesBar = this._workspacesManager.controlsBar.actor;
|
2010-02-12 15:12:39 -05:00
|
|
|
this._workspacesBar.set_position(this._workspacesBarX,
|
|
|
|
this._workspacesBarY);
|
|
|
|
this._workspacesBar.width = this._workspacesBarWidth;
|
|
|
|
|
|
|
|
this._group.add_actor(this._workspacesBar);
|
2010-04-14 16:22:41 -04:00
|
|
|
this._workspacesBar.raise(this.workspaces.actor);
|
2009-09-01 11:56:41 -04:00
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
// All the the actors in the window group are completely obscured,
|
2009-08-11 07:46:10 -04:00
|
|
|
// hiding the group holding them while the Overview is displayed greatly
|
|
|
|
// increases performance of the Overview especially when there are many
|
2008-12-01 14:51:43 -05:00
|
|
|
// windows visible.
|
|
|
|
//
|
2009-08-11 07:46:10 -04:00
|
|
|
// If we switched to displaying the actors in the Overview rather than
|
2008-12-01 14:51:43 -05:00
|
|
|
// clones of them, this would obviously no longer be necessary.
|
2008-12-02 11:15:00 -05:00
|
|
|
global.window_group.hide();
|
2008-12-01 14:51:43 -05:00
|
|
|
this._group.show();
|
2009-03-20 12:06:34 -04:00
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
// Create a zoom out effect. First scale the Overview group up and
|
2009-08-10 18:31:39 -04:00
|
|
|
// position it so that the active workspace fills up the whole screen,
|
|
|
|
// then transform the group to its normal dimensions and position.
|
|
|
|
// The opposite transition is used in hide().
|
|
|
|
this._group.scaleX = this._group.scaleY = this.getZoomedInScale();
|
|
|
|
[this._group.x, this._group.y] = this.getZoomedInPosition();
|
2009-10-07 15:25:41 -04:00
|
|
|
let primary = global.get_primary_monitor();
|
2009-08-10 18:31:39 -04:00
|
|
|
Tweener.addTween(this._group,
|
2009-10-07 15:25:41 -04:00
|
|
|
{ x: primary.x,
|
|
|
|
y: primary.y,
|
2009-08-10 18:31:39 -04:00
|
|
|
scaleX: 1,
|
|
|
|
scaleY: 1,
|
|
|
|
transition: 'easeOutQuad',
|
2009-04-21 20:23:06 -04:00
|
|
|
time: ANIMATION_TIME,
|
|
|
|
onComplete: this._showDone,
|
2009-03-20 12:06:34 -04:00
|
|
|
onCompleteScope: this
|
2009-08-10 18:31:39 -04:00
|
|
|
});
|
2009-04-21 20:23:06 -04:00
|
|
|
|
2010-02-12 15:12:39 -05:00
|
|
|
// Make Dash fade in so that it doesn't appear too big.
|
2009-08-10 18:31:39 -04:00
|
|
|
this._dash.actor.opacity = 0;
|
|
|
|
Tweener.addTween(this._dash.actor,
|
|
|
|
{ opacity: 255,
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
time: ANIMATION_TIME
|
2009-03-20 12:06:34 -04:00
|
|
|
});
|
2009-05-07 09:47:48 -04:00
|
|
|
|
2009-09-13 14:54:56 -04:00
|
|
|
this._coverPane.raise_top();
|
2009-05-07 09:47:48 -04:00
|
|
|
this.emit('showing');
|
2008-12-01 14:51:43 -05:00
|
|
|
},
|
|
|
|
|
2009-09-11 12:39:59 -04:00
|
|
|
hide: function() {
|
2009-03-20 12:06:34 -04:00
|
|
|
if (!this.visible || this._hideInProgress)
|
2008-12-01 14:51:43 -05:00
|
|
|
return;
|
|
|
|
|
2009-08-07 18:22:05 -04:00
|
|
|
this.animationInProgress = true;
|
2009-03-20 12:06:34 -04:00
|
|
|
this._hideInProgress = true;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
if (this._activeDisplayPane != null)
|
|
|
|
this._activeDisplayPane.close();
|
2010-04-14 16:22:41 -04:00
|
|
|
this.workspaces.hide();
|
2008-12-04 10:16:16 -05:00
|
|
|
|
2009-08-11 07:46:10 -04:00
|
|
|
// Create a zoom in effect by transforming the Overview group so that
|
2009-08-10 18:31:39 -04:00
|
|
|
// the active workspace fills up the whole screen. The opposite
|
|
|
|
// transition is used in show().
|
|
|
|
let scale = this.getZoomedInScale();
|
|
|
|
let [posX, posY] = this.getZoomedInPosition();
|
|
|
|
Tweener.addTween(this._group,
|
|
|
|
{ x: posX,
|
|
|
|
y: posY,
|
|
|
|
scaleX: scale,
|
|
|
|
scaleY: scale,
|
|
|
|
transition: 'easeOutQuad',
|
2009-04-21 20:23:06 -04:00
|
|
|
time: ANIMATION_TIME,
|
2008-12-04 10:16:16 -05:00
|
|
|
onComplete: this._hideDone,
|
|
|
|
onCompleteScope: this
|
2009-08-10 18:31:39 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// Make Dash fade out so that it doesn't appear to big.
|
|
|
|
Tweener.addTween(this._dash.actor,
|
|
|
|
{ opacity: 0,
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
time: ANIMATION_TIME
|
2008-12-04 10:16:16 -05:00
|
|
|
});
|
2009-05-07 09:47:48 -04:00
|
|
|
|
2009-09-13 14:54:56 -04:00
|
|
|
this._coverPane.raise_top();
|
2009-05-07 09:47:48 -04:00
|
|
|
this.emit('hiding');
|
|
|
|
},
|
|
|
|
|
|
|
|
toggle: function() {
|
|
|
|
if (this.visible)
|
|
|
|
this.hide();
|
|
|
|
else
|
|
|
|
this.show();
|
2008-12-04 10:16:16 -05:00
|
|
|
},
|
2008-12-15 15:48:59 -05:00
|
|
|
|
2009-09-11 12:47:53 -04:00
|
|
|
/**
|
|
|
|
* getWorkspacesForWindow:
|
|
|
|
* @metaWindow: A #MetaWindow
|
|
|
|
*
|
|
|
|
* Returns the Workspaces object associated with the given window.
|
|
|
|
* This method is not be accessible if the overview is not open
|
|
|
|
* and will return %null.
|
|
|
|
*/
|
|
|
|
getWorkspacesForWindow: function(metaWindow) {
|
2010-04-14 16:22:41 -04:00
|
|
|
return this.workspaces;
|
2009-09-11 12:47:53 -04:00
|
|
|
},
|
|
|
|
|
2009-03-11 15:21:45 -04:00
|
|
|
//// Private methods ////
|
|
|
|
|
2009-04-21 20:23:06 -04:00
|
|
|
_showDone: function() {
|
2009-03-20 12:06:34 -04:00
|
|
|
if (this._hideInProgress)
|
|
|
|
return;
|
|
|
|
|
2009-08-07 18:22:05 -04:00
|
|
|
this.animationInProgress = false;
|
2009-09-13 14:54:56 -04:00
|
|
|
this._coverPane.lower_bottom();
|
2009-08-07 18:22:05 -04:00
|
|
|
|
2009-05-07 09:47:48 -04:00
|
|
|
this.emit('shown');
|
2009-04-21 20:23:06 -04:00
|
|
|
},
|
2009-03-20 12:06:34 -04:00
|
|
|
|
2008-12-04 10:16:16 -05:00
|
|
|
_hideDone: function() {
|
2008-12-02 11:15:00 -05:00
|
|
|
global.window_group.show();
|
2008-12-15 15:48:59 -05:00
|
|
|
|
2010-04-14 16:22:41 -04:00
|
|
|
this.workspaces.destroy();
|
|
|
|
this.workspaces = null;
|
2009-02-03 17:58:33 -05:00
|
|
|
|
2010-02-12 15:12:39 -05:00
|
|
|
this._workspacesBar.destroy();
|
|
|
|
this._workspacesBar = null;
|
|
|
|
|
2010-02-14 18:32:57 -05:00
|
|
|
this._workspacesManager = null;
|
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
this._dash.hide();
|
2009-02-03 17:58:33 -05:00
|
|
|
this._group.hide();
|
2009-03-20 12:06:34 -04:00
|
|
|
|
2010-01-21 21:33:48 -05:00
|
|
|
this.visible = false;
|
2009-08-07 18:22:05 -04:00
|
|
|
this.animationInProgress = false;
|
2009-03-20 12:06:34 -04:00
|
|
|
this._hideInProgress = false;
|
2008-12-01 14:51:43 -05:00
|
|
|
|
2009-09-13 14:54:56 -04:00
|
|
|
this._coverPane.lower_bottom();
|
|
|
|
|
2009-09-15 15:53:07 -04:00
|
|
|
Main.popModal(this._dash.actor);
|
2009-05-07 09:47:48 -04:00
|
|
|
this.emit('hidden');
|
2008-12-01 14:51:43 -05:00
|
|
|
}
|
2008-10-31 19:09:46 -04:00
|
|
|
};
|
2009-08-11 07:46:10 -04:00
|
|
|
Signals.addSignalMethods(Overview.prototype);
|