1
0
Fork 0

Updating 46/vertical-workspaces to version 46.2+20240828 [5b87af5].

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-24 19:44:06 +01:00
parent 6c3def31e8
commit f2db668ec8
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
27 changed files with 6003 additions and 4248 deletions

View file

@ -41,7 +41,7 @@ const ThumbnailState = {
const ControlsState = OverviewControls.ControlsState;
const WORKSPACE_CUT_SIZE = 10;
const WORKSPACE_CUT_SCALE = 0.15;
const WORKSPACE_KEEP_ALIVE_TIME = 100;
export const WorkspaceThumbnailModule = class {
@ -85,6 +85,7 @@ export const WorkspaceThumbnailModule = class {
this._overrides.addOverride('WorkspaceThumbnail', WorkspaceThumbnail.WorkspaceThumbnail.prototype, WorkspaceThumbnailCommon);
this._overrides.addOverride('ThumbnailsBoxCommon', WorkspaceThumbnail.ThumbnailsBox.prototype, ThumbnailsBoxCommon);
this._overrides.addOverride('WindowClone', WorkspaceThumbnail.WindowClone.prototype, WindowClone);
// replacing opt.ORIENTATION local constant with boxOrientation internal variable allows external customers such as the AATWS extension to control the box orientation.
Main.overview._overview.controls._thumbnailsBox._boxOrientation = opt.ORIENTATION;
@ -702,10 +703,19 @@ const ThumbnailsBoxCommon = {
},
};
function _getWorkspaceCutSize(tmbSize, index) {
let cutSize = WORKSPACE_CUT_SCALE * tmbSize;
// Compensate for the missing thumbnail in front of the first one
if (index === 0)
cutSize *= 1.5;
return Math.floor(cutSize);
}
const ThumbnailsBoxVertical = {
_getPlaceholderTarget(index, spacing, rtl) {
this._dropPlaceholder.add_style_class_name('placeholder-vertical');
const workspace = this._thumbnails[index];
const WORKSPACE_CUT_SIZE = _getWorkspaceCutSize(workspace.height, index);
let targetY1;
let targetY2;
@ -740,6 +750,7 @@ const ThumbnailsBoxVertical = {
_withinWorkspace(y, index, rtl) {
const length = this._thumbnails.length;
const workspace = this._thumbnails[index];
const WORKSPACE_CUT_SIZE = _getWorkspaceCutSize(workspace.height, index);
let workspaceY1 = workspace.y + WORKSPACE_CUT_SIZE;
let workspaceY2 = workspace.y + workspace.height - WORKSPACE_CUT_SIZE;
@ -788,12 +799,14 @@ const ThumbnailsBoxVertical = {
const ratio = this._porthole.width / this._porthole.height;
const tmbHeight = themeNode.adjust_for_width(forWidth) / ratio;
const naturalheight = this._thumbnails.reduce((accumulator, thumbnail/* , index*/) => {
const progress = 1 - thumbnail.collapse_fraction;
const height = tmbHeight * progress;
return accumulator + height;
}, 0);
return themeNode.adjust_preferred_width(totalSpacing, Math.round(naturalheight));
const naturalHeight = Math.round(
this._thumbnails.reduce((accumulator, thumbnail/* , index*/) => {
const progress = 1 - thumbnail.collapse_fraction;
const height = tmbHeight * progress;
return accumulator + height;
}, 0)
);
return themeNode.adjust_preferred_width(totalSpacing, naturalHeight);
},
// removes extra space (extraWidth in the original function), we need the box as accurate as possible
@ -976,6 +989,7 @@ const ThumbnailsBoxVertical = {
const ThumbnailsBoxHorizontal = {
_getPlaceholderTarget(index, spacing, rtl) {
const workspace = this._thumbnails[index];
const WORKSPACE_CUT_SIZE = _getWorkspaceCutSize(workspace.width, index);
let targetX1;
let targetX2;
@ -1010,6 +1024,7 @@ const ThumbnailsBoxHorizontal = {
_withinWorkspace(x, index, rtl) {
const length = this._thumbnails.length;
const workspace = this._thumbnails[index];
const WORKSPACE_CUT_SIZE = _getWorkspaceCutSize(workspace.width, index);
let workspaceX1 = workspace.x + WORKSPACE_CUT_SIZE;
let workspaceX2 = workspace.x + workspace.width - WORKSPACE_CUT_SIZE;
@ -1060,11 +1075,13 @@ const ThumbnailsBoxHorizontal = {
const tmbWidth = themeNode.adjust_for_height(forHeight) / ratio;
const naturalWidth = this._thumbnails.reduce((accumulator, thumbnail) => {
const progress = 1 - thumbnail.collapse_fraction;
const width = tmbWidth * progress;
return accumulator + width;
}, 0);
const naturalWidth = Math.round(
this._thumbnails.reduce((accumulator, thumbnail) => {
const progress = 1 - thumbnail.collapse_fraction;
const width = tmbWidth * progress;
return accumulator + width;
}, 0)
);
return themeNode.adjust_preferred_width(totalSpacing, naturalWidth);
},
@ -1234,3 +1251,11 @@ const ThumbnailsBoxHorizontal = {
_updateShouldShow: ThumbnailsBoxVertical._updateShouldShow,
};
const WindowClone = {
after__init() {
// Make it transparent and smaller than usual while dragging
this._draggable._dragActorOpacity = 200;
this._draggable._dragActorMaxSize = 150;
},
};