[gnome] Update extensions
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
// Gnome imports
|
||||
import Clutter from "gi://Clutter";
|
||||
import GObject from "gi://GObject";
|
||||
import Meta from "gi://Meta";
|
||||
import Shell from "gi://Shell";
|
||||
@ -490,11 +491,22 @@ export class Node extends GObject.Object {
|
||||
metaWin.activate(global.display.get_current_time());
|
||||
};
|
||||
|
||||
iconBin.connect("clicked", clickFn);
|
||||
titleButton.connect("clicked", clickFn);
|
||||
closeButton.connect("clicked", () => {
|
||||
let closeFn = () => {
|
||||
metaWin.delete(global.get_current_time());
|
||||
});
|
||||
};
|
||||
|
||||
let middleClickCloseFn = (_, event) => {
|
||||
if (event.get_button() === Clutter.BUTTON_MIDDLE) {
|
||||
metaWin.delete(global.get_current_time());
|
||||
}
|
||||
};
|
||||
|
||||
iconBin.connect("clicked", clickFn);
|
||||
iconBin.connect("button-release-event", middleClickCloseFn);
|
||||
titleButton.connect("clicked", clickFn);
|
||||
titleButton.connect("button-release-event", middleClickCloseFn);
|
||||
closeButton.connect("clicked", closeFn);
|
||||
closeButton.connect("button-release-event", middleClickCloseFn);
|
||||
|
||||
if (metaWin === global.display.get_focus_window()) {
|
||||
tabContents.add_style_class_name("window-tabbed-tab-active");
|
||||
@ -1215,6 +1227,18 @@ export class Tree extends Node {
|
||||
if (!this.extWm.floatingWindow(node)) cleanUpParent(existParent);
|
||||
}
|
||||
|
||||
// If only a single tab remains, exit tabbed layout
|
||||
if (
|
||||
this.settings.get_boolean("auto-exit-tabbed") &&
|
||||
parentNode.nodeType === NODE_TYPES.CON &&
|
||||
parentNode.layout === LAYOUT_TYPES.TABBED &&
|
||||
parentNode.childNodes.length === 1
|
||||
) {
|
||||
parentNode.layout = this.extWm.determineSplitLayout();
|
||||
this.resetSiblingPercent(parentNode);
|
||||
parentNode.lastTabFocus = null;
|
||||
}
|
||||
|
||||
if (node === this.attachNode) {
|
||||
this.attachNode = null;
|
||||
} else {
|
||||
@ -1511,7 +1535,6 @@ export class Tree extends Node {
|
||||
|
||||
if (gap === 0) {
|
||||
adjustY = renderRect.y;
|
||||
nodeY = renderRect.y + params.stackedHeight + adjust / 4;
|
||||
}
|
||||
|
||||
let decoration = node.decoration;
|
||||
|
||||
@ -261,11 +261,16 @@ export function positionFromGrabOp(grabOp) {
|
||||
}
|
||||
|
||||
export function allowResizeGrabOp(grabOp) {
|
||||
grabOp &= ~1024; // ignore META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED
|
||||
return (
|
||||
grabOp === Meta.GrabOp.RESIZING_N ||
|
||||
grabOp === Meta.GrabOp.RESIZING_E ||
|
||||
grabOp === Meta.GrabOp.RESIZING_W ||
|
||||
grabOp === Meta.GrabOp.RESIZING_S ||
|
||||
grabOp === Meta.GrabOp.RESIZING_NE ||
|
||||
grabOp === Meta.GrabOp.RESIZING_NW ||
|
||||
grabOp === Meta.GrabOp.RESIZING_SE ||
|
||||
grabOp === Meta.GrabOp.RESIZING_SW ||
|
||||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_N ||
|
||||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_E ||
|
||||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_W ||
|
||||
@ -275,11 +280,16 @@ export function allowResizeGrabOp(grabOp) {
|
||||
}
|
||||
|
||||
export function grabMode(grabOp) {
|
||||
grabOp &= ~1024; // ignore META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED
|
||||
if (
|
||||
grabOp === Meta.GrabOp.RESIZING_N ||
|
||||
grabOp === Meta.GrabOp.RESIZING_E ||
|
||||
grabOp === Meta.GrabOp.RESIZING_W ||
|
||||
grabOp === Meta.GrabOp.RESIZING_S ||
|
||||
grabOp === Meta.GrabOp.RESIZING_NE ||
|
||||
grabOp === Meta.GrabOp.RESIZING_NW ||
|
||||
grabOp === Meta.GrabOp.RESIZING_SE ||
|
||||
grabOp === Meta.GrabOp.RESIZING_SW ||
|
||||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_N ||
|
||||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_E ||
|
||||
grabOp === Meta.GrabOp.KEYBOARD_RESIZING_W ||
|
||||
@ -297,6 +307,22 @@ export function grabMode(grabOp) {
|
||||
return GRAB_TYPES.UNKNOWN;
|
||||
}
|
||||
|
||||
export function decomposeGrabOp(grabOp) {
|
||||
grabOp &= ~1024; // ignore META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED
|
||||
switch (grabOp) {
|
||||
case Meta.GrabOp.RESIZING_NE:
|
||||
return [Meta.GrabOp.RESIZING_N, Meta.GrabOp.RESIZING_E];
|
||||
case Meta.GrabOp.RESIZING_NW:
|
||||
return [Meta.GrabOp.RESIZING_N, Meta.GrabOp.RESIZING_W];
|
||||
case Meta.GrabOp.RESIZING_SE:
|
||||
return [Meta.GrabOp.RESIZING_S, Meta.GrabOp.RESIZING_E];
|
||||
case Meta.GrabOp.RESIZING_SW:
|
||||
return [Meta.GrabOp.RESIZING_S, Meta.GrabOp.RESIZING_W];
|
||||
default:
|
||||
return [grabOp];
|
||||
}
|
||||
}
|
||||
|
||||
export function directionFromGrab(grabOp) {
|
||||
if (grabOp === Meta.GrabOp.RESIZING_E || grabOp === Meta.GrabOp.KEYBOARD_RESIZING_E) {
|
||||
return Meta.MotionDirection.RIGHT;
|
||||
|
||||
@ -2348,143 +2348,145 @@ export class WindowManager extends GObject.Object {
|
||||
|
||||
_handleResizing(focusNodeWindow) {
|
||||
if (!focusNodeWindow || focusNodeWindow.isFloat()) return;
|
||||
let grabOp = this.grabOp;
|
||||
let initGrabOp = focusNodeWindow.initGrabOp;
|
||||
let direction = Utils.directionFromGrab(grabOp);
|
||||
let orientation = Utils.orientationFromGrab(grabOp);
|
||||
let parentNodeForFocus = focusNodeWindow.parentNode;
|
||||
let position = Utils.positionFromGrabOp(grabOp);
|
||||
// normalize the rect without gaps
|
||||
let frameRect = this.focusMetaWindow.get_frame_rect();
|
||||
let gaps = this.calculateGaps(focusNodeWindow);
|
||||
let currentRect = Utils.removeGapOnRect(frameRect, gaps);
|
||||
let firstRect;
|
||||
let secondRect;
|
||||
let parentRect;
|
||||
let resizePairForWindow;
|
||||
let grabOps = Utils.decomposeGrabOp(this.grabOp);
|
||||
for (let grabOp of grabOps) {
|
||||
let initGrabOp = focusNodeWindow.initGrabOp;
|
||||
let direction = Utils.directionFromGrab(grabOp);
|
||||
let orientation = Utils.orientationFromGrab(grabOp);
|
||||
let parentNodeForFocus = focusNodeWindow.parentNode;
|
||||
let position = Utils.positionFromGrabOp(grabOp);
|
||||
// normalize the rect without gaps
|
||||
let frameRect = this.focusMetaWindow.get_frame_rect();
|
||||
let gaps = this.calculateGaps(focusNodeWindow);
|
||||
let currentRect = Utils.removeGapOnRect(frameRect, gaps);
|
||||
let firstRect;
|
||||
let secondRect;
|
||||
let parentRect;
|
||||
let resizePairForWindow;
|
||||
|
||||
if (initGrabOp === Meta.GrabOp.RESIZING_UNKNOWN) {
|
||||
// the direction is null so do not process yet below.
|
||||
return;
|
||||
} else {
|
||||
resizePairForWindow = this.tree.nextVisible(focusNodeWindow, direction);
|
||||
}
|
||||
|
||||
let sameParent = resizePairForWindow
|
||||
? resizePairForWindow.parentNode === focusNodeWindow.parentNode
|
||||
: false;
|
||||
|
||||
if (orientation === ORIENTATION_TYPES.HORIZONTAL) {
|
||||
if (sameParent) {
|
||||
// use the window or con pairs
|
||||
if (this.tree.getTiledChildren(parentNodeForFocus.childNodes).length <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
firstRect = focusNodeWindow.initRect;
|
||||
if (resizePairForWindow) {
|
||||
if (
|
||||
!this.floatingWindow(resizePairForWindow) &&
|
||||
!this.minimizedWindow(resizePairForWindow)
|
||||
) {
|
||||
secondRect = resizePairForWindow.rect;
|
||||
} else {
|
||||
// TODO try to get the next resize pair?
|
||||
}
|
||||
}
|
||||
|
||||
if (!firstRect || !secondRect) {
|
||||
return;
|
||||
}
|
||||
|
||||
parentRect = parentNodeForFocus.rect;
|
||||
let changePx = currentRect.width - firstRect.width;
|
||||
let firstPercent = (firstRect.width + changePx) / parentRect.width;
|
||||
let secondPercent = (secondRect.width - changePx) / parentRect.width;
|
||||
focusNodeWindow.percent = firstPercent;
|
||||
resizePairForWindow.percent = secondPercent;
|
||||
if (initGrabOp === Meta.GrabOp.RESIZING_UNKNOWN) {
|
||||
// the direction is null so do not process yet below.
|
||||
return;
|
||||
} else {
|
||||
// use the parent pairs (con to another con or window)
|
||||
if (resizePairForWindow && resizePairForWindow.parentNode) {
|
||||
if (this.tree.getTiledChildren(resizePairForWindow.parentNode.childNodes).length <= 1) {
|
||||
resizePairForWindow = this.tree.nextVisible(focusNodeWindow, direction);
|
||||
}
|
||||
|
||||
let sameParent = resizePairForWindow
|
||||
? resizePairForWindow.parentNode === focusNodeWindow.parentNode
|
||||
: false;
|
||||
|
||||
if (orientation === ORIENTATION_TYPES.HORIZONTAL) {
|
||||
if (sameParent) {
|
||||
// use the window or con pairs
|
||||
if (this.tree.getTiledChildren(parentNodeForFocus.childNodes).length <= 1) {
|
||||
return;
|
||||
}
|
||||
let firstWindowRect = focusNodeWindow.initRect;
|
||||
let index = resizePairForWindow.index;
|
||||
if (position === POSITION.BEFORE) {
|
||||
// Find the opposite node
|
||||
index = index + 1;
|
||||
} else {
|
||||
index = index - 1;
|
||||
|
||||
firstRect = focusNodeWindow.initRect;
|
||||
if (resizePairForWindow) {
|
||||
if (
|
||||
!this.floatingWindow(resizePairForWindow) &&
|
||||
!this.minimizedWindow(resizePairForWindow)
|
||||
) {
|
||||
secondRect = resizePairForWindow.rect;
|
||||
} else {
|
||||
// TODO try to get the next resize pair?
|
||||
}
|
||||
}
|
||||
parentNodeForFocus = resizePairForWindow.parentNode.childNodes[index];
|
||||
firstRect = parentNodeForFocus.rect;
|
||||
secondRect = resizePairForWindow.rect;
|
||||
|
||||
if (!firstRect || !secondRect) {
|
||||
return;
|
||||
}
|
||||
|
||||
parentRect = parentNodeForFocus.parentNode.rect;
|
||||
let changePx = currentRect.width - firstWindowRect.width;
|
||||
parentRect = parentNodeForFocus.rect;
|
||||
let changePx = currentRect.width - firstRect.width;
|
||||
let firstPercent = (firstRect.width + changePx) / parentRect.width;
|
||||
let secondPercent = (secondRect.width - changePx) / parentRect.width;
|
||||
parentNodeForFocus.percent = firstPercent;
|
||||
focusNodeWindow.percent = firstPercent;
|
||||
resizePairForWindow.percent = secondPercent;
|
||||
}
|
||||
}
|
||||
} else if (orientation === ORIENTATION_TYPES.VERTICAL) {
|
||||
if (sameParent) {
|
||||
// use the window or con pairs
|
||||
if (this.tree.getTiledChildren(parentNodeForFocus.childNodes).length <= 1) {
|
||||
return;
|
||||
}
|
||||
firstRect = focusNodeWindow.initRect;
|
||||
if (resizePairForWindow) {
|
||||
if (
|
||||
!this.floatingWindow(resizePairForWindow) &&
|
||||
!this.minimizedWindow(resizePairForWindow)
|
||||
) {
|
||||
} else {
|
||||
// use the parent pairs (con to another con or window)
|
||||
if (resizePairForWindow && resizePairForWindow.parentNode) {
|
||||
if (this.tree.getTiledChildren(resizePairForWindow.parentNode.childNodes).length <= 1) {
|
||||
return;
|
||||
}
|
||||
let firstWindowRect = focusNodeWindow.initRect;
|
||||
let index = resizePairForWindow.index;
|
||||
if (position === POSITION.BEFORE) {
|
||||
// Find the opposite node
|
||||
index = index + 1;
|
||||
} else {
|
||||
index = index - 1;
|
||||
}
|
||||
parentNodeForFocus = resizePairForWindow.parentNode.childNodes[index];
|
||||
firstRect = parentNodeForFocus.rect;
|
||||
secondRect = resizePairForWindow.rect;
|
||||
} else {
|
||||
// TODO try to get the next resize pair?
|
||||
if (!firstRect || !secondRect) {
|
||||
return;
|
||||
}
|
||||
|
||||
parentRect = parentNodeForFocus.parentNode.rect;
|
||||
let changePx = currentRect.width - firstWindowRect.width;
|
||||
let firstPercent = (firstRect.width + changePx) / parentRect.width;
|
||||
let secondPercent = (secondRect.width - changePx) / parentRect.width;
|
||||
parentNodeForFocus.percent = firstPercent;
|
||||
resizePairForWindow.percent = secondPercent;
|
||||
}
|
||||
}
|
||||
if (!firstRect || !secondRect) {
|
||||
return;
|
||||
}
|
||||
parentRect = parentNodeForFocus.rect;
|
||||
let changePx = currentRect.height - firstRect.height;
|
||||
let firstPercent = (firstRect.height + changePx) / parentRect.height;
|
||||
let secondPercent = (secondRect.height - changePx) / parentRect.height;
|
||||
focusNodeWindow.percent = firstPercent;
|
||||
resizePairForWindow.percent = secondPercent;
|
||||
} else {
|
||||
// use the parent pairs (con to another con or window)
|
||||
if (resizePairForWindow && resizePairForWindow.parentNode) {
|
||||
if (this.tree.getTiledChildren(resizePairForWindow.parentNode.childNodes).length <= 1) {
|
||||
} else if (orientation === ORIENTATION_TYPES.VERTICAL) {
|
||||
if (sameParent) {
|
||||
// use the window or con pairs
|
||||
if (this.tree.getTiledChildren(parentNodeForFocus.childNodes).length <= 1) {
|
||||
return;
|
||||
}
|
||||
let firstWindowRect = focusNodeWindow.initRect;
|
||||
let index = resizePairForWindow.index;
|
||||
if (position === POSITION.BEFORE) {
|
||||
// Find the opposite node
|
||||
index = index + 1;
|
||||
} else {
|
||||
index = index - 1;
|
||||
firstRect = focusNodeWindow.initRect;
|
||||
if (resizePairForWindow) {
|
||||
if (
|
||||
!this.floatingWindow(resizePairForWindow) &&
|
||||
!this.minimizedWindow(resizePairForWindow)
|
||||
) {
|
||||
secondRect = resizePairForWindow.rect;
|
||||
} else {
|
||||
// TODO try to get the next resize pair?
|
||||
}
|
||||
}
|
||||
parentNodeForFocus = resizePairForWindow.parentNode.childNodes[index];
|
||||
firstRect = parentNodeForFocus.rect;
|
||||
secondRect = resizePairForWindow.rect;
|
||||
if (!firstRect || !secondRect) {
|
||||
return;
|
||||
}
|
||||
|
||||
parentRect = parentNodeForFocus.parentNode.rect;
|
||||
let changePx = currentRect.height - firstWindowRect.height;
|
||||
parentRect = parentNodeForFocus.rect;
|
||||
let changePx = currentRect.height - firstRect.height;
|
||||
let firstPercent = (firstRect.height + changePx) / parentRect.height;
|
||||
let secondPercent = (secondRect.height - changePx) / parentRect.height;
|
||||
parentNodeForFocus.percent = firstPercent;
|
||||
focusNodeWindow.percent = firstPercent;
|
||||
resizePairForWindow.percent = secondPercent;
|
||||
} else {
|
||||
// use the parent pairs (con to another con or window)
|
||||
if (resizePairForWindow && resizePairForWindow.parentNode) {
|
||||
if (this.tree.getTiledChildren(resizePairForWindow.parentNode.childNodes).length <= 1) {
|
||||
return;
|
||||
}
|
||||
let firstWindowRect = focusNodeWindow.initRect;
|
||||
let index = resizePairForWindow.index;
|
||||
if (position === POSITION.BEFORE) {
|
||||
// Find the opposite node
|
||||
index = index + 1;
|
||||
} else {
|
||||
index = index - 1;
|
||||
}
|
||||
parentNodeForFocus = resizePairForWindow.parentNode.childNodes[index];
|
||||
firstRect = parentNodeForFocus.rect;
|
||||
secondRect = resizePairForWindow.rect;
|
||||
if (!firstRect || !secondRect) {
|
||||
return;
|
||||
}
|
||||
|
||||
parentRect = parentNodeForFocus.parentNode.rect;
|
||||
let changePx = currentRect.height - firstWindowRect.height;
|
||||
let firstPercent = (firstRect.height + changePx) / parentRect.height;
|
||||
let secondPercent = (secondRect.height - changePx) / parentRect.height;
|
||||
parentNodeForFocus.percent = firstPercent;
|
||||
resizePairForWindow.percent = secondPercent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user