DesktopManager: rename methods

This commit is contained in:
Peter Fajdiga
2023-08-19 23:55:46 +02:00
parent c7e7b91f3f
commit 5b71f1c48f
5 changed files with 23 additions and 23 deletions

View File

@@ -43,7 +43,7 @@ module Actions {
focusStart: () => {
world.do((clientManager, desktopManager) => {
const grid = desktopManager.getCurrent().grid;
const grid = desktopManager.getCurrentDesktop().grid;
const firstColumn = grid.getFirstColumn();
if (firstColumn === null) {
return;
@@ -54,7 +54,7 @@ module Actions {
focusEnd: () => {
world.do((clientManager, desktopManager) => {
const grid = desktopManager.getCurrent().grid;
const grid = desktopManager.getCurrentDesktop().grid;
const lastColumn = grid.getLastColumn();
if (lastColumn === null) {
return;
@@ -186,7 +186,7 @@ module Actions {
gridScrollStart: () => {
world.do((clientManager, desktopManager) => {
const grid = desktopManager.getCurrent().grid;
const grid = desktopManager.getCurrentDesktop().grid;
const firstColumn = grid.getFirstColumn();
if (firstColumn === null) {
return;
@@ -197,7 +197,7 @@ module Actions {
gridScrollEnd: () => {
world.do((clientManager, desktopManager) => {
const grid = desktopManager.getCurrent().grid;
const grid = desktopManager.getCurrentDesktop().grid;
const lastColumn = grid.getLastColumn();
if (lastColumn === null) {
return;
@@ -214,7 +214,7 @@ module Actions {
gridScrollLeftColumn: () => {
world.do((clientManager, desktopManager) => {
const grid = desktopManager.getCurrent().grid;
const grid = desktopManager.getCurrentDesktop().grid;
const column = grid.getLeftmostVisibleColumn(grid.container.getCurrentScrollPos(), true);
if (column === null) {
return;
@@ -231,7 +231,7 @@ module Actions {
gridScrollRightColumn: () => {
world.do((clientManager, desktopManager) => {
const grid = desktopManager.getCurrent().grid;
const grid = desktopManager.getCurrentDesktop().grid;
const column = grid.getRightmostVisibleColumn(grid.container.getCurrentScrollPos(), true);
if (column === null) {
return;
@@ -252,7 +252,7 @@ module Actions {
return {
focusColumn: (columnIndex: number) => {
world.do((clientManager, desktopManager) => {
const grid = desktopManager.getCurrent().grid;
const grid = desktopManager.getCurrentDesktop().grid;
const targetColumn = grid.getColumnAtIndex(columnIndex);
if (targetColumn === null) {
return null;
@@ -289,7 +289,7 @@ module Actions {
columnMoveToDesktop: (desktopIndex: number) => {
world.doIfTiledFocused(true, (clientManager, desktopManager, window, column, oldGrid) => {
const desktopNumber = desktopIndex + 1;
const newGrid = desktopManager.getInCurrentActivity(desktopNumber).grid;
const newGrid = desktopManager.getDesktopInCurrentActivity(desktopNumber).grid;
if (newGrid === null || newGrid === oldGrid) {
return;
}
@@ -300,7 +300,7 @@ module Actions {
tailMoveToDesktop: (desktopIndex: number) => {
world.doIfTiledFocused(true, (clientManager, desktopManager, window, column, oldGrid) => {
const desktopNumber = desktopIndex + 1;
const newGrid = desktopManager.getInCurrentActivity(desktopNumber).grid;
const newGrid = desktopManager.getDesktopInCurrentActivity(desktopNumber).grid;
if (newGrid === null || newGrid === oldGrid) {
return;
}
@@ -312,7 +312,7 @@ module Actions {
function gridScroll(world: World, amount: number) {
world.do((clientManager, desktopManager) => {
const grid = desktopManager.getCurrent().grid;
const grid = desktopManager.getCurrentDesktop().grid;
grid.container.adjustScroll(amount, false);
});
}

View File

@@ -33,7 +33,7 @@ class ClientManager {
if (kwinClient.dock) {
client.stateManager.setState(new ClientStateDocked(this.world, kwinClient), false);
} else if (this.windowRuleEnforcer.shouldTile(kwinClient)) {
const grid = this.desktopManager.getForClient(client.kwinClient).grid;
const grid = this.desktopManager.getDesktopForClient(client.kwinClient).grid;
client.stateManager.setState(new ClientStateTiled(this.world, client, grid), false);
}
}
@@ -77,7 +77,7 @@ class ClientManager {
return;
}
if (client.stateManager.getState() instanceof ClientStateTiledMinimized) {
const grid = this.desktopManager.getForClient(client.kwinClient).grid;
const grid = this.desktopManager.getDesktopForClient(client.kwinClient).grid;
client.stateManager.setState(new ClientStateTiled(this.world, client, grid), false);
}
}
@@ -90,7 +90,7 @@ class ClientManager {
if (client.stateManager.getState() instanceof ClientStateTiled) {
return;
}
const grid = this.desktopManager.getForClient(client.kwinClient).grid;
const grid = this.desktopManager.getDesktopForClient(client.kwinClient).grid;
client.stateManager.setState(new ClientStateTiled(this.world, client, grid), false);
}
@@ -113,7 +113,7 @@ class ClientManager {
const clientState = client.stateManager.getState();
if (clientState instanceof ClientStateFloating && Clients.canTileEver(kwinClient)) {
Clients.makeTileable(kwinClient);
const grid = this.desktopManager.getForClient(client.kwinClient).grid;
const grid = this.desktopManager.getDesktopForClient(client.kwinClient).grid;
client.stateManager.setState(new ClientStateTiled(this.world, client, grid), false);
} else if (clientState instanceof ClientStateTiled) {
client.stateManager.setState(new ClientStateFloating(), false);

View File

@@ -99,7 +99,7 @@ class ClientStateTiled {
const kwinClient = window.client.kwinClient;
const oldGrid = window.column.grid;
const newGrid = desktopManager.getForClient(kwinClient).grid;
const newGrid = desktopManager.getDesktopForClient(kwinClient).grid;
if (oldGrid === newGrid) {
// window already on the correct grid
return;

View File

@@ -17,7 +17,7 @@ class DesktopManager {
this.setNVirtualDesktops(workspace.desktops);
}
public get(activity: string, desktopNumber: number) {
public getDesktop(activity: string, desktopNumber: number) {
const desktopIndex = desktopNumber - 1;
if (desktopIndex >= this.nVirtualDesktops || this.nVirtualDesktops < 0) {
throw new Error("invalid desktop number: " + String(desktopNumber));
@@ -28,17 +28,17 @@ class DesktopManager {
return this.desktopsPerActivity.get(activity)![desktopIndex];
}
public getCurrent() {
return this.get(workspace.currentActivity, workspace.currentDesktop);
public getCurrentDesktop() {
return this.getDesktop(workspace.currentActivity, workspace.currentDesktop);
}
public getInCurrentActivity(desktopNumber: number) {
return this.get(workspace.currentActivity, desktopNumber);
public getDesktopInCurrentActivity(desktopNumber: number) {
return this.getDesktop(workspace.currentActivity, desktopNumber);
}
public getForClient(kwinClient: AbstractClient) {
public getDesktopForClient(kwinClient: AbstractClient) {
console.assert(kwinClient.activities.length === 1);
return this.get(kwinClient.activities[0], kwinClient.desktop);
return this.getDesktop(kwinClient.activities[0], kwinClient.desktop);
}
private setNVirtualDesktops(nVirtualDesktops: number) {

View File

@@ -47,7 +47,7 @@ class World {
}
public update() {
this.desktopManager.getCurrent().arrange();
this.desktopManager.getCurrentDesktop().arrange();
}
public do(f: (clientManager: ClientManager, desktopManager: DesktopManager) => void) {