Skip to content

Commit

Permalink
Undo fix(tiling) pop-os#1171
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxHeki committed Oct 3, 2021
1 parent 5220303 commit 130ac4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
7 changes: 3 additions & 4 deletions src/auto_tiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ export class AutoTiler {
log.debug(`attach to workspace: ${result.value}`)
this.attach_to_workspace(ext, win, ext.workspace_id(win));
} else {
log.debug(`attaching to window ${win.entity}`)
this.attach_to_window(ext, result.value, win, { auto: 0 })
}
}
Expand Down Expand Up @@ -657,7 +656,7 @@ export class AutoTiler {
return Err('ignoring focus');
}

const prev = ext.previously_focused(win)
const prev = ext.prev_focused[1]

if (!prev) {
return Err('no window has been previously focused');
Expand Down Expand Up @@ -685,9 +684,9 @@ export class AutoTiler {
return Err('focused window is not attached');
}

return onto.workspace_id() == win.workspace_id()
return onto.meta.get_monitor() == win.meta.get_monitor() && onto.workspace_id() == win.workspace_id()
? Ok(onto)
: Err('window is not on the same workspace');
: Err('window is not on the same monitor or workspace');
}

private toggle_orientation_(ext: Ext, focused: ShellWindow): Result<void, string> {
Expand Down
22 changes: 4 additions & 18 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class Ext extends Ecs.System<ExtEvent> {
injections: Array<Injection> = new Array();

/** The window that was focused before the last window */
private prev_focused: [null | Entity, null | Entity] = [null, null];
prev_focused: [null | Entity, null | Entity] = [null, null];

tween_signals: Map<string, [SignalID, any]> = new Map();

Expand Down Expand Up @@ -788,11 +788,8 @@ export class Ext extends Ecs.System<ExtEvent> {
this.exception_add(win)
}

// Track history of focused windows, but do not permit duplicates.
if (this.prev_focused[1] !== win.entity) {
this.prev_focused[0] = this.prev_focused[1];
this.prev_focused[1] = win.entity;
}
this.prev_focused[0] = this.prev_focused[1];
this.prev_focused[1] = win.entity;

// Update the active tab in the stack.
if (null !== this.auto_tiler && null !== win.stack) {
Expand Down Expand Up @@ -1066,17 +1063,6 @@ export class Ext extends Ecs.System<ExtEvent> {
}
}

previously_focused(active: Window.ShellWindow): null | Ecs.Entity {
for (const id of [1, 0]) {
const prev = this.prev_focused[id]
if (prev && ! Ecs.entity_eq(active.entity, prev)) {
return prev;
}
}

return null
}

movement_is_valid(win: Window.ShellWindow, movement: movement.Movement) {
if ((movement & Movement.SHRINK) !== 0) {
if ((movement & Movement.DOWN) !== 0) {
Expand Down Expand Up @@ -2048,7 +2034,7 @@ export class Ext extends Ecs.System<ExtEvent> {
let actor = window.meta.get_compositor_private();
if (actor) {
if (!window.meta.minimized) {
tiler.auto_tile(this, window, true);
tiler.auto_tile(this, window, false);
}
}
}
Expand Down

0 comments on commit 130ac4f

Please sign in to comment.