Handle fullscreen state birth rotation

Fixes #319.
This commit is contained in:
Bastien Dejean 2015-11-19 15:08:54 +01:00
parent 518a242f40
commit 9c29c0892e
4 changed files with 29 additions and 22 deletions

View file

@ -201,7 +201,7 @@ void restore_tree(char *file_path)
xcb_change_window_attributes(dpy, n->client->window, XCB_CW_EVENT_MASK, values); xcb_change_window_attributes(dpy, n->client->window, XCB_CW_EVENT_MASK, values);
if (!IS_TILED(n->client)) { if (!IS_TILED(n->client)) {
n->vacant = true; n->vacant = true;
update_vacant_state(n->parent); propagate_vacant_state(n);
} }
if (n->client->private) { if (n->client->private) {
update_privacy_level(n, true); update_privacy_level(n, true);

31
tree.c
View file

@ -274,7 +274,7 @@ void insert_node(monitor_t *m, desktop_t *d, node_t *n, node_t *f)
break; break;
} }
if (f->vacant) { if (f->vacant) {
update_vacant_state(f->parent); propagate_vacant_state(f);
} }
if (f->client != NULL) { if (f->client != NULL) {
if (f->client->private) { if (f->client->private) {
@ -938,7 +938,7 @@ void unlink_node(monitor_t *m, desktop_t *d, node_t *n)
b->birth_rotation = p->birth_rotation; b->birth_rotation = p->birth_rotation;
n->parent = NULL; n->parent = NULL;
free(p); free(p);
update_vacant_state(b->parent); propagate_vacant_state(b);
if (n == d->focus) { if (n == d->focus) {
d->focus = history_get_node(d, n); d->focus = history_get_node(d, n);
@ -1027,8 +1027,8 @@ bool swap_nodes(monitor_t *m1, desktop_t *d1, node_t *n1, monitor_t *m2, desktop
n2->privacy_level = pl1; n2->privacy_level = pl1;
if (n1->vacant != n2->vacant) { if (n1->vacant != n2->vacant) {
update_vacant_state(n1->parent); propagate_vacant_state(n1);
update_vacant_state(n2->parent); propagate_vacant_state(n2);
} }
if (n1->client->private != n2->client->private) { if (n1->client->private != n2->client->private) {
@ -1167,13 +1167,26 @@ void circulate_leaves(monitor_t *m, desktop_t *d, circulate_dir_t dir)
focus_node(m, d, p->second_child); focus_node(m, d, p->second_child);
} }
void update_vacant_state(node_t *n) void set_vacant_state(node_t *n, bool value)
{ {
if (n == NULL) n->vacant = value;
return;
/* n is not a leaf */ if (value) {
node_t *p = n; unrotate_brother(n);
} else {
rotate_brother(n);
}
propagate_vacant_state(n);
}
void propagate_vacant_state(node_t *n)
{
if (n == NULL) {
return;
}
node_t *p = n->parent;
while (p != NULL) { while (p != NULL) {
p->vacant = (p->first_child->vacant && p->second_child->vacant); p->vacant = (p->first_child->vacant && p->second_child->vacant);

3
tree.h
View file

@ -69,7 +69,8 @@ bool swap_nodes(monitor_t *m1, desktop_t *d1, node_t *n1, monitor_t *m2, desktop
bool transfer_node(monitor_t *ms, desktop_t *ds, node_t *ns, monitor_t *md, desktop_t *dd, node_t *nd); bool transfer_node(monitor_t *ms, desktop_t *ds, node_t *ns, monitor_t *md, desktop_t *dd, node_t *nd);
node_t *closest_node(monitor_t *m, desktop_t *d, node_t *n, cycle_dir_t dir, client_select_t sel); node_t *closest_node(monitor_t *m, desktop_t *d, node_t *n, cycle_dir_t dir, client_select_t sel);
void circulate_leaves(monitor_t *m, desktop_t *d, circulate_dir_t dir); void circulate_leaves(monitor_t *m, desktop_t *d, circulate_dir_t dir);
void update_vacant_state(node_t *n); void set_vacant_state(node_t *n, bool value);
void propagate_vacant_state(node_t *n);
void update_privacy_level(node_t *n, bool value); void update_privacy_level(node_t *n, bool value);
#endif #endif

View file

@ -452,16 +452,10 @@ void set_floating(monitor_t *m, desktop_t *d, node_t *n, bool value)
} }
n->split_mode = MODE_AUTOMATIC; n->split_mode = MODE_AUTOMATIC;
n->vacant = value; set_vacant_state(n, value);
update_vacant_state(n->parent);
if (value) { if (!value && d->focus == n) {
unrotate_brother(n); neutralize_obscuring_windows(m, d, n);
} else {
rotate_brother(n);
if (d->focus == n) {
neutralize_obscuring_windows(m, d, n);
}
} }
stack(n, (d->focus == n)); stack(n, (d->focus == n));
@ -476,8 +470,7 @@ void set_fullscreen(monitor_t *m, desktop_t *d, node_t *n, bool value)
client_t *c = n->client; client_t *c = n->client;
n->split_mode = MODE_AUTOMATIC; n->split_mode = MODE_AUTOMATIC;
n->vacant = value; set_vacant_state(n, value);
update_vacant_state(n->parent);
if (value) { if (value) {
ewmh_wm_state_add(c, ewmh->_NET_WM_STATE_FULLSCREEN); ewmh_wm_state_add(c, ewmh->_NET_WM_STATE_FULLSCREEN);