2008-12-01 19:51:43 +00:00
|
|
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2008-10-31 23:09:46 +00:00
|
|
|
|
2009-02-02 23:02:16 +00:00
|
|
|
const Big = imports.gi.Big;
|
2008-11-21 00:53:11 +00:00
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const Gio = imports.gi.Gio;
|
|
|
|
const Gtk = imports.gi.Gtk;
|
2009-02-02 23:02:16 +00:00
|
|
|
const Mainloop = imports.mainloop;
|
2008-11-21 00:53:11 +00:00
|
|
|
const Shell = imports.gi.Shell;
|
2009-02-02 23:02:16 +00:00
|
|
|
const Signals = imports.signals;
|
2009-04-13 18:45:58 +00:00
|
|
|
const Lang = imports.lang;
|
2009-02-02 23:02:16 +00:00
|
|
|
|
2008-12-09 22:10:43 +00:00
|
|
|
const AppDisplay = imports.ui.appDisplay;
|
2008-12-20 04:27:57 +00:00
|
|
|
const DocDisplay = imports.ui.docDisplay;
|
2009-02-03 22:58:33 +00:00
|
|
|
const GenericDisplay = imports.ui.genericDisplay;
|
2009-02-26 22:05:35 +00:00
|
|
|
const Link = imports.ui.link;
|
2009-02-02 23:02:16 +00: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-08-01 02:12:01 +00:00
|
|
|
const Dash = imports.ui.dash;
|
2009-02-10 16:12:58 +00:00
|
|
|
const Tweener = imports.ui.tweener;
|
2009-02-02 23:02:16 +00:00
|
|
|
const Workspaces = imports.ui.workspaces;
|
2008-10-31 23:09:46 +00:00
|
|
|
|
2009-04-22 00:23:06 +00:00
|
|
|
const ROOT_OVERLAY_COLOR = new Clutter.Color();
|
|
|
|
ROOT_OVERLAY_COLOR.from_pixel(0x000000bb);
|
|
|
|
|
|
|
|
// The factor to scale the overlay wallpaper with. This should not be less
|
|
|
|
// than 3/2, because the rule of thirds is used for positioning (see below).
|
|
|
|
const BACKGROUND_SCALE = 2;
|
2008-10-31 23:09:46 +00:00
|
|
|
|
2008-12-01 19:51:43 +00:00
|
|
|
// Time for initial animation going into overlay mode
|
2009-06-02 17:43:34 +00:00
|
|
|
const ANIMATION_TIME = 0.25;
|
2008-11-06 14:00:14 +00:00
|
|
|
|
2009-02-10 22:38:06 +00:00
|
|
|
// We divide the screen into a grid of rows and columns, which we use
|
|
|
|
// to help us position the overlay components, such as the side panel
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
const COLUMNS_REGULAR_SCREEN = 4;
|
|
|
|
const ROWS_REGULAR_SCREEN = 8;
|
|
|
|
const COLUMNS_WIDE_SCREEN = 5;
|
|
|
|
const ROWS_WIDE_SCREEN = 10;
|
2009-02-03 22:58:33 +00: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-08-01 02:12:01 +00:00
|
|
|
const DEFAULT_PADDING = 4;
|
|
|
|
|
2009-06-02 17:13:51 +00:00
|
|
|
// Padding around workspace grid / Spacing between Dash and Workspaces
|
2009-02-10 22:38:06 +00: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 19:51:17 +00: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 23:04:52 +00: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 22:24:48 +00:00
|
|
|
const NUMBER_OF_SECTIONS_IN_SEARCH = 2;
|
|
|
|
|
2009-02-10 22:38:06 +00:00
|
|
|
let wideScreen = false;
|
|
|
|
let displayGridColumnWidth = null;
|
|
|
|
let displayGridRowHeight = null;
|
2008-12-22 21:50:23 +00: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-08-01 02:12:01 +00:00
|
|
|
function Overlay() {
|
2009-03-31 18:12:33 +00:00
|
|
|
this._init();
|
2008-11-21 00:53:11 +00: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-08-01 02:12:01 +00:00
|
|
|
Overlay.prototype = {
|
2009-03-31 18:12:33 +00:00
|
|
|
_init : function() {
|
2008-12-01 19:51:43 +00:00
|
|
|
let me = this;
|
|
|
|
|
2009-04-28 19:35:36 +00:00
|
|
|
let global = Shell.Global.get();
|
|
|
|
|
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-08-01 02:12:01 +00:00
|
|
|
this._group = new Clutter.Group();
|
|
|
|
this._group._delegate = this;
|
2009-06-24 22:24:48 +00: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-08-01 02:12:01 +00:00
|
|
|
this.visible = false;
|
|
|
|
this._hideInProgress = false;
|
2009-06-24 22:24:48 +00: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-08-01 02:12:01 +00:00
|
|
|
this._recalculateGridSizes();
|
2009-06-24 22:24:48 +00: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-08-01 02:12:01 +00:00
|
|
|
// A scaled root pixmap actor is used as a background. It is zoomed in
|
|
|
|
// to the lower right intersection of the lines that divide the image
|
|
|
|
// evenly in a 3x3 grid. This is based on the rule of thirds, a
|
|
|
|
// compositional rule of thumb in visual arts. The choice for the
|
|
|
|
// lower right point is based on a quick survey of GNOME wallpapers.
|
|
|
|
this._background = global.create_root_pixmap_actor();
|
|
|
|
this._group.add_actor(this._background);
|
2009-07-04 16:46:35 +00: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-08-01 02:12:01 +00:00
|
|
|
this._activeDisplayPane = null;
|
2009-06-24 22:24:48 +00: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-08-01 02:12:01 +00:00
|
|
|
// Used to catch any clicks when we have an active pane; see the comments
|
|
|
|
// in addPane below.
|
|
|
|
this._transparentBackground = new Clutter.Rectangle({ opacity: 0,
|
|
|
|
reactive: true });
|
|
|
|
this._group.add_actor(this._transparentBackground);
|
2009-06-24 22:24:48 +00: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-08-01 02:12:01 +00:00
|
|
|
// Draw a semitransparent rectangle over the background for readability.
|
|
|
|
this._backOver = new Clutter.Rectangle({ color: ROOT_OVERLAY_COLOR });
|
|
|
|
this._group.add_actor(this._backOver);
|
2009-06-24 22:24:48 +00: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-08-01 02:12:01 +00:00
|
|
|
this._group.hide();
|
|
|
|
global.overlay_group.add_actor(this._group);
|
2009-06-24 22:24:48 +00: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-08-01 02:12:01 +00:00
|
|
|
// TODO - recalculate everything when desktop size changes
|
|
|
|
this._dash = new Dash.Dash(displayGridColumnWidth);
|
|
|
|
this._group.add_actor(this._dash.actor);
|
2009-06-24 22:24:48 +00: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-08-01 02:12:01 +00:00
|
|
|
// Container to hold popup pane chrome.
|
|
|
|
this._paneContainer = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
|
|
|
spacing: 6
|
|
|
|
});
|
|
|
|
// 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 16:46:35 +00: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-08-01 02:12:01 +00:00
|
|
|
this._transparentBackground.lower_bottom();
|
|
|
|
this._paneContainer.lower_bottom();
|
2009-07-04 16:46:35 +00: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-08-01 02:12:01 +00:00
|
|
|
this._repositionChildren();
|
2009-07-29 17:35:11 +00: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-08-01 02:12:01 +00:00
|
|
|
this._workspaces = null;
|
2009-06-24 22:24:48 +00: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-08-01 02:12:01 +00:00
|
|
|
_recalculateGridSizes: function () {
|
2008-12-01 19:51:43 +00:00
|
|
|
let global = Shell.Global.get();
|
2008-11-28 20:12:20 +00:00
|
|
|
|
2009-02-10 22:38:06 +00:00
|
|
|
wideScreen = (global.screen_width/global.screen_height > WIDE_SCREEN_CUT_OFF_RATIO);
|
|
|
|
|
|
|
|
// 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-08-01 02:12:01 +00:00
|
|
|
// different visual components.
|
2009-02-10 22:38:06 +00:00
|
|
|
if (wideScreen) {
|
|
|
|
displayGridColumnWidth = global.screen_width / COLUMNS_WIDE_SCREEN;
|
|
|
|
displayGridRowHeight = global.screen_height / ROWS_WIDE_SCREEN;
|
|
|
|
} else {
|
|
|
|
displayGridColumnWidth = global.screen_width / COLUMNS_REGULAR_SCREEN;
|
|
|
|
displayGridRowHeight = global.screen_height / ROWS_REGULAR_SCREEN;
|
|
|
|
}
|
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-08-01 02:12:01 +00:00
|
|
|
},
|
2009-02-10 22:38:06 +00: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-08-01 02:12:01 +00:00
|
|
|
_repositionChildren: function () {
|
|
|
|
let global = Shell.Global.get();
|
2009-03-11 19:21:45 +00: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-08-01 02:12:01 +00:00
|
|
|
let contentHeight = global.screen_height - Panel.PANEL_HEIGHT;
|
2008-11-28 20:12:20 +00: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-08-01 02:12:01 +00:00
|
|
|
this._dash.actor.set_position(0, Panel.PANEL_HEIGHT);
|
|
|
|
this._dash.actor.set_size(displayGridColumnWidth, contentHeight);
|
2009-06-08 23:04:52 +00: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-08-01 02:12:01 +00:00
|
|
|
this._backOver.set_position(0, Panel.PANEL_HEIGHT);
|
|
|
|
this._backOver.set_size(global.screen_width, contentHeight);
|
2009-04-22 00:23:06 +00: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-08-01 02:12:01 +00:00
|
|
|
let bgPositionFactor = (4 * BACKGROUND_SCALE - 3) / 6;
|
|
|
|
this._background.set_size(global.screen_width * BACKGROUND_SCALE,
|
|
|
|
global.screen_height * BACKGROUND_SCALE);
|
|
|
|
this._background.set_position(-global.screen_width * bgPositionFactor,
|
|
|
|
-global.screen_height * bgPositionFactor);
|
2008-11-28 20:12:20 +00: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-08-01 02:12:01 +00:00
|
|
|
this._paneContainer.set_position(this._dash.actor.x + this._dash.actor.width + DEFAULT_PADDING,
|
|
|
|
Panel.PANEL_HEIGHT);
|
|
|
|
// Dynamic width
|
|
|
|
this._paneContainer.height = contentHeight;
|
|
|
|
|
|
|
|
this._transparentBackground.set_position(this._paneContainer.x, this._paneContainer.y);
|
|
|
|
this._transparentBackground.set_size(global.screen_width - this._paneContainer.x,
|
|
|
|
this._paneContainer.height);
|
|
|
|
},
|
|
|
|
|
|
|
|
addPane: function (pane) {
|
|
|
|
pane.actor.width = displayGridColumnWidth * 2;
|
|
|
|
this._paneContainer.append(pane.actor, Big.BoxPackFlags.NONE);
|
|
|
|
// 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();
|
|
|
|
if (backgroundEventId != null)
|
|
|
|
this._transparentBackground.disconnect(backgroundEventId);
|
|
|
|
backgroundEventId = this._transparentBackground.connect('button-release-event', Lang.bind(this, function () {
|
|
|
|
this._activeDisplayPane.close();
|
2009-06-08 23:04:52 +00: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-08-01 02:12:01 +00:00
|
|
|
}));
|
|
|
|
} else if (pane == this._activeDisplayPane) {
|
|
|
|
this._activeDisplayPane = null;
|
|
|
|
if (backgroundEventId != null) {
|
|
|
|
this._transparentBackground.disconnect(backgroundEventId);
|
|
|
|
backgroundEventId = null;
|
|
|
|
}
|
|
|
|
this._transparentBackground.lower_bottom();
|
|
|
|
this._paneContainer.lower_bottom();
|
2009-02-10 22:38:06 +00: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-08-01 02:12:01 +00:00
|
|
|
}));
|
2008-12-01 19:51:43 +00:00
|
|
|
},
|
|
|
|
|
2009-03-11 19:21:45 +00: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-08-01 02:12:01 +00:00
|
|
|
// Closes any active panes if a GenericDisplayItem is being
|
2009-06-08 23:04:52 +00:00
|
|
|
// dragged over the overlay, 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-08-01 02:12:01 +00:00
|
|
|
// This allows the user to place the item on any workspace.
|
2009-03-11 19:21:45 +00: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-08-01 02:12:01 +00:00
|
|
|
if (source instanceof GenericDisplay.GenericDisplayItem
|
|
|
|
|| source instanceof AppDisplay.WellDisplayItem) {
|
|
|
|
if (this._activeDisplayPane != null)
|
|
|
|
this._activeDisplayPane.close();
|
2009-06-08 23:04:52 +00: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-08-01 02:12:01 +00:00
|
|
|
|
2009-03-11 19:21:45 +00:00
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
//// Public methods ////
|
|
|
|
|
2008-12-01 19:51:43 +00:00
|
|
|
show : function() {
|
|
|
|
if (this.visible)
|
|
|
|
return;
|
2009-05-07 13:47:48 +00:00
|
|
|
if (!Main.startModal())
|
|
|
|
return;
|
2008-11-28 20:12:20 +00:00
|
|
|
|
2008-12-01 19:51:43 +00:00
|
|
|
this.visible = true;
|
2008-11-28 20:12:20 +00:00
|
|
|
|
2008-12-01 19:51:43 +00:00
|
|
|
let global = Shell.Global.get();
|
2009-02-10 22:38:06 +00:00
|
|
|
let screenWidth = global.screen_width;
|
|
|
|
let screenHeight = global.screen_height;
|
2008-11-28 20:12:20 +00:00
|
|
|
|
2009-06-02 17:13:51 +00:00
|
|
|
this._dash.show();
|
2009-02-20 16:57:30 +00:00
|
|
|
|
2009-02-10 22:38:06 +00:00
|
|
|
let columnsUsed = wideScreen ? COLUMNS_FOR_WORKSPACES_WIDE_SCREEN : COLUMNS_FOR_WORKSPACES_REGULAR_SCREEN;
|
|
|
|
let rowsUsed = wideScreen ? ROWS_FOR_WORKSPACES_WIDE_SCREEN : ROWS_FOR_WORKSPACES_REGULAR_SCREEN;
|
|
|
|
|
|
|
|
let workspacesWidth = displayGridColumnWidth * columnsUsed - WORKSPACE_GRID_PADDING * 2;
|
|
|
|
// We scale the vertical padding by (screenHeight / screenWidth) so that the workspace preserves its aspect ratio.
|
|
|
|
let workspacesHeight = displayGridRowHeight * rowsUsed - WORKSPACE_GRID_PADDING * (screenHeight / screenWidth) * 2;
|
|
|
|
|
|
|
|
let workspacesX = displayGridColumnWidth + WORKSPACE_GRID_PADDING;
|
|
|
|
let workspacesY = displayGridRowHeight + WORKSPACE_GRID_PADDING * (screenHeight / screenWidth);
|
|
|
|
|
|
|
|
// place the 'Add Workspace' button in the bottom row of the grid
|
|
|
|
let addButtonSize = Math.floor(displayGridRowHeight * 3/5);
|
|
|
|
let addButtonX = workspacesX + workspacesWidth - addButtonSize;
|
|
|
|
let addButtonY = screenHeight - Math.floor(displayGridRowHeight * 4/5);
|
|
|
|
|
|
|
|
this._workspaces = new Workspaces.Workspaces(workspacesWidth, workspacesHeight, workspacesX, workspacesY,
|
|
|
|
addButtonSize, addButtonX, addButtonY);
|
2008-12-15 20:48:59 +00:00
|
|
|
this._group.add_actor(this._workspaces.actor);
|
2008-12-01 19:51:43 +00:00
|
|
|
|
|
|
|
// All the the actors in the window group are completely obscured,
|
|
|
|
// hiding the group holding them while the overlay is displayed greatly
|
|
|
|
// increases performance of the overlay especially when there are many
|
|
|
|
// windows visible.
|
|
|
|
//
|
|
|
|
// If we switched to displaying the actors in the overlay rather than
|
|
|
|
// clones of them, this would obviously no longer be necessary.
|
2008-12-02 16:15:00 +00:00
|
|
|
global.window_group.hide();
|
2008-12-01 19:51:43 +00:00
|
|
|
this._group.show();
|
2009-03-20 16:06:34 +00:00
|
|
|
|
2009-04-22 00:23:06 +00:00
|
|
|
// Try to make the menu not too visible behind the empty space between
|
|
|
|
// the workspace previews by sliding in its clipping rectangle.
|
2009-06-02 17:13:51 +00:00
|
|
|
// We want to finish drawing the Dash just before the top workspace fully
|
2009-04-22 00:23:06 +00:00
|
|
|
// slides in on the top. Which means that we have more time to wait before
|
2009-06-02 17:13:51 +00:00
|
|
|
// drawing the dash if the active workspace is displayed on the bottom of
|
2009-04-22 00:23:06 +00:00
|
|
|
// the workspaces grid, and almost no time to wait if it is displayed in the top
|
|
|
|
// row of the workspaces grid. The calculations used below try to roughly
|
|
|
|
// capture the animation ratio for when workspaces are covering the top of the overlay
|
|
|
|
// vs. when workspaces are already below the top of the overlay, and apply it
|
2009-06-02 17:13:51 +00:00
|
|
|
// to clipping the dash. The clipping is removed in this._showDone().
|
|
|
|
this._dash.actor.set_clip(0, 0,
|
2009-04-22 00:23:06 +00:00
|
|
|
this._workspaces.getFullSizeX(),
|
2009-06-02 17:13:51 +00:00
|
|
|
this._dash.actor.height);
|
|
|
|
Tweener.addTween(this._dash.actor,
|
|
|
|
{ clipWidthRight: this._dash._width + WORKSPACE_GRID_PADDING + this._workspaces.getWidthToTopActiveWorkspace(),
|
2009-04-22 00:23:06 +00:00
|
|
|
time: ANIMATION_TIME,
|
|
|
|
transition: "easeOutQuad",
|
|
|
|
onComplete: this._showDone,
|
2009-03-20 16:06:34 +00:00
|
|
|
onCompleteScope: this
|
2009-04-22 00:23:06 +00:00
|
|
|
|
2009-03-20 16:06:34 +00:00
|
|
|
});
|
2009-05-07 13:47:48 +00:00
|
|
|
|
|
|
|
this.emit('showing');
|
2008-12-01 19:51:43 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
hide : function() {
|
2009-03-20 16:06:34 +00:00
|
|
|
if (!this.visible || this._hideInProgress)
|
2008-12-01 19:51:43 +00:00
|
|
|
return;
|
|
|
|
|
2009-04-22 00:23:06 +00:00
|
|
|
let global = Shell.Global.get();
|
|
|
|
|
2009-03-20 16:06:34 +00: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-08-01 02:12:01 +00:00
|
|
|
if (this._activeDisplayPane != null)
|
|
|
|
this._activeDisplayPane.close();
|
|
|
|
// lower the panes, so that workspaces display is on top while sliding out
|
2009-06-02 17:13:51 +00:00
|
|
|
this._dash.actor.lower(this._workspaces.actor);
|
2008-12-04 15:20:37 +00:00
|
|
|
this._workspaces.hide();
|
2008-12-04 15:16:16 +00:00
|
|
|
|
2009-04-22 00:23:06 +00:00
|
|
|
// Try to make the menu not too visible behind the empty space between
|
|
|
|
// the workspace previews by sliding in its clipping rectangle.
|
|
|
|
// The logic used is the same as described in this.show(). If the active workspace
|
|
|
|
// is displayed in the top row, than almost full animation time is needed for it
|
2009-06-02 17:13:51 +00:00
|
|
|
// to reach the top of the overlay and cover the Dash fully, while if the
|
2009-04-22 00:23:06 +00:00
|
|
|
// active workspace is in the lower row, than the top left workspace reaches the
|
|
|
|
// top of the overlay sooner as it is moving out of the way.
|
|
|
|
// The clipping is removed in this._hideDone().
|
2009-06-02 17:13:51 +00:00
|
|
|
this._dash.actor.set_clip(0, 0,
|
|
|
|
this._dash.actor.width + WORKSPACE_GRID_PADDING + this._workspaces.getWidthToTopActiveWorkspace(),
|
|
|
|
this._dash.actor.height);
|
|
|
|
Tweener.addTween(this._dash.actor,
|
2009-04-22 00:23:06 +00:00
|
|
|
{ clipWidthRight: this._workspaces.getFullSizeX() + this._workspaces.getWidthToTopActiveWorkspace() - global.screen_width,
|
|
|
|
time: ANIMATION_TIME,
|
|
|
|
transition: "easeOutQuad",
|
2008-12-04 15:16:16 +00:00
|
|
|
onComplete: this._hideDone,
|
|
|
|
onCompleteScope: this
|
|
|
|
});
|
2009-05-07 13:47:48 +00:00
|
|
|
|
|
|
|
this.emit('hiding');
|
|
|
|
},
|
|
|
|
|
|
|
|
toggle: function() {
|
|
|
|
if (this.visible)
|
|
|
|
this.hide();
|
|
|
|
else
|
|
|
|
this.show();
|
2008-12-04 15:16:16 +00:00
|
|
|
},
|
2008-12-15 20:48:59 +00:00
|
|
|
|
2009-07-31 21:20:26 +00:00
|
|
|
/**
|
|
|
|
* activateWindow:
|
|
|
|
* @metaWindow: A #MetaWindow
|
|
|
|
* @time: Event timestamp integer
|
|
|
|
*
|
|
|
|
* Make the given MetaWindow be the focus window, switching
|
|
|
|
* to the workspace it's on if necessary. This function
|
|
|
|
* should only be used when the overlay is currently active;
|
|
|
|
* outside of that, use the relevant methods on MetaDisplay.
|
|
|
|
*/
|
|
|
|
activateWindow: function (metaWindow, time) {
|
|
|
|
this._workspaces.activateWindowFromOverlay(metaWindow, time);
|
|
|
|
this.hide();
|
|
|
|
},
|
|
|
|
|
2009-03-11 19:21:45 +00:00
|
|
|
//// Private methods ////
|
|
|
|
|
2009-06-02 17:13:51 +00:00
|
|
|
// Raises the Dash to the top, so that we can tell if the pointer is above one of its items.
|
2009-04-22 00:23:06 +00:00
|
|
|
// We need to do this once the workspaces are shown because the workspaces actor currently covers
|
|
|
|
// the whole screen, regardless of where the workspaces are actually displayed.
|
2009-03-20 16:06:34 +00:00
|
|
|
//
|
|
|
|
// Once we rework the workspaces actor to only cover the area it actually needs, we can
|
|
|
|
// remove this workaround. Also http://bugzilla.openedhand.com/show_bug.cgi?id=1513 requests being
|
|
|
|
// able to pick only a reactive actor at a certain position, rather than any actor. Being able
|
2009-06-02 17:13:51 +00:00
|
|
|
// to do that would allow us to not have to raise the Dash.
|
2009-04-22 00:23:06 +00:00
|
|
|
_showDone: function() {
|
2009-03-20 16:06:34 +00:00
|
|
|
if (this._hideInProgress)
|
|
|
|
return;
|
|
|
|
|
2009-06-02 17:13:51 +00:00
|
|
|
this._dash.actor.raise_top();
|
|
|
|
this._dash.actor.remove_clip();
|
2009-05-07 13:47:48 +00:00
|
|
|
|
|
|
|
this.emit('shown');
|
2009-04-22 00:23:06 +00:00
|
|
|
},
|
2009-03-20 16:06:34 +00:00
|
|
|
|
2008-12-04 15:16:16 +00:00
|
|
|
_hideDone: function() {
|
2008-12-01 19:51:43 +00:00
|
|
|
let global = Shell.Global.get();
|
|
|
|
|
2008-12-02 16:15:00 +00:00
|
|
|
global.window_group.show();
|
2008-12-15 20:48:59 +00:00
|
|
|
|
|
|
|
this._workspaces.destroy();
|
|
|
|
this._workspaces = null;
|
2009-02-03 22:58:33 +00:00
|
|
|
|
2009-06-02 17:13:51 +00:00
|
|
|
this._dash.actor.remove_clip();
|
|
|
|
this._dash.hide();
|
2009-02-03 22:58:33 +00:00
|
|
|
this._group.hide();
|
2009-03-20 16:06:34 +00:00
|
|
|
|
|
|
|
this.visible = false;
|
|
|
|
this._hideInProgress = false;
|
2008-12-01 19:51:43 +00:00
|
|
|
|
2009-05-07 13:47:48 +00:00
|
|
|
Main.endModal();
|
|
|
|
this.emit('hidden');
|
2008-12-01 19:51:43 +00:00
|
|
|
}
|
2008-10-31 23:09:46 +00:00
|
|
|
};
|
2009-05-07 13:47:48 +00:00
|
|
|
Signals.addSignalMethods(Overlay.prototype);
|
2009-02-03 22:58:33 +00:00
|
|
|
|
2009-02-20 16:57:30 +00:00
|
|
|
Tweener.registerSpecialProperty("clipHeightBottom", _clipHeightBottomGet, _clipHeightBottomSet);
|
2009-02-03 22:58:33 +00:00
|
|
|
|
2009-02-20 16:57:30 +00:00
|
|
|
function _clipHeightBottomGet(actor) {
|
|
|
|
let [xOffset, yOffset, clipWidth, clipHeight] = actor.get_clip();
|
2009-02-03 22:58:33 +00:00
|
|
|
return clipHeight;
|
|
|
|
}
|
|
|
|
|
2009-02-20 16:57:30 +00:00
|
|
|
function _clipHeightBottomSet(actor, clipHeight) {
|
2009-02-03 22:58:33 +00:00
|
|
|
actor.set_clip(0, 0, actor.width, clipHeight);
|
|
|
|
}
|
2009-02-20 16:57:30 +00:00
|
|
|
|
|
|
|
Tweener.registerSpecialProperty("clipHeightTop", _clipHeightTopGet, _clipHeightTopSet);
|
|
|
|
|
|
|
|
function _clipHeightTopGet(actor) {
|
|
|
|
let [xOffset, yOffset, clipWidth, clipHeight] = actor.get_clip();
|
|
|
|
return clipHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
function _clipHeightTopSet(actor, clipHeight) {
|
|
|
|
actor.set_clip(0, actor.height - clipHeight, actor.width, clipHeight);
|
|
|
|
}
|
2009-04-22 00:23:06 +00:00
|
|
|
|
|
|
|
Tweener.registerSpecialProperty("clipWidthRight", _clipWidthRightGet, _clipWidthRightSet);
|
|
|
|
|
|
|
|
function _clipWidthRightGet(actor) {
|
|
|
|
let [xOffset, yOffset, clipWidth, clipHeight] = actor.get_clip();
|
|
|
|
return clipWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
function _clipWidthRightSet(actor, clipWidth) {
|
|
|
|
actor.set_clip(0, 0, clipWidth, actor.height);
|
|
|
|
}
|