From 3c6b367a3acdc7726d65b10bfc0706eec23d191a Mon Sep 17 00:00:00 2001 From: Thomas Stilwell Date: Tue, 21 Jun 2022 04:44:04 -0500 Subject: [PATCH] fix(kwinscript): arrange after kwin moves a window between screens ...instead of forcing it back where it was. KWin changes a window's size before moving it between screens, so we can't react to a geometry change by always changing it back. --- src/kwinscript/controller/index.ts | 12 +++++++++++- src/kwinscript/driver/index.ts | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/kwinscript/controller/index.ts b/src/kwinscript/controller/index.ts index aae1af0d..c5adb7fb 100644 --- a/src/kwinscript/controller/index.ts +++ b/src/kwinscript/controller/index.ts @@ -77,6 +77,12 @@ export interface Controller { */ onWindowResizeStart(window: EngineWindow): void; + /** + * React to window changing screens + * @param window the window whose screen has changed + */ + onWindowScreenChanged(window: EngineWindow): void; + /** * React to window resize operation end. The window * resize operation ends, when the users drops @@ -336,7 +342,11 @@ export class ControllerImpl implements Controller { public onWindowGeometryChanged(window: EngineWindow): void { this.log.log(["onWindowGeometryChanged", { window }]); - this.engine.enforceSize(window); + } + + public onWindowScreenChanged(_window: EngineWindow): void { + //TODO only arrange the surface the window came from and went to + this.engine.arrange(); } // NOTE: accepts `null` to simplify caller. This event is a catch-all hack diff --git a/src/kwinscript/driver/index.ts b/src/kwinscript/driver/index.ts index b0bb6970..b61f47d0 100644 --- a/src/kwinscript/driver/index.ts +++ b/src/kwinscript/driver/index.ts @@ -370,9 +370,9 @@ export class DriverImpl implements Driver { } }); - this.connect(client.screenChanged, () => - this.controller.onWindowChanged(window, `screen=${client.screen}`) - ); + this.connect(client.screenChanged, () => { + this.controller.onWindowScreenChanged(window); + }); this.connect(client.activitiesChanged, () => this.controller.onWindowChanged(