Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GJS 1.72 Shell 42 #217

Merged
merged 9 commits into from
Apr 28, 2022
3 changes: 1 addition & 2 deletions wsmatrix@martin.zurowietz.de/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"shell-version": [
"40",
"41"
"42"
],
"uuid": "wsmatrix@martin.zurowietz.de",
"url": "https://github.com/mzur/gnome-shell-wsmatrix",
Expand Down
12 changes: 7 additions & 5 deletions wsmatrix@martin.zurowietz.de/overview/controlsManagerLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@ var ControlsManagerLayout = class {
constructor() {
this.originalLayout = null;
this._overrideProperties = {
_computeWorkspacesBoxForState(state, workAreaBox, searchHeight, dashHeight, thumbnailsHeight) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an incompatible change. @mzur, would you please open a shell-42 branch (or take this as it)?

_computeWorkspacesBoxForState(state, box, workAreaBox, searchHeight, dashHeight, thumbnailsHeight) {
const { ControlsState } = OverviewControls;
const workspaceBox = workAreaBox.copy();
const [startX, startY] = workAreaBox.get_origin();
const workspaceBox = box.copy();
const [width, height] = workspaceBox.get_size();
const { y1: startY } = workAreaBox;
const {spacing} = this;
const {expandFraction} = this._workspacesThumbnails;
let workspaceManager = global.workspace_manager;
let rows = workspaceManager.layout_rows;

switch (state) {
case ControlsState.HIDDEN:
workspaceBox.set_origin(...workAreaBox.get_origin());
workspaceBox.set_size(...workAreaBox.get_size());
break;
case ControlsState.WINDOW_PICKER:
workspaceBox.set_origin(startX,
workspaceBox.set_origin(0,
startY + searchHeight + spacing +
thumbnailsHeight * rows + spacing * expandFraction);
workspaceBox.set_size(width,
Expand All @@ -33,7 +35,7 @@ var ControlsManagerLayout = class {
thumbnailsHeight * rows - spacing * expandFraction);
break;
case ControlsState.APP_GRID:
workspaceBox.set_origin(startX, startY + searchHeight + spacing);
workspaceBox.set_origin(0, startY + searchHeight + spacing);
workspaceBox.set_size(
width,
Math.round(height * rows * SMALL_WORKSPACE_RATIO));
Expand Down
2 changes: 1 addition & 1 deletion wsmatrix@martin.zurowietz.de/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Gio = imports.gi.Gio;
const Self = imports.misc.extensionUtils.getCurrentExtension();

function hookVfunc(proto, symbol, func) {
proto[Gi.hook_up_vfunc_symbol](symbol, func);
proto[Gi.hook_up_vfunc_symbol].call(proto[Gi.gobject_prototype_symbol], symbol, func);
}

function overrideProto(proto, overrides) {
Expand Down
47 changes: 40 additions & 7 deletions wsmatrix@martin.zurowietz.de/workspacePopup/workspaceAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ const {GObject, Meta, St} = imports.gi;

const Main = imports.ui.main;
const GWorkspaceAnimation = imports.ui.workspaceAnimation;

const { WORKSPACE_SPACING } = GWorkspaceAnimation;
const ExtensionUtils = imports.misc.extensionUtils;
const Self = ExtensionUtils.getCurrentExtension();
const Util = Self.imports.util;
const {WORKSPACE_SPACING} = GWorkspaceAnimation;

const MonitorGroup = GObject.registerClass(
class MonitorGroup extends GWorkspaceAnimation.MonitorGroup {
Expand Down Expand Up @@ -37,10 +39,6 @@ class MonitorGroup extends GWorkspaceAnimation.MonitorGroup {
}

const group = new GWorkspaceAnimation.WorkspaceGroup(ws, monitor, movingWindow);
// avoid warnings
group._syncStacking = () => {
};

this._workspaceGroups.push(group);
this._container.add_child(group);
group.set_position(x, y);
Expand Down Expand Up @@ -132,7 +130,7 @@ class MonitorGroup extends GWorkspaceAnimation.MonitorGroup {
}
});

class WorkspaceAnimationController extends GWorkspaceAnimation.WorkspaceAnimationController {
var WorkspaceAnimationController = class WorkspaceAnimationController extends GWorkspaceAnimation.WorkspaceAnimationController {
_prepareWorkspaceSwitch(workspaceIndices) {
if (this._switchData)
return;
Expand Down Expand Up @@ -169,3 +167,38 @@ class WorkspaceAnimationController extends GWorkspaceAnimation.WorkspaceAnimatio
Meta.disable_unredirect_for_display(global.display);
}
}

var WorkspaceGroup = class {
constructor() {
this.originalLayout = null;
this._overrideProperties = {
_syncStacking() {
const windowActors = global.get_window_actors().filter(w =>
this._shouldShowWindow(w.meta_window));

let lastRecord;

for (const windowActor of windowActors) {
const record = this._windowRecords.find(r => r.windowActor === windowActor);

if (record && lastRecord) {
this.set_child_above_sibling(record.clone, lastRecord ? lastRecord.clone : this._background);
lastRecord = record;
}
}
},
Comment on lines +258 to +272
Copy link
Owner

@mzur mzur Apr 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ettavolt Could you please explain why this is override necessary? The (record && lastRecord) will never be true. Otherwise I see no difference to the upstream code.

}
}

destroy() {
this.restoreOriginalProperties();
}

overrideOriginalProperties() {
this.originalLayout = Util.overrideProto(GWorkspaceAnimation.WorkspaceGroup.prototype, this._overrideProperties);
}

restoreOriginalProperties() {
Util.overrideProto(GWorkspaceAnimation.WorkspaceGroup.prototype, this.originalLayout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var WorkspaceManagerOverride = class {
'_workspaceAnimation',
'handleWorkspaceScroll',
];

this._overrideWorkspaceGroup();
this._overrideDynamicWorkspaces();
this._overrideKeybindingHandlers();
this._overrideOriginalProperties();
Expand All @@ -45,6 +45,7 @@ var WorkspaceManagerOverride = class {
}

destroy() {
this._restoreWorkspaceGroup();
this._destroyWorkspaceSwitcherPopup();
this._restoreLayout();
this._restoreKeybindingHandlers();
Expand Down Expand Up @@ -283,6 +284,15 @@ var WorkspaceManagerOverride = class {
}
}

_overrideWorkspaceGroup() {
this.overrideWorkspaceGroup = new WorkspaceAnimation.WorkspaceGroup();
this.overrideWorkspaceGroup.overrideOriginalProperties();
}

_restoreWorkspaceGroup() {
this.overrideWorkspaceGroup.destroy();
}

_overrideDynamicWorkspaces() {
this._mutterSettings.set_boolean('dynamic-workspaces', false);
}
Expand Down