make shouldIgnore/Float into properties

This commit is contained in:
Eon S. Jeon 2019-03-29 23:57:22 +09:00
parent c8aea2d24f
commit b34e8474e4
2 changed files with 24 additions and 24 deletions

View File

@ -79,10 +79,10 @@ interface IDriverWindow {
readonly fullScreen: boolean;
readonly geometry: Rect;
readonly id: string;
readonly shouldIgnore: boolean;
readonly shouldFloat: boolean;
commit(geometry?: Rect, noBorder?: boolean, keepBelow?: boolean): void;
shouldIgnore(): boolean;
shouldFloat(): boolean;
visible(ctx: IDriverContext): boolean;
}

View File

@ -50,6 +50,28 @@ class KWinWindow implements IDriverWindow {
return toRect(this.client.geometry);
}
public get shouldIgnore(): boolean {
const resourceClass = String(this.client.resourceClass);
return (
this.client.specialWindow
|| resourceClass === "plasmashell"
|| (KWINCONFIG.ignoreClass.indexOf(resourceClass) >= 0)
|| (matchWords(this.client.caption, KWINCONFIG.ignoreTitle) >= 0)
);
}
public get shouldFloat(): boolean {
const resourceClass = String(this.client.resourceClass);
return (
this.client.modal
|| (!this.client.resizeable)
|| (KWINCONFIG.floatUtility
&& (this.client.dialog || this.client.splash || this.client.utility))
|| (KWINCONFIG.floatingClass.indexOf(resourceClass) >= 0)
|| (matchWords(this.client.caption, KWINCONFIG.floatingTitle) >= 0)
);
}
private readonly _bakNoBorder: boolean;
constructor(client: KWin.Client) {
@ -72,28 +94,6 @@ class KWinWindow implements IDriverWindow {
this.client.geometry = toQRect(this.adjustGeometry(geometry));
}
public shouldIgnore(): boolean {
const resourceClass = String(this.client.resourceClass);
return (
this.client.specialWindow
|| resourceClass === "plasmashell"
|| (KWINCONFIG.ignoreClass.indexOf(resourceClass) >= 0)
|| (matchWords(this.client.caption, KWINCONFIG.ignoreTitle) >= 0)
);
}
public shouldFloat(): boolean {
const resourceClass = String(this.client.resourceClass);
return (
this.client.modal
|| (!this.client.resizeable)
|| (KWINCONFIG.floatUtility
&& (this.client.dialog || this.client.splash || this.client.utility))
|| (KWINCONFIG.floatingClass.indexOf(resourceClass) >= 0)
|| (matchWords(this.client.caption, KWINCONFIG.floatingTitle) >= 0)
);
}
public toString(): string {
/* using a shorthand name to keep debug message tidy */
return "KWin(" + this.client.windowId.toString(16) + "." + this.client.resourceClass + ")";