diff --git a/src/layout/Grid.ts b/src/layout/Grid.ts index 5191a9b..906003b 100644 --- a/src/layout/Grid.ts +++ b/src/layout/Grid.ts @@ -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; diff --git a/src/layout/Window.ts b/src/layout/Window.ts index bf101b0..25635c6 100644 --- a/src/layout/Window.ts +++ b/src/layout/Window.ts @@ -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); diff --git a/src/world/ClientStateTiled.ts b/src/world/ClientStateTiled.ts index e36abdd..40d5a20 100644 --- a/src/world/ClientStateTiled.ts +++ b/src/world/ClientStateTiled.ts @@ -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);