pass focus when moving a column to another desktop
This commit is contained in:
@@ -21,7 +21,7 @@ class Column {
|
||||
if (targetGrid === this.grid) {
|
||||
this.grid.moveColumn(this, leftColumn);
|
||||
} else {
|
||||
this.grid.onColumnRemoved(this, false);
|
||||
this.grid.onColumnRemoved(this, this.isFocused());
|
||||
this.grid = targetGrid;
|
||||
targetGrid.onColumnAdded(this, leftColumn);
|
||||
for (const window of this.windows.iterator()) {
|
||||
@@ -203,6 +203,14 @@ class Column {
|
||||
window.focus();
|
||||
}
|
||||
|
||||
public isFocused() {
|
||||
const lastFocusedWindow = this.grid.getLastFocusedWindow();
|
||||
if (lastFocusedWindow === null) {
|
||||
return false;
|
||||
}
|
||||
return lastFocusedWindow.column === this && lastFocusedWindow.isFocused();
|
||||
}
|
||||
|
||||
public arrange(x: number, visibleRange: Range, forceOpaque: boolean) {
|
||||
if (this.grid.config.offScreenOpacity < 1.0 && !forceOpaque) {
|
||||
const opacity = Range.contains(visibleRange, this) ? 100 : this.grid.config.offScreenOpacity;
|
||||
|
||||
13
src/tests/flows/passFocus.ts
Normal file
13
src/tests/flows/passFocus.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
tests.register("Pass focus", 1, () => {
|
||||
const config = getDefaultConfig();
|
||||
const { qtMock, workspaceMock, world } = init(config);
|
||||
|
||||
const [client0, client1, client2, client3, client4] = workspaceMock.createClients(5);
|
||||
workspaceMock.activeWindow = client3;
|
||||
|
||||
workspaceMock.removeWindow(client3);
|
||||
Assert.equal(workspaceMock.activeWindow, client2);
|
||||
|
||||
qtMock.fireShortcut("karousel-column-move-to-desktop-2");
|
||||
Assert.equal(workspaceMock.activeWindow, client1);
|
||||
});
|
||||
@@ -50,6 +50,11 @@ class MockWorkspace {
|
||||
return this.createClientsWithFrames(...widths.map(width => new MockQmlRect(randomInt(100), randomInt(100), width, 100+randomInt(400))));
|
||||
}
|
||||
|
||||
public removeWindow(window: MockKwinClient) {
|
||||
this.windowRemoved.fire(window);
|
||||
// TODO: activate another window
|
||||
}
|
||||
|
||||
public resizeWindow(window: MockKwinClient, edgeResize: boolean, leftEdge: boolean, topEdge: boolean, ...deltas: QmlSize[]) {
|
||||
const frame = window.getFrameGeometryCopy();
|
||||
if (edgeResize) {
|
||||
|
||||
Reference in New Issue
Block a user