7 #include <xcb/xcb_event.h>
16 bool is_leaf(node_t *n)
18 return (n != NULL && n->first_child == NULL && n->second_child == NULL);
21 bool is_tiled(client_t *c)
25 return (!c->floating && !c->transient && !c->fullscreen);
28 bool is_floating(client_t *c)
32 return (c->floating && !c->fullscreen);
35 bool is_first_child(node_t *n)
37 return (n != NULL && n->parent != NULL && n->parent->first_child == n);
40 bool is_second_child(node_t *n)
42 return (n != NULL && n->parent != NULL && n->parent->second_child == n);
45 void change_split_ratio(node_t *n, value_change_t chg) {
46 n->split_ratio = pow(n->split_ratio, (chg == CHANGE_INCREASE ? INC_EXP : DEC_EXP));
49 node_t *first_extrema(node_t *n)
53 else if (n->first_child == NULL)
56 return first_extrema(n->first_child);
59 node_t *second_extrema(node_t *n)
63 else if (n->second_child == NULL)
66 return second_extrema(n->second_child);
69 node_t *next_leaf(node_t *n)
74 while (is_second_child(p))
76 if (p->parent == NULL)
78 return first_extrema(p->parent->second_child);
81 node_t *prev_leaf(node_t *n)
86 while (is_first_child(p))
88 if (p->parent == NULL)
90 return second_extrema(p->parent->first_child);
93 node_t *find_fence(node_t *n, direction_t dir)
103 if ((dir == DIR_UP && p->split_type == TYPE_HORIZONTAL && p->rectangle.y < n->rectangle.y)
104 || (dir == DIR_LEFT && p->split_type == TYPE_VERTICAL && p->rectangle.x < n->rectangle.x)
105 || (dir == DIR_DOWN && p->split_type == TYPE_HORIZONTAL && (p->rectangle.y + p->rectangle.height) > (n->rectangle.y + n->rectangle.height))
106 || (dir == DIR_RIGHT && p->split_type == TYPE_VERTICAL && (p->rectangle.x + p->rectangle.width) > (n->rectangle.x + n->rectangle.width)))
114 node_t *find_neighbor(node_t *n, direction_t dir)
116 node_t *fence = find_fence(n, dir);
121 if (dir == DIR_UP || dir == DIR_LEFT)
122 return second_extrema(fence->first_child);
123 else if (dir == DIR_DOWN || dir == DIR_RIGHT)
124 return first_extrema(fence->second_child);
129 void move_fence(node_t *n, direction_t dir, fence_move_t mov)
131 node_t *fence = find_fence(n, dir);
136 if ((mov == MOVE_PUSH && (dir == DIR_RIGHT || dir == DIR_DOWN))
137 || (mov == MOVE_PULL && (dir == DIR_LEFT || dir == DIR_UP)))
138 change_split_ratio(fence, CHANGE_INCREASE);
140 change_split_ratio(fence, CHANGE_DECREASE);
143 void rotate_tree(node_t *n, rotate_t rot)
145 if (n == NULL || is_leaf(n))
150 if ((rot == ROTATE_CLOCKWISE && n->split_type == TYPE_HORIZONTAL)
151 || (rot == ROTATE_COUNTER_CLOCKWISE && n->split_type == TYPE_VERTICAL)
152 || rot == ROTATE_FULL_CYCLE) {
153 tmp = n->first_child;
154 n->first_child = n->second_child;
155 n->second_child = tmp;
156 n->split_ratio = 1.0 - n->split_ratio;
159 if (rot != ROTATE_FULL_CYCLE) {
160 if (n->split_type == TYPE_HORIZONTAL)
161 n->split_type = TYPE_VERTICAL;
162 else if (n->split_type == TYPE_VERTICAL)
163 n->split_type = TYPE_HORIZONTAL;
166 rotate_tree(n->first_child, rot);
167 rotate_tree(n->second_child, rot);
171 void arrange(monitor_t *m, desktop_t *d)
173 PRINTF("arrange %s%s%s\n", (num_monitors > 1 ? m->name : ""), (num_monitors > 1 ? " " : ""), d->name);
175 xcb_rectangle_t rect = m->rectangle;
176 int wg = (gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : window_gap);
177 rect.x += m->left_padding + wg;
178 rect.y += m->top_padding + wg;
179 rect.width -= m->left_padding + m->right_padding + wg;
180 rect.height -= m->top_padding + m->bottom_padding + wg;
181 if (focus_follows_pointer)
182 save_pointer_position(&last_pointer_position);
183 apply_layout(m, d, d->root, rect, rect);
186 void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, xcb_rectangle_t root_rect)
194 if (n->client->fullscreen)
197 if (is_floating(n->client) && n->client->border_width != border_width) {
198 int ds = 2 * (border_width - n->client->border_width);
199 n->client->floating_rectangle.width += ds;
200 n->client->floating_rectangle.height += ds;
203 if (borderless_monocle && is_tiled(n->client) && d->layout == LAYOUT_MONOCLE)
204 n->client->border_width = 0;
206 n->client->border_width = border_width;
209 if (is_tiled(n->client)) {
210 if (d->layout == LAYOUT_TILED)
212 else if (d->layout == LAYOUT_MONOCLE)
214 int wg = (gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : window_gap);
215 int bleed = wg + 2 * n->client->border_width;
216 r.width = (bleed < r.width ? r.width - bleed : 1);
217 r.height = (bleed < r.height ? r.height - bleed : 1);
218 n->client->tiled_rectangle = r;
220 r = n->client->floating_rectangle;
223 window_move_resize(n->client->window, r.x, r.y, r.width, r.height);
224 window_border_width(n->client->window, n->client->border_width);
225 window_draw_border(n, n == d->focus, m == mon);
228 xcb_rectangle_t first_rect;
229 xcb_rectangle_t second_rect;
231 if (n->first_child->vacant || n->second_child->vacant) {
232 first_rect = second_rect = rect;
235 if (n->split_type == TYPE_VERTICAL) {
236 fence = rect.width * n->split_ratio;
237 first_rect = (xcb_rectangle_t) {rect.x, rect.y, fence, rect.height};
238 second_rect = (xcb_rectangle_t) {rect.x + fence, rect.y, rect.width - fence, rect.height};
240 } else if (n->split_type == TYPE_HORIZONTAL) {
241 fence = rect.height * n->split_ratio;
242 first_rect = (xcb_rectangle_t) {rect.x, rect.y, rect.width, fence};
243 second_rect = (xcb_rectangle_t) {rect.x, rect.y + fence, rect.width, rect.height - fence};
247 apply_layout(m, d, n->first_child, first_rect, root_rect);
248 apply_layout(m, d, n->second_child, second_rect, root_rect);
252 void insert_node(monitor_t *m, desktop_t *d, node_t *n)
254 if (d == NULL || n == NULL)
257 PRINTF("insert node %X\n", n->client->window);
259 node_t *focus = d->focus;
264 node_t *dad = make_node();
265 node_t *fopar = focus->parent;
267 n->client->born_as = split_mode;
268 switch (split_mode) {
271 dad->first_child = n;
272 dad->second_child = focus;
273 if (m->rectangle.width > m->rectangle.height)
274 dad->split_type = TYPE_VERTICAL;
276 dad->split_type = TYPE_HORIZONTAL;
280 node_t *grandpa = fopar->parent;
281 dad->parent = grandpa;
282 if (grandpa != NULL) {
283 if (is_first_child(fopar))
284 grandpa->first_child = dad;
286 grandpa->second_child = dad;
290 dad->split_type = fopar->split_type;
291 dad->split_ratio = fopar->split_ratio;
293 if (is_first_child(focus)) {
294 dad->first_child = n;
295 dad->second_child = fopar;
296 rotate_tree(fopar, ROTATE_CLOCKWISE);
298 dad->first_child = fopar;
299 dad->second_child = n;
300 rotate_tree(fopar, ROTATE_COUNTER_CLOCKWISE);
306 if (is_first_child(focus))
307 fopar->first_child = dad;
309 fopar->second_child = dad;
311 dad->split_ratio = focus->split_ratio;
316 dad->split_type = TYPE_VERTICAL;
317 dad->first_child = n;
318 dad->second_child = focus;
321 dad->split_type = TYPE_VERTICAL;
322 dad->first_child = focus;
323 dad->second_child = n;
326 dad->split_type = TYPE_HORIZONTAL;
327 dad->first_child = n;
328 dad->second_child = focus;
331 dad->split_type = TYPE_HORIZONTAL;
332 dad->first_child = focus;
333 dad->second_child = n;
336 if (d->root == focus)
338 split_mode = MODE_AUTOMATIC;
342 update_vacant_state(fopar);
346 void focus_node(monitor_t *m, desktop_t *d, node_t *n, bool is_mapped)
351 PRINTF("focus node %X\n", n->client->window);
353 split_mode = MODE_AUTOMATIC;
354 n->client->urgent = false;
358 for (desktop_t *cd = mon->desk_head; cd != NULL; cd = cd->next)
359 window_draw_border(cd->focus, true, false);
360 for (desktop_t *cd = m->desk_head; cd != NULL; cd = cd->next)
362 window_draw_border(cd->focus, true, true);
364 window_draw_border(n, true, true);
367 window_draw_border(d->focus, false, true);
368 window_draw_border(n, true, true);
370 xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, n->client->window, XCB_CURRENT_TIME);
373 if (focus_follows_pointer) {
374 save_pointer_position(&last_pointer_position);
375 if (n != mon->desk->focus) {
376 if (last_focused_window != XCB_NONE) {
377 uint32_t values[] = {CLIENT_EVENT_MASK_FFP};
378 xcb_change_window_attributes(dpy, last_focused_window, XCB_CW_EVENT_MASK, values);
380 uint32_t values[] = {CLIENT_EVENT_MASK};
381 xcb_change_window_attributes(dpy, n->client->window, XCB_CW_EVENT_MASK, values);
382 last_focused_window = n->client->window;
386 if (!is_tiled(n->client)) {
387 if (!adaptative_raise || !might_cover(d, n))
388 window_raise(n->client->window);
390 window_pseudo_raise(d, n->client->window);
394 d->last_focus = d->focus;
398 ewmh_update_active_window();
402 void update_current(void)
404 if (mon->desk->focus == NULL)
405 ewmh_update_active_window();
407 focus_node(mon, mon->desk, mon->desk->focus, true);
411 void unlink_node(desktop_t *d, node_t *n)
413 if (d == NULL || n == NULL)
416 PRINTF("unlink node %X\n", n->client->window);
418 node_t *p = n->parent;
423 d->last_focus = NULL;
426 node_t *g = p->parent;
427 bool n_first_child = is_first_child(n);
430 if (n->client->born_as == MODE_AUTOMATIC)
431 rotate_tree(b, ROTATE_COUNTER_CLOCKWISE);
434 if (n->client->born_as == MODE_AUTOMATIC)
435 rotate_tree(b, ROTATE_CLOCKWISE);
439 if (is_first_child(p))
450 if (n == d->last_focus) {
451 d->last_focus = NULL;
452 } else if (n == d->focus) {
453 if (d->last_focus != NULL)
454 d->focus = d->last_focus;
456 d->focus = (n_first_child ? first_extrema(b) : second_extrema(b));
457 d->last_focus = NULL;
460 update_vacant_state(b->parent);
464 void remove_node(desktop_t *d, node_t *n)
466 if (d == NULL || n == NULL)
469 PRINTF("remove node %X\n", n->client->window);
476 ewmh_update_client_list();
482 void destroy_tree(node_t *n)
486 node_t *first_tree = n->first_child;
487 node_t *second_tree = n->second_child;
488 if (n->client != NULL)
491 destroy_tree(first_tree);
492 destroy_tree(second_tree);
495 void swap_nodes(node_t *n1, node_t *n2)
497 if (n1 == NULL || n2 == NULL || n1 == n2)
502 /* (n1 and n2 are leaves) */
503 node_t *pn1 = n1->parent;
504 node_t *pn2 = n2->parent;
505 bool n1_first_child = is_first_child(n1);
506 bool n2_first_child = is_first_child(n2);
510 pn1->first_child = n2;
512 pn1->second_child = n2;
517 pn2->first_child = n1;
519 pn2->second_child = n1;
525 if (n1->vacant != n2->vacant) {
526 update_vacant_state(n1->parent);
527 update_vacant_state(n2->parent);
531 void transfer_node(monitor_t *ms, desktop_t *ds, monitor_t *md, desktop_t *dd, node_t *n)
533 if (n == NULL || ds == NULL || dd == NULL || ms == NULL || md == NULL || (ms == md && dd == ds))
536 PRINTF("transfer node %X\n", n->client->window);
539 insert_node(md, dd, n);
540 ewmh_set_wm_desktop(n, dd);
542 if (ds == ms->desk && dd != md->desk) {
543 window_hide(n->client->window);
546 fit_monitor(md, n->client);
548 if (n->client->fullscreen)
549 window_move_resize(n->client->window, md->rectangle.x, md->rectangle.y, md->rectangle.width, md->rectangle.height);
551 if (ds != ms->desk && dd == md->desk) {
552 window_show(n->client->window);
553 focus_node(md, dd, n, true);
555 focus_node(md, dd, n, false);
558 if (ds == ms->desk || dd == md->desk)
562 void select_monitor(monitor_t *m)
564 if (m == NULL || mon == m)
567 PRINTF("select monitor %s\n", m->name);
569 focus_node(m, m->desk, m->desk->focus, true);
574 ewmh_update_current_desktop();
578 void select_desktop(desktop_t *d)
580 if (d == NULL || d == mon->desk)
583 PRINTF("select desktop %s\n", d->name);
586 node_t *n = first_extrema(d->root);
589 window_show(n->client->window);
593 n = first_extrema(mon->desk->root);
596 window_hide(n->client->window);
601 mon->last_desk = mon->desk;
605 ewmh_update_current_desktop();
609 void cycle_monitor(cycle_dir_t dir)
611 if (dir == CYCLE_NEXT)
612 select_monitor((mon->next == NULL ? mon_head : mon->next));
613 else if (dir == CYCLE_PREV)
614 select_monitor((mon->prev == NULL ? mon_tail : mon->prev));
617 void cycle_desktop(monitor_t *m, desktop_t *d, cycle_dir_t dir, skip_desktop_t skip)
619 desktop_t *f = (dir == CYCLE_PREV ? d->prev : d->next);
621 f = (dir == CYCLE_PREV ? m->desk_tail : m->desk_head);
624 if (skip == DESKTOP_SKIP_NONE
625 || (skip == DESKTOP_SKIP_FREE && f->root != NULL)
626 || (skip == DESKTOP_SKIP_OCCUPIED && f->root == NULL)) {
630 f = (dir == CYCLE_PREV ? f->prev : f->next);
632 f = (dir == CYCLE_PREV ? m->desk_tail : m->desk_head);
636 void cycle_leaf(monitor_t *m, desktop_t *d, node_t *n, cycle_dir_t dir, skip_client_t skip)
643 node_t *f = (dir == CYCLE_PREV ? prev_leaf(n) : next_leaf(n));
645 f = (dir == CYCLE_PREV ? second_extrema(d->root) : first_extrema(d->root));
648 bool tiled = is_tiled(f->client);
649 if (skip == CLIENT_SKIP_NONE || (skip == CLIENT_SKIP_TILED && !tiled) || (skip == CLIENT_SKIP_FLOATING && tiled)
650 || (skip == CLIENT_SKIP_CLASS_DIFFER && strcmp(f->client->class_name, n->client->class_name) == 0)
651 || (skip == CLIENT_SKIP_CLASS_EQUAL && strcmp(f->client->class_name, n->client->class_name) != 0)) {
652 focus_node(m, d, f, true);
655 f = (dir == CYCLE_PREV ? prev_leaf(f) : next_leaf(f));
657 f = (dir == CYCLE_PREV ? second_extrema(d->root) : first_extrema(d->root));
661 void nearest_leaf(monitor_t *m, desktop_t *d, node_t *n, nearest_arg_t dir, skip_client_t skip)
666 PUTS("nearest leaf");
670 for (node_t *f = first_extrema(d->root); f != NULL; f = next_leaf(f))
671 if (skip == CLIENT_SKIP_NONE || (skip == CLIENT_SKIP_TILED && !is_tiled(f->client)) || (skip == CLIENT_SKIP_FLOATING && is_tiled(f->client))
672 || (skip == CLIENT_SKIP_CLASS_DIFFER && strcmp(f->client->class_name, n->client->class_name) == 0)
673 || (skip == CLIENT_SKIP_CLASS_EQUAL && strcmp(f->client->class_name, n->client->class_name) != 0))
674 if ((dir == NEAREST_OLDER
675 && (f->client->uid < n->client->uid)
676 && (x == NULL || f->client->uid > x->client->uid))
677 || (dir == NEAREST_NEWER
678 && (f->client->uid > n->client->uid)
679 && (x == NULL || f->client->uid < x->client->uid)))
682 focus_node(m, d, x, true);
685 void circulate_leaves(monitor_t *m, desktop_t *d, circulate_dir_t dir) {
686 if (d == NULL || d->root == NULL || is_leaf(d->root))
688 node_t *par = d->focus->parent;
689 bool focus_first_child = is_first_child(d->focus);
690 if (dir == CIRCULATE_FORWARD)
691 for (node_t *s = second_extrema(d->root), *f = prev_leaf(s); f != NULL; s = prev_leaf(f), f = prev_leaf(s))
694 for (node_t *f = first_extrema(d->root), *s = next_leaf(f); s != NULL; f = next_leaf(s), s = next_leaf(f))
696 if (focus_first_child)
697 focus_node(m, d, par->first_child, true);
699 focus_node(m, d, par->second_child, true);
702 void update_vacant_state(node_t *n)
707 PUTS("update vacant state");
709 /* n is not a leaf */
713 p->vacant = (p->first_child->vacant && p->second_child->vacant);
718 void fit_monitor(monitor_t *m, client_t *c)
720 xcb_rectangle_t crect = c->floating_rectangle;
721 xcb_rectangle_t mrect = m->rectangle;
722 while (crect.x < mrect.x)
723 crect.x += mrect.width;
724 while (crect.x > (mrect.x + mrect.width - 1))
725 crect.x -= mrect.width;
726 while (crect.y < mrect.y)
727 crect.y += mrect.height;
728 while (crect.y > (mrect.y + mrect.height - 1))
729 crect.y -= mrect.height;
730 c->floating_rectangle = crect;
733 void put_status(void)
735 if (status_fifo == NULL)
738 for (monitor_t *m = mon_head; m != NULL; m = m->next) {
739 fprintf(status_fifo, "%c%s:", (mon == m ? 'M' : 'm'), m->name);
740 for (desktop_t *d = m->desk_head; d != NULL; d = d->next, urgent = false) {
741 for (node_t *n = first_extrema(d->root); n != NULL && !urgent; n = next_leaf(n))
742 urgent |= n->client->urgent;
743 fprintf(status_fifo, "%c%c%s:", (m->desk == d ? 'D' : (d->root != NULL ? 'd' : '_')), (urgent ? '!' : '_'), d->name);
746 fprintf(status_fifo, "L%s:W%X\n", (mon->desk->layout == LAYOUT_TILED ? "tiled" : "monocle"), (mon->desk->focus == NULL ? 0 : mon->desk->focus->client->window));
750 void list_monitors(list_option_t opt, char *rsp)
753 for (monitor_t *m = mon_head; m != NULL; m = m->next) {
754 snprintf(line, sizeof(line), "%s %ux%u%+i%+i", m->name, m->rectangle.width, m->rectangle.height, m->rectangle.x, m->rectangle.y);
755 strncat(rsp, line, REMLEN(rsp));
757 strncat(rsp, " #\n", REMLEN(rsp));
758 else if (m == last_mon)
759 strncat(rsp, " ~\n", REMLEN(rsp));
761 strncat(rsp, "\n", REMLEN(rsp));
762 if (opt == LIST_OPTION_VERBOSE)
763 list_desktops(m, opt, 1, rsp);
767 void list_desktops(monitor_t *m, list_option_t opt, unsigned int depth, char *rsp)
770 for (desktop_t *d = m->desk_head; d != NULL; d = d->next) {
771 for (unsigned int i = 0; i < depth; i++)
772 strncat(rsp, " ", REMLEN(rsp));
773 snprintf(line, sizeof(line), "%s %c", d->name, (d->layout == LAYOUT_TILED ? 'T' : 'M'));
774 strncat(rsp, line, REMLEN(rsp));
776 strncat(rsp, " @\n", REMLEN(rsp));
777 else if (d == m->last_desk)
778 strncat(rsp, " ~\n", REMLEN(rsp));
780 strncat(rsp, "\n", REMLEN(rsp));
781 if (opt == LIST_OPTION_VERBOSE)
782 list(d, d->root, rsp, depth + 1);
786 void list(desktop_t *d, node_t *n, char *rsp, unsigned int depth)
793 for (unsigned int i = 0; i < depth; i++)
794 strncat(rsp, " ", REMLEN(rsp));
797 client_t *c = n->client;
798 snprintf(line, sizeof(line), "%c %s %X %u %u %ux%u%+i%+i %c%c%c%c%c", (c->born_as == MODE_AUTOMATIC ? 'a' : 'm'), c->class_name, c->window, c->uid, c->border_width, c->floating_rectangle.width, c->floating_rectangle.height, c->floating_rectangle.x, c->floating_rectangle.y, (c->floating ? 'f' : '-'), (c->transient ? 't' : '-'), (c->fullscreen ? 'F' : '-'), (c->urgent ? 'u' : '-'), (c->locked ? 'l' : '-'));
800 snprintf(line, sizeof(line), "%c %.2f", (n->split_type == TYPE_HORIZONTAL ? 'H' : 'V'), n->split_ratio);
803 strncat(rsp, line, REMLEN(rsp));
806 strncat(rsp, " *\n", REMLEN(rsp));
807 else if (n == d->last_focus)
808 strncat(rsp, " ~\n", REMLEN(rsp));
810 strncat(rsp, "\n", REMLEN(rsp));
812 list(d, n->first_child, rsp, depth + 1);
813 list(d, n->second_child, rsp, depth + 1);
816 void restore(char *file_path)
818 if (file_path == NULL)
821 FILE *snapshot = fopen(file_path, "r");
822 if (snapshot == NULL) {
823 warn("restore: can't open file\n");
832 unsigned int level, last_level = 0, max_uid = 0;
833 bool aborted = false;
835 while (!aborted && fgets(line, sizeof(line), snapshot) != NULL) {
836 unsigned int len = strlen(line);
838 while (level < strlen(line) && isspace(line[level]))
846 switch (line[len - 2]) {
854 } else if (level == 2) {
860 while (i > 0 && !isupper(line[i]))
863 d->layout = LAYOUT_MONOCLE;
864 else if (line[i] == 'T')
865 d->layout = LAYOUT_TILED;
867 switch (line[len - 2]) {
876 node_t *birth = make_node();
881 if (level > last_level) {
882 n->first_child = birth;
886 } while (n != NULL && n->second_child != NULL);
888 warn("restore: file is malformed\n");
891 n->second_child = birth;
897 if (isupper(line[level])) {
899 sscanf(line + level, "%c %lf", &st, &n->split_ratio);
901 n->split_type = TYPE_HORIZONTAL;
903 n->split_type = TYPE_VERTICAL;
905 client_t *c = make_client(XCB_NONE);
907 char ba, floating, transient, fullscreen, urgent, locked;
908 sscanf(line + level, "%c %s %X %u %u %hux%hu%hi%hi %c%c%c%c%c", &ba, c->class_name, &c->window, &c->uid, &c->border_width, &c->floating_rectangle.width, &c->floating_rectangle.height, &c->floating_rectangle.x, &c->floating_rectangle.y, &floating, &transient, &fullscreen, &urgent, &locked);
910 c->born_as = MODE_AUTOMATIC;
912 c->born_as = MODE_MANUAL;
913 c->floating = (floating == '-' ? false : true);
914 c->transient = (transient == '-' ? false : true);
915 c->fullscreen = (fullscreen == '-' ? false : true);
916 c->urgent = (urgent == '-' ? false : true);
917 c->locked = (locked == '-' ? false : true);
918 if (c->uid > max_uid)
922 switch (line[len - 2]) {
936 client_uid = max_uid + 1;
937 for (monitor_t *m = mon_head; m != NULL; m = m->next)
938 for (desktop_t *d = m->desk_head; d != NULL; d = d->next)
939 for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n)) {
940 uint32_t values[] = {(focus_follows_pointer ? CLIENT_EVENT_MASK_FFP : CLIENT_EVENT_MASK)};
941 xcb_change_window_attributes(dpy, n->client->window, XCB_CW_EVENT_MASK, values);
942 if (n->client->floating) {
944 update_vacant_state(n->parent);