Skip to content

Commit 130ac4f

Browse files
author
LinuxHeki
committed
Undo fix(tiling) pop-os#1171
1 parent 5220303 commit 130ac4f

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

src/auto_tiler.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ export class AutoTiler {
202202
log.debug(`attach to workspace: ${result.value}`)
203203
this.attach_to_workspace(ext, win, ext.workspace_id(win));
204204
} else {
205-
log.debug(`attaching to window ${win.entity}`)
206205
this.attach_to_window(ext, result.value, win, { auto: 0 })
207206
}
208207
}
@@ -657,7 +656,7 @@ export class AutoTiler {
657656
return Err('ignoring focus');
658657
}
659658

660-
const prev = ext.previously_focused(win)
659+
const prev = ext.prev_focused[1]
661660

662661
if (!prev) {
663662
return Err('no window has been previously focused');
@@ -685,9 +684,9 @@ export class AutoTiler {
685684
return Err('focused window is not attached');
686685
}
687686

688-
return onto.workspace_id() == win.workspace_id()
687+
return onto.meta.get_monitor() == win.meta.get_monitor() && onto.workspace_id() == win.workspace_id()
689688
? Ok(onto)
690-
: Err('window is not on the same workspace');
689+
: Err('window is not on the same monitor or workspace');
691690
}
692691

693692
private toggle_orientation_(ext: Ext, focused: ShellWindow): Result<void, string> {

src/extension.ts

+4-18
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export class Ext extends Ecs.System<ExtEvent> {
152152
injections: Array<Injection> = new Array();
153153

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

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

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

791-
// Track history of focused windows, but do not permit duplicates.
792-
if (this.prev_focused[1] !== win.entity) {
793-
this.prev_focused[0] = this.prev_focused[1];
794-
this.prev_focused[1] = win.entity;
795-
}
791+
this.prev_focused[0] = this.prev_focused[1];
792+
this.prev_focused[1] = win.entity;
796793

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

1069-
previously_focused(active: Window.ShellWindow): null | Ecs.Entity {
1070-
for (const id of [1, 0]) {
1071-
const prev = this.prev_focused[id]
1072-
if (prev && ! Ecs.entity_eq(active.entity, prev)) {
1073-
return prev;
1074-
}
1075-
}
1076-
1077-
return null
1078-
}
1079-
10801066
movement_is_valid(win: Window.ShellWindow, movement: movement.Movement) {
10811067
if ((movement & Movement.SHRINK) !== 0) {
10821068
if ((movement & Movement.DOWN) !== 0) {
@@ -2048,7 +2034,7 @@ export class Ext extends Ecs.System<ExtEvent> {
20482034
let actor = window.meta.get_compositor_private();
20492035
if (actor) {
20502036
if (!window.meta.minimized) {
2051-
tiler.auto_tile(this, window, true);
2037+
tiler.auto_tile(this, window, false);
20522038
}
20532039
}
20542040
}

0 commit comments

Comments
 (0)