rename desktopNumber and virtualDesktop
This commit is contained in:
@@ -25,7 +25,7 @@ class Column {
|
||||
this.grid = targetGrid;
|
||||
targetGrid.onColumnAdded(this, prevColumn);
|
||||
for (const window of this.windows.iterator()) {
|
||||
window.client.kwinClient.desktop = targetGrid.container.desktop;
|
||||
window.client.kwinClient.desktop = targetGrid.container.desktopNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
class ScrollView {
|
||||
public readonly grid: Grid;
|
||||
public readonly desktop: number;
|
||||
public readonly desktopNumber: number;
|
||||
private readonly config: ScrollView.Config;
|
||||
private scrollX: number;
|
||||
private dirty: boolean;
|
||||
public clientArea: QRect;
|
||||
public tilingArea: QRect;
|
||||
|
||||
constructor(desktop: number, config: ScrollView.Config, layoutConfig: LayoutConfig) {
|
||||
constructor(desktopNumber: number, config: ScrollView.Config, layoutConfig: LayoutConfig) {
|
||||
this.config = config;
|
||||
this.scrollX = 0;
|
||||
this.dirty = false;
|
||||
this.desktop = desktop;
|
||||
this.desktopNumber = desktopNumber;
|
||||
this.grid = new Grid(this, layoutConfig);
|
||||
this.updateArea();
|
||||
}
|
||||
|
||||
private updateArea() {
|
||||
const newClientArea = workspace.clientArea(workspace.PlacementArea, 0, this.desktop);
|
||||
const newClientArea = workspace.clientArea(workspace.PlacementArea, 0, this.desktopNumber);
|
||||
if (newClientArea === this.clientArea) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ function initWorkspaceSignalHandlers(world: World) {
|
||||
});
|
||||
});
|
||||
|
||||
manager.connect(workspace.numberDesktopsChanged, (oldNumberOfDesktops: number) => {
|
||||
manager.connect(workspace.numberDesktopsChanged, (oldNumberOfVirtualDesktops: number) => {
|
||||
world.updateDesktops();
|
||||
});
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ class ClientWrapper {
|
||||
});
|
||||
}
|
||||
|
||||
private moveTransient(dx: number, dy: number, desktop: number) {
|
||||
private moveTransient(dx: number, dy: number, desktopNumber: number) {
|
||||
// TODO: prevent moving off the grid
|
||||
if (this.stateManager.getState() instanceof ClientStateFloating) {
|
||||
if (this.kwinClient.desktop === desktop) {
|
||||
if (this.kwinClient.desktop === desktopNumber) {
|
||||
const frame = this.kwinClient.frameGeometry;
|
||||
this.kwinClient.frameGeometry = Qt.rect(
|
||||
frame.x + dx,
|
||||
@@ -51,7 +51,7 @@ class ClientWrapper {
|
||||
}
|
||||
|
||||
for (const transient of this.transients) {
|
||||
transient.moveTransient(dx, dy, desktop);
|
||||
transient.moveTransient(dx, dy, desktopNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,24 @@ class ScrollViewManager {
|
||||
private readonly config: ScrollView.Config;
|
||||
public readonly layoutConfig: LayoutConfig;
|
||||
private readonly scrollViewsPerActivity: Map<string, ScrollView[]>;
|
||||
private nDesktops: number;
|
||||
private nVirtualDesktops: number;
|
||||
|
||||
constructor(config: ScrollView.Config, layoutConfig: LayoutConfig, currentActivity: string) {
|
||||
this.config = config;
|
||||
this.layoutConfig = layoutConfig;
|
||||
this.scrollViewsPerActivity = new Map();
|
||||
this.nDesktops = 0;
|
||||
this.nVirtualDesktops = 0;
|
||||
this.update()
|
||||
this.addActivity(currentActivity);
|
||||
}
|
||||
|
||||
public update() {
|
||||
this.setNDesktops(workspace.desktops);
|
||||
this.setNVirtualDesktops(workspace.desktops);
|
||||
}
|
||||
|
||||
public get(activity: string, desktopNumber: number) {
|
||||
const desktopIndex = desktopNumber - 1;
|
||||
if (desktopIndex >= this.nDesktops || this.nDesktops < 0) {
|
||||
if (desktopIndex >= this.nVirtualDesktops || this.nVirtualDesktops < 0) {
|
||||
throw new Error("invalid desktop number: " + String(desktopNumber));
|
||||
}
|
||||
if (!this.scrollViewsPerActivity.has(activity)) {
|
||||
@@ -41,13 +41,13 @@ class ScrollViewManager {
|
||||
return this.get(kwinClient.activities[0], kwinClient.desktop);
|
||||
}
|
||||
|
||||
private setNDesktops(nDesktops: number) {
|
||||
if (nDesktops > this.nDesktops) {
|
||||
this.addDesktopsToActivities(nDesktops - this.nDesktops);
|
||||
} else if (nDesktops < this.nDesktops) {
|
||||
this.removeDesktopsFromActivities(this.nDesktops - nDesktops);
|
||||
private setNVirtualDesktops(nVirtualDesktops: number) {
|
||||
if (nVirtualDesktops > this.nVirtualDesktops) {
|
||||
this.addDesktopsToActivities(nVirtualDesktops - this.nVirtualDesktops);
|
||||
} else if (nVirtualDesktops < this.nVirtualDesktops) {
|
||||
this.removeDesktopsFromActivities(this.nVirtualDesktops - nVirtualDesktops);
|
||||
}
|
||||
this.nDesktops = nDesktops;
|
||||
this.nVirtualDesktops = nVirtualDesktops;
|
||||
}
|
||||
|
||||
private addDesktopsToActivities(n: number) {
|
||||
@@ -65,7 +65,7 @@ class ScrollViewManager {
|
||||
}
|
||||
|
||||
private removeDesktopsFromActivities(n: number) {
|
||||
const lastRemainingDesktopIndex = this.nDesktops - n - 1;
|
||||
const lastRemainingDesktopIndex = this.nVirtualDesktops - n - 1;
|
||||
for (const scrollViews of this.scrollViewsPerActivity.values()) {
|
||||
const targetScrollView = scrollViews[lastRemainingDesktopIndex];
|
||||
for (let i = 0; i < n; i++) {
|
||||
@@ -77,7 +77,7 @@ class ScrollViewManager {
|
||||
|
||||
private addActivity(activity: string) {
|
||||
const scrollViews: ScrollView[] = [];
|
||||
this.addDesktops(scrollViews, this.nDesktops);
|
||||
this.addDesktops(scrollViews, this.nVirtualDesktops);
|
||||
this.scrollViewsPerActivity.set(activity, scrollViews);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user