pass focus when moving a window to another desktop

This commit is contained in:
Peter Fajdiga
2025-01-15 19:01:24 +01:00
parent 02154f2f5e
commit 64457429d0
3 changed files with 9 additions and 10 deletions

View File

@@ -21,7 +21,7 @@ class Window {
if (targetColumn === this.column) {
return;
}
this.column.onWindowRemoved(this, false);
this.column.onWindowRemoved(this, this.isFocused() && targetColumn.grid !== this.column.grid);
this.column = targetColumn;
targetColumn.onWindowAdded(this, bottom);
}

View File

@@ -1,4 +1,4 @@
tests.register("Pass focus", 1, () => {
tests.register("Pass focus", 10, () => {
const config = getDefaultConfig();
const { qtMock, workspaceMock, world } = init(config);
@@ -10,4 +10,7 @@ tests.register("Pass focus", 1, () => {
qtMock.fireShortcut("karousel-column-move-to-desktop-2");
Assert.equal(workspaceMock.activeWindow, client1);
client1.desktops = [workspaceMock.desktops[1]];
Assert.equal(workspaceMock.activeWindow, client0);
});

View File

@@ -182,14 +182,10 @@ class MockKwinClient {
public set desktops(desktops: KwinDesktop[]) {
this._desktops = desktops;
runReorder(
() => this.desktopsChanged.fire(),
() => {
if (Workspace.activeWindow === this && !desktops.includes(Workspace.currentDesktop)) {
Workspace.activeWindow = null;
}
},
);
this.desktopsChanged.fire();
if (Workspace.activeWindow === this && !desktops.includes(Workspace.currentDesktop)) {
Workspace.activeWindow = null;
};
}
public get tile() {