Fixes #865.
Closes #852.
stack_head = stack_tail = NULL;
subscribe_head = subscribe_tail = NULL;
pending_rule_head = pending_rule_tail = NULL;
- auto_raise = sticky_still = record_history = true;
+ auto_raise = sticky_still = hide_sticky = record_history = true;
auto_split_type = false;
randr_base = 0;
exit_status = 0;
bool auto_raise;
bool auto_split_type;
bool sticky_still;
+bool hide_sticky;
bool record_history;
bool running;
bool randr;
return false;
}
- if (m->sticky_count > 0) {
- transfer_sticky_nodes(m, m->desk, d, m->desk->root);
+ if (m->sticky_count > 0 && m->desk != NULL) {
+ transfer_sticky_nodes(m, m->desk, m, d, m->desk->root);
}
show_desktop(d);
unlink_desktop(ms, d);
if ((!follow || !d_was_active || !ms_was_focused) && md->desk != NULL) {
+ hide_sticky = false;
hide_desktop(d);
+ hide_sticky = true;
}
insert_desktop(md, d);
}
if (ms->sticky_count > 0 && d_was_active) {
- transfer_sticky_nodes(ms, d, ms->desk, d->root);
+ if (ms->desk != NULL) {
+ transfer_sticky_nodes(md, d, ms, ms->desk, d->root);
+ } else {
+ ms->sticky_count -= sticky_count(d->root);
+ md->sticky_count += sticky_count(d->root);
+ if (d != md->desk) {
+ transfer_sticky_nodes(md, d, md, md->desk, d->root);
+ }
+ }
}
adapt_geometry(&ms->rectangle, &md->rectangle, d->root);
if (ds == NULL || dd == NULL || ds == dd) {
return;
}
+ /* TODO: Handle sticky nodes. */
transfer_node(ms, ds, ds->root, md, dd, dd->focus, false);
}
return true;
}
-void transfer_sticky_nodes(monitor_t *m, desktop_t *ds, desktop_t *dd, node_t *n)
+void transfer_sticky_nodes(monitor_t *ms, desktop_t *ds, monitor_t *md, desktop_t *dd, node_t *n)
{
if (n == NULL) {
return;
} else if (n->sticky) {
sticky_still = false;
- transfer_node(m, ds, n, m, dd, dd->focus, false);
+ transfer_node(ms, ds, n, md, dd, dd->focus, false);
sticky_still = true;
} else {
/* we need references to the children because n might be freed after
* the first recursive call */
node_t *first_child = n->first_child;
node_t *second_child = n->second_child;
- transfer_sticky_nodes(m, ds, dd, first_child);
- transfer_sticky_nodes(m, ds, dd, second_child);
+ transfer_sticky_nodes(ms, ds, md, dd, first_child);
+ transfer_sticky_nodes(ms, ds, md, dd, second_child);
}
}
clear_input_focus();
}
- if (m->sticky_count > 0 && d != m->desk) {
+ if (m->sticky_count > 0 && m->desk != NULL && d != m->desk) {
if (guess && m->desk->focus != NULL && m->desk->focus->sticky) {
n = m->desk->focus;
}
- transfer_sticky_nodes(m, m->desk, d, m->desk->root);
+ transfer_sticky_nodes(m, m->desk, m, d, m->desk->root);
if (n == NULL && d->focus != NULL) {
n = d->focus;
void hide_node(desktop_t *d, node_t *n)
{
- if (n == NULL) {
+ if (n == NULL || (!hide_sticky && n->sticky)) {
return;
} else {
if (!n->hidden) {
if (ns->client == NULL || monitor_from_client(ns->client) != md) {
adapt_geometry(&ms->rectangle, &md->rectangle, ns);
}
-
- if (ms->sticky_count > 0 && sticky_count(ns) > 0) {
- ms->sticky_count -= sticky_count(ns);
- md->sticky_count += sticky_count(ns);
- }
}
if (ds != dd) {
node_t *insert_node(monitor_t *m, desktop_t *d, node_t *n, node_t *f);
void insert_receptacle(monitor_t *m, desktop_t *d, node_t *n);
bool activate_node(monitor_t *m, desktop_t *d, node_t *n);
-void transfer_sticky_nodes(monitor_t *m, desktop_t *ds, desktop_t *dd, node_t *n);
+void transfer_sticky_nodes(monitor_t *ms, desktop_t *ds, monitor_t *md, desktop_t *dd, node_t *n);
bool focus_node(monitor_t *m, desktop_t *d, node_t *n);
void hide_node(desktop_t *d, node_t *n);
void show_node(desktop_t *d, node_t *n);