fix: no crashes in closing transients -- might fix others too; ref #110, #109

This commit is contained in:
Derek Stevens 2021-10-14 22:32:20 -06:00 committed by Mikhail Zolotukhin
parent 49ac131044
commit 502f812081
2 changed files with 38 additions and 31 deletions

View File

@ -243,8 +243,11 @@ export class TilingController implements Controller {
this.engine.arrange();
// Switch to next window if monocle with config.monocleMinimizeRest
try {
if (!this.currentWindow && this.engine.isLayoutMonocleAndMinimizeRest()) {
if (
!window.window.isDialog &&
!this.currentWindow &&
this.engine.isLayoutMonocleAndMinimizeRest()
) {
this.engine.focusOrder(1, true);
/* HACK: force window to maximize if it isn't already
* This is ultimately to trigger onWindowFocused() at the right time
@ -252,11 +255,6 @@ export class TilingController implements Controller {
this.engine.focusOrder(1, true);
this.engine.focusOrder(-1, true);
}
} catch {
/* HACK for the HACK: transient modals cause an error with the above workaround,
* so if we catch it here and ignore it, all is well */
return;
}
}
public onWindowMoveStart(_window: Window): void {
@ -352,6 +350,7 @@ export class TilingController implements Controller {
}
public onWindowFocused(window: Window): void {
try {
window.timestamp = new Date().getTime();
this.currentWindow = window;
// Minimize other windows if Monocle and config.monocleMinimizeRest
@ -372,6 +371,9 @@ export class TilingController implements Controller {
this.engine.minimizeOthers(window);
}
} catch {
return;
}
}
public onWindowShadeChanged(win: Window): void {

View File

@ -20,6 +20,7 @@ export interface DriverWindow {
readonly shouldFloat: boolean;
readonly screen: number;
readonly active: boolean;
readonly isDialog: boolean;
surface: DriverSurface;
minimized: boolean;
shaded: boolean;
@ -261,4 +262,8 @@ export class KWinWindow implements DriverWindow {
return new Rect(geometry.x, geometry.y, width, height);
}
public get isDialog(): boolean {
return this.client.dialog;
}
}