feat: remove crap code

This commit is contained in:
Lucas Oskorep
2025-10-15 23:53:55 -04:00
parent 265ff05436
commit 3593d7cafd
3 changed files with 59 additions and 3 deletions
+25
View File
@@ -16,12 +16,14 @@ export default class WindowContainer {
_tiledWindowLookup: Map<number, WindowWrapper>;
_orientation: Orientation = Orientation.HORIZONTAL;
_workArea: Rect;
_customSizes: Map<number, number>; // Maps window ID to custom width (horizontal) or height (vertical)
constructor(workspaceArea: Rect,) {
// this._id = monitorId;
this._tiledItems = [];
this._tiledWindowLookup = new Map<number, WindowWrapper>();
this._workArea = workspaceArea;
this._customSizes = new Map<number, number>();
}
@@ -74,6 +76,7 @@ export default class WindowContainer {
removeWindow(win_id: number): void {
if (this._tiledWindowLookup.has(win_id)) {
this._tiledWindowLookup.delete(win_id);
this._customSizes.delete(win_id);
const index = this._getIndexOfWindow(win_id)
this._tiledItems.splice(index, 1);
} else {
@@ -201,5 +204,27 @@ export default class WindowContainer {
}
windowManuallyResized(win_id: number): void {
const window = this.getWindow(win_id);
if (!window) {
// Check nested containers
for (const item of this._tiledItems) {
if (item instanceof WindowContainer) {
item.windowManuallyResized(win_id);
}
}
return;
}
const rect = window.getRect();
if (this._orientation === Orientation.HORIZONTAL) {
this._customSizes.set(win_id, rect.width);
Logger.log(`Window ${win_id} manually resized to width: ${rect.width}`);
} else {
this._customSizes.set(win_id, rect.height);
Logger.log(`Window ${win_id} manually resized to height: ${rect.height}`);
}
}
}
+11
View File
@@ -83,4 +83,15 @@ export default class Monitor {
this._workspaces[item.getWorkspace()].itemDragged(item, x, y);
}
windowManuallyResized(win_id: number): void {
// Find which workspace contains the window and notify it
for (const container of this._workspaces) {
const win = container.getWindow(win_id);
if (win) {
container.windowManuallyResized(win_id);
return;
}
}
}
}
+23 -3
View File
@@ -199,9 +199,6 @@ export default class WindowManager implements IWindowManager {
handleGrabOpBegin(display: Meta.Display, window: Meta.Window, op: Meta.GrabOp): void {
if (op === Meta.GrabOp.MOVING_UNCONSTRAINED){
}
Logger.log("Grab Op Start", op);
Logger.log(display, window, op)
Logger.log(window.get_monitor())
@@ -210,9 +207,32 @@ export default class WindowManager implements IWindowManager {
this._grabbedWindowId = window.get_id();
}
_isResizeOperation(op: Meta.GrabOp): boolean {
// Check if the operation is any kind of resize
return op === Meta.GrabOp.RESIZING_E ||
op === Meta.GrabOp.RESIZING_W ||
op === Meta.GrabOp.RESIZING_N ||
op === Meta.GrabOp.RESIZING_S ||
op === Meta.GrabOp.RESIZING_NE ||
op === Meta.GrabOp.RESIZING_NW ||
op === Meta.GrabOp.RESIZING_SE ||
op === Meta.GrabOp.RESIZING_SW;
}
handleGrabOpEnd(display: Meta.Display, window: Meta.Window, op: Meta.GrabOp): void {
Logger.log("Grab Op End ", op);
Logger.log("primary display", display.get_primary_monitor())
const isResizing = this._isResizeOperation(op);
if (isResizing) {
// Window was manually resized - capture the new size
const monitor = this._monitors.get(window.get_monitor());
if (monitor) {
monitor.windowManuallyResized(window.get_id());
}
}
this._grabbedWindowId = _UNUSED_WINDOW_ID;
this._getWrappedWindow(window)?.stopDragging();
this._tileMonitors();