prevent widening left neighbor on edge resize with min-width
This commit is contained in:
@@ -116,11 +116,13 @@ class Window {
|
||||
const widthDelta = newGeometry.width - oldGeometry.width;
|
||||
const heightDelta = newGeometry.height - oldGeometry.height;
|
||||
if (widthDelta !== 0) {
|
||||
this.column.adjustWidth(widthDelta, true);
|
||||
let leftEdgeDelta = newGeometry.left - oldGeometry.left;
|
||||
const resizingLeftSide = leftEdgeDelta !== 0;
|
||||
const resizingLeftSide = newGeometry.left !== oldGeometry.left;
|
||||
let widthDeltaTotal = newGeometry.width - startWidth;
|
||||
const oldColumnWidth = this.column.getWidth();
|
||||
this.column.setWidth(startWidth + widthDeltaTotal, true);
|
||||
widthDeltaTotal = this.column.getWidth() - startWidth;
|
||||
let leftEdgeDelta = resizingLeftSide ? oldColumnWidth - this.column.getWidth() : 0;
|
||||
if (neighbor !== undefined) {
|
||||
const widthDeltaTotal = newGeometry.width - startWidth;
|
||||
const oldNeighborWidth = neighbor.column.getWidth();
|
||||
neighbor.column.setWidth(neighbor.startWidth - widthDeltaTotal, true);
|
||||
if (resizingLeftSide) {
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace ClientState {
|
||||
|
||||
if (kwinClient.resize) {
|
||||
resizing = true;
|
||||
resizeStartWidth = kwinClient.frameGeometry.width;
|
||||
resizeStartWidth = window.column.getWidth();
|
||||
if (config.resizeNeighborColumn) {
|
||||
const resizeNeighborColumn = Tiled.getResizeNeighborColumn(window);
|
||||
if (resizeNeighborColumn !== null) {
|
||||
|
||||
@@ -72,10 +72,39 @@ tests.register("User resize", 10, () => {
|
||||
assertSizes(310, 295, h-20, h+20);
|
||||
|
||||
workspaceMock.resizeWindow(clientRightBottom, true, true, false, new MockQmlSize(-10, 20));
|
||||
assertSizes(320, 295, h-20, h+20);
|
||||
assertSizes(310, 295, h-20, h+20);
|
||||
|
||||
workspaceMock.resizeWindow(clientRightTop, true, true, false, new MockQmlSize(-10, 0));
|
||||
assertSizes(310, 295, h-20, h+20);
|
||||
|
||||
// TODO
|
||||
// workspaceMock.resizeWindow(clientRightBottom, true, false, true, new MockQmlSize(0, -80));
|
||||
// assertSizes(320, 295, h+60, h-20);
|
||||
// assertSizes(310, 295, h+60, h-20);
|
||||
}
|
||||
|
||||
{
|
||||
const { qtMock, workspaceMock, world } = init(config);
|
||||
const [clientLeftTop, clientLeftBottom, clientRight] = workspaceMock.createClientsWithWidths(300, 200, 300);
|
||||
clientLeftBottom.minSize = new MockQmlSize(295, h-20);
|
||||
|
||||
function assertSizes(leftWidth: number, rightWidth: number, topHeight: number, bottomHeight: number) {
|
||||
const { left, right } = getGridBounds(clientLeftTop, clientRight);
|
||||
Assert.rect(clientLeftTop.frameGeometry, left, tilingArea.top, leftWidth, topHeight);
|
||||
Assert.rect(clientLeftBottom.frameGeometry, left, tilingArea.top+topHeight+gapV, leftWidth, bottomHeight);
|
||||
Assert.rect(clientRight.frameGeometry, left+leftWidth+gapH, tilingArea.top, rightWidth, tilingArea.height);
|
||||
}
|
||||
|
||||
workspaceMock.activeWindow = clientLeftBottom;
|
||||
qtMock.fireShortcut("karousel-window-move-left");
|
||||
assertSizes(300, 300, h, h);
|
||||
|
||||
workspaceMock.resizeWindow(clientLeftTop, true, false, false, new MockQmlSize(-10, 0));
|
||||
assertSizes(295, 305, h, h);
|
||||
|
||||
workspaceMock.resizeWindow(clientLeftTop, true, false, false, new MockQmlSize(10, 0));
|
||||
assertSizes(305, 295, h, h);
|
||||
|
||||
workspaceMock.resizeWindow(clientLeftTop, true, false, false, new MockQmlSize(-20, 0), new MockQmlSize(20, 0));
|
||||
assertSizes(305, 295, h, h);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user