overview: Move background to Workspace
Move the background to the Workspace class by introducing a new container called WorkspaceBackground, which handles clipping the background to the workarea. Move the click action from WorkspaceDisplay into each workspace. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1599>
This commit is contained in:

committed by
Marge Bot

parent
cfc1f1fd9c
commit
8eb81ae649
@ -8,21 +8,14 @@ const Signals = imports.signals;
|
||||
// this is defined here to make it available in imports.
|
||||
var ANIMATION_TIME = 250;
|
||||
|
||||
const Background = imports.ui.background;
|
||||
const DND = imports.ui.dnd;
|
||||
const LayoutManager = imports.ui.layout;
|
||||
const Lightbox = imports.ui.lightbox;
|
||||
const Main = imports.ui.main;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
const OverviewControls = imports.ui.overviewControls;
|
||||
const Params = imports.misc.params;
|
||||
const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
|
||||
|
||||
// Must be less than ANIMATION_TIME, since we switch to
|
||||
// or from the overview completely after ANIMATION_TIME,
|
||||
// and don't want the shading animation to get cut off
|
||||
var SHADE_ANIMATION_TIME = 240;
|
||||
|
||||
var DND_WINDOW_SWITCH_TIMEOUT = 750;
|
||||
|
||||
var OVERVIEW_ACTIVATION_TIMEOUT = 0.5;
|
||||
@ -177,15 +170,6 @@ var Overview = class {
|
||||
if (this.isDummy)
|
||||
return;
|
||||
|
||||
// The main Background actors are inside global.window_group which are
|
||||
// hidden when displaying the overview, so we create a new
|
||||
// one. Instances of this class share a single CoglTexture behind the
|
||||
// scenes which allows us to show the background with different
|
||||
// rendering options without duplicating the texture data.
|
||||
this._backgroundGroup = new Meta.BackgroundGroup({ reactive: true });
|
||||
Main.layoutManager.overviewGroup.add_child(this._backgroundGroup);
|
||||
this._bgManagers = [];
|
||||
|
||||
this._desktopFade = new St.Widget();
|
||||
Main.layoutManager.overviewGroup.add_child(this._desktopFade);
|
||||
|
||||
@ -228,50 +212,6 @@ var Overview = class {
|
||||
this.init();
|
||||
}
|
||||
|
||||
_updateBackgrounds() {
|
||||
for (let i = 0; i < this._bgManagers.length; i++)
|
||||
this._bgManagers[i].destroy();
|
||||
|
||||
this._bgManagers = [];
|
||||
|
||||
for (let i = 0; i < Main.layoutManager.monitors.length; i++) {
|
||||
let bgManager = new Background.BackgroundManager({ container: this._backgroundGroup,
|
||||
monitorIndex: i,
|
||||
vignette: true });
|
||||
this._bgManagers.push(bgManager);
|
||||
}
|
||||
}
|
||||
|
||||
_unshadeBackgrounds() {
|
||||
let backgrounds = this._backgroundGroup.get_children();
|
||||
for (let i = 0; i < backgrounds.length; i++) {
|
||||
backgrounds[i].ease_property('@content.brightness', 1.0, {
|
||||
duration: SHADE_ANIMATION_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
backgrounds[i].ease_property('@content.vignette-sharpness', 0.0, {
|
||||
duration: SHADE_ANIMATION_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_shadeBackgrounds() {
|
||||
let backgrounds = this._backgroundGroup.get_children();
|
||||
for (let i = 0; i < backgrounds.length; i++) {
|
||||
backgrounds[i].ease_property('@content.brightness',
|
||||
Lightbox.VIGNETTE_BRIGHTNESS, {
|
||||
duration: SHADE_ANIMATION_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
backgrounds[i].ease_property('@content.vignette-sharpness',
|
||||
Lightbox.VIGNETTE_SHARPNESS, {
|
||||
duration: SHADE_ANIMATION_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_sessionUpdated() {
|
||||
const { hasOverview } = Main.sessionMode;
|
||||
if (!hasOverview)
|
||||
@ -395,13 +335,6 @@ var Overview = class {
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
addAction(action) {
|
||||
if (this.isDummy)
|
||||
return;
|
||||
|
||||
this._backgroundGroup.add_action(action);
|
||||
}
|
||||
|
||||
_getDesktopClone() {
|
||||
let windows = global.get_window_actors().filter(
|
||||
w => w.meta_window.get_window_type() === Meta.WindowType.DESKTOP);
|
||||
@ -425,8 +358,6 @@ var Overview = class {
|
||||
|
||||
this._coverPane.set_position(0, 0);
|
||||
this._coverPane.set_size(global.screen_width, global.screen_height);
|
||||
|
||||
this._updateBackgrounds();
|
||||
}
|
||||
|
||||
_onRestacked() {
|
||||
@ -588,7 +519,6 @@ var Overview = class {
|
||||
duration: ANIMATION_TIME,
|
||||
onComplete: () => this._showDone(),
|
||||
});
|
||||
this._shadeBackgrounds();
|
||||
|
||||
Main.layoutManager.overviewGroup.set_child_above_sibling(
|
||||
this._coverPane, null);
|
||||
@ -652,7 +582,6 @@ var Overview = class {
|
||||
duration: ANIMATION_TIME,
|
||||
onComplete: () => this._hideDone(),
|
||||
});
|
||||
this._unshadeBackgrounds();
|
||||
|
||||
Main.layoutManager.overviewGroup.set_child_above_sibling(
|
||||
this._coverPane, null);
|
||||
|
Reference in New Issue
Block a user