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

View File

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

View File

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