Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Fix the inability to move windows between screens #419

Merged
merged 2 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/kwinscript/controller/index.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,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
15 changes: 0 additions & 15 deletions src/kwinscript/engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ export interface Engine {
*/
resizeWindow(window: EngineWindow, dir: CompassDirection, step: Step): void;

/**
* Re-apply window geometry, computed by layout algorithm.
*
* Sometimes applications move or resize windows without user intervention,
* which is straight against the purpose of tiling WM. This operation
* move/resize such windows back to where/how they should be.
*/
enforceSize(window: EngineWindow): void;

/**
* @returns the layout we have on the surface of the active window
*/
Expand Down Expand Up @@ -386,12 +377,6 @@ export class EngineImpl implements Engine {
return this.controller.currentWindow;
}

public enforceSize(window: EngineWindow): void {
if (window.tiled && !window.actualGeometry.equals(window.geometry)) {
window.commit();
}
}

public manage(window: EngineWindow): void {
if (!window.shouldIgnore) {
/* engine#arrange will update the state when required. */
Expand Down