mark methods explicitly public or private
This commit is contained in:
@@ -17,7 +17,7 @@ class Column {
|
||||
this.grid.onColumnAdded(this, prevColumn);
|
||||
}
|
||||
|
||||
moveToGrid(targetGrid: Grid, prevColumn: Column|null) {
|
||||
public moveToGrid(targetGrid: Grid, prevColumn: Column|null) {
|
||||
if (targetGrid === this.grid) {
|
||||
this.grid.onColumnMoved(this, prevColumn);
|
||||
} else {
|
||||
@@ -30,50 +30,50 @@ class Column {
|
||||
}
|
||||
}
|
||||
|
||||
moveAfter(prevColumn: Column|null) {
|
||||
public moveAfter(prevColumn: Column|null) {
|
||||
if (prevColumn === this) {
|
||||
return;
|
||||
}
|
||||
this.grid.onColumnMoved(this, prevColumn);
|
||||
}
|
||||
|
||||
isAfter(other: Column) {
|
||||
public isAfter(other: Column) {
|
||||
return this.gridX > other.gridX;
|
||||
}
|
||||
|
||||
isBefore(other: Column) {
|
||||
public isBefore(other: Column) {
|
||||
return this.gridX < other.gridX;
|
||||
}
|
||||
|
||||
moveWindowUp(window: Window) {
|
||||
public moveWindowUp(window: Window) {
|
||||
this.windows.moveBack(window);
|
||||
}
|
||||
|
||||
moveWindowDown(window: Window) {
|
||||
public moveWindowDown(window: Window) {
|
||||
this.windows.moveForward(window);
|
||||
}
|
||||
|
||||
getWindowCount() {
|
||||
public getWindowCount() {
|
||||
return this.windows.length();
|
||||
}
|
||||
|
||||
isEmpty() {
|
||||
public isEmpty() {
|
||||
return this.getWindowCount() === 0;
|
||||
}
|
||||
|
||||
getPrevWindow(window: Window) {
|
||||
public getPrevWindow(window: Window) {
|
||||
return this.windows.getPrev(window);
|
||||
}
|
||||
|
||||
getNextWindow(window: Window) {
|
||||
public getNextWindow(window: Window) {
|
||||
return this.windows.getNext(window);
|
||||
}
|
||||
|
||||
getWidth() {
|
||||
public getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
|
||||
getMinWidth() {
|
||||
public getMinWidth() {
|
||||
let maxMinWidth = Column.minWidth;
|
||||
for (const window of this.windows.iterator()) {
|
||||
const minWidth = window.client.kwinClient.minSize.width;
|
||||
@@ -84,11 +84,11 @@ class Column {
|
||||
return maxMinWidth;
|
||||
}
|
||||
|
||||
getMaxWidth() {
|
||||
public getMaxWidth() {
|
||||
return this.grid.container.tilingArea.width;
|
||||
}
|
||||
|
||||
setWidth(width: number, setPreferred: boolean) {
|
||||
public setWidth(width: number, setPreferred: boolean) {
|
||||
width = clamp(width, this.getMinWidth(), this.getMaxWidth());
|
||||
const oldWidth = this.width;
|
||||
this.width = width;
|
||||
@@ -102,21 +102,21 @@ class Column {
|
||||
}
|
||||
}
|
||||
|
||||
adjustWidth(widthDelta: number, setPreferred: boolean) {
|
||||
public adjustWidth(widthDelta: number, setPreferred: boolean) {
|
||||
this.setWidth(this.width + widthDelta, setPreferred);
|
||||
}
|
||||
|
||||
// returns x position of left edge in grid space
|
||||
getLeft() {
|
||||
public getLeft() {
|
||||
return this.gridX;
|
||||
}
|
||||
|
||||
// returns x position of right edge in grid space
|
||||
getRight() {
|
||||
public getRight() {
|
||||
return this.gridX + this.width;
|
||||
}
|
||||
|
||||
adjustWindowHeight(window: Window, heightDelta: number, top: boolean) {
|
||||
public adjustWindowHeight(window: Window, heightDelta: number, top: boolean) {
|
||||
const otherWindow = top ? this.windows.getPrev(window) : this.windows.getNext(window);
|
||||
if (otherWindow === null) {
|
||||
return;
|
||||
@@ -126,7 +126,7 @@ class Column {
|
||||
otherWindow.height -= heightDelta;
|
||||
}
|
||||
|
||||
resizeWindows() {
|
||||
public resizeWindows() {
|
||||
const nWindows = this.windows.length();
|
||||
if (nWindows === 0) {
|
||||
return;
|
||||
@@ -146,14 +146,14 @@ class Column {
|
||||
// TODO: respect min height
|
||||
}
|
||||
|
||||
getFocusTaker() {
|
||||
private getFocusTaker() {
|
||||
if (this.focusTaker === null || !this.windows.contains(this.focusTaker)) {
|
||||
return null;
|
||||
}
|
||||
return this.focusTaker;
|
||||
}
|
||||
|
||||
focus() {
|
||||
public focus() {
|
||||
const window = this.getFocusTaker() ?? this.windows.getFirst();
|
||||
if (window === null) {
|
||||
return;
|
||||
@@ -161,7 +161,7 @@ class Column {
|
||||
window.focus();
|
||||
}
|
||||
|
||||
arrange(x: number) {
|
||||
public arrange(x: number) {
|
||||
if (this.stacked && this.windows.length() >= 2) {
|
||||
this.arrangeStacked(x);
|
||||
return;
|
||||
@@ -174,7 +174,7 @@ class Column {
|
||||
}
|
||||
}
|
||||
|
||||
arrangeStacked(x: number) {
|
||||
public arrangeStacked(x: number) {
|
||||
const expandedWindow = this.getFocusTaker();
|
||||
let collapsedHeight;
|
||||
for (const window of this.windows.iterator()) {
|
||||
@@ -201,7 +201,7 @@ class Column {
|
||||
}
|
||||
}
|
||||
|
||||
toggleStacked() {
|
||||
public toggleStacked() {
|
||||
if (this.windows.length() < 2) {
|
||||
return;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ class Column {
|
||||
}
|
||||
}
|
||||
|
||||
onWindowAdded(window: Window) {
|
||||
public onWindowAdded(window: Window) {
|
||||
this.windows.insertEnd(window);
|
||||
if (this.width === 0) {
|
||||
this.setWidth(window.client.preferredWidth, false);
|
||||
@@ -232,7 +232,7 @@ class Column {
|
||||
}
|
||||
}
|
||||
|
||||
onWindowRemoved(window: Window, passFocus: boolean) {
|
||||
public onWindowRemoved(window: Window, passFocus: boolean) {
|
||||
const lastWindow = this.windows.length() === 1;
|
||||
const windowToFocus = this.getPrevWindow(window) ?? this.getNextWindow(window);
|
||||
|
||||
@@ -253,19 +253,19 @@ class Column {
|
||||
}
|
||||
}
|
||||
|
||||
onWindowFocused(window: Window) {
|
||||
public onWindowFocused(window: Window) {
|
||||
this.grid.onColumnFocused(this);
|
||||
this.focusTaker = window;
|
||||
}
|
||||
|
||||
restoreToTiled() {
|
||||
public restoreToTiled() {
|
||||
const lastFocusedWindow = this.getFocusTaker();
|
||||
if (lastFocusedWindow !== null) {
|
||||
lastFocusedWindow.restoreToTiled();
|
||||
}
|
||||
}
|
||||
|
||||
destroy(passFocus: boolean) {
|
||||
private destroy(passFocus: boolean) {
|
||||
this.grid.onColumnRemoved(this, passFocus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ class Grid {
|
||||
});
|
||||
}
|
||||
|
||||
moveColumnLeft(column: Column) {
|
||||
public moveColumnLeft(column: Column) {
|
||||
this.columns.moveBack(column);
|
||||
this.columnsSetX(column);
|
||||
this.container.onGridReordered();
|
||||
}
|
||||
|
||||
moveColumnRight(column: Column) {
|
||||
public moveColumnRight(column: Column) {
|
||||
const nextColumn = this.columns.getNext(column);
|
||||
if (nextColumn === null) {
|
||||
return;
|
||||
@@ -35,31 +35,31 @@ class Grid {
|
||||
this.moveColumnLeft(nextColumn);
|
||||
}
|
||||
|
||||
getWidth() {
|
||||
public getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
|
||||
getPrevColumn(column: Column) {
|
||||
public getPrevColumn(column: Column) {
|
||||
return this.columns.getPrev(column);
|
||||
}
|
||||
|
||||
getNextColumn(column: Column) {
|
||||
public getNextColumn(column: Column) {
|
||||
return this.columns.getNext(column);
|
||||
}
|
||||
|
||||
getFirstColumn() {
|
||||
public getFirstColumn() {
|
||||
return this.columns.getFirst();
|
||||
}
|
||||
|
||||
getLastColumn() {
|
||||
public getLastColumn() {
|
||||
return this.columns.getLast();
|
||||
}
|
||||
|
||||
getColumnAtIndex(i: number) {
|
||||
public getColumnAtIndex(i: number) {
|
||||
return this.columns.getItemAtIndex(i);
|
||||
}
|
||||
|
||||
getLastFocusedColumn() {
|
||||
public getLastFocusedColumn() {
|
||||
if (this.lastFocusedColumn === null || this.lastFocusedColumn.grid !== this) {
|
||||
return null;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class Grid {
|
||||
this.width = x - this.config.gapsInnerHorizontal;
|
||||
}
|
||||
|
||||
getLeftmostVisibleColumn(scrollPos: ScrollPos, fullyVisible: boolean) {
|
||||
public getLeftmostVisibleColumn(scrollPos: ScrollPos, fullyVisible: boolean) {
|
||||
const scrollX = scrollPos.getLeft();
|
||||
for (const column of this.columns.iterator()) {
|
||||
const x = fullyVisible ? column.getLeft() : column.getRight() + (this.config.gapsInnerHorizontal - 1);
|
||||
@@ -89,7 +89,7 @@ class Grid {
|
||||
return null;
|
||||
}
|
||||
|
||||
getRightmostVisibleColumn(scrollPos: ScrollPos, fullyVisible: boolean) {
|
||||
public getRightmostVisibleColumn(scrollPos: ScrollPos, fullyVisible: boolean) {
|
||||
const scrollX = scrollPos.getRight();
|
||||
let last = null;
|
||||
for (const column of this.columns.iterator()) {
|
||||
@@ -103,7 +103,7 @@ class Grid {
|
||||
return last;
|
||||
}
|
||||
|
||||
getVisibleColumnsWidth(scrollPos: ScrollPos, fullyVisible: boolean) {
|
||||
public getVisibleColumnsWidth(scrollPos: ScrollPos, fullyVisible: boolean) {
|
||||
let width = 0;
|
||||
let nVisible = 0;
|
||||
for (const column of this.columns.iterator()) {
|
||||
@@ -120,7 +120,7 @@ class Grid {
|
||||
return width;
|
||||
}
|
||||
|
||||
getLeftOffScreenColumn(scrollPos: ScrollPos) {
|
||||
private getLeftOffScreenColumn(scrollPos: ScrollPos) {
|
||||
const leftVisible = this.getLeftmostVisibleColumn(scrollPos, true);
|
||||
if (leftVisible === null) {
|
||||
return null;
|
||||
@@ -128,7 +128,7 @@ class Grid {
|
||||
return this.getPrevColumn(leftVisible);
|
||||
}
|
||||
|
||||
getRightOffScreenColumn(scrollPos: ScrollPos) {
|
||||
private getRightOffScreenColumn(scrollPos: ScrollPos) {
|
||||
const rightVisible = this.getRightmostVisibleColumn(scrollPos, true);
|
||||
if (rightVisible === null) {
|
||||
return null;
|
||||
@@ -136,7 +136,7 @@ class Grid {
|
||||
return this.getNextColumn(rightVisible);
|
||||
}
|
||||
|
||||
increaseColumnWidth(column: Column) {
|
||||
public increaseColumnWidth(column: Column) {
|
||||
const scrollPos = this.container.getScrollPosForColumn(column);
|
||||
if (this.width < scrollPos.width) {
|
||||
column.adjustWidth(scrollPos.width - this.width, false);
|
||||
@@ -165,7 +165,7 @@ class Grid {
|
||||
column.adjustWidth(widthDelta, true);
|
||||
}
|
||||
|
||||
decreaseColumnWidth(column: Column) {
|
||||
public decreaseColumnWidth(column: Column) {
|
||||
const scrollPos = this.container.getScrollPosForColumn(column);
|
||||
if (this.width <= scrollPos.width) {
|
||||
column.setWidth(Math.round(column.getWidth() / 2), false);
|
||||
@@ -195,14 +195,14 @@ class Grid {
|
||||
column.adjustWidth(-widthDelta, true);
|
||||
}
|
||||
|
||||
arrange(x: number) {
|
||||
public arrange(x: number) {
|
||||
for (const column of this.columns.iterator()) {
|
||||
column.arrange(x);
|
||||
x += column.getWidth() + this.config.gapsInnerHorizontal;
|
||||
}
|
||||
}
|
||||
|
||||
onColumnAdded(column: Column, prevColumn: Column|null) {
|
||||
public onColumnAdded(column: Column, prevColumn: Column|null) {
|
||||
if (prevColumn === null) {
|
||||
this.columns.insertStart(column);
|
||||
} else {
|
||||
@@ -212,7 +212,7 @@ class Grid {
|
||||
this.container.onGridWidthChanged();
|
||||
}
|
||||
|
||||
onColumnRemoved(column: Column, passFocus: boolean) {
|
||||
public onColumnRemoved(column: Column, passFocus: boolean) {
|
||||
const isLastColumn = this.columns.length() === 1;
|
||||
const nextColumn = this.getNextColumn(column);
|
||||
const columnToFocus = isLastColumn ? null : this.getPrevColumn(column) ?? nextColumn;
|
||||
@@ -230,7 +230,7 @@ class Grid {
|
||||
}
|
||||
}
|
||||
|
||||
onColumnMoved(column: Column, prevColumn: Column|null) {
|
||||
public onColumnMoved(column: Column, prevColumn: Column|null) {
|
||||
const movedLeft = prevColumn === null ? true : column.isAfter(prevColumn);
|
||||
const firstMovedColumn = movedLeft ? column : this.getNextColumn(column);
|
||||
this.columns.move(column, prevColumn);
|
||||
@@ -238,7 +238,7 @@ class Grid {
|
||||
this.container.onGridReordered();
|
||||
}
|
||||
|
||||
onColumnWidthChanged(column: Column, oldWidth: number, width: number) {
|
||||
public onColumnWidthChanged(column: Column, oldWidth: number, width: number) {
|
||||
const nextColumn = this.columns.getNext(column);
|
||||
this.columnsSetX(nextColumn);
|
||||
if (!this.userResize) {
|
||||
@@ -246,7 +246,7 @@ class Grid {
|
||||
}
|
||||
}
|
||||
|
||||
onColumnFocused(column: Column) {
|
||||
public onColumnFocused(column: Column) {
|
||||
const lastFocusedColumn = this.getLastFocusedColumn();
|
||||
if (lastFocusedColumn !== null) {
|
||||
lastFocusedColumn.restoreToTiled();
|
||||
@@ -255,34 +255,34 @@ class Grid {
|
||||
this.container.scrollToColumn(column);
|
||||
}
|
||||
|
||||
onScreenSizeChanged() {
|
||||
public onScreenSizeChanged() {
|
||||
for (const column of this.columns.iterator()) {
|
||||
column.resizeWindows();
|
||||
}
|
||||
}
|
||||
|
||||
onUserResizeStarted() {
|
||||
public onUserResizeStarted() {
|
||||
this.userResize = true;
|
||||
}
|
||||
|
||||
onUserResizeFinished() {
|
||||
public onUserResizeFinished() {
|
||||
this.userResize = false;
|
||||
this.userResizeFinishedDelayer.run();
|
||||
}
|
||||
|
||||
evacuateTail(targetGrid: Grid, startColumn: Column) {
|
||||
public evacuateTail(targetGrid: Grid, startColumn: Column) {
|
||||
for (const column of this.columns.iteratorFrom(startColumn)) {
|
||||
column.moveToGrid(targetGrid, targetGrid.getLastColumn());
|
||||
}
|
||||
}
|
||||
|
||||
evacuate(targetGrid: Grid) {
|
||||
public evacuate(targetGrid: Grid) {
|
||||
for (const column of this.columns.iterator()) {
|
||||
column.moveToGrid(targetGrid, targetGrid.getLastColumn());
|
||||
}
|
||||
}
|
||||
|
||||
destroy() {
|
||||
public destroy() {
|
||||
this.userResizeFinishedDelayer.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class ScrollView {
|
||||
this.updateArea();
|
||||
}
|
||||
|
||||
updateArea() {
|
||||
private updateArea() {
|
||||
const newClientArea = workspace.clientArea(workspace.PlacementArea, 0, this.desktop);
|
||||
if (newClientArea === this.clientArea) {
|
||||
return;
|
||||
@@ -64,11 +64,11 @@ class ScrollView {
|
||||
return overscrollX * direction;
|
||||
}
|
||||
|
||||
scrollToColumn(column: Column) {
|
||||
public scrollToColumn(column: Column) {
|
||||
this.scrollX = this.getScrollPosForColumn(column).x;
|
||||
}
|
||||
|
||||
scrollCenterColumn(column: Column) {
|
||||
public scrollCenterColumn(column: Column) {
|
||||
const windowCenter = column.getLeft() + column.getWidth() / 2;
|
||||
const screenCenter = this.scrollX + this.tilingArea.width / 2;
|
||||
this.adjustScroll(Math.round(windowCenter - screenCenter), false);
|
||||
@@ -115,7 +115,7 @@ class ScrollView {
|
||||
this.scrollX = scrollPos.x;
|
||||
}
|
||||
|
||||
adjustScroll(dx: number, force: boolean) {
|
||||
public adjustScroll(dx: number, force: boolean) {
|
||||
this.setScroll(this.scrollX + dx, force);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class Window {
|
||||
column.onWindowAdded(this);
|
||||
}
|
||||
|
||||
moveToColumn(targetColumn: Column) {
|
||||
public moveToColumn(targetColumn: Column) {
|
||||
if (targetColumn === this.column) {
|
||||
return;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class Window {
|
||||
targetColumn.onWindowAdded(this);
|
||||
}
|
||||
|
||||
arrange(x: number, y: number, width: number, height: number) {
|
||||
public arrange(x: number, y: number, width: number, height: number) {
|
||||
if (this.skipArrange) {
|
||||
// window is maximized, fullscreen, or being manually resized, prevent fighting with the user
|
||||
return;
|
||||
@@ -41,7 +41,7 @@ class Window {
|
||||
}
|
||||
}
|
||||
|
||||
focus() {
|
||||
public focus() {
|
||||
if (this.client.isShaded()) {
|
||||
// workaround for KWin deactivating clients when unshading immediately after activation
|
||||
this.client.setShade(false);
|
||||
@@ -49,15 +49,15 @@ class Window {
|
||||
this.client.focus();
|
||||
}
|
||||
|
||||
isFocused() {
|
||||
public isFocused() {
|
||||
return this.client.isFocused();
|
||||
}
|
||||
|
||||
onFocused() {
|
||||
public onFocused() {
|
||||
this.column.onWindowFocused(this);
|
||||
}
|
||||
|
||||
restoreToTiled() {
|
||||
public restoreToTiled() {
|
||||
if (this.isFocused()) {
|
||||
return;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class Window {
|
||||
this.client.setFullScreen(false);
|
||||
}
|
||||
|
||||
onMaximizedChanged(horizontally: boolean, vertically: boolean) {
|
||||
public onMaximizedChanged(horizontally: boolean, vertically: boolean) {
|
||||
const maximized = horizontally || vertically;
|
||||
this.skipArrange = maximized;
|
||||
this.client.kwinClient.keepBelow = !maximized;
|
||||
@@ -75,7 +75,7 @@ class Window {
|
||||
}
|
||||
}
|
||||
|
||||
onFullScreenChanged(fullScreen: boolean) {
|
||||
public onFullScreenChanged(fullScreen: boolean) {
|
||||
this.skipArrange = fullScreen;
|
||||
if (this.isFocused()) {
|
||||
this.client.kwinClient.keepBelow = !fullScreen;
|
||||
@@ -83,7 +83,7 @@ class Window {
|
||||
}
|
||||
}
|
||||
|
||||
onUserResize(oldGeometry: QRect, resizeNeighborColumn: boolean) {
|
||||
public onUserResize(oldGeometry: QRect, resizeNeighborColumn: boolean) {
|
||||
const newGeometry = this.client.kwinClient.frameGeometry;
|
||||
const widthDelta = newGeometry.width - oldGeometry.width;
|
||||
const heightDelta = newGeometry.height - oldGeometry.height;
|
||||
@@ -108,12 +108,12 @@ class Window {
|
||||
}
|
||||
}
|
||||
|
||||
onProgrammaticResize(oldGeometry: QRect) {
|
||||
public onProgrammaticResize(oldGeometry: QRect) {
|
||||
const newGeometry = this.client.kwinClient.frameGeometry;
|
||||
this.column.setWidth(newGeometry.width, true);
|
||||
}
|
||||
|
||||
destroy(passFocus: boolean) {
|
||||
public destroy(passFocus: boolean) {
|
||||
this.column.onWindowRemoved(this, passFocus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ class ClientMatcher {
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
matches(kwinClient: AbstractClient) {
|
||||
public matches(kwinClient: AbstractClient) {
|
||||
const rule = this.rules.get(String(kwinClient.resourceClass));
|
||||
if (rule === undefined) {
|
||||
return false;
|
||||
|
||||
@@ -10,14 +10,14 @@ class WindowRuleEnforcer {
|
||||
this.followCaption = new Set([...mapFloat.keys(), ...mapTile.keys()]);
|
||||
}
|
||||
|
||||
shouldTile(kwinClient: AbstractClient) {
|
||||
public shouldTile(kwinClient: AbstractClient) {
|
||||
return Clients.canTileNow(kwinClient) && (
|
||||
this.preferTiling.matches(kwinClient) ||
|
||||
kwinClient.normalWindow && kwinClient.managed && !this.preferFloating.matches(kwinClient)
|
||||
);
|
||||
}
|
||||
|
||||
initClientSignalManager(world: World, kwinClient: AbstractClient) {
|
||||
public initClientSignalManager(world: World, kwinClient: AbstractClient) {
|
||||
if (!this.followCaption.has(kwinClient.resourceClass)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ class Delayer {
|
||||
this.timer.triggered.connect(f);
|
||||
}
|
||||
|
||||
run() {
|
||||
public run() {
|
||||
this.timer.restart();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
public destroy() {
|
||||
this.timer.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@ class Doer {
|
||||
this.nCalls = 0;
|
||||
}
|
||||
|
||||
do (f: () => void) {
|
||||
public do (f: () => void) {
|
||||
this.nCalls++;
|
||||
f();
|
||||
this.nCalls--;
|
||||
}
|
||||
|
||||
isDoing() {
|
||||
public isDoing() {
|
||||
return this.nCalls > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,21 +17,21 @@ class LinkedList<T> {
|
||||
return node;
|
||||
}
|
||||
|
||||
insertBefore(item: T, nextItem: T) {
|
||||
public insertBefore(item: T, nextItem: T) {
|
||||
const nextNode = this.getNode(nextItem);
|
||||
this.insert(item, nextNode.prev, nextNode);
|
||||
}
|
||||
|
||||
insertAfter(item: T, prevItem: T) {
|
||||
public insertAfter(item: T, prevItem: T) {
|
||||
const prevNode = this.getNode(prevItem);
|
||||
this.insert(item, prevNode, prevNode.next);
|
||||
}
|
||||
|
||||
insertStart(item: T) {
|
||||
public insertStart(item: T) {
|
||||
this.insert(item, null, this.firstNode);
|
||||
}
|
||||
|
||||
insertEnd(item: T) {
|
||||
public insertEnd(item: T) {
|
||||
this.insert(item, this.lastNode, null);
|
||||
}
|
||||
|
||||
@@ -60,31 +60,31 @@ class LinkedList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
getPrev(item: T) {
|
||||
public getPrev(item: T) {
|
||||
const prevNode = this.getNode(item).prev;
|
||||
return prevNode === null ? null : prevNode.item;
|
||||
}
|
||||
|
||||
getNext(item: T) {
|
||||
public getNext(item: T) {
|
||||
const nextNode = this.getNode(item).next;
|
||||
return nextNode === null ? null : nextNode.item;
|
||||
}
|
||||
|
||||
getFirst() {
|
||||
public getFirst() {
|
||||
if (this.firstNode === null) {
|
||||
return null;
|
||||
}
|
||||
return this.firstNode.item;
|
||||
}
|
||||
|
||||
getLast() {
|
||||
public getLast() {
|
||||
if (this.lastNode === null) {
|
||||
return null;
|
||||
}
|
||||
return this.lastNode.item;
|
||||
}
|
||||
|
||||
getItemAtIndex(index: number) {
|
||||
public getItemAtIndex(index: number) {
|
||||
let node = this.firstNode;
|
||||
if (node === null) {
|
||||
return null;
|
||||
@@ -98,7 +98,7 @@ class LinkedList<T> {
|
||||
return node.item;
|
||||
}
|
||||
|
||||
remove(item: T) {
|
||||
public remove(item: T) {
|
||||
const node = this.getNode(item);
|
||||
this.itemMap.delete(item);
|
||||
this.removeNode(node);
|
||||
@@ -121,7 +121,7 @@ class LinkedList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
contains(item: T) {
|
||||
public contains(item: T) {
|
||||
return this.itemMap.has(item);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ class LinkedList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
move(item: T, prevItem: T|null) {
|
||||
public move(item: T, prevItem: T|null) {
|
||||
const node = this.getNode(item);
|
||||
this.removeNode(node);
|
||||
if (prevItem === null) {
|
||||
@@ -161,7 +161,7 @@ class LinkedList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
moveBack(item: T) {
|
||||
public moveBack(item: T) {
|
||||
const node = this.getNode(item);
|
||||
if (node.prev !== null) {
|
||||
console.assert(node !== this.firstNode);
|
||||
@@ -169,7 +169,7 @@ class LinkedList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
moveForward(item: T) {
|
||||
public moveForward(item: T) {
|
||||
const node = this.getNode(item);
|
||||
if (node.next !== null) {
|
||||
console.assert(node !== this.lastNode);
|
||||
@@ -177,17 +177,17 @@ class LinkedList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
length() {
|
||||
public length() {
|
||||
return this.itemMap.size;
|
||||
}
|
||||
|
||||
*iterator() {
|
||||
public *iterator() {
|
||||
for (let node = this.firstNode; node !== null; node = node.next) {
|
||||
yield node.item;
|
||||
}
|
||||
}
|
||||
|
||||
*iteratorFrom(startItem: T) {
|
||||
public *iteratorFrom(startItem: T) {
|
||||
for (let node: LinkedListNode<T>|null = this.getNode(startItem); node !== null; node = node.next) {
|
||||
yield node.item;
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@ class SignalManager {
|
||||
this.connections = [];
|
||||
}
|
||||
|
||||
connect(signal: QSignal, handler: (...args: any[]) => void) {
|
||||
public connect(signal: QSignal, handler: (...args: any[]) => void) {
|
||||
signal.connect(handler);
|
||||
this.connections.push({ signal: signal, handler: handler });
|
||||
}
|
||||
|
||||
destroy() {
|
||||
public destroy() {
|
||||
for (const connection of this.connections) {
|
||||
connection.signal.disconnect(connection.handler);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class ClientStateTiled {
|
||||
this.signalManager = ClientStateTiled.initSignalManager(world, window);
|
||||
}
|
||||
|
||||
destroy(passFocus: boolean) {
|
||||
public destroy(passFocus: boolean) {
|
||||
this.signalManager.destroy();
|
||||
|
||||
const window = this.window;
|
||||
@@ -26,7 +26,7 @@ class ClientStateTiled {
|
||||
clientWrapper.prepareForFloating(grid.container.clientArea);
|
||||
}
|
||||
|
||||
static initSignalManager(world: World, window: Window) {
|
||||
private static initSignalManager(world: World, window: Window) {
|
||||
const client = window.client;
|
||||
const kwinClient = client.kwinClient;
|
||||
const manager = new SignalManager();
|
||||
@@ -92,7 +92,7 @@ class ClientStateTiled {
|
||||
return manager;
|
||||
}
|
||||
|
||||
static moveWindowToCorrectGrid(world: World, window: Window) {
|
||||
private static moveWindowToCorrectGrid(world: World, window: Window) {
|
||||
const kwinClient = window.client.kwinClient;
|
||||
|
||||
const oldGrid = window.column.grid;
|
||||
|
||||
@@ -45,7 +45,7 @@ class World {
|
||||
this.addExistingClients();
|
||||
}
|
||||
|
||||
updateDesktops() {
|
||||
public updateDesktops() {
|
||||
this.scrollViewManager.setNDesktops(workspace.desktops);
|
||||
}
|
||||
|
||||
@@ -57,25 +57,25 @@ class World {
|
||||
}
|
||||
}
|
||||
|
||||
getGrid(activity: string, desktopNumber: number) {
|
||||
private getGrid(activity: string, desktopNumber: number) {
|
||||
console.assert(desktopNumber > 0 && desktopNumber <= workspace.desktops);
|
||||
return this.scrollViewManager.get(activity, desktopNumber).grid;
|
||||
}
|
||||
|
||||
getGridInCurrentActivity(desktopNumber: number) {
|
||||
public getGridInCurrentActivity(desktopNumber: number) {
|
||||
return this.getGrid(workspace.currentActivity, desktopNumber);
|
||||
}
|
||||
|
||||
getCurrentGrid() {
|
||||
public getCurrentGrid() {
|
||||
return this.getGrid(workspace.currentActivity, workspace.currentDesktop);
|
||||
}
|
||||
|
||||
getClientGrid(kwinClient: AbstractClient) {
|
||||
public getClientGrid(kwinClient: AbstractClient) {
|
||||
console.assert(kwinClient.activities.length === 1);
|
||||
return this.getGrid(kwinClient.activities[0], kwinClient.desktop);
|
||||
}
|
||||
|
||||
addClient(kwinClient: AbstractClient) {
|
||||
public addClient(kwinClient: AbstractClient) {
|
||||
const client = new ClientWrapper(
|
||||
kwinClient,
|
||||
new ClientStateFloating(),
|
||||
@@ -91,7 +91,7 @@ class World {
|
||||
}
|
||||
}
|
||||
|
||||
removeClient(kwinClient: AbstractClient, passFocus: boolean) {
|
||||
public removeClient(kwinClient: AbstractClient, passFocus: boolean) {
|
||||
const client = this.clientMap.get(kwinClient);
|
||||
if (client === undefined) {
|
||||
return;
|
||||
@@ -100,7 +100,7 @@ class World {
|
||||
this.clientMap.delete(kwinClient);
|
||||
}
|
||||
|
||||
findTransientFor(kwinClient: AbstractClient) {
|
||||
private findTransientFor(kwinClient: AbstractClient) {
|
||||
if (!kwinClient.transient) {
|
||||
return null;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class World {
|
||||
});
|
||||
}
|
||||
|
||||
minimizeClient(kwinClient: AbstractClient) {
|
||||
public minimizeClient(kwinClient: AbstractClient) {
|
||||
const client = this.clientMap.get(kwinClient);
|
||||
if (client === undefined) {
|
||||
return;
|
||||
@@ -129,7 +129,7 @@ class World {
|
||||
}
|
||||
}
|
||||
|
||||
unminimizeClient(kwinClient: AbstractClient) {
|
||||
public unminimizeClient(kwinClient: AbstractClient) {
|
||||
const client = this.clientMap.get(kwinClient);
|
||||
if (client === undefined) {
|
||||
return;
|
||||
@@ -139,7 +139,7 @@ class World {
|
||||
}
|
||||
}
|
||||
|
||||
tileClient(kwinClient: AbstractClient) {
|
||||
public tileClient(kwinClient: AbstractClient) {
|
||||
const client = this.clientMap.get(kwinClient);
|
||||
if (client === undefined) {
|
||||
return;
|
||||
@@ -150,7 +150,7 @@ class World {
|
||||
client.stateManager.setState(new ClientStateTiled(this, client), false);
|
||||
}
|
||||
|
||||
untileClient(kwinClient: AbstractClient) {
|
||||
public untileClient(kwinClient: AbstractClient) {
|
||||
const client = this.clientMap.get(kwinClient);
|
||||
if (client === undefined) {
|
||||
return;
|
||||
@@ -160,7 +160,7 @@ class World {
|
||||
}
|
||||
}
|
||||
|
||||
toggleFloatingClient(kwinClient: AbstractClient) {
|
||||
public toggleFloatingClient(kwinClient: AbstractClient) {
|
||||
const client = this.clientMap.get(kwinClient);
|
||||
if (client === undefined) {
|
||||
return;
|
||||
@@ -175,11 +175,11 @@ class World {
|
||||
}
|
||||
}
|
||||
|
||||
hasClient(kwinClient: AbstractClient) {
|
||||
public hasClient(kwinClient: AbstractClient) {
|
||||
return this.clientMap.has(kwinClient);
|
||||
}
|
||||
|
||||
onClientFocused(kwinClient: AbstractClient) {
|
||||
public onClientFocused(kwinClient: AbstractClient) {
|
||||
this.lastFocusedClient = kwinClient;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ class World {
|
||||
}
|
||||
}
|
||||
|
||||
doIfTiled(kwinClient: AbstractClient, followTransient: boolean, f: (window: Window, column: Column, grid: Grid) => void) {
|
||||
public doIfTiled(kwinClient: AbstractClient, followTransient: boolean, f: (window: Window, column: Column, grid: Grid) => void) {
|
||||
const client = this.clientMap.get(kwinClient);
|
||||
if (client === undefined) {
|
||||
return;
|
||||
@@ -203,11 +203,11 @@ class World {
|
||||
this.doIfTiledInner(client, followTransient, f);
|
||||
}
|
||||
|
||||
doIfTiledFocused(followTransient: boolean, f: (window: Window, column: Column, grid: Grid) => void) {
|
||||
public doIfTiledFocused(followTransient: boolean, f: (window: Window, column: Column, grid: Grid) => void) {
|
||||
this.doIfTiled(workspace.activeClient, followTransient, f);
|
||||
}
|
||||
|
||||
getFocusedWindow() {
|
||||
public getFocusedWindow() {
|
||||
const activeClient = workspace.activeClient;
|
||||
if (activeClient === null) {
|
||||
return null;
|
||||
@@ -224,13 +224,13 @@ class World {
|
||||
}
|
||||
}
|
||||
|
||||
removeAllClients() {
|
||||
private removeAllClients() {
|
||||
for (const kwinClient of Array.from(this.clientMap.keys())) {
|
||||
this.removeClient(kwinClient, false);
|
||||
}
|
||||
}
|
||||
|
||||
destroy() {
|
||||
public destroy() {
|
||||
this.workspaceSignalManager.destroy();
|
||||
this.removeAllClients();
|
||||
for (const scrollView of this.scrollViewManager.scrollViews()) {
|
||||
@@ -238,7 +238,7 @@ class World {
|
||||
}
|
||||
}
|
||||
|
||||
onScreenResized() {
|
||||
public onScreenResized() {
|
||||
this.screenResizedDelayer.run();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user