Updating 44/vertical-workspaces to version 37+20231208 [0d82192].
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
975b88c6bb
commit
07381ac119
37 changed files with 9559 additions and 4338 deletions
|
@ -10,103 +10,372 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { Clutter, GLib, GObject, Graphene, Meta, Shell, St } = imports.gi;
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const Atk = imports.gi.Atk;
|
||||
const GLib = imports.gi.GLib;
|
||||
const Graphene = imports.gi.Graphene;
|
||||
const Meta = imports.gi.Meta;
|
||||
const Pango = imports.gi.Pango;
|
||||
const Shell = imports.gi.Shell;
|
||||
const St = imports.gi.St;
|
||||
|
||||
const DND = imports.ui.dnd;
|
||||
const Main = imports.ui.main;
|
||||
const OverviewControls = imports.ui.overviewControls;
|
||||
const WindowPreview = imports.ui.windowPreview;
|
||||
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
|
||||
const _Util = Me.imports.lib.util;
|
||||
const shellVersion = _Util.shellVersion;
|
||||
|
||||
let _overrides;
|
||||
|
||||
const WINDOW_SCALE_TIME = imports.ui.windowPreview.WINDOW_SCALE_TIME;
|
||||
const WINDOW_ACTIVE_SIZE_INC = imports.ui.windowPreview.WINDOW_ACTIVE_SIZE_INC;
|
||||
const WINDOW_OVERLAY_FADE_TIME = imports.ui.windowPreview.WINDOW_OVERLAY_FADE_TIME;
|
||||
const SEARCH_WINDOWS_PREFIX = Me.imports.lib.windowSearchProvider.prefix;
|
||||
|
||||
const ControlsState = imports.ui.overviewControls.ControlsState;
|
||||
|
||||
let Me;
|
||||
let opt;
|
||||
let _firstRun = true;
|
||||
|
||||
function update(reset = false) {
|
||||
opt = Me.imports.lib.settings.opt;
|
||||
const moduleEnabled = opt.get('windowPreviewModule', true);
|
||||
reset = reset || !moduleEnabled;
|
||||
const WINDOW_SCALE_TIME = 200;
|
||||
const WINDOW_ACTIVE_SIZE_INC = 5;
|
||||
const WINDOW_OVERLAY_FADE_TIME = 200;
|
||||
const WINDOW_DND_SIZE = 256;
|
||||
const DRAGGING_WINDOW_OPACITY = 100;
|
||||
|
||||
// don't even touch this module if disabled
|
||||
if (_firstRun && reset)
|
||||
return;
|
||||
const ControlsState = OverviewControls.ControlsState;
|
||||
|
||||
_firstRun = false;
|
||||
var WindowPreviewModule = class {
|
||||
constructor(me) {
|
||||
Me = me;
|
||||
opt = Me.opt;
|
||||
|
||||
if (_overrides)
|
||||
_overrides.removeAll();
|
||||
|
||||
|
||||
if (reset) {
|
||||
_overrides = null;
|
||||
opt = null;
|
||||
WindowPreview.WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT = 750;
|
||||
return;
|
||||
this._firstActivation = true;
|
||||
this.moduleEnabled = false;
|
||||
this._overrides = null;
|
||||
}
|
||||
|
||||
_overrides = new _Util.Overrides();
|
||||
cleanGlobals() {
|
||||
Me = null;
|
||||
opt = null;
|
||||
}
|
||||
|
||||
_overrides.addOverride('WindowPreview', WindowPreview.WindowPreview.prototype, WindowPreviewCommon);
|
||||
// A shorter timeout allows user to quickly cancel the selection by leaving the preview with the mouse pointer
|
||||
if (opt.ALWAYS_ACTIVATE_SELECTED_WINDOW)
|
||||
WindowPreview.WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT = 150;
|
||||
}
|
||||
update(reset) {
|
||||
this.moduleEnabled = opt.get('windowPreviewModule');
|
||||
const conflict = false;
|
||||
|
||||
const WindowPreviewCommon = {
|
||||
// injection to _init()
|
||||
after__init() {
|
||||
const ICON_OVERLAP = 0.7;
|
||||
reset = reset || !this.moduleEnabled || conflict;
|
||||
|
||||
if (opt.WIN_PREVIEW_ICON_SIZE < 64) {
|
||||
this.remove_child(this._icon);
|
||||
this._icon.destroy();
|
||||
const tracker = Shell.WindowTracker.get_default();
|
||||
const app = tracker.get_window_app(this.metaWindow);
|
||||
this._icon = app.create_icon_texture(opt.WIN_PREVIEW_ICON_SIZE);
|
||||
this._icon.add_style_class_name('icon-dropshadow');
|
||||
this._icon.set({
|
||||
reactive: true,
|
||||
pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }),
|
||||
});
|
||||
this._icon.add_constraint(new Clutter.BindConstraint({
|
||||
source: this.windowContainer,
|
||||
coordinate: Clutter.BindCoordinate.POSITION,
|
||||
}));
|
||||
this._icon.add_constraint(new Clutter.AlignConstraint({
|
||||
source: this.windowContainer,
|
||||
align_axis: Clutter.AlignAxis.X_AXIS,
|
||||
factor: 0.5,
|
||||
}));
|
||||
this._icon.add_constraint(new Clutter.AlignConstraint({
|
||||
source: this.windowContainer,
|
||||
align_axis: Clutter.AlignAxis.Y_AXIS,
|
||||
pivot_point: new Graphene.Point({ x: -1, y: ICON_OVERLAP }),
|
||||
factor: 1,
|
||||
}));
|
||||
this.add_child(this._icon);
|
||||
if (opt.WIN_PREVIEW_ICON_SIZE < 22) {
|
||||
// disable app icon
|
||||
this._icon.hide();
|
||||
}
|
||||
this._iconSize = opt.WIN_PREVIEW_ICON_SIZE;
|
||||
// don't touch the original code if module disabled
|
||||
if (reset && !this._firstActivation) {
|
||||
this._disableModule();
|
||||
} else if (!reset) {
|
||||
this._firstActivation = false;
|
||||
this._activateModule();
|
||||
}
|
||||
if (reset && this._firstActivation)
|
||||
console.debug(' WindowPreviewModule - Keeping untouched');
|
||||
}
|
||||
|
||||
_activateModule() {
|
||||
if (!this._overrides)
|
||||
this._overrides = new Me.Util.Overrides();
|
||||
|
||||
this._overrides.addOverride('WindowPreview', WindowPreview.WindowPreview.prototype, WindowPreviewCommon);
|
||||
// A shorter timeout allows user to quickly cancel the selection by leaving the preview with the mouse pointer
|
||||
if (opt.ALWAYS_ACTIVATE_SELECTED_WINDOW)
|
||||
WindowPreview.WINDOW_OVERLAY_IDLE_HIDE_TIMEOUT = 150;
|
||||
console.debug(' WindowPreviewModule - Activated');
|
||||
}
|
||||
|
||||
_disableModule() {
|
||||
// If WindowPreview._init was injected by another extension (like Burn My Windows)
|
||||
// which enables/disables before V-Shell
|
||||
// don't restore the original if it's not injected,
|
||||
// because it would restore injected _init and recursion would freeze GS when extensions are enabled again.
|
||||
// This can happen when all extension re-enabled, not only when screen is locked/unlocked
|
||||
// If _init doesn't include "fn.apply(this, args)" when reset === true, some extension already restored the original
|
||||
const skipReset = WindowPreview.WindowPreview.prototype._init.toString().includes('fn.apply(this, args)');
|
||||
if (this._overrides && skipReset) {
|
||||
// skip restoring original _init()
|
||||
this._overrides['_init'] = null;
|
||||
}
|
||||
|
||||
if (this._overrides)
|
||||
this._overrides.removeAll();
|
||||
|
||||
this._overrides = null;
|
||||
|
||||
console.debug(' WindowPreviewModule - Disabled');
|
||||
}
|
||||
};
|
||||
|
||||
const WindowPreviewCommon = {
|
||||
_init(metaWindow, workspace, overviewAdjustment) {
|
||||
this.metaWindow = metaWindow;
|
||||
this.metaWindow._delegate = this;
|
||||
this._windowActor = metaWindow.get_compositor_private();
|
||||
this._workspace = workspace;
|
||||
this._overviewAdjustment = overviewAdjustment;
|
||||
|
||||
const ICON_SIZE = opt.WIN_PREVIEW_ICON_SIZE;
|
||||
const ICON_OVERLAP = 0.7;
|
||||
|
||||
Shell.WindowPreview.prototype._init.bind(this)({
|
||||
reactive: true,
|
||||
can_focus: true,
|
||||
accessible_role: Atk.Role.PUSH_BUTTON,
|
||||
offscreen_redirect: Clutter.OffscreenRedirect.AUTOMATIC_FOR_OPACITY,
|
||||
});
|
||||
|
||||
const windowContainer = new Clutter.Actor({
|
||||
pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }),
|
||||
});
|
||||
this.window_container = windowContainer;
|
||||
|
||||
windowContainer.connect('notify::scale-x',
|
||||
() => this._adjustOverlayOffsets());
|
||||
// gjs currently can't handle setting an actors layout manager during
|
||||
// the initialization of the actor if that layout manager keeps track
|
||||
// of its container, so set the layout manager after creating the
|
||||
// container
|
||||
windowContainer.layout_manager = new Shell.WindowPreviewLayout();
|
||||
this.add_child(windowContainer);
|
||||
|
||||
this._addWindow(metaWindow);
|
||||
|
||||
this._delegate = this;
|
||||
|
||||
this._stackAbove = null;
|
||||
|
||||
this._cachedBoundingBox = {
|
||||
x: windowContainer.layout_manager.bounding_box.x1,
|
||||
y: windowContainer.layout_manager.bounding_box.y1,
|
||||
width: windowContainer.layout_manager.bounding_box.get_width(),
|
||||
height: windowContainer.layout_manager.bounding_box.get_height(),
|
||||
};
|
||||
|
||||
windowContainer.layout_manager.connect(
|
||||
'notify::bounding-box', layout => {
|
||||
this._cachedBoundingBox = {
|
||||
x: layout.bounding_box.x1,
|
||||
y: layout.bounding_box.y1,
|
||||
width: layout.bounding_box.get_width(),
|
||||
height: layout.bounding_box.get_height(),
|
||||
};
|
||||
|
||||
// A bounding box of 0x0 means all windows were removed
|
||||
if (layout.bounding_box.get_area() > 0)
|
||||
this.emit('size-changed');
|
||||
});
|
||||
|
||||
this._windowActor.connectObject('destroy', () => this.destroy(), this);
|
||||
|
||||
this._updateAttachedDialogs();
|
||||
|
||||
let clickAction = new Clutter.ClickAction();
|
||||
clickAction.connect('clicked', act => {
|
||||
const button = act.get_button();
|
||||
if (button === Clutter.BUTTON_SECONDARY) {
|
||||
if (opt.WIN_PREVIEW_SEC_BTN_ACTION === 1) {
|
||||
this._closeWinAction();
|
||||
return Clutter.EVENT_STOP;
|
||||
} else if (opt.WIN_PREVIEW_SEC_BTN_ACTION === 2) {
|
||||
this._searchAppWindowsAction();
|
||||
return Clutter.EVENT_STOP;
|
||||
} else if (opt.WIN_PREVIEW_SEC_BTN_ACTION === 3 && opt.WINDOW_THUMBNAIL_ENABLED) {
|
||||
this._removeLaters();
|
||||
Me.Modules.winTmbModule.createThumbnail(metaWindow);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
} else if (button === Clutter.BUTTON_MIDDLE) {
|
||||
if (opt.WIN_PREVIEW_MID_BTN_ACTION === 1) {
|
||||
this._closeWinAction();
|
||||
return Clutter.EVENT_STOP;
|
||||
} else if (opt.WIN_PREVIEW_MID_BTN_ACTION === 2) {
|
||||
this._searchAppWindowsAction();
|
||||
return Clutter.EVENT_STOP;
|
||||
} else if (opt.WIN_PREVIEW_MID_BTN_ACTION === 3 && opt.WINDOW_THUMBNAIL_ENABLED) {
|
||||
this._removeLaters();
|
||||
Me.Modules.winTmbModule.createThumbnail(metaWindow);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
}
|
||||
return this._activate();
|
||||
});
|
||||
|
||||
|
||||
if (this._onLongPress) {
|
||||
clickAction.connect('long-press', this._onLongPress.bind(this));
|
||||
} else {
|
||||
clickAction.connect('long-press', (action, actor, state) => {
|
||||
if (state === Clutter.LongPressState.ACTIVATE)
|
||||
this.showOverlay(true);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
|
||||
this._draggable = DND.makeDraggable(this, {
|
||||
restoreOnSuccess: true,
|
||||
manualMode: !!this._onLongPress,
|
||||
dragActorMaxSize: WINDOW_DND_SIZE,
|
||||
dragActorOpacity: DRAGGING_WINDOW_OPACITY,
|
||||
});
|
||||
|
||||
// _draggable.addClickAction is new in GS45
|
||||
if (this._draggable.addClickAction)
|
||||
this._draggable.addClickAction(clickAction);
|
||||
else
|
||||
this.add_action(clickAction);
|
||||
|
||||
this._draggable.connect('drag-begin', this._onDragBegin.bind(this));
|
||||
this._draggable.connect('drag-cancelled', this._onDragCancelled.bind(this));
|
||||
this._draggable.connect('drag-end', this._onDragEnd.bind(this));
|
||||
this.inDrag = false;
|
||||
|
||||
this._selected = false;
|
||||
this._overlayEnabled = true;
|
||||
this._overlayShown = false;
|
||||
this._closeRequested = false;
|
||||
this._idleHideOverlayId = 0;
|
||||
|
||||
const tracker = Shell.WindowTracker.get_default();
|
||||
const app = tracker.get_window_app(this.metaWindow);
|
||||
this._icon = app.create_icon_texture(ICON_SIZE);
|
||||
this._icon.add_style_class_name('icon-dropshadow');
|
||||
this._icon.set({
|
||||
reactive: true,
|
||||
pivot_point: new Graphene.Point({ x: 0.5, y: 0.5 }),
|
||||
});
|
||||
this._icon.add_constraint(new Clutter.BindConstraint({
|
||||
source: windowContainer,
|
||||
coordinate: Clutter.BindCoordinate.POSITION,
|
||||
}));
|
||||
this._icon.add_constraint(new Clutter.AlignConstraint({
|
||||
source: windowContainer,
|
||||
align_axis: Clutter.AlignAxis.X_AXIS,
|
||||
factor: 0.5,
|
||||
}));
|
||||
this._icon.add_constraint(new Clutter.AlignConstraint({
|
||||
source: windowContainer,
|
||||
align_axis: Clutter.AlignAxis.Y_AXIS,
|
||||
pivot_point: new Graphene.Point({ x: -1, y: ICON_OVERLAP }),
|
||||
factor: 1,
|
||||
}));
|
||||
|
||||
if (opt.WINDOW_ICON_CLICK_ACTION) {
|
||||
const iconClickAction = new Clutter.ClickAction();
|
||||
iconClickAction.connect('clicked', act => {
|
||||
if (act.get_button() === Clutter.BUTTON_PRIMARY) {
|
||||
if (opt.WINDOW_ICON_CLICK_ACTION === 1) {
|
||||
this._searchAppWindowsAction();
|
||||
return Clutter.EVENT_STOP;
|
||||
} else if (opt.WINDOW_ICON_CLICK_ACTION === 2 && opt.WINDOW_THUMBNAIL_ENABLED) {
|
||||
this._removeLaters();
|
||||
Me.Modules.winTmbModule.createThumbnail(metaWindow);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
} /* else if (act.get_button() === Clutter.BUTTON_SECONDARY) {
|
||||
return Clutter.EVENT_STOP;
|
||||
}*/
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
this._icon.add_action(iconClickAction);
|
||||
}
|
||||
const { scaleFactor } = St.ThemeContext.get_for_stage(global.stage);
|
||||
const iconOverlap = opt.WIN_PREVIEW_ICON_SIZE * ICON_OVERLAP;
|
||||
// we cannot get proper title height before it gets to the stage, so 35 is estimated height + spacing
|
||||
this._title.get_constraints()[1].offset = scaleFactor * (-iconOverlap - 35);
|
||||
this.set_child_above_sibling(this._title, null);
|
||||
this._title = new St.Label({
|
||||
visible: false,
|
||||
style_class: 'window-caption',
|
||||
text: this._getCaption(),
|
||||
reactive: true,
|
||||
});
|
||||
this._title.clutter_text.single_line_mode = true;
|
||||
this._title.add_constraint(new Clutter.BindConstraint({
|
||||
source: windowContainer,
|
||||
coordinate: Clutter.BindCoordinate.X,
|
||||
}));
|
||||
|
||||
let offset;
|
||||
if (opt.WIN_TITLES_POSITION < 2) {
|
||||
// we cannot get proper title height before it gets to the stage, so 35 is estimated height + spacing
|
||||
offset = -scaleFactor * (ICON_SIZE * ICON_OVERLAP + 35);
|
||||
} else {
|
||||
offset = scaleFactor * (ICON_SIZE * (1 - ICON_OVERLAP) + 4);
|
||||
}
|
||||
this._title.add_constraint(new Clutter.BindConstraint({
|
||||
source: windowContainer,
|
||||
coordinate: Clutter.BindCoordinate.Y,
|
||||
offset,
|
||||
}));
|
||||
this._title.add_constraint(new Clutter.AlignConstraint({
|
||||
source: windowContainer,
|
||||
align_axis: Clutter.AlignAxis.X_AXIS,
|
||||
factor: 0.5,
|
||||
}));
|
||||
this._title.add_constraint(new Clutter.AlignConstraint({
|
||||
source: windowContainer,
|
||||
align_axis: Clutter.AlignAxis.Y_AXIS,
|
||||
pivot_point: new Graphene.Point({ x: -1, y: 0 }),
|
||||
factor: 1,
|
||||
}));
|
||||
this._title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
|
||||
this.label_actor = this._title;
|
||||
this.metaWindow.connectObject(
|
||||
'notify::title', () => (this._title.text = this._getCaption()),
|
||||
this);
|
||||
|
||||
const layout = Meta.prefs_get_button_layout();
|
||||
this._closeButtonSide =
|
||||
layout.left_buttons.includes(Meta.ButtonFunction.CLOSE)
|
||||
? St.Side.LEFT : St.Side.RIGHT;
|
||||
if (Me.shellVersion < 43) {
|
||||
this._closeButton = new St.Button({
|
||||
visible: false,
|
||||
style_class: 'window-close',
|
||||
child: new St.Icon({ icon_name: 'preview-close-symbolic' }),
|
||||
});
|
||||
} else {
|
||||
this._closeButton = new St.Button({
|
||||
visible: false,
|
||||
style_class: 'window-close',
|
||||
icon_name: 'preview-close-symbolic',
|
||||
});
|
||||
}
|
||||
this._closeButton.add_constraint(new Clutter.BindConstraint({
|
||||
source: windowContainer,
|
||||
coordinate: Clutter.BindCoordinate.POSITION,
|
||||
}));
|
||||
this._closeButton.add_constraint(new Clutter.AlignConstraint({
|
||||
source: windowContainer,
|
||||
align_axis: Clutter.AlignAxis.X_AXIS,
|
||||
pivot_point: new Graphene.Point({ x: 0.5, y: -1 }),
|
||||
factor: this._closeButtonSide === St.Side.LEFT ? 0 : 1,
|
||||
}));
|
||||
this._closeButton.add_constraint(new Clutter.AlignConstraint({
|
||||
source: windowContainer,
|
||||
align_axis: Clutter.AlignAxis.Y_AXIS,
|
||||
pivot_point: new Graphene.Point({ x: -1, y: 0.5 }),
|
||||
factor: 0,
|
||||
}));
|
||||
this._closeButton.connect('clicked', () => this._deleteAll());
|
||||
|
||||
this.add_child(this._title);
|
||||
this.add_child(this._icon);
|
||||
this.add_child(this._closeButton);
|
||||
|
||||
this._overviewAdjustment.connectObject(
|
||||
'notify::value', () => this._updateIconScale(), this);
|
||||
this._updateIconScale();
|
||||
|
||||
this.connect('notify::realized', () => {
|
||||
if (!this.realized)
|
||||
return;
|
||||
|
||||
this._title.ensure_style();
|
||||
this._icon.ensure_style();
|
||||
});
|
||||
|
||||
if (ICON_SIZE < 22) {
|
||||
// disable app icon
|
||||
this._icon.hide();
|
||||
} else {
|
||||
this._updateIconScale();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if window is created while the overview is shown, icon and title should be visible immediately
|
||||
if (Main.overview._overview._controls._stateAdjustment.value < 1) {
|
||||
this._icon.scale_x = 0;
|
||||
|
@ -124,9 +393,9 @@ const WindowPreviewCommon = {
|
|||
if (global.get_pointer()[0] === opt.showingPointerX || Main.overview._overview._controls._stateAdjustment.value < 1)
|
||||
return;
|
||||
|
||||
const adjustment = this._workspace._background._stateAdjustment;
|
||||
opt.WORKSPACE_MODE = 1;
|
||||
_Util.exposeWindows(adjustment, false);
|
||||
const view = this._workspace.get_parent();
|
||||
view.exposeWindows(this._workspace.metaWorkspace.index());
|
||||
this.disconnect(this._wsStateConId);
|
||||
});
|
||||
}
|
||||
|
@ -136,53 +405,39 @@ const WindowPreviewCommon = {
|
|||
this._stateAdjustmentSigId = this._workspace.stateAdjustment.connect('notify::value', this._updateIconScale.bind(this));
|
||||
}
|
||||
|
||||
// replace click action with custom one
|
||||
const action = this.get_actions()[0];
|
||||
|
||||
const handlerId = GObject.signal_handler_find(action, { signalId: 'clicked' });
|
||||
if (handlerId)
|
||||
action.disconnect(handlerId);
|
||||
|
||||
action.connect('clicked', act => {
|
||||
const button = act.get_button();
|
||||
if (button === Clutter.BUTTON_PRIMARY) {
|
||||
this._activate();
|
||||
return Clutter.EVENT_STOP;
|
||||
} else if (button === Clutter.BUTTON_SECONDARY) {
|
||||
// this action cancels long-press event and the 'long-press-cancel' event is used by the Shell to actually initiate DnD
|
||||
// so the dnd initiation needs to be removed
|
||||
if (this._longPressLater) {
|
||||
if (shellVersion >= 44) {
|
||||
const laters = global.compositor.get_laters();
|
||||
laters.remove(this._longPressLater);
|
||||
} else {
|
||||
Meta.later_remove(this._longPressLater);
|
||||
delete this._longPressLater;
|
||||
}
|
||||
}
|
||||
const tracker = Shell.WindowTracker.get_default();
|
||||
const appName = tracker.get_window_app(this.metaWindow).get_name();
|
||||
_Util.activateSearchProvider(`${SEARCH_WINDOWS_PREFIX} ${appName}`);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
|
||||
if (opt.WINDOW_ICON_CLICK_SEARCH) {
|
||||
const iconClickAction = new Clutter.ClickAction();
|
||||
iconClickAction.connect('clicked', act => {
|
||||
if (act.get_button() === Clutter.BUTTON_PRIMARY) {
|
||||
const tracker = Shell.WindowTracker.get_default();
|
||||
const appName = tracker.get_window_app(this.metaWindow).get_name();
|
||||
_Util.activateSearchProvider(`${SEARCH_WINDOWS_PREFIX} ${appName}`);
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
this._icon.add_action(iconClickAction);
|
||||
const metaWin = this.metaWindow;
|
||||
if (opt.DASH_ISOLATE_WS && !metaWin._wsChangedConId) {
|
||||
metaWin._wsChangedConId = metaWin.connect('workspace-changed',
|
||||
() => Main.overview.dash._queueRedisplay());
|
||||
} else if (!opt.DASH_ISOLATE_WS && metaWin._wsChangedConId) {
|
||||
metaWin.disconnect(metaWin._wsChangedConId);
|
||||
}
|
||||
},
|
||||
|
||||
_closeWinAction() {
|
||||
this.hide();
|
||||
this._deleteAll();
|
||||
},
|
||||
|
||||
_removeLaters() {
|
||||
// this action cancels long-press event and the 'long-press-cancel' event is used by the Shell to actually initiate DnD
|
||||
// so the dnd initiation needs to be removed
|
||||
if (this._longPressLater) {
|
||||
if (Meta.later_remove)
|
||||
Meta.later_remove(this._longPressLater);
|
||||
else
|
||||
global.compositor.get_laters().remove(this._longPressLater);
|
||||
delete this._longPressLater;
|
||||
}
|
||||
},
|
||||
|
||||
_searchAppWindowsAction() {
|
||||
this._removeLaters();
|
||||
const tracker = Shell.WindowTracker.get_default();
|
||||
const appName = tracker.get_window_app(this.metaWindow).get_name();
|
||||
Me.Util.activateSearchProvider(`${Me.WSP_PREFIX} ${appName}`);
|
||||
},
|
||||
|
||||
_updateIconScale() {
|
||||
let { currentState, initialState, finalState } =
|
||||
this._overviewAdjustment.getStateTransitionParams();
|
||||
|
@ -192,7 +447,7 @@ const WindowPreviewCommon = {
|
|||
|
||||
const visible =
|
||||
(initialState > ControlsState.HIDDEN || finalState > ControlsState.HIDDEN) &&
|
||||
!(finalState === ControlsState.APP_GRID && primaryMonitor);
|
||||
!(finalState === ControlsState.APP_GRID && opt.WS_ANIMATION && primaryMonitor);
|
||||
|
||||
let scale = 0;
|
||||
if (visible)
|
||||
|
@ -210,7 +465,6 @@ const WindowPreviewCommon = {
|
|||
else if (primaryMonitor && currentState > ControlsState.WINDOW_PICKER)
|
||||
scale = 0;
|
||||
|
||||
|
||||
// in static workspace mode show icon and title on windows expose
|
||||
if (opt.OVERVIEW_MODE) {
|
||||
if (currentState === 1)
|
||||
|
@ -219,29 +473,32 @@ const WindowPreviewCommon = {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!opt.WS_ANIMATION && (Main.overview._overview.controls._searchController.searchActive ||
|
||||
((initialState === ControlsState.WINDOW_PICKER && finalState === ControlsState.APP_GRID) ||
|
||||
(initialState === ControlsState.APP_GRID && finalState === ControlsState.WINDOW_PICKER)))
|
||||
)
|
||||
return;
|
||||
|
||||
// if titles are in 'always show' mode, we need to add transition between visible/invisible state
|
||||
// but the transition is quite expensive,
|
||||
// showing the titles at the end of the transition is good enough and workspace preview transition is much smoother
|
||||
if (scale === 1) {
|
||||
this._icon.ease({
|
||||
duration: 50,
|
||||
scale_x: scale,
|
||||
scale_y: scale,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
this._icon.set({
|
||||
scale_x: 1,
|
||||
scale_y: 1,
|
||||
});
|
||||
this._title.ease({
|
||||
duration: 100,
|
||||
opacity: 255,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
} else if (this._icon.scale_x !== 0) {
|
||||
this._icon.set({
|
||||
scale_x: 0,
|
||||
scale_y: 0,
|
||||
});
|
||||
} else {
|
||||
this._title.opacity = 0;
|
||||
this._icon.set({
|
||||
scale_x: scale,
|
||||
scale_y: scale,
|
||||
});
|
||||
}
|
||||
|
||||
// if titles are in 'always show' mode, we need to add transition between visible/invisible state
|
||||
// but the transition is quite expensive,
|
||||
// showing the titles at the end of the transition is good enough and workspace preview transition is much smoother
|
||||
},
|
||||
|
||||
showOverlay(animate) {
|
||||
|
@ -252,7 +509,7 @@ const WindowPreviewCommon = {
|
|||
return;
|
||||
|
||||
this._overlayShown = true;
|
||||
if (!opt.ALWAYS_ACTIVATE_SELECTED_WINDOW)
|
||||
if (opt.WIN_TITLES_POSITION === 2)
|
||||
this._restack();
|
||||
|
||||
// If we're supposed to animate and an animation in our direction
|
||||
|
@ -263,7 +520,7 @@ const WindowPreviewCommon = {
|
|||
ongoingTransition.get_interval().peek_final_value() === 255)
|
||||
return;
|
||||
|
||||
const toShow = this._windowCanClose()
|
||||
const toShow = this._windowCanClose() && opt.SHOW_CLOSE_BUTTON
|
||||
? [this._closeButton]
|
||||
: [];
|
||||
|
||||
|
@ -301,12 +558,12 @@ const WindowPreviewCommon = {
|
|||
if (!this._overlayShown)
|
||||
return;
|
||||
this._overlayShown = false;
|
||||
if (opt.ALWAYS_ACTIVATE_SELECTED_WINDOW && Main.overview._overview.controls._stateAdjustment.value < 1) {
|
||||
this.get_parent()?.set_child_above_sibling(this, null);
|
||||
this._activateSelected = true;
|
||||
}
|
||||
|
||||
if (!opt.ALWAYS_ACTIVATE_SELECTED_WINDOW)
|
||||
if (opt.ALWAYS_ACTIVATE_SELECTED_WINDOW && Main.overview._overview.controls._stateAdjustment.value < 1)
|
||||
this._activateSelected = true;
|
||||
|
||||
|
||||
if (opt.WIN_TITLES_POSITION === 2)
|
||||
this._restack();
|
||||
|
||||
// If we're supposed to animate and an animation in our direction
|
||||
|
@ -353,14 +610,11 @@ const WindowPreviewCommon = {
|
|||
this._delegate = null;
|
||||
|
||||
if (this._longPressLater) {
|
||||
if (shellVersion >= 44) {
|
||||
const laters = global.compositor.get_laters();
|
||||
laters.remove(this._longPressLater);
|
||||
delete this._longPressLater;
|
||||
} else {
|
||||
Meta.later_remove(this._longPressLater);
|
||||
delete this._longPressLater;
|
||||
}
|
||||
if (Meta.later_add)
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, this._longPressLater);
|
||||
else
|
||||
global.compositor.get_laters().add(Meta.LaterType.BEFORE_REDRAW, this._longPressLater);
|
||||
delete this._longPressLater;
|
||||
}
|
||||
|
||||
if (this._idleHideOverlayId > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue