Don't transplant when swapping

The new syntax provides a separate transplantation option.
This commit is contained in:
Bastien Dejean 2013-07-13 09:40:19 +02:00
parent 7073f88479
commit 1f83706ab5
4 changed files with 6 additions and 11 deletions

View file

@ -456,7 +456,7 @@ void track_pointer(int root_x, int root_y)
coordinates_t loc;
bool is_managed = (pwin == XCB_NONE ? false : locate_window(pwin, &loc));
if (is_managed && is_tiled(loc.node->client) && loc.monitor == m) {
swap_nodes(n, loc.node, true);
swap_nodes(n, loc.node);
arrange(m, d);
} else {
if (is_managed && loc.monitor == m) {

View file

@ -80,7 +80,7 @@ bool cmd_window(char **args, int num)
return false;
coordinates_t dst;
if (node_from_desc(*args, &trg, &dst))
swap_nodes(trg.node, dst.node, true);
swap_nodes(trg.node, dst.node);
else
return false;
dirty = true;

11
tree.c
View file

@ -762,18 +762,13 @@ void destroy_tree(node_t *n)
destroy_tree(second_tree);
}
void swap_nodes(node_t *n1, node_t *n2, bool interpret)
void swap_nodes(node_t *n1, node_t *n2)
{
if (n1 == NULL || n2 == NULL || n1 == n2)
return;
PUTS("swap nodes");
if (interpret && n2->split_mode == MODE_MANUAL) {
transplant_node(mon, mon->desk, n1, n2);
return;
}
/* (n1 and n2 are leaves) */
node_t *pn1 = n1->parent;
node_t *pn2 = n2->parent;
@ -1003,10 +998,10 @@ void circulate_leaves(monitor_t *m, desktop_t *d, circulate_dir_t dir)
bool focus_first_child = is_first_child(d->focus);
if (dir == CIRCULATE_FORWARD)
for (node_t *s = second_extrema(d->root), *f = prev_leaf(s, d->root); f != NULL; s = prev_leaf(f, d->root), f = prev_leaf(s, d->root))
swap_nodes(f, s, false);
swap_nodes(f, s);
else
for (node_t *f = first_extrema(d->root), *s = next_leaf(f, d->root); s != NULL; f = next_leaf(s, d->root), s = next_leaf(f, d->root))
swap_nodes(f, s, false);
swap_nodes(f, s);
if (focus_first_child)
focus_node(m, d, p->first_child);
else

2
tree.h
View file

@ -9,7 +9,7 @@ void focus_node(monitor_t *, desktop_t *, node_t *);
void insert_node(monitor_t *, desktop_t *, node_t *, node_t *);
void unlink_node(desktop_t *, node_t *);
void remove_node(desktop_t *, node_t *);
void swap_nodes(node_t *, node_t *, bool);
void swap_nodes(node_t *, node_t *);
void pseudo_focus(desktop_t *, node_t *);
void update_current(void);
node_t *find_fence(node_t *, direction_t);