resize neighbor column on edge resize
This commit is contained in:
@@ -132,9 +132,8 @@ class Grid {
|
||||
|
||||
for (const column of this.columns.iteratorFrom(startColumn)) {
|
||||
if (column !== endColumn) {
|
||||
const newWidth = Math.round(column.width * scaleRatio);
|
||||
column.setWidth(newWidth, true);
|
||||
remainingWidth -= newWidth + this.world.config.gapsInnerHorizontal;
|
||||
column.setWidth(Math.round(column.width * scaleRatio), true);
|
||||
remainingWidth -= column.width + this.world.config.gapsInnerHorizontal;
|
||||
} else {
|
||||
column.setWidth(remainingWidth, true);
|
||||
break;
|
||||
|
||||
@@ -83,15 +83,25 @@ class Window {
|
||||
}
|
||||
}
|
||||
|
||||
onUserResize(oldGeometry: QRect) {
|
||||
onUserResize(oldGeometry: QRect, resizeNeighborColumn: boolean) {
|
||||
const newGeometry = this.client.kwinClient.frameGeometry;
|
||||
const widthDelta = newGeometry.width - oldGeometry.width;
|
||||
const heightDelta = newGeometry.height - oldGeometry.height;
|
||||
if (widthDelta !== 0) {
|
||||
this.column.adjustWidth(widthDelta, true);
|
||||
if (newGeometry.x !== oldGeometry.x) {
|
||||
this.column.grid.adjustScroll(widthDelta, true);
|
||||
let leftEdgeDelta = newGeometry.left - oldGeometry.left;
|
||||
const resizingLeftSide = leftEdgeDelta !== 0;
|
||||
if (resizeNeighborColumn) {
|
||||
const neighborColumn = resizingLeftSide ? this.column.grid.getPrevColumn(this.column) : this.column.grid.getNextColumn(this.column);
|
||||
if (neighborColumn !== null) {
|
||||
const oldNeighborWidth = neighborColumn.width;
|
||||
neighborColumn.adjustWidth(-widthDelta, true);
|
||||
if (resizingLeftSide) {
|
||||
leftEdgeDelta -= neighborColumn.width - oldNeighborWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.column.grid.adjustScroll(-leftEdgeDelta, true);
|
||||
}
|
||||
if (heightDelta !== 0) {
|
||||
this.column.adjustWindowHeight(this, heightDelta, newGeometry.y !== oldGeometry.y);
|
||||
|
||||
@@ -67,11 +67,19 @@ class ClientStateTiled {
|
||||
lastResize = resize;
|
||||
});
|
||||
|
||||
let cursorChangedAfterResizeStart = false;
|
||||
manager.connect(kwinClient.moveResizeCursorChanged, () => {
|
||||
cursorChangedAfterResizeStart = true;
|
||||
});
|
||||
manager.connect(kwinClient.clientStartUserMovedResized, () => {
|
||||
cursorChangedAfterResizeStart = false;
|
||||
});
|
||||
|
||||
manager.connect(kwinClient.frameGeometryChanged, (kwinClient: TopLevel, oldGeometry: QRect) => {
|
||||
console.assert(!kwinClient.move, "moved clients are removed in kwinClient.moveResizedChanged");
|
||||
const grid = window.column.grid;
|
||||
if (kwinClient.resize) {
|
||||
window.onUserResize(oldGeometry);
|
||||
window.onUserResize(oldGeometry, !cursorChangedAfterResizeStart);
|
||||
grid.arrange();
|
||||
} else {
|
||||
const maximized = rectEqual(kwinClient.frameGeometry, grid.clientArea);
|
||||
|
||||
Reference in New Issue
Block a user