Skip to content

Commit

Permalink
fix: update make above for swaps
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmaranan committed Oct 28, 2021
1 parent 183f773 commit 142edfe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -961,14 +961,29 @@ var Tree = GObject.registerClass(
if (parentForTo && parentForFrom) {
let nextIndex = toNode.index;
let focusIndex = fromNode.index;

parentForTo.childNodes[nextIndex] = fromNode;
fromNode.parentNode = parentForTo;
parentForFrom.childNodes[focusIndex] = toNode;
toNode.parentNode = parentForFrom;
let percent = fromNode.percent;
fromNode.percent = toNode.percent;
toNode.percent = percent;

// Tabbed layout uses make above, update both nodes
if (parentForTo.isTabbedLayout()) {
fromNode.nodeValue.make_above();
} else {
fromNode.nodeValue.unmake_above();
}
if (parentForFrom.isTabbedLayout()) {
toNode.nodeValue.make_above();
} else {
toNode.nodeValue.unmake_above();
}

if (focus) {
// The fromNode is now on the parent-target
fromNode.nodeValue.raise();
fromNode.nodeValue.focus(global.get_current_time());
}
Expand Down
2 changes: 1 addition & 1 deletion window.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ var WindowManager = GObject.registerClass(
let swapDirection = Utils.resolveDirection(action.direction);
this.tree.swap(focusNodeWindow, swapDirection);
focusNodeWindow.nodeValue.raise();
this.renderTree("swap");
this.updateTabbedFocus(focusNodeWindow);
this.updateStackedFocus(focusNodeWindow);
this.renderTree("swap");
break;
case "Split":
if (!focusNodeWindow) return;
Expand Down

0 comments on commit 142edfe

Please sign in to comment.