Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 73 additions & 13 deletions lib/extension/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,16 @@ export class WindowManager extends GObject.Object {
move(metaWindow, rect) {
if (!metaWindow) return;
if (metaWindow.grabbed) return;
metaWindow.unmaximize(Meta.MaximizeFlags.HORIZONTAL);
metaWindow.unmaximize(Meta.MaximizeFlags.VERTICAL);
metaWindow.unmaximize(Meta.MaximizeFlags.BOTH);
try {
// GNOME 49+
metaWindow.set_unmaximize_flags(Meta.MaximizeFlags.BOTH);
metaWindow.unmaximize();
} catch (e) {
// pre-49 fallback
metaWindow.unmaximize(Meta.MaximizeFlags.HORIZONTAL);
metaWindow.unmaximize(Meta.MaximizeFlags.VERTICAL);
metaWindow.unmaximize(Meta.MaximizeFlags.BOTH);
}

let windowActor = metaWindow.get_compositor_private();
if (!windowActor) return;
Expand Down Expand Up @@ -1235,7 +1242,13 @@ export class WindowManager extends GObject.Object {
let tilingModeEnabled = this.ext.settings.get_boolean("tiling-mode-enabled");
let gap = this.calculateGaps(nodeWindow);
let maximized = () => {
return metaWindow.get_maximized() === 3 || metaWindow.is_fullscreen() || gap === 0;
try {
// GNOME 49+
return metaWindow.is_maximized() || metaWindow.is_fullscreen() || gap === 0;
} catch (e) {
// pre-49 fallback
return metaWindow.get_maximized() === 3 || metaWindow.is_fullscreen() || gap === 0;
}
};
let monitorCount = global.display.get_n_monitors();
let tiledChildren = this.tree.getTiledChildren(nodeWindow.parentNode.childNodes);
Expand Down Expand Up @@ -1287,7 +1300,18 @@ export class WindowManager extends GObject.Object {
}
}

if (gap === 0 || metaWindow.get_maximized() === 1 || metaWindow.get_maximized() === 2) {
if (
gap === 0 ||
(() => {
try {
// GNOME 49+
return metaWindow.is_maximized();
} catch (e) {
// pre-49 fallback
return metaWindow.get_maximized() === 1 || metaWindow.get_maximized() === 2;
}
})()
) {
inset = 0;
}

Expand Down Expand Up @@ -1506,9 +1530,16 @@ export class WindowManager extends GObject.Object {
{
name: "window-create-queue",
callback: () => {
metaWindow.unmaximize(Meta.MaximizeFlags.HORIZONTAL);
metaWindow.unmaximize(Meta.MaximizeFlags.VERTICAL);
metaWindow.unmaximize(Meta.MaximizeFlags.BOTH);
try {
// GNOME 49+
metaWindow.set_unmaximize_flags(Meta.MaximizeFlags.BOTH);
metaWindow.unmaximize();
} catch (e) {
// pre-49 fallback
metaWindow.unmaximize(Meta.MaximizeFlags.HORIZONTAL);
metaWindow.unmaximize(Meta.MaximizeFlags.VERTICAL);
metaWindow.unmaximize(Meta.MaximizeFlags.BOTH);
}
this.renderTree("window-create", true);
},
},
Expand Down Expand Up @@ -1727,7 +1758,17 @@ export class WindowManager extends GObject.Object {
this._handleMoving(focusNodeWindow);
}
} else {
if (focusMetaWindow.get_maximized() === 0) {
if (
(() => {
try {
// GNOME 49+
return !focusMetaWindow.is_maximized();
} catch (e) {
// pre-49 fallback
return focusMetaWindow.get_maximized() === 0;
}
})()
) {
this.renderTree(from);
}
}
Expand Down Expand Up @@ -1765,9 +1806,18 @@ export class WindowManager extends GObject.Object {
let monWsNoMaxWindows = activeWsNode.getNodeByType(NODE_TYPES.MONITOR).filter((monitor) => {
return (
monitor.getNodeByType(NODE_TYPES.WINDOW).filter((w) => {
return (
w.nodeValue.get_maximized() === Meta.MaximizeFlags.BOTH || w.nodeValue.is_fullscreen()
);
return (() => {
try {
// GNOME 49+
return w.nodeValue.is_maximized() || w.nodeValue.is_fullscreen();
} catch (e) {
// pre-49 fallback
return (
w.nodeValue.get_maximized() === Meta.MaximizeFlags.BOTH ||
w.nodeValue.is_fullscreen()
);
}
})();
}).length === 0
);
});
Expand Down Expand Up @@ -2410,7 +2460,17 @@ export class WindowManager extends GObject.Object {
}
this._grabCleanup(focusNodeWindow);

if (focusMetaWindow.get_maximized() === 0) {
if (
(() => {
try {
// GNOME 49+
return !focusMetaWindow.is_maximized();
} catch (e) {
// pre-49 fallback
return focusMetaWindow.get_maximized() === 0;
}
})()
) {
this.renderTree("grab-op-end");
}

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"gettext-domain": "forge",
"uuid": "forge@jmmaranan.com",
"settings-schema": "org.gnome.shell.extensions.forge",
"shell-version": ["45", "46", "47", "48"],
"shell-version": ["45", "46", "47", "48", "49"],
"session-modes": ["user", "unlock-dialog"],
"url": "https://github.com/forge-ext/forge"
}