clang-format-3.5 **/*.h **/*.c

This should be the last commit that formats a big bunch of files. From
here on, whenever I merge patches, I’ll run clang-format like described
in the title.
This commit is contained in:
Michael Stapelberg
2014-06-19 11:20:32 +02:00
parent 4211274fcd
commit 4c06e7a573
64 changed files with 1317 additions and 1252 deletions

View File

@ -23,7 +23,7 @@ void run_assignments(i3Window *window) {
/* Check if any assignments match */
Assignment *current;
TAILQ_FOREACH (current, &assignments, assignments) {
TAILQ_FOREACH(current, &assignments, assignments) {
if (!match_matches_window(&(current->match), window))
continue;
@ -72,7 +72,7 @@ void run_assignments(i3Window *window) {
Assignment *assignment_for(i3Window *window, int type) {
Assignment *assignment;
TAILQ_FOREACH (assignment, &assignments, assignments) {
TAILQ_FOREACH(assignment, &assignments, assignments) {
if ((type != A_ANY && (assignment->type & type) == 0) ||
!match_matches_window(&(assignment->match), window))
continue;

View File

@ -25,7 +25,7 @@ static struct Mode *mode_from_name(const char *name) {
struct Mode *mode;
/* Try to find the mode in the list of modes and return it */
SLIST_FOREACH (mode, &modes, modes) {
SLIST_FOREACH(mode, &modes, modes) {
if (strcmp(mode->name, name) == 0)
return mode;
}
@ -104,7 +104,7 @@ static void grab_keycode_for_binding(xcb_connection_t *conn, Binding *bind, uint
*/
void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch) {
Binding *bind;
TAILQ_FOREACH (bind, bindings, bindings) {
TAILQ_FOREACH(bind, bindings, bindings) {
if (bind->input_type != B_KEYBOARD ||
(bind_mode_switch && (bind->mods & BIND_MODE_SWITCH) == 0) ||
(!bind_mode_switch && (bind->mods & BIND_MODE_SWITCH) != 0))
@ -133,7 +133,7 @@ static Binding *get_binding(uint16_t modifiers, bool is_release, uint16_t input_
if (!is_release) {
/* On a press event, we first reset all B_UPON_KEYRELEASE_IGNORE_MODS
* bindings back to B_UPON_KEYRELEASE */
TAILQ_FOREACH (bind, bindings, bindings) {
TAILQ_FOREACH(bind, bindings, bindings) {
if (bind->input_type != input_type)
continue;
if (bind->release == B_UPON_KEYRELEASE_IGNORE_MODS)
@ -141,7 +141,7 @@ static Binding *get_binding(uint16_t modifiers, bool is_release, uint16_t input_
}
}
TAILQ_FOREACH (bind, bindings, bindings) {
TAILQ_FOREACH(bind, bindings, bindings) {
/* First compare the modifiers (unless this is a
* B_UPON_KEYRELEASE_IGNORE_MODS binding and this is a KeyRelease
* event) */
@ -248,7 +248,7 @@ void translate_keysyms(void) {
min_keycode = xcb_get_setup(conn)->min_keycode;
max_keycode = xcb_get_setup(conn)->max_keycode;
TAILQ_FOREACH (bind, bindings, bindings) {
TAILQ_FOREACH(bind, bindings, bindings) {
if (bind->input_type == B_MOUSE) {
int button = atoi(bind->symbol + (sizeof("button") - 1));
bind->keycode = button;
@ -304,7 +304,7 @@ void switch_mode(const char *new_mode) {
DLOG("Switching to mode %s\n", new_mode);
SLIST_FOREACH (mode, &modes, modes) {
SLIST_FOREACH(mode, &modes, modes) {
if (strcasecmp(mode->name, new_mode) != 0)
continue;
@ -334,8 +334,8 @@ void switch_mode(const char *new_mode) {
*/
void check_for_duplicate_bindings(struct context *context) {
Binding *bind, *current;
TAILQ_FOREACH (current, bindings, bindings) {
TAILQ_FOREACH (bind, bindings, bindings) {
TAILQ_FOREACH(current, bindings, bindings) {
TAILQ_FOREACH(bind, bindings, bindings) {
/* Abort when we reach the current keybinding, only check the
* bindings before */
if (bind == current)

View File

@ -330,7 +330,7 @@ int handle_button_press(xcb_button_press_event_t *event) {
* click coordinates and focus the output's active workspace. */
if (event->event == root) {
Con *output, *ws;
TAILQ_FOREACH (output, &(croot->nodes_head), nodes) {
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
if (con_is_internal(output) ||
!rect_contains(output->rect, event->event_x, event->event_y))
continue;
@ -358,7 +358,7 @@ int handle_button_press(xcb_button_press_event_t *event) {
/* Check if the click was on the decoration of a child */
Con *child;
TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
if (!rect_contains(child->deco_rect, event->event_x, event->event_y))
continue;

View File

@ -273,7 +273,7 @@ void cmd_criteria_init(I3_CMD) {
}
TAILQ_INIT(&owindows);
/* copy all_cons */
TAILQ_FOREACH (con, &all_cons, all_cons) {
TAILQ_FOREACH(con, &all_cons, all_cons) {
ow = smalloc(sizeof(owindow));
ow->con = con;
TAILQ_INSERT_TAIL(&owindows, ow, owindows);
@ -324,7 +324,7 @@ void cmd_criteria_match_windows(I3_CMD) {
}
}
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
}
}
@ -448,7 +448,7 @@ void cmd_move_con_to_workspace(I3_CMD, char *which) {
return;
}
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
con_move_to_workspace(current->con, ws, true, false);
}
@ -475,7 +475,7 @@ void cmd_move_con_to_workspace_back_and_forth(I3_CMD) {
HANDLE_EMPTY_MATCH;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
con_move_to_workspace(current->con, ws, true, false);
}
@ -519,7 +519,7 @@ void cmd_move_con_to_workspace_name(I3_CMD, char *name) {
HANDLE_EMPTY_MATCH;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
con_move_to_workspace(current->con, ws, true, false);
}
@ -562,9 +562,9 @@ void cmd_move_con_to_workspace_number(I3_CMD, char *which) {
return;
}
TAILQ_FOREACH (output, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(output),
child->num == parsed_num);
TAILQ_FOREACH(output, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(output),
child->num == parsed_num);
if (!workspace) {
workspace = workspace_get(which, NULL);
@ -574,7 +574,7 @@ void cmd_move_con_to_workspace_number(I3_CMD, char *which) {
HANDLE_EMPTY_MATCH;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
con_move_to_workspace(current->con, workspace, true, false);
}
@ -728,7 +728,7 @@ static bool cmd_resize_tiling_width_height(I3_CMD, Con *current, char *way, char
/* Ensure all the other children have a percentage set. */
Con *child;
TAILQ_FOREACH (child, &(current->parent->nodes_head), nodes) {
TAILQ_FOREACH(child, &(current->parent->nodes_head), nodes) {
LOG("child->percent = %f (child %p)\n", child->percent, child);
if (child->percent == 0.0)
child->percent = percentage;
@ -740,7 +740,7 @@ static bool cmd_resize_tiling_width_height(I3_CMD, Con *current, char *way, char
LOG("subtract_percent = %f\n", subtract_percent);
/* Ensure that the new percentages are positive and greater than
* 0.05 to have a reasonable minimum size. */
TAILQ_FOREACH (child, &(current->parent->nodes_head), nodes) {
TAILQ_FOREACH(child, &(current->parent->nodes_head), nodes) {
if (child == current)
continue;
if (!definitelyGreaterThan(child->percent - subtract_percent, 0.05, DBL_EPSILON)) {
@ -758,7 +758,7 @@ static bool cmd_resize_tiling_width_height(I3_CMD, Con *current, char *way, char
current->percent += ((double)ppt / 100.0);
LOG("current->percent after = %f\n", current->percent);
TAILQ_FOREACH (child, &(current->parent->nodes_head), nodes) {
TAILQ_FOREACH(child, &(current->parent->nodes_head), nodes) {
if (child == current)
continue;
child->percent -= subtract_percent;
@ -786,7 +786,7 @@ void cmd_resize(I3_CMD, char *way, char *direction, char *resize_px, char *resiz
HANDLE_EMPTY_MATCH;
owindow *current;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
/* Don't handle dock windows (issue #1201) */
if (current->con->window && current->con->window->dock) {
DLOG("This is a dock window. Not resizing (con = %p)\n)", current->con);
@ -823,7 +823,7 @@ void cmd_border(I3_CMD, char *border_style_str, char *border_width) {
HANDLE_EMPTY_MATCH;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
int border_style = current->con->border_style;
char *end;
@ -967,9 +967,9 @@ void cmd_workspace_number(I3_CMD, char *which) {
return;
}
TAILQ_FOREACH (output, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(output),
child->num == parsed_num);
TAILQ_FOREACH(output, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(output),
child->num == parsed_num);
if (!workspace) {
LOG("There is no workspace with number %ld, creating a new one.\n", parsed_num);
@ -1028,7 +1028,7 @@ void cmd_mark(I3_CMD, char *mark) {
DLOG("Clearing all windows which have that mark first\n");
Con *con;
TAILQ_FOREACH (con, &all_cons, all_cons) {
TAILQ_FOREACH(con, &all_cons, all_cons) {
if (con->mark && strcmp(con->mark, mark) == 0)
FREE(con->mark);
}
@ -1038,7 +1038,7 @@ void cmd_mark(I3_CMD, char *mark) {
HANDLE_EMPTY_MATCH;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
current->con->mark = sstrdup(mark);
}
@ -1055,13 +1055,13 @@ void cmd_mark(I3_CMD, char *mark) {
void cmd_unmark(I3_CMD, char *mark) {
if (mark == NULL) {
Con *con;
TAILQ_FOREACH (con, &all_cons, all_cons) {
TAILQ_FOREACH(con, &all_cons, all_cons) {
FREE(con->mark);
}
DLOG("removed all window marks");
} else {
Con *con;
TAILQ_FOREACH (con, &all_cons, all_cons) {
TAILQ_FOREACH(con, &all_cons, all_cons) {
if (con->mark && strcmp(con->mark, mark) == 0)
FREE(con->mark);
}
@ -1101,8 +1101,8 @@ void cmd_move_con_to_output(I3_CMD, char *name) {
Output *output;
// TODO: fix the handling of criteria
TAILQ_FOREACH (current, &owindows, owindows)
current_output = get_output_of_con(current->con);
TAILQ_FOREACH(current, &owindows, owindows)
current_output = get_output_of_con(current->con);
assert(current_output != NULL);
@ -1132,7 +1132,7 @@ void cmd_move_con_to_output(I3_CMD, char *name) {
return;
}
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
con_move_to_workspace(current->con, ws, true, false);
}
@ -1153,7 +1153,7 @@ void cmd_floating(I3_CMD, char *floating_mode) {
HANDLE_EMPTY_MATCH;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
if (strcmp(floating_mode, "toggle") == 0) {
DLOG("should toggle mode\n");
@ -1183,7 +1183,7 @@ void cmd_move_workspace_to_output(I3_CMD, char *name) {
HANDLE_EMPTY_MATCH;
owindow *current;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
Output *current_output = get_output_of_con(current->con);
if (!current_output) {
ELOG("Cannot get current output. This is a bug in i3.\n");
@ -1213,15 +1213,15 @@ void cmd_move_workspace_to_output(I3_CMD, char *name) {
/* check if we can find a workspace assigned to this output */
bool used_assignment = false;
struct Workspace_Assignment *assignment;
TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
if (strcmp(assignment->output, current_output->name) != 0)
continue;
/* check if this workspace is already attached to the tree */
Con *workspace = NULL, *out;
TAILQ_FOREACH (out, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(out),
!strcasecmp(child->name, assignment->name));
TAILQ_FOREACH(out, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(out),
!strcasecmp(child->name, assignment->name));
if (workspace != NULL)
continue;
@ -1256,8 +1256,8 @@ void cmd_move_workspace_to_output(I3_CMD, char *name) {
/* fix the coordinates of the floating containers */
Con *floating_con;
TAILQ_FOREACH (floating_con, &(ws->floating_head), floating_windows)
floating_fix_coordinates(floating_con, &(old_content->rect), &(content->rect));
TAILQ_FOREACH(floating_con, &(ws->floating_head), floating_windows)
floating_fix_coordinates(floating_con, &(old_content->rect), &(content->rect));
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"move\"}");
if (workspace_was_visible) {
@ -1270,7 +1270,7 @@ void cmd_move_workspace_to_output(I3_CMD, char *name) {
* focus order/number of other workspaces on the output.
* Instead, we loop through the available workspaces and only work with
* previously_visible_ws if we still find it. */
TAILQ_FOREACH (ws, &(content->nodes_head), nodes) {
TAILQ_FOREACH(ws, &(content->nodes_head), nodes) {
if (ws != previously_visible_ws)
continue;
@ -1298,7 +1298,7 @@ void cmd_split(I3_CMD, char *direction) {
if (match_is_empty(current_match))
tree_split(focused, (direction[0] == 'v' ? VERT : HORIZ));
else {
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
tree_split(current->con, (direction[0] == 'v' ? VERT : HORIZ));
}
@ -1335,7 +1335,7 @@ void cmd_kill(I3_CMD, char *kill_mode_str) {
if (match_is_empty(current_match))
tree_close_con(kill_mode);
else {
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
tree_close(current->con, kill_mode, false, false);
}
@ -1403,7 +1403,7 @@ void cmd_focus_window_mode(I3_CMD, char *window_mode) {
else
window_mode = "floating";
}
TAILQ_FOREACH (current, &(ws->focus_head), focused) {
TAILQ_FOREACH(current, &(ws->focus_head), focused) {
if ((strcmp(window_mode, "floating") == 0 && current->type != CT_FLOATING_CON) ||
(strcmp(window_mode, "tiling") == 0 && current->type == CT_FLOATING_CON))
continue;
@ -1465,7 +1465,7 @@ void cmd_focus(I3_CMD) {
Con *__i3_scratch = workspace_get("__i3_scratch", NULL);
int count = 0;
owindow *current;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
Con *ws = con_get_workspace(current->con);
/* If no workspace could be found, this was a dock window.
* Just skip it, you cannot focus dock windows. */
@ -1534,7 +1534,7 @@ void cmd_fullscreen(I3_CMD, char *fullscreen_mode) {
HANDLE_EMPTY_MATCH;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
con_toggle_fullscreen(current->con, (strcmp(fullscreen_mode, "global") == 0 ? CF_GLOBAL : CF_OUTPUT));
}
@ -1607,7 +1607,7 @@ void cmd_layout(I3_CMD, char *layout_str) {
if (match_is_empty(current_match))
con_set_layout(focused, layout);
else {
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
con_set_layout(current->con, layout);
}
@ -1634,7 +1634,7 @@ void cmd_layout_toggle(I3_CMD, char *toggle_mode) {
if (match_is_empty(current_match))
con_toggle_layout(focused, toggle_mode);
else {
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
con_toggle_layout(current->con, toggle_mode);
}
@ -1733,8 +1733,8 @@ void cmd_focus_output(I3_CMD, char *name) {
Output *current_output = NULL;
Output *output;
TAILQ_FOREACH (current, &owindows, owindows)
current_output = get_output_of_con(current->con);
TAILQ_FOREACH(current, &owindows, owindows)
current_output = get_output_of_con(current->con);
assert(current_output != NULL);
output = get_output_from_string(current_output, name);
@ -1844,7 +1844,7 @@ void cmd_move_scratchpad(I3_CMD) {
HANDLE_EMPTY_MATCH;
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
scratchpad_move(current->con);
}
@ -1865,7 +1865,7 @@ void cmd_scratchpad_show(I3_CMD) {
if (match_is_empty(current_match)) {
scratchpad_show(NULL);
} else {
TAILQ_FOREACH (current, &owindows, owindows) {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
scratchpad_show(current->con);
}
@ -1894,9 +1894,9 @@ void cmd_rename_workspace(I3_CMD, char *old_name, char *new_name) {
Con *output, *workspace = NULL;
if (old_name) {
TAILQ_FOREACH (output, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(output),
!strcasecmp(child->name, old_name));
TAILQ_FOREACH(output, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(output),
!strcasecmp(child->name, old_name));
} else {
workspace = con_get_workspace(focused);
}
@ -1910,9 +1910,9 @@ void cmd_rename_workspace(I3_CMD, char *old_name, char *new_name) {
}
Con *check_dest = NULL;
TAILQ_FOREACH (output, &(croot->nodes_head), nodes)
GREP_FIRST(check_dest, output_get_content(output),
!strcasecmp(child->name, new_name));
TAILQ_FOREACH(output, &(croot->nodes_head), nodes)
GREP_FIRST(check_dest, output_get_content(output),
!strcasecmp(child->name, new_name));
if (check_dest != NULL) {
// TODO: we should include the new workspace name here and use yajl for
@ -1972,7 +1972,7 @@ bool cmd_bar_mode(char *bar_mode, char *bar_id) {
bool changed_sth = false;
Barconfig *current = NULL;
TAILQ_FOREACH (current, &barconfigs, configs) {
TAILQ_FOREACH(current, &barconfigs, configs) {
if (bar_id && strcmp(current->id, bar_id) != 0)
continue;
@ -2015,7 +2015,7 @@ bool cmd_bar_hidden_state(char *bar_hidden_state, char *bar_id) {
bool changed_sth = false;
Barconfig *current = NULL;
TAILQ_FOREACH (current, &barconfigs, configs) {
TAILQ_FOREACH(current, &barconfigs, configs) {
if (bar_id && strcmp(current->id, bar_id) != 0)
continue;

View File

@ -142,7 +142,7 @@ void con_attach(Con *con, Con *parent, bool ignore_focus) {
} 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;
@ -388,13 +388,13 @@ Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode) {
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);
@ -460,9 +460,9 @@ bool con_inside_focused(Con *con) {
*/
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;
}
@ -473,9 +473,9 @@ Con *con_by_window_id(xcb_window_t window) {
*/
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;
}
@ -490,8 +490,8 @@ Con *con_for_window(Con *con, i3Window *window, Match **store_match) {
//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)
@ -503,8 +503,8 @@ Con *con_for_window(Con *con, i3Window *window, Match **store_match) {
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)
@ -527,8 +527,8 @@ int con_num_children(Con *con) {
Con *child;
int children = 0;
TAILQ_FOREACH (child, &(con->nodes_head), nodes)
children++;
TAILQ_FOREACH(child, &(con->nodes_head), nodes)
children++;
return children;
}
@ -547,7 +547,7 @@ void con_fix_percent(Con *con) {
// 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;
@ -557,7 +557,7 @@ void con_fix_percent(Con *con) {
// 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);
@ -570,11 +570,11 @@ void con_fix_percent(Con *con) {
// 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;
}
}
@ -807,7 +807,7 @@ void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool
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;
@ -1003,7 +1003,7 @@ Con *con_descend_tiling_focused(Con *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;
@ -1038,7 +1038,7 @@ Con *con_descend_direction(Con *con, direction_t direction) {
/* 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;
@ -1063,7 +1063,7 @@ Con *con_descend_direction(Con *con, direction_t direction) {
/* 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;
@ -1426,7 +1426,7 @@ Rect con_minimum_size(Con *con) {
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);
@ -1443,7 +1443,7 @@ Rect con_minimum_size(Con *con) {
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;
@ -1538,7 +1538,7 @@ bool con_has_urgent_child(Con *con) {
/* 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;
}
@ -1651,7 +1651,7 @@ char *con_get_tree_representation(Con *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;

View File

@ -36,7 +36,7 @@ void ungrab_all_keys(xcb_connection_t *conn) {
*/
void update_barconfig() {
Barconfig *current;
TAILQ_FOREACH (current, &barconfigs, configs) {
TAILQ_FOREACH(current, &barconfigs, configs) {
ipc_send_barconfig_update_event(current);
}
}
@ -204,8 +204,8 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
/* Invalidate pixmap caches in case font or colors changed */
Con *con;
TAILQ_FOREACH (con, &all_cons, all_cons)
FREE(con->deco_render_params);
TAILQ_FOREACH(con, &all_cons, all_cons)
FREE(con->deco_render_params);
/* Get rid of the current font */
free_font();

View File

@ -334,7 +334,7 @@ CFGFUN(workspace, const char *workspace, const char *output) {
* outputs */
struct Workspace_Assignment *assignment;
bool duplicate = false;
TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
if (strcasecmp(assignment->name, workspace) == 0) {
ELOG("You have a duplicate workspace assignment for workspace \"%s\"\n",
workspace);

View File

@ -917,7 +917,7 @@ void parse_file(const char *f) {
* variables (otherwise we will count them twice, which is bad when
* 'extra' is negative) */
char *bufcopy = sstrdup(buf);
SLIST_FOREACH (current, &variables, variables) {
SLIST_FOREACH(current, &variables, variables) {
int extra = (strlen(current->value) - strlen(current->key));
char *next;
for (next = bufcopy;
@ -937,11 +937,11 @@ void parse_file(const char *f) {
destwalk = new;
while (walk < (buf + stbuf.st_size)) {
/* Find the next variable */
SLIST_FOREACH (current, &variables, variables)
current->next_match = strcasestr(walk, current->key);
SLIST_FOREACH(current, &variables, variables)
current->next_match = strcasestr(walk, current->key);
nearest = NULL;
int distance = stbuf.st_size;
SLIST_FOREACH (current, &variables, variables) {
SLIST_FOREACH(current, &variables, variables) {
if (current->next_match == NULL)
continue;
if ((current->next_match - walk) < distance) {

View File

@ -24,9 +24,9 @@ void ewmh_update_current_desktop(void) {
uint32_t idx = 0;
/* We count to get the index of this workspace because named workspaces
* dont have the ->num property */
TAILQ_FOREACH (output, &(croot->nodes_head), nodes) {
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
Con *ws;
TAILQ_FOREACH (ws, &(output_get_content(output)->nodes_head), nodes) {
TAILQ_FOREACH(ws, &(output_get_content(output)->nodes_head), nodes) {
if (STARTS_WITH(ws->name, "__"))
continue;

View File

@ -20,9 +20,9 @@ static int num_screens;
*/
static Output *get_screen_at(unsigned int x, unsigned int y) {
Output *output;
TAILQ_FOREACH (output, &outputs, outputs)
if (output->rect.x == x && output->rect.y == y)
return output;
TAILQ_FOREACH(output, &outputs, outputs)
if (output->rect.x == x && output->rect.y == y)
return output;
return NULL;
}

View File

@ -21,7 +21,7 @@ static Rect total_outputs_dimensions(void) {
Output *output;
/* Use Rect to encapsulate dimensions, ignoring x/y */
Rect outputs_dimensions = {0, 0, 0, 0};
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
outputs_dimensions.height += output->rect.height;
outputs_dimensions.width += output->rect.width;
}
@ -205,7 +205,7 @@ void floating_enable(Con *con, bool automatic) {
if (memcmp(&(nc->rect), &zero, sizeof(Rect)) == 0) {
DLOG("Geometry not set, combining children\n");
Con *child;
TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
DLOG("child geometry: %d x %d\n", child->geometry.width, child->geometry.height);
nc->rect.width += child->geometry.width;
nc->rect.height = max(nc->rect.height, child->geometry.height);

View File

@ -62,7 +62,7 @@ bool event_is_ignored(const int sequence, const int response_type) {
event = SLIST_NEXT(event, ignore_events);
}
SLIST_FOREACH (event, &ignore_events, ignore_events) {
SLIST_FOREACH(event, &ignore_events, ignore_events) {
if (event->sequence != sequence)
continue;
@ -163,12 +163,12 @@ static void handle_enter_notify(xcb_enter_notify_event_t *event) {
layout_t layout = (enter_child ? con->parent->layout : con->layout);
if (layout == L_DEFAULT) {
Con *child;
TAILQ_FOREACH (child, &(con->nodes_head), nodes)
if (rect_contains(child->deco_rect, event->event_x, event->event_y)) {
LOG("using child %p / %s instead!\n", child, child->name);
con = child;
break;
}
TAILQ_FOREACH(child, &(con->nodes_head), nodes)
if (rect_contains(child->deco_rect, event->event_x, event->event_y)) {
LOG("using child %p / %s instead!\n", child, child->name);
con = child;
break;
}
}
#if 0
@ -231,7 +231,7 @@ static void handle_motion_notify(xcb_motion_notify_event_t *event) {
/* see over which rect the user is */
Con *current;
TAILQ_FOREACH (current, &(con->nodes_head), nodes) {
TAILQ_FOREACH(current, &(con->nodes_head), nodes) {
if (!rect_contains(current->deco_rect, event->event_x, event->event_y))
continue;

View File

@ -74,7 +74,7 @@ static bool mkdirp(const char *path) {
*/
void ipc_send_event(const char *event, uint32_t message_type, const char *payload) {
ipc_client *current;
TAILQ_FOREACH (current, &all_clients, clients) {
TAILQ_FOREACH(current, &all_clients, clients) {
/* see if this client is interested in this event */
bool interested = false;
for (int i = 0; i < current->num_events; i++) {
@ -344,7 +344,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
y(array_open);
Con *node;
if (con->type != CT_DOCKAREA || !inplace_restart) {
TAILQ_FOREACH (node, &(con->nodes_head), nodes) {
TAILQ_FOREACH(node, &(con->nodes_head), nodes) {
dump_node(gen, node, inplace_restart);
}
}
@ -352,14 +352,14 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
ystr("floating_nodes");
y(array_open);
TAILQ_FOREACH (node, &(con->floating_head), floating_windows) {
TAILQ_FOREACH(node, &(con->floating_head), floating_windows) {
dump_node(gen, node, inplace_restart);
}
y(array_close);
ystr("focus");
y(array_open);
TAILQ_FOREACH (node, &(con->focus_head), focused) {
TAILQ_FOREACH(node, &(con->focus_head), focused) {
y(integer, (long int)node);
}
y(array_close);
@ -386,7 +386,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
ystr("swallows");
y(array_open);
Match *match;
TAILQ_FOREACH (match, &(con->swallow_head), matches) {
TAILQ_FOREACH(match, &(con->swallow_head), matches) {
y(map_open);
if (match->dock != -1) {
ystr("dock");
@ -591,11 +591,11 @@ IPC_HANDLER(get_workspaces) {
Con *focused_ws = con_get_workspace(focused);
Con *output;
TAILQ_FOREACH (output, &(croot->nodes_head), nodes) {
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
if (con_is_internal(output))
continue;
Con *ws;
TAILQ_FOREACH (ws, &(output_get_content(output)->nodes_head), nodes) {
TAILQ_FOREACH(ws, &(output_get_content(output)->nodes_head), nodes) {
assert(ws->type == CT_WORKSPACE);
y(map_open);
@ -656,7 +656,7 @@ IPC_HANDLER(get_outputs) {
y(array_open);
Output *output;
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
y(map_open);
ystr("name");
@ -710,9 +710,9 @@ IPC_HANDLER(get_marks) {
y(array_open);
Con *con;
TAILQ_FOREACH (con, &all_cons, all_cons)
if (con->mark != NULL)
ystr(con->mark);
TAILQ_FOREACH(con, &all_cons, all_cons)
if (con->mark != NULL)
ystr(con->mark);
y(array_close);
@ -766,7 +766,7 @@ IPC_HANDLER(get_bar_config) {
if (message_size == 0) {
y(array_open);
Barconfig *current;
TAILQ_FOREACH (current, &barconfigs, configs) {
TAILQ_FOREACH(current, &barconfigs, configs) {
ystr(current->id);
}
y(array_close);
@ -786,7 +786,7 @@ IPC_HANDLER(get_bar_config) {
strncpy(bar_id, (const char *)message, message_size);
LOG("IPC: looking for config for bar ID \"%s\"\n", bar_id);
Barconfig *current, *config = NULL;
TAILQ_FOREACH (current, &barconfigs, configs) {
TAILQ_FOREACH(current, &barconfigs, configs) {
if (strcmp(current->id, bar_id) != 0)
continue;
@ -852,7 +852,7 @@ IPC_HANDLER(subscribe) {
ipc_client *current, *client = NULL;
/* Search the ipc_client structure for this connection */
TAILQ_FOREACH (current, &all_clients, clients) {
TAILQ_FOREACH(current, &all_clients, clients) {
if (current->fd != fd)
continue;
@ -932,7 +932,7 @@ static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
/* Delete the client from the list of clients */
ipc_client *current;
TAILQ_FOREACH (current, &all_clients, clients) {
TAILQ_FOREACH(current, &all_clients, clients) {
if (current->fd != w->fd)
continue;

View File

@ -110,10 +110,10 @@ static int json_end_array(void *ctx) {
if (parsing_focus) {
/* Clear the list of focus mappings */
struct focus_mapping *mapping;
TAILQ_FOREACH_REVERSE (mapping, &focus_mappings, focus_mappings_head, focus_mappings) {
TAILQ_FOREACH_REVERSE(mapping, &focus_mappings, focus_mappings_head, focus_mappings) {
LOG("focus (reverse) %d\n", mapping->old_id);
Con *con;
TAILQ_FOREACH (con, &(json_node->focus_head), focused) {
TAILQ_FOREACH(con, &(json_node->focus_head), focused) {
if (con->old_id != mapping->old_id)
continue;
LOG("got it! %p\n", con);

View File

@ -884,7 +884,7 @@ int main(int argc, char *argv[]) {
/* Autostarting exec-lines */
if (autostart) {
struct Autostart *exec;
TAILQ_FOREACH (exec, &autostarts, autostarts) {
TAILQ_FOREACH(exec, &autostarts, autostarts) {
LOG("auto-starting %s\n", exec->command);
start_application(exec->command, exec->no_startup_id);
}
@ -892,14 +892,14 @@ int main(int argc, char *argv[]) {
/* Autostarting exec_always-lines */
struct Autostart *exec_always;
TAILQ_FOREACH (exec_always, &autostarts_always, autostarts_always) {
TAILQ_FOREACH(exec_always, &autostarts_always, autostarts_always) {
LOG("auto-starting (always!) %s\n", exec_always->command);
start_application(exec_always->command, exec_always->no_startup_id);
}
/* Start i3bar processes for all configured bars */
Barconfig *barconfig;
TAILQ_FOREACH (barconfig, &barconfigs, configs) {
TAILQ_FOREACH(barconfig, &barconfigs, configs) {
char *command = NULL;
sasprintf(&command, "%s --bar_id=%s --socket=\"%s\"",
barconfig->i3bar_command ? barconfig->i3bar_command : "i3bar",

View File

@ -56,16 +56,16 @@ void restore_geometry(void) {
DLOG("Restoring geometry\n");
Con *con;
TAILQ_FOREACH (con, &all_cons, all_cons)
if (con->window) {
DLOG("Re-adding X11 border of %d px\n", con->border_width);
con->window_rect.width += (2 * con->border_width);
con->window_rect.height += (2 * con->border_width);
xcb_set_window_rect(conn, con->window->id, con->window_rect);
DLOG("placing window %08x at %d %d\n", con->window->id, con->rect.x, con->rect.y);
xcb_reparent_window(conn, con->window->id, root,
con->rect.x, con->rect.y);
}
TAILQ_FOREACH(con, &all_cons, all_cons)
if (con->window) {
DLOG("Re-adding X11 border of %d px\n", con->border_width);
con->window_rect.width += (2 * con->border_width);
con->window_rect.height += (2 * con->border_width);
xcb_set_window_rect(conn, con->window->id, con->window_rect);
DLOG("placing window %08x at %d %d\n", con->window->id, con->rect.x, con->rect.y);
xcb_reparent_window(conn, con->window->id, root,
con->rect.x, con->rect.y);
}
/* Strictly speaking, this line doesnt really belong here, but since we
* are syncing, lets un-register as a window manager first */

View File

@ -136,7 +136,7 @@ bool match_matches_window(Match *match, i3Window *window) {
return false;
}
/* if we find a window that is newer than this one, bail */
TAILQ_FOREACH (con, &all_cons, all_cons) {
TAILQ_FOREACH(con, &all_cons, all_cons) {
if ((con->window != NULL) &&
_i3_timercmp(con->window->urgent, window->urgent, > )) {
return false;
@ -151,7 +151,7 @@ bool match_matches_window(Match *match, i3Window *window) {
return false;
}
/* if we find a window that is older than this one (and not 0), bail */
TAILQ_FOREACH (con, &all_cons, all_cons) {
TAILQ_FOREACH(con, &all_cons, all_cons) {
if ((con->window != NULL) &&
(con->window->urgent.tv_sec != 0) &&
_i3_timercmp(con->window->urgent, window->urgent, < )) {

View File

@ -18,9 +18,9 @@
Con *output_get_content(Con *output) {
Con *child;
TAILQ_FOREACH (child, &(output->nodes_head), nodes)
if (child->type == CT_CON)
return child;
TAILQ_FOREACH(child, &(output->nodes_head), nodes)
if (child->type == CT_CON)
return child;
return NULL;
}

View File

@ -37,9 +37,9 @@ static bool randr_disabled = false;
*/
static Output *get_output_by_id(xcb_randr_output_t id) {
Output *output;
TAILQ_FOREACH (output, &outputs, outputs)
if (output->id == id)
return output;
TAILQ_FOREACH(output, &outputs, outputs)
if (output->id == id)
return output;
return NULL;
}
@ -50,10 +50,10 @@ static Output *get_output_by_id(xcb_randr_output_t id) {
*/
Output *get_output_by_name(const char *name) {
Output *output;
TAILQ_FOREACH (output, &outputs, outputs)
if (output->active &&
strcasecmp(output->name, name) == 0)
return output;
TAILQ_FOREACH(output, &outputs, outputs)
if (output->active &&
strcasecmp(output->name, name) == 0)
return output;
return NULL;
}
@ -65,9 +65,9 @@ Output *get_output_by_name(const char *name) {
Output *get_first_output(void) {
Output *output;
TAILQ_FOREACH (output, &outputs, outputs)
if (output->active)
return output;
TAILQ_FOREACH(output, &outputs, outputs)
if (output->active)
return output;
die("No usable outputs available.\n");
}
@ -79,7 +79,7 @@ Output *get_first_output(void) {
*/
Output *get_output_containing(unsigned int x, unsigned int y) {
Output *output;
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
if (!output->active)
continue;
DLOG("comparing x=%d y=%d with x=%d and y=%d width %d height %d\n",
@ -104,7 +104,7 @@ bool contained_by_output(Rect rect) {
Output *output;
int lx = rect.x, uy = rect.y;
int rx = rect.x + rect.width, by = rect.y + rect.height;
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
if (!output->active)
continue;
DLOG("comparing x=%d y=%d with x=%d and y=%d width %d height %d\n",
@ -163,7 +163,7 @@ Output *get_output_next(direction_t direction, Output *current, output_close_far
*other;
Output *output,
*best = NULL;
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
if (!output->active)
continue;
@ -256,7 +256,7 @@ void output_init_con(Output *output) {
/* Search for a Con with that name directly below the root node. There
* might be one from a restored layout. */
TAILQ_FOREACH (current, &(croot->nodes_head), nodes) {
TAILQ_FOREACH(current, &(croot->nodes_head), nodes) {
if (strcmp(current->name, output->name) != 0)
continue;
@ -355,15 +355,15 @@ void output_init_con(Output *output) {
void init_ws_for_output(Output *output, Con *content) {
/* go through all assignments and move the existing workspaces to this output */
struct Workspace_Assignment *assignment;
TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
if (strcmp(assignment->output, output->name) != 0)
continue;
/* check if this workspace actually exists */
Con *workspace = NULL, *out;
TAILQ_FOREACH (out, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(out),
!strcasecmp(child->name, assignment->name));
TAILQ_FOREACH(out, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(out),
!strcasecmp(child->name, assignment->name));
if (workspace == NULL)
continue;
@ -401,10 +401,10 @@ void init_ws_for_output(Output *output, Con *content) {
Con *ws_out_content = output_get_content(workspace_out);
Con *floating_con;
TAILQ_FOREACH (floating_con, &(workspace->floating_head), floating_windows)
/* NB: We use output->con here because content is not yet rendered,
TAILQ_FOREACH(floating_con, &(workspace->floating_head), floating_windows)
/* NB: We use output->con here because content is not yet rendered,
* so it has a rect of {0, 0, 0, 0}. */
floating_fix_coordinates(floating_con, &(ws_out_content->rect), &(output->con->rect));
floating_fix_coordinates(floating_con, &(ws_out_content->rect), &(output->con->rect));
con_detach(workspace);
con_attach(workspace, content, false);
@ -436,7 +436,7 @@ void init_ws_for_output(Output *output, Con *content) {
}
/* otherwise, we create the first assigned ws for this output */
TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
if (strcmp(assignment->output, output->name) != 0)
continue;
@ -478,8 +478,8 @@ static void output_change_mode(xcb_connection_t *conn, Output *output) {
/* Fix the position of all floating windows on this output.
* The 'rect' of each workspace will be updated in src/render.c. */
TAILQ_FOREACH (workspace, &(content->nodes_head), nodes) {
TAILQ_FOREACH (child, &(workspace->floating_head), floating_windows) {
TAILQ_FOREACH(workspace, &(content->nodes_head), nodes) {
TAILQ_FOREACH(child, &(workspace->floating_head), floating_windows) {
floating_fix_coordinates(child, &(workspace->rect), &(output->con->rect));
}
}
@ -488,7 +488,7 @@ static void output_change_mode(xcb_connection_t *conn, Output *output) {
* the workspaces and their childs depending on output resolution. This is
* only done for workspaces with maximum one child. */
if (config.default_orientation == NO_ORIENTATION) {
TAILQ_FOREACH (workspace, &(content->nodes_head), nodes) {
TAILQ_FOREACH(workspace, &(content->nodes_head), nodes) {
/* Workspaces with more than one child are left untouched because
* we do not want to change an existing layout. */
if (con_num_children(workspace) > 1)
@ -640,7 +640,7 @@ void randr_query_outputs(void) {
/* Check for clones, disable the clones and reduce the mode to the
* lowest common mode */
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
if (!output->active || output->to_be_disabled)
continue;
DLOG("output %p / %s, position (%d, %d), checking for clones\n",
@ -681,7 +681,7 @@ void randr_query_outputs(void) {
* necessary because in the next step, a clone might get disabled. Example:
* LVDS1 active, VGA1 gets activated as a clone of LVDS1 (has no con).
* LVDS1 gets disabled. */
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
if (output->active && output->con == NULL) {
DLOG("Need to initialize a Con for output %s\n", output->name);
output_init_con(output);
@ -691,7 +691,7 @@ void randr_query_outputs(void) {
/* Handle outputs which have a new mode or are disabled now (either
* because the user disabled them or because they are clones) */
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
if (output->to_be_disabled) {
output->active = false;
DLOG("Output %s disabled, re-assigning workspaces/docks\n", output->name);
@ -731,8 +731,8 @@ void randr_query_outputs(void) {
con_attach(current, first_content, false);
DLOG("Fixing the coordinates of floating containers\n");
Con *floating_con;
TAILQ_FOREACH (floating_con, &(current->floating_head), floating_windows)
floating_fix_coordinates(floating_con, &(output->con->rect), &(first->con->rect));
TAILQ_FOREACH(floating_con, &(current->floating_head), floating_windows)
floating_fix_coordinates(floating_con, &(output->con->rect), &(first->con->rect));
DLOG("Done, next\n");
}
DLOG("re-attached all workspaces\n");
@ -745,7 +745,7 @@ void randr_query_outputs(void) {
/* 3: move the dock clients to the first output */
Con *child;
TAILQ_FOREACH (child, &(output->con->nodes_head), nodes) {
TAILQ_FOREACH(child, &(output->con->nodes_head), nodes) {
if (child->type != CT_DOCKAREA)
continue;
DLOG("Handling dock con %p\n", child);
@ -788,7 +788,7 @@ void randr_query_outputs(void) {
get_first_output();
/* Just go through each active output and assign one workspace */
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
if (!output->active)
continue;
Con *content = output_get_content(output->con);
@ -799,7 +799,7 @@ void randr_query_outputs(void) {
}
/* Focus the primary screen, if possible */
TAILQ_FOREACH (output, &outputs, outputs) {
TAILQ_FOREACH(output, &outputs, outputs) {
if (!output->primary || !output->con)
continue;

View File

@ -41,7 +41,7 @@ static void render_l_output(Con *con) {
/* Find the content container and ensure that there is exactly one. Also
* check for any non-CT_DOCKAREA clients. */
Con *content = NULL;
TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
if (child->type == CT_CON) {
if (content != NULL) {
DLOG("More than one CT_CON on output container\n");
@ -77,19 +77,19 @@ static void render_l_output(Con *con) {
/* First pass: determine the height of all CT_DOCKAREAs (the sum of their
* children) and figure out how many pixels we have left for the rest */
TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
if (child->type != CT_DOCKAREA)
continue;
child->rect.height = 0;
TAILQ_FOREACH (dockchild, &(child->nodes_head), nodes)
child->rect.height += dockchild->geometry.height;
TAILQ_FOREACH(dockchild, &(child->nodes_head), nodes)
child->rect.height += dockchild->geometry.height;
height -= child->rect.height;
}
/* Second pass: Set the widths/heights */
TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
if (child->type == CT_CON) {
child->rect.x = x;
child->rect.y = y;
@ -224,7 +224,7 @@ void render_con(Con *con, bool render_fullscreen) {
Con *child;
int i = 0, assigned = 0;
int total = con_orientation(con) == HORIZ ? rect.width : rect.height;
TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
double percentage = child->percent > 0.0 ? child->percent : 1.0 / children;
assigned += sizes[i++] = percentage * total;
}
@ -247,7 +247,7 @@ void render_con(Con *con, bool render_fullscreen) {
render_l_output(con);
} else if (con->type == CT_ROOT) {
Con *output;
TAILQ_FOREACH (output, &(con->nodes_head), nodes) {
TAILQ_FOREACH(output, &(con->nodes_head), nodes) {
render_con(output, false);
}
@ -256,7 +256,7 @@ void render_con(Con *con, bool render_fullscreen) {
* all times. This is important when the user places floating
* windows/containers so that they overlap on another output. */
DLOG("Rendering floating windows:\n");
TAILQ_FOREACH (output, &(con->nodes_head), nodes) {
TAILQ_FOREACH(output, &(con->nodes_head), nodes) {
if (con_is_internal(output))
continue;
/* Get the active workspace of that output */
@ -268,7 +268,7 @@ void render_con(Con *con, bool render_fullscreen) {
Con *workspace = TAILQ_FIRST(&(content->focus_head));
Con *fullscreen = con_get_fullscreen_con(workspace, CF_OUTPUT);
Con *child;
TAILQ_FOREACH (child, &(workspace->floating_head), floating_windows) {
TAILQ_FOREACH(child, &(workspace->floating_head), floating_windows) {
/* Dont render floating windows when there is a fullscreen window
* on that workspace. Necessary to make floating fullscreen work
* correctly (ticket #564). */
@ -321,7 +321,7 @@ void render_con(Con *con, bool render_fullscreen) {
} else {
/* FIXME: refactor this into separate functions: */
Con *child;
TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
assert(children > 0);
/* default layout */
@ -428,8 +428,8 @@ void render_con(Con *con, bool render_fullscreen) {
/* in a stacking or tabbed container, we ensure the focused client is raised */
if (con->layout == L_STACKED || con->layout == L_TABBED) {
TAILQ_FOREACH_REVERSE (child, &(con->focus_head), focus_head, focused)
x_raise_con(child);
TAILQ_FOREACH_REVERSE(child, &(con->focus_head), focus_head, focused)
x_raise_con(child);
if ((child = TAILQ_FIRST(&(con->focus_head)))) {
/* By rendering the stacked container again, we handle the case
* that we have a non-leaf-container inside the stack. In that

View File

@ -137,7 +137,7 @@ static void update_placeholder_contents(placeholder_state *state) {
Match *swallows;
int n = 0;
TAILQ_FOREACH (swallows, &(state->con->swallow_head), matches) {
TAILQ_FOREACH(swallows, &(state->con->swallow_head), matches) {
char *serialized = NULL;
#define APPEND_REGEX(re_name) \
@ -222,10 +222,10 @@ static void open_placeholder_window(Con *con) {
}
Con *child;
TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
TAILQ_FOREACH(child, &(con->nodes_head), nodes) {
open_placeholder_window(child);
}
TAILQ_FOREACH (child, &(con->floating_head), floating_windows) {
TAILQ_FOREACH(child, &(con->floating_head), floating_windows) {
open_placeholder_window(child);
}
}
@ -239,10 +239,10 @@ static void open_placeholder_window(Con *con) {
*/
void restore_open_placeholder_windows(Con *parent) {
Con *child;
TAILQ_FOREACH (child, &(parent->nodes_head), nodes) {
TAILQ_FOREACH(child, &(parent->nodes_head), nodes) {
open_placeholder_window(child);
}
TAILQ_FOREACH (child, &(parent->floating_head), floating_windows) {
TAILQ_FOREACH(child, &(parent->floating_head), floating_windows) {
open_placeholder_window(child);
}
@ -258,7 +258,7 @@ void restore_open_placeholder_windows(Con *parent) {
*/
bool restore_kill_placeholder(xcb_window_t placeholder) {
placeholder_state *state;
TAILQ_FOREACH (state, &state_head, state) {
TAILQ_FOREACH(state, &state_head, state) {
if (state->window != placeholder)
continue;
@ -277,7 +277,7 @@ bool restore_kill_placeholder(xcb_window_t placeholder) {
static void expose_event(xcb_expose_event_t *event) {
placeholder_state *state;
TAILQ_FOREACH (state, &state_head, state) {
TAILQ_FOREACH(state, &state_head, state) {
if (state->window != event->window)
continue;
@ -305,7 +305,7 @@ static void expose_event(xcb_expose_event_t *event) {
*/
static void configure_notify(xcb_configure_notify_event_t *event) {
placeholder_state *state;
TAILQ_FOREACH (state, &state_head, state) {
TAILQ_FOREACH(state, &state_head, state) {
if (state->window != event->window)
continue;

View File

@ -116,7 +116,7 @@ void scratchpad_show(Con *con) {
* unfocused scratchpad on the current workspace and focus it */
Con *walk_con;
Con *focused_ws = con_get_workspace(focused);
TAILQ_FOREACH (walk_con, &(focused_ws->floating_head), floating_windows) {
TAILQ_FOREACH(walk_con, &(focused_ws->floating_head), floating_windows) {
if (!con && (floating = con_inside_floating(walk_con)) &&
floating->scratchpad_state != SCRATCHPAD_NONE &&
floating != con_inside_floating(focused)) {
@ -134,7 +134,7 @@ void scratchpad_show(Con *con) {
* visible scratchpad window on another workspace. In this case we move it
* to the current workspace. */
focused_ws = con_get_workspace(focused);
TAILQ_FOREACH (walk_con, &all_cons, all_cons) {
TAILQ_FOREACH(walk_con, &all_cons, all_cons) {
Con *walk_ws = con_get_workspace(walk_con);
if (!con && walk_ws &&
!con_is_internal(walk_ws) && focused_ws != walk_ws &&
@ -257,7 +257,7 @@ void scratchpad_fix_resolution(void) {
Con *output;
int new_width = -1,
new_height = -1;
TAILQ_FOREACH (output, &(croot->nodes_head), nodes) {
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
if (output == __i3_output)
continue;
DLOG("output %s's resolution: (%d, %d) %d x %d\n",
@ -288,7 +288,7 @@ void scratchpad_fix_resolution(void) {
DLOG("Fixing coordinates of scratchpad windows\n");
Con *con;
TAILQ_FOREACH (con, &(__i3_scratch->floating_head), floating_windows) {
TAILQ_FOREACH(con, &(__i3_scratch->floating_head), floating_windows) {
floating_fix_coordinates(con, &old_rect, &new_rect);
}
}

View File

@ -253,7 +253,7 @@ static void open_popups() {
/* Open a popup window on each virtual screen */
Output *screen;
xcb_window_t win;
TAILQ_FOREACH (screen, &outputs, outputs) {
TAILQ_FOREACH(screen, &outputs, outputs) {
if (!screen->active)
continue;
win = open_input_window(conn, screen->rect, width, height);

View File

@ -37,7 +37,7 @@ static void startup_timeout(EV_P_ ev_timer *w, int revents) {
DLOG("Timeout for startup sequence %s\n", id);
struct Startup_Sequence *current, *sequence = NULL;
TAILQ_FOREACH (current, &startup_sequences, sequences) {
TAILQ_FOREACH(current, &startup_sequences, sequences) {
if (strcmp(current->id, id) != 0)
continue;
@ -219,7 +219,7 @@ void startup_monitor_event(SnMonitorEvent *event, void *userdata) {
/* Get the corresponding internal startup sequence */
const char *id = sn_startup_sequence_get_id(snsequence);
struct Startup_Sequence *current, *sequence = NULL;
TAILQ_FOREACH (current, &startup_sequences, sequences) {
TAILQ_FOREACH(current, &startup_sequences, sequences) {
if (strcmp(current->id, id) != 0)
continue;
@ -309,7 +309,7 @@ struct Startup_Sequence *startup_sequence_get(i3Window *cwindow,
}
struct Startup_Sequence *current, *sequence = NULL;
TAILQ_FOREACH (current, &startup_sequences, sequences) {
TAILQ_FOREACH(current, &startup_sequences, sequences) {
if (strcmp(current->id, startup_id) != 0)
continue;

View File

@ -167,9 +167,9 @@ Con *tree_open_con(Con *con, i3Window *window) {
static bool _is_con_mapped(Con *con) {
Con *child;
TAILQ_FOREACH (child, &(con->nodes_head), nodes)
if (_is_con_mapped(child))
return true;
TAILQ_FOREACH(child, &(con->nodes_head), nodes)
if (_is_con_mapped(child))
return true;
return con->mapped;
}
@ -489,13 +489,13 @@ static void mark_unmapped(Con *con) {
Con *current;
con->mapped = false;
TAILQ_FOREACH (current, &(con->nodes_head), nodes)
mark_unmapped(current);
TAILQ_FOREACH(current, &(con->nodes_head), nodes)
mark_unmapped(current);
if (con->type == CT_WORKSPACE) {
/* We need to call mark_unmapped on floating nodes aswell since we can
* make containers floating. */
TAILQ_FOREACH (current, &(con->floating_head), floating_windows)
mark_unmapped(current);
TAILQ_FOREACH(current, &(con->floating_head), floating_windows)
mark_unmapped(current);
}
}

View File

@ -44,8 +44,8 @@ static void _workspace_apply_default_orientation(Con *ws) {
Con *workspace_get(const char *num, bool *created) {
Con *output, *workspace = NULL;
TAILQ_FOREACH (output, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(output), !strcasecmp(child->name, num));
TAILQ_FOREACH(output, &(croot->nodes_head), nodes)
GREP_FIRST(workspace, output_get_content(output), !strcasecmp(child->name, num));
if (workspace == NULL) {
LOG("Creating new workspace \"%s\"\n", num);
@ -59,7 +59,7 @@ Con *workspace_get(const char *num, bool *created) {
* -1. */
long parsed_num = ws_name_to_number(num);
TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
if (strcmp(assignment->name, num) == 0) {
DLOG("Found workspace name assignment to output \"%s\"\n", assignment->output);
GREP_FIRST(output, croot, !strcmp(child->name, assignment->output));
@ -117,7 +117,7 @@ Con *create_workspace_on_output(Output *output, Con *content) {
/* try the configured workspace bindings first to find a free name */
Binding *bind;
TAILQ_FOREACH (bind, bindings, bindings) {
TAILQ_FOREACH(bind, bindings, bindings) {
DLOG("binding with command %s\n", bind->command);
if (strlen(bind->command) < strlen("workspace ") ||
strncasecmp(bind->command, "workspace", strlen("workspace")) != 0)
@ -156,7 +156,7 @@ Con *create_workspace_on_output(Output *output, Con *content) {
* find a new workspace, etc… */
bool assigned = false;
struct Workspace_Assignment *assignment;
TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
if (strcmp(assignment->name, ws->name) != 0 ||
strcmp(assignment->output, output->name) == 0)
continue;
@ -169,8 +169,8 @@ Con *create_workspace_on_output(Output *output, Con *content) {
continue;
current = NULL;
TAILQ_FOREACH (out, &(croot->nodes_head), nodes)
GREP_FIRST(current, output_get_content(out), !strcasecmp(child->name, ws->name));
TAILQ_FOREACH(out, &(croot->nodes_head), nodes)
GREP_FIRST(current, output_get_content(out), !strcasecmp(child->name, ws->name));
exists = (current != NULL);
if (!exists) {
@ -201,8 +201,8 @@ Con *create_workspace_on_output(Output *output, Con *content) {
ws->num = c;
current = NULL;
TAILQ_FOREACH (out, &(croot->nodes_head), nodes)
GREP_FIRST(current, output_get_content(out), child->num == ws->num);
TAILQ_FOREACH(out, &(croot->nodes_head), nodes)
GREP_FIRST(current, output_get_content(out), child->num == ws->num);
exists = (current != NULL);
DLOG("result for ws %d: exists = %d\n", c, exists);
@ -245,7 +245,7 @@ bool workspace_is_visible(Con *ws) {
Con *_get_sticky(Con *con, const char *sticky_group, Con *exclude) {
Con *current;
TAILQ_FOREACH (current, &(con->nodes_head), nodes) {
TAILQ_FOREACH(current, &(con->nodes_head), nodes) {
if (current != exclude &&
current->sticky_group != NULL &&
current->window != NULL &&
@ -257,7 +257,7 @@ Con *_get_sticky(Con *con, const char *sticky_group, Con *exclude) {
return recurse;
}
TAILQ_FOREACH (current, &(con->floating_head), floating_windows) {
TAILQ_FOREACH(current, &(con->floating_head), floating_windows) {
if (current != exclude &&
current->sticky_group != NULL &&
current->window != NULL &&
@ -284,7 +284,7 @@ static void workspace_reassign_sticky(Con *con) {
/* 1: go through all containers */
/* handle all children and floating windows of this node */
TAILQ_FOREACH (current, &(con->nodes_head), nodes) {
TAILQ_FOREACH(current, &(con->nodes_head), nodes) {
if (current->sticky_group == NULL) {
workspace_reassign_sticky(current);
continue;
@ -312,8 +312,8 @@ static void workspace_reassign_sticky(Con *con) {
LOG("re-assigned window from src %p to dest %p\n", src, current);
}
TAILQ_FOREACH (current, &(con->floating_head), floating_windows)
workspace_reassign_sticky(current);
TAILQ_FOREACH(current, &(con->floating_head), floating_windows)
workspace_reassign_sticky(current);
}
/*
@ -344,7 +344,7 @@ static void _workspace_show(Con *workspace) {
/* disable fullscreen for the other workspaces and get the workspace we are
* currently on. */
TAILQ_FOREACH (current, &(workspace->parent->nodes_head), nodes) {
TAILQ_FOREACH(current, &(workspace->parent->nodes_head), nodes) {
if (current->fullscreen_mode == CF_OUTPUT)
old = current;
current->fullscreen_mode = CF_NONE;
@ -472,11 +472,11 @@ Con *workspace_next(void) {
next = TAILQ_NEXT(current, nodes);
} else {
/* If currently a numbered workspace, find next numbered workspace. */
TAILQ_FOREACH (output, &(croot->nodes_head), nodes) {
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
/* Skip outputs starting with __, they are internal. */
if (con_is_internal(output))
continue;
NODES_FOREACH (output_get_content(output)) {
NODES_FOREACH(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (child->num == -1)
@ -493,11 +493,11 @@ Con *workspace_next(void) {
/* Find next named workspace. */
if (!next) {
bool found_current = false;
TAILQ_FOREACH (output, &(croot->nodes_head), nodes) {
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
/* Skip outputs starting with __, they are internal. */
if (con_is_internal(output))
continue;
NODES_FOREACH (output_get_content(output)) {
NODES_FOREACH(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (child == current) {
@ -512,11 +512,11 @@ Con *workspace_next(void) {
/* Find first workspace. */
if (!next) {
TAILQ_FOREACH (output, &(croot->nodes_head), nodes) {
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
/* Skip outputs starting with __, they are internal. */
if (con_is_internal(output))
continue;
NODES_FOREACH (output_get_content(output)) {
NODES_FOREACH(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (!next || (child->num != -1 && child->num < next->num))
@ -544,11 +544,11 @@ Con *workspace_prev(void) {
prev = NULL;
} else {
/* If numbered workspace, find previous numbered workspace. */
TAILQ_FOREACH_REVERSE (output, &(croot->nodes_head), nodes_head, nodes) {
TAILQ_FOREACH_REVERSE(output, &(croot->nodes_head), nodes_head, nodes) {
/* Skip outputs starting with __, they are internal. */
if (con_is_internal(output))
continue;
NODES_FOREACH_REVERSE (output_get_content(output)) {
NODES_FOREACH_REVERSE(output_get_content(output)) {
if (child->type != CT_WORKSPACE || child->num == -1)
continue;
/* Need to check child against current and previous because we
@ -563,11 +563,11 @@ Con *workspace_prev(void) {
/* Find previous named workspace. */
if (!prev) {
bool found_current = false;
TAILQ_FOREACH_REVERSE (output, &(croot->nodes_head), nodes_head, nodes) {
TAILQ_FOREACH_REVERSE(output, &(croot->nodes_head), nodes_head, nodes) {
/* Skip outputs starting with __, they are internal. */
if (con_is_internal(output))
continue;
NODES_FOREACH_REVERSE (output_get_content(output)) {
NODES_FOREACH_REVERSE(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (child == current) {
@ -582,11 +582,11 @@ Con *workspace_prev(void) {
/* Find last workspace. */
if (!prev) {
TAILQ_FOREACH_REVERSE (output, &(croot->nodes_head), nodes_head, nodes) {
TAILQ_FOREACH_REVERSE(output, &(croot->nodes_head), nodes_head, nodes) {
/* Skip outputs starting with __, they are internal. */
if (con_is_internal(output))
continue;
NODES_FOREACH_REVERSE (output_get_content(output)) {
NODES_FOREACH_REVERSE(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (!prev || child->num > prev->num)
@ -613,7 +613,7 @@ Con *workspace_next_on_output(void) {
next = TAILQ_NEXT(current, nodes);
} else {
/* If currently a numbered workspace, find next numbered workspace. */
NODES_FOREACH (output_get_content(output)) {
NODES_FOREACH(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (child->num == -1)
@ -629,7 +629,7 @@ Con *workspace_next_on_output(void) {
/* Find next named workspace. */
if (!next) {
bool found_current = false;
NODES_FOREACH (output_get_content(output)) {
NODES_FOREACH(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (child == current) {
@ -643,7 +643,7 @@ Con *workspace_next_on_output(void) {
/* Find first workspace. */
if (!next) {
NODES_FOREACH (output_get_content(output)) {
NODES_FOREACH(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (!next || (child->num != -1 && child->num < next->num))
@ -671,7 +671,7 @@ Con *workspace_prev_on_output(void) {
prev = NULL;
} else {
/* If numbered workspace, find previous numbered workspace. */
NODES_FOREACH_REVERSE (output_get_content(output)) {
NODES_FOREACH_REVERSE(output_get_content(output)) {
if (child->type != CT_WORKSPACE || child->num == -1)
continue;
/* Need to check child against current and previous because we
@ -685,7 +685,7 @@ Con *workspace_prev_on_output(void) {
/* Find previous named workspace. */
if (!prev) {
bool found_current = false;
NODES_FOREACH_REVERSE (output_get_content(output)) {
NODES_FOREACH_REVERSE(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (child == current) {
@ -699,7 +699,7 @@ Con *workspace_prev_on_output(void) {
/* Find last workspace. */
if (!prev) {
NODES_FOREACH_REVERSE (output_get_content(output)) {
NODES_FOREACH_REVERSE(output_get_content(output)) {
if (child->type != CT_WORKSPACE)
continue;
if (!prev || child->num > prev->num)
@ -742,13 +742,13 @@ Con *workspace_back_and_forth_get(void) {
static bool get_urgency_flag(Con *con) {
Con *child;
TAILQ_FOREACH (child, &(con->nodes_head), nodes)
if (child->urgent || get_urgency_flag(child))
return true;
TAILQ_FOREACH(child, &(con->nodes_head), nodes)
if (child->urgent || get_urgency_flag(child))
return true;
TAILQ_FOREACH (child, &(con->floating_head), floating_windows)
if (child->urgent || get_urgency_flag(child))
return true;
TAILQ_FOREACH(child, &(con->floating_head), floating_windows)
if (child->urgent || get_urgency_flag(child))
return true;
return false;
}

50
src/x.c
View File

@ -76,9 +76,9 @@ TAILQ_HEAD(initial_mapping_head, con_state) initial_mapping_head =
*/
static con_state *state_for_frame(xcb_window_t window) {
con_state *state;
CIRCLEQ_FOREACH (state, &state_head, state)
if (state->id == window)
return state;
CIRCLEQ_FOREACH(state, &state_head, state)
if (state->id == window)
return state;
/* TODO: better error handling? */
ELOG("No state found\n");
@ -579,11 +579,11 @@ void x_deco_recurse(Con *con) {
con_state *state = state_for_frame(con->frame);
if (!leaf) {
TAILQ_FOREACH (current, &(con->nodes_head), nodes)
x_deco_recurse(current);
TAILQ_FOREACH(current, &(con->nodes_head), nodes)
x_deco_recurse(current);
TAILQ_FOREACH (current, &(con->floating_head), floating_windows)
x_deco_recurse(current);
TAILQ_FOREACH(current, &(con->floating_head), floating_windows)
x_deco_recurse(current);
if (state->mapped)
xcb_copy_area(conn, con->pixmap, con->frame, con->pm_gc, 0, 0, 0, 0, con->rect.width, con->rect.height);
@ -620,7 +620,7 @@ void x_push_node(Con *con) {
/* Calculate the height of all window decorations which will be drawn on to
* this frame. */
uint32_t max_y = 0, max_height = 0;
TAILQ_FOREACH (current, &(con->nodes_head), nodes) {
TAILQ_FOREACH(current, &(con->nodes_head), nodes) {
Rect *dr = &(current->deco_rect);
if (dr->y >= max_y && dr->height >= max_height) {
max_y = dr->y;
@ -799,8 +799,8 @@ void x_push_node(Con *con) {
/* Handle all children and floating windows of this node. We recurse
* in focus order to display the focused client in a stack first when
* switching workspaces (reduces flickering). */
TAILQ_FOREACH (current, &(con->focus_head), focused)
x_push_node(current);
TAILQ_FOREACH(current, &(con->focus_head), focused)
x_push_node(current);
}
/*
@ -844,11 +844,11 @@ static void x_push_node_unmaps(Con *con) {
}
/* handle all children and floating windows of this node */
TAILQ_FOREACH (current, &(con->nodes_head), nodes)
x_push_node_unmaps(current);
TAILQ_FOREACH(current, &(con->nodes_head), nodes)
x_push_node_unmaps(current);
TAILQ_FOREACH (current, &(con->floating_head), floating_windows)
x_push_node_unmaps(current);
TAILQ_FOREACH(current, &(con->floating_head), floating_windows)
x_push_node_unmaps(current);
}
/*
@ -861,7 +861,7 @@ static bool is_con_attached(Con *con) {
return false;
Con *current;
TAILQ_FOREACH (current, &(con->parent->nodes_head), nodes) {
TAILQ_FOREACH(current, &(con->parent->nodes_head), nodes) {
if (current == con)
return true;
}
@ -892,7 +892,7 @@ void x_push_changes(Con *con) {
DLOG("-- PUSHING WINDOW STACK --\n");
//DLOG("Disabling EnterNotify\n");
uint32_t values[1] = {XCB_NONE};
CIRCLEQ_FOREACH_REVERSE (state, &state_head, state) {
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
if (state->mapped)
xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
}
@ -903,9 +903,9 @@ void x_push_changes(Con *con) {
/* count first, necessary to (re)allocate memory for the bottom-to-top
* stack afterwards */
int cnt = 0;
CIRCLEQ_FOREACH_REVERSE (state, &state_head, state)
if (con_has_managed_window(state->con))
cnt++;
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state)
if (con_has_managed_window(state->con))
cnt++;
/* The bottom-to-top window stack of all windows which are managed by i3.
* Used for x_get_window_stack(). */
@ -920,7 +920,7 @@ void x_push_changes(Con *con) {
xcb_window_t *walk = client_list_windows;
/* X11 correctly represents the stack if we push it from bottom to top */
CIRCLEQ_FOREACH_REVERSE (state, &state_head, state) {
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
if (con_has_managed_window(state->con))
memcpy(walk++, &(state->con->window->id), sizeof(xcb_window_t));
@ -951,7 +951,7 @@ void x_push_changes(Con *con) {
walk = client_list_windows;
/* reorder by initial mapping */
TAILQ_FOREACH (state, &initial_mapping_head, initial_mapping_order) {
TAILQ_FOREACH(state, &initial_mapping_head, initial_mapping_order) {
if (con_has_managed_window(state->con))
*walk++ = state->con->window->id;
}
@ -984,7 +984,7 @@ void x_push_changes(Con *con) {
//DLOG("Re-enabling EnterNotify\n");
values[0] = FRAME_EVENT_MASK;
CIRCLEQ_FOREACH_REVERSE (state, &state_head, state) {
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
if (state->mapped)
xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
}
@ -1056,7 +1056,7 @@ void x_push_changes(Con *con) {
* unmapped, the second one appears under the cursor and therefore gets an
* EnterNotify event. */
values[0] = FRAME_EVENT_MASK & ~XCB_EVENT_MASK_ENTER_WINDOW;
CIRCLEQ_FOREACH_REVERSE (state, &state_head, state) {
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
if (!state->unmap_now)
continue;
xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
@ -1066,7 +1066,7 @@ void x_push_changes(Con *con) {
x_push_node_unmaps(con);
/* save the current stack as old stack */
CIRCLEQ_FOREACH (state, &state_head, state) {
CIRCLEQ_FOREACH(state, &state_head, state) {
CIRCLEQ_REMOVE(&old_state_head, state, old_state);
CIRCLEQ_INSERT_TAIL(&old_state_head, state, old_state);
}
@ -1155,7 +1155,7 @@ void x_mask_event_mask(uint32_t mask) {
uint32_t values[] = {FRAME_EVENT_MASK & mask};
con_state *state;
CIRCLEQ_FOREACH_REVERSE (state, &state_head, state) {
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
if (state->mapped)
xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
}

View File

@ -23,9 +23,9 @@ static int num_screens;
*/
static Output *get_screen_at(unsigned int x, unsigned int y) {
Output *output;
TAILQ_FOREACH (output, &outputs, outputs)
if (output->rect.x == x && output->rect.y == y)
return output;
TAILQ_FOREACH(output, &outputs, outputs)
if (output->rect.x == x && output->rect.y == y)
return output;
return NULL;
}