diff --git a/src/layout/ScrollView.ts b/src/layout/ScrollView.ts index 8712d63..3f30688 100644 --- a/src/layout/ScrollView.ts +++ b/src/layout/ScrollView.ts @@ -127,6 +127,7 @@ class ScrollView { // TODO (optimization): only arrange visible windows this.updateArea(); this.grid.arrange(this.tilingArea.x - this.scrollX); + this.world.ensureFocusedTransientsVisible(); // TODO: refactor - call from elsewhere } public onGridWidthChanged() { diff --git a/src/world/ClientWrapper.ts b/src/world/ClientWrapper.ts index 762db1b..3897962 100644 --- a/src/world/ClientWrapper.ts +++ b/src/world/ClientWrapper.ts @@ -119,6 +119,25 @@ class ClientWrapper { this.transients.splice(i, 1); } + public ensureTransientsVisible(screenSize: QRect) { + for (const transient of this.transients) { + if (transient.stateManager.getState() instanceof ClientStateFloating) { + transient.ensureVisible(screenSize); + transient.ensureTransientsVisible(screenSize); + + } + } + } + + public ensureVisible(screenSize: QRect) { + const frame = this.kwinClient.frameGeometry; + if (frame.left < 0) { + frame.x = 0; + } else if (frame.right > screenSize.width) { + frame.x = screenSize.width - frame.width; + } + } + destroy(passFocus: boolean) { this.stateManager.destroy(passFocus); this.signalManager.destroy(); diff --git a/src/world/World.ts b/src/world/World.ts index 1e16862..ca4668a 100644 --- a/src/world/World.ts +++ b/src/world/World.ts @@ -113,6 +113,12 @@ class World { return transientFor; } + public ensureFocusedTransientsVisible() { + this.doIfTiledFocused(true, (window, column, grid) => { + window.client.ensureTransientsVisible(grid.container.clientArea); + }); + } + minimizeClient(kwinClient: AbstractClient) { const client = this.clientMap.get(kwinClient); if (client === undefined) {