refactor: rename KWinSurface to DriverSurfaceImpl

This commit is contained in:
Mikhail Zolotukhin 2021-10-19 00:15:50 +03:00
parent 2d87ca9bc4
commit d44eb13fb7
3 changed files with 17 additions and 12 deletions

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
import { DriverSurface } from "./surface"; import { DriverSurface } from "./surface";
import { KWinSurface } from "./surface"; import { DriverSurfaceImpl } from "./surface";
import { KWinWindow } from "./window"; import { KWinWindow } from "./window";
import { Controller } from "../controller"; import { Controller } from "../controller";
@ -39,7 +39,7 @@ export interface DriverContext {
*/ */
export class KWinDriver implements DriverContext { export class KWinDriver implements DriverContext {
public get currentSurface(): DriverSurface { public get currentSurface(): DriverSurface {
return new KWinSurface( return new DriverSurfaceImpl(
this.kwinApi.workspace.activeClient this.kwinApi.workspace.activeClient
? this.kwinApi.workspace.activeClient.screen ? this.kwinApi.workspace.activeClient.screen
: 0, : 0,
@ -52,7 +52,7 @@ export class KWinDriver implements DriverContext {
} }
public set currentSurface(value: DriverSurface) { public set currentSurface(value: DriverSurface) {
const kwinSurface = value as KWinSurface; const kwinSurface = value as DriverSurfaceImpl;
/* NOTE: only supports switching desktops */ /* NOTE: only supports switching desktops */
// TODO: focusing window on other screen? // TODO: focusing window on other screen?
@ -80,7 +80,7 @@ export class KWinDriver implements DriverContext {
const screensArr = []; const screensArr = [];
for (let screen = 0; screen < this.kwinApi.workspace.numScreens; screen++) { for (let screen = 0; screen < this.kwinApi.workspace.numScreens; screen++) {
screensArr.push( screensArr.push(
new KWinSurface( new DriverSurfaceImpl(
screen, screen,
this.kwinApi.workspace.currentActivity, this.kwinApi.workspace.currentActivity,
this.kwinApi.workspace.currentDesktop, this.kwinApi.workspace.currentDesktop,
@ -146,7 +146,7 @@ export class KWinDriver implements DriverContext {
}; };
const onScreenResized = (screen: number): void => { const onScreenResized = (screen: number): void => {
const srf = new KWinSurface( const srf = new DriverSurfaceImpl(
screen, screen,
this.kwinApi.workspace.currentActivity, this.kwinApi.workspace.currentActivity,
this.kwinApi.workspace.currentDesktop, this.kwinApi.workspace.currentDesktop,

View File

@ -15,7 +15,7 @@ export interface DriverSurface {
next(): DriverSurface | null; next(): DriverSurface | null;
} }
export class KWinSurface implements DriverSurface { export class DriverSurfaceImpl implements DriverSurface {
public static generateId( public static generateId(
screen: number, screen: number,
activity: string, activity: string,
@ -57,7 +57,12 @@ export class KWinSurface implements DriverSurface {
this.kwinApi = kwinApi; this.kwinApi = kwinApi;
this.config = config; this.config = config;
this.id = KWinSurface.generateId(screen, activity, desktop, this.config); this.id = DriverSurfaceImpl.generateId(
screen,
activity,
desktop,
this.config
);
this.ignore = this.ignore =
this.config.ignoreActivity.indexOf(activityName) >= 0 || this.config.ignoreActivity.indexOf(activityName) >= 0 ||
this.config.ignoreScreen.indexOf(screen) >= 0; this.config.ignoreScreen.indexOf(screen) >= 0;
@ -81,7 +86,7 @@ export class KWinSurface implements DriverSurface {
return null; return null;
} }
return new KWinSurface( return new DriverSurfaceImpl(
this.screen, this.screen,
this.activity, this.activity,
this.desktop + 1, this.desktop + 1,

View File

@ -3,7 +3,7 @@
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
import { DriverSurface, KWinSurface } from "./surface"; import { DriverSurface, DriverSurfaceImpl } from "./surface";
import Rect from "../util/rect"; import Rect from "../util/rect";
import { toQRect, toRect } from "../util/kwinutil"; import { toQRect, toRect } from "../util/kwinutil";
@ -116,7 +116,7 @@ export class KWinWindow implements DriverWindow {
? this.client.desktop ? this.client.desktop
: this.kwinApi.workspace.currentDesktop; : this.kwinApi.workspace.currentDesktop;
return new KWinSurface( return new DriverSurfaceImpl(
this.client.screen, this.client.screen,
activity, activity,
desktop, desktop,
@ -127,7 +127,7 @@ export class KWinWindow implements DriverWindow {
} }
public set surface(srf: DriverSurface) { public set surface(srf: DriverSurface) {
const ksrf = srf as KWinSurface; const ksrf = srf as DriverSurfaceImpl;
// TODO: setting activity? // TODO: setting activity?
// TODO: setting screen = move to the screen // TODO: setting screen = move to the screen
@ -226,7 +226,7 @@ export class KWinWindow implements DriverWindow {
} }
public visible(srf: DriverSurface): boolean { public visible(srf: DriverSurface): boolean {
const ksrf = srf as KWinSurface; const ksrf = srf as DriverSurfaceImpl;
return ( return (
!this.client.minimized && !this.client.minimized &&
(this.client.desktop === ksrf.desktop || (this.client.desktop === ksrf.desktop ||