Skip to content

Commit

Permalink
fix(kwinscript): arrange after kwin moves a window between screens
Browse files Browse the repository at this point in the history
...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.
  • Loading branch information
benemorius authored and gikari committed Sep 2, 2022
1 parent 73f4347 commit 3c6b367
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion src/kwinscript/controller/index.ts
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/kwinscript/driver/index.ts
Expand Up @@ -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(
Expand Down

0 comments on commit 3c6b367

Please sign in to comment.