*/
#include "all.h"
-char *colors[] = {
- "#ff0000",
- "#00FF00",
- "#0000FF",
- "#ff00ff",
- "#00ffff",
- "#ffff00",
- "#aa0000",
- "#00aa00",
- "#0000aa",
- "#aa00aa"};
-
static void con_on_remove_child(Con *con);
/*
new->depth = window->depth;
else
new->depth = XCB_COPY_FROM_PARENT;
- static int cnt = 0;
- DLOG("opening window %d\n", cnt);
-
- /* TODO: remove window coloring after test-phase */
- DLOG("color %s\n", colors[cnt]);
- new->name = strdup(colors[cnt]);
- //uint32_t cp = get_colorpixel(colors[cnt]);
- cnt++;
- if ((cnt % (sizeof(colors) / sizeof(char *))) == 0)
- cnt = 0;
+ DLOG("opening window\n");
TAILQ_INIT(&(new->floating_head));
TAILQ_INIT(&(new->nodes_head));
} else {
if (!ignore_focus) {
/* Get the first tiling container in focus stack */
- TAILQ_FOREACH (loop, &(parent->focus_head), focused) {
+ TAILQ_FOREACH(loop, &(parent->focus_head), focused) {
if (loop->type == CT_FLOATING_CON)
continue;
current = loop;
con->urgent = false;
con_update_parents_urgency(con);
workspace_update_urgent_flag(con_get_workspace(con));
+ ipc_send_window_event("urgent", con);
}
}
TAILQ_REMOVE(&bfs_head, entry, entries);
free(entry);
- TAILQ_FOREACH (child, &(current->nodes_head), nodes) {
+ TAILQ_FOREACH(child, &(current->nodes_head), nodes) {
entry = smalloc(sizeof(struct bfs_entry));
entry->con = child;
TAILQ_INSERT_TAIL(&bfs_head, entry, entries);
}
- TAILQ_FOREACH (child, &(current->floating_head), floating_windows) {
+ TAILQ_FOREACH(child, &(current->floating_head), floating_windows) {
entry = smalloc(sizeof(struct bfs_entry));
entry->con = child;
TAILQ_INSERT_TAIL(&bfs_head, entry, entries);
*/
Con *con_by_window_id(xcb_window_t window) {
Con *con;
- TAILQ_FOREACH (con, &all_cons, all_cons)
- if (con->window != NULL && con->window->id == window)
- return con;
+ TAILQ_FOREACH(con, &all_cons, all_cons)
+ if (con->window != NULL && con->window->id == window)
+ return con;
return NULL;
}
*/
Con *con_by_frame_id(xcb_window_t frame) {
Con *con;
- TAILQ_FOREACH (con, &all_cons, all_cons)
- if (con->frame == frame)
- return con;
+ TAILQ_FOREACH(con, &all_cons, all_cons)
+ if (con->frame == frame)
+ return con;
return NULL;
}
//DLOG("searching con for window %p starting at con %p\n", window, con);
//DLOG("class == %s\n", window->class_class);
- TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
- TAILQ_FOREACH (match, &(child->swallow_head), matches) {
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
+ TAILQ_FOREACH(match, &(child->swallow_head), matches) {
if (!match_matches_window(match, window))
continue;
if (store_match != NULL)
return result;
}
- TAILQ_FOREACH (child, &(con->floating_head), floating_windows) {
- TAILQ_FOREACH (match, &(child->swallow_head), matches) {
+ TAILQ_FOREACH(child, &(con->floating_head), floating_windows) {
+ TAILQ_FOREACH(match, &(child->swallow_head), matches) {
if (!match_matches_window(match, window))
continue;
if (store_match != NULL)
Con *child;
int children = 0;
- TAILQ_FOREACH (child, &(con->nodes_head), nodes)
- children++;
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes)
+ children++;
return children;
}
// with a percentage set we have
double total = 0.0;
int children_with_percent = 0;
- TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
if (child->percent > 0.0) {
total += child->percent;
++children_with_percent;
// if there were children without a percentage set, set to a value that
// will make those children proportional to all others
if (children_with_percent != children) {
- TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
if (child->percent <= 0.0) {
if (children_with_percent == 0)
total += (child->percent = 1.0);
// if we got a zero, just distribute the space equally, otherwise
// distribute according to the proportions we got
if (total == 0.0) {
- TAILQ_FOREACH (child, &(con->nodes_head), nodes)
- child->percent = 1.0 / children;
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes)
+ child->percent = 1.0 / children;
} else if (total != 1.0) {
- TAILQ_FOREACH (child, &(con->nodes_head), nodes)
- child->percent /= total;
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes)
+ child->percent /= total;
}
}
if (!con_is_leaf(con)) {
Con *child;
- TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
if (!child->window)
continue;
}
CALL(parent, on_remove_child);
+
+ ipc_send_window_event("move", con);
}
/*
return next;
do {
before = next;
- TAILQ_FOREACH (child, &(next->focus_head), focused) {
+ TAILQ_FOREACH(child, &(next->focus_head), focused) {
if (child->type == CT_FLOATING_CON)
continue;
/* Wrong orientation. We use the last focused con. Within that con,
* we recurse to chose the left/right con or at least the last
* focused one. */
- TAILQ_FOREACH (current, &(con->focus_head), focused) {
+ TAILQ_FOREACH(current, &(con->focus_head), focused) {
if (current->type != CT_FLOATING_CON) {
most = current;
break;
/* Wrong orientation. We use the last focused con. Within that con,
* we recurse to chose the top/bottom con or at least the last
* focused one. */
- TAILQ_FOREACH (current, &(con->focus_head), focused) {
+ TAILQ_FOREACH(current, &(con->focus_head), focused) {
if (current->type != CT_FLOATING_CON) {
most = current;
break;
if (con->layout == L_STACKED || con->layout == L_TABBED) {
uint32_t max_width = 0, max_height = 0, deco_height = 0;
Con *child;
- TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
Rect min = con_minimum_size(child);
deco_height += child->deco_rect.height;
max_width = max(max_width, min.width);
if (con_is_split(con)) {
uint32_t width = 0, height = 0;
Con *child;
- TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
Rect min = con_minimum_size(child);
if (con->layout == L_SPLITH) {
width += min.width;
/* We are not interested in floating windows since they can only be
* attached to a workspace → nodes_head instead of focus_head */
- TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
if (con_has_urgent_child(child))
return true;
}
con_update_parents_urgency(con);
- if (con->urgent == urgent)
- LOG("Urgency flag changed to %d\n", con->urgent);
-
Con *ws;
/* Set the urgency flag on the workspace, if a workspace could be found
* (for dock clients, that is not the case). */
if ((ws = con_get_workspace(con)) != NULL)
workspace_update_urgent_flag(ws);
+
+ if (con->urgent == urgent) {
+ LOG("Urgency flag changed to %d\n", con->urgent);
+ ipc_send_window_event("urgent", con);
+ }
}
/*
/* 2) append representation of children */
Con *child;
- TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
+ TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
char *child_txt = con_get_tree_representation(child);
char *tmp_buf;