- monitor_t *m = mon;
- desktop_t *d = mon->desk;
- node_t *f = mon->desk->focus;
-
- parse_rule_consequence(fd, csq);
-
- if (csq->lower)
- window_lower(win);
-
- if (!csq->manage) {
- disable_floating_atom(win);
- window_show(win);
- return;
- }
-
- PRINTF("manage %X\n", win);
-
- if (csq->node_desc[0] != '\0') {
- coordinates_t ref = {m, d, f};
- coordinates_t trg = {NULL, NULL, NULL};
- if (node_from_desc(csq->node_desc, &ref, &trg)) {
- m = trg.monitor;
- d = trg.desktop;
- f = trg.node;
- }
- } else if (csq->desktop_desc[0] != '\0') {
- coordinates_t ref = {m, d, NULL};
- coordinates_t trg = {NULL, NULL, NULL};
- if (desktop_from_desc(csq->desktop_desc, &ref, &trg)) {
- m = trg.monitor;
- d = trg.desktop;
- f = trg.desktop->focus;
- }
- } else if (csq->monitor_desc[0] != '\0') {
- coordinates_t ref = {m, NULL, NULL};
- coordinates_t trg = {NULL, NULL, NULL};
- if (monitor_from_desc(csq->monitor_desc, &ref, &trg)) {
- m = trg.monitor;
- d = trg.monitor->desk;
- f = trg.monitor->desk->focus;
- }
- }
-
- if (csq->sticky) {
- m = mon;
- d = mon->desk;
- f = mon->desk->focus;
- }
-
- client_t *c = make_client(win);
- update_floating_rectangle(c);
- monitor_t *mm = monitor_from_client(c);
- embrace_client(mm, c);
- translate_client(mm, m, c);
- if (csq->center)
- window_center(m, c);
-
- snprintf(c->class_name, sizeof(c->class_name), "%s", csq->class_name);
- snprintf(c->instance_name, sizeof(c->instance_name), "%s", csq->instance_name);
-
- csq->floating = csq->floating || d->floating;
-
- node_t *n = make_node();
- n->client = c;
-
- insert_node(m, d, n, f);
-
- disable_floating_atom(c->window);
- set_pseudo_tiled(n, csq->pseudo_tiled);
- set_floating(n, csq->floating);
- set_locked(m, d, n, csq->locked);
- set_sticky(m, d, n, csq->sticky);
- set_private(m, d, n, csq->private);
-
- if (d->focus != NULL && d->focus->client->fullscreen)
- set_fullscreen(d->focus, false);
-
- set_fullscreen(n, csq->fullscreen);
-
- arrange(m, d);
-
- bool give_focus = (csq->focus && (d == mon->desk || csq->follow));
-
- if (give_focus)
- focus_node(m, d, n);
- else if (csq->focus)
- pseudo_focus(m, d, n);
- else
- stack(n, STACK_ABOVE);
-
- uint32_t values[] = {CLIENT_EVENT_MASK | (focus_follows_pointer ? XCB_EVENT_MASK_ENTER_WINDOW : 0)};
- xcb_change_window_attributes(dpy, c->window, XCB_CW_EVENT_MASK, values);
-
- if (visible) {
- if (d == m->desk)
- window_show(n->client->window);
- else
- window_hide(n->client->window);
- }
-
- /* the same function is already called in `focus_node` but has no effects on unmapped windows */
- if (give_focus)
- xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, win, XCB_CURRENT_TIME);
-
- num_clients++;
- ewmh_set_wm_desktop(n, d);
- ewmh_update_client_list();
+ monitor_t *m = mon;
+ desktop_t *d = mon->desk;
+ node_t *f = mon->desk->focus;
+
+ parse_rule_consequence(fd, csq);
+
+ if (!csq->manage) {
+ disable_floating_atom(win);
+ window_show(win);
+ return;
+ }
+
+ PRINTF("manage %X\n", win);
+ put_status(SBSC_MASK_WINDOW_MANAGE, "window_manage 0x%X\n", win);
+
+ if (csq->node_desc[0] != '\0') {
+ coordinates_t ref = {m, d, f};
+ coordinates_t trg = {NULL, NULL, NULL};
+ if (node_from_desc(csq->node_desc, &ref, &trg)) {
+ m = trg.monitor;
+ d = trg.desktop;
+ f = trg.node;
+ }
+ } else if (csq->desktop_desc[0] != '\0') {
+ coordinates_t ref = {m, d, NULL};
+ coordinates_t trg = {NULL, NULL, NULL};
+ if (desktop_from_desc(csq->desktop_desc, &ref, &trg)) {
+ m = trg.monitor;
+ d = trg.desktop;
+ f = trg.desktop->focus;
+ }
+ } else if (csq->monitor_desc[0] != '\0') {
+ coordinates_t ref = {m, NULL, NULL};
+ coordinates_t trg = {NULL, NULL, NULL};
+ if (monitor_from_desc(csq->monitor_desc, &ref, &trg)) {
+ m = trg.monitor;
+ d = trg.monitor->desk;
+ f = trg.monitor->desk->focus;
+ }
+ }
+
+ if (csq->sticky) {
+ m = mon;
+ d = mon->desk;
+ f = mon->desk->focus;
+ }
+
+ if (csq->split_dir[0] != '\0' && f != NULL) {
+ direction_t dir;
+ if (parse_direction(csq->split_dir, &dir)) {
+ f->split_mode = MODE_MANUAL;
+ f->split_dir = dir;
+ }
+ }
+
+ if (csq->split_ratio != 0 && f != NULL) {
+ f->split_ratio = csq->split_ratio;
+ }
+
+ client_t *c = make_client(win, csq->border ? d->border_width : 0);
+ update_floating_rectangle(c);
+ if (c->floating_rectangle.x == 0 && c->floating_rectangle.y == 0)
+ csq->center = true;
+ c->min_width = csq->min_width;
+ c->max_width = csq->max_width;
+ c->min_height = csq->min_height;
+ c->max_height = csq->max_height;
+ monitor_t *mm = monitor_from_client(c);
+ embrace_client(mm, c);
+ translate_client(mm, m, c);
+ if (csq->center)
+ window_center(m, c);
+
+ snprintf(c->class_name, sizeof(c->class_name), "%s", csq->class_name);
+ snprintf(c->instance_name, sizeof(c->instance_name), "%s", csq->instance_name);
+
+ csq->floating = csq->floating || d->floating;
+
+ node_t *n = make_node();
+ n->client = c;
+
+ insert_node(m, d, n, f);
+
+ disable_floating_atom(c->window);
+ set_pseudo_tiled(n, csq->pseudo_tiled);
+ set_floating(n, csq->floating);
+ set_locked(m, d, n, csq->locked);
+ set_sticky(m, d, n, csq->sticky);
+ set_private(m, d, n, csq->private);
+
+ if (d->focus != NULL && d->focus->client->fullscreen)
+ set_fullscreen(d->focus, false);
+
+ set_fullscreen(n, csq->fullscreen);
+
+ arrange(m, d);
+
+ bool give_focus = (csq->focus && (d == mon->desk || csq->follow));
+
+ if (give_focus)
+ focus_node(m, d, n);
+ else if (csq->focus)
+ pseudo_focus(m, d, n);
+ else
+ stack(n, STACK_ABOVE);
+
+ uint32_t values[] = {CLIENT_EVENT_MASK | (focus_follows_pointer ? XCB_EVENT_MASK_ENTER_WINDOW : 0)};
+ xcb_change_window_attributes(dpy, c->window, XCB_CW_EVENT_MASK, values);
+
+ if (visible) {
+ if (d == m->desk)
+ window_show(n->client->window);
+ else
+ window_hide(n->client->window);
+ }
+
+ /* the same function is already called in `focus_node` but has no effects on unmapped windows */
+ if (give_focus)
+ xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, win, XCB_CURRENT_TIME);
+
+ num_clients++;
+ ewmh_set_wm_desktop(n, d);
+ ewmh_update_client_list();