Skip to content

Commit

Permalink
Remove outdated //-style commented-out code
Browse files Browse the repository at this point in the history
This makes the whole code-base have zero changes with clang-format
(v13).
  • Loading branch information
orestisfl committed Dec 6, 2021
1 parent 70f23ca commit a4ac843
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 60 deletions.
8 changes: 2 additions & 6 deletions i3-config-wizard/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,6 @@ static char *rewrite_binding(const char *input) {
while ((*walk == ' ' || *walk == '\t') && *walk != '\0')
walk++;

//printf("remaining input: %s\n", walk);

cmdp_token_ptr *ptr = &(tokens[state]);
for (c = 0; c < ptr->n; c++) {
token = &(ptr->array[c]);
Expand Down Expand Up @@ -426,15 +424,13 @@ static char *rewrite_binding(const char *input) {
}

if (strcmp(token->name, "end") == 0) {
//printf("checking for end: *%s*\n", walk);
if (*walk == '\0' || *walk == '\n' || *walk == '\r') {
if ((result = next_state(token)) != NULL)
return result;
/* To make sure we start with an appropriate matching
* datastructure for commands which do *not* specify any
/* To make sure we start with an appropriate matching data
* structure for commands which do *not* specify any
* criteria, we re-initialize the criteria system after
* every command. */
// TODO: make this testable
walk++;
break;
}
Expand Down
14 changes: 7 additions & 7 deletions include/config_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ struct parser_ctx {
Match current_match;

/* A list which contains the states that lead to the current state, e.g.
* INITIAL, WORKSPACE_LAYOUT.
* When jumping back to INITIAL, statelist_idx will simply be set to 1
* (likewise for other states, e.g. MODE or BAR).
* This list is used to process the nearest error token. */
* INITIAL, WORKSPACE_LAYOUT.
* When jumping back to INITIAL, statelist_idx will simply be set to 1
* (likewise for other states, e.g. MODE or BAR).
* This list is used to process the nearest error token. */
int statelist[10];
/* NB: statelist_idx points to where the next entry will be inserted */
int statelist_idx;

/*******************************************************************************
* The (small) stack where identified literals are stored during the parsing
* of a single config directive (like $workspace).
******************************************************************************/
* The (small) stack where identified literals are stored during the parsing
* of a single config directive (like $workspace).
******************************************************************************/
struct stack *stack;

struct variables_head variables;
Expand Down
4 changes: 2 additions & 2 deletions include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ struct Con {
char *title_format;

/** Whether the window icon should be displayed, and with what padding. -1
* means display no window icon (default behavior), 0 means display without
* any padding, 1 means display with 1 pixel of padding and so on. */
* means display no window icon (default behavior), 0 means display without
* any padding, 1 means display with 1 pixel of padding and so on. */
int window_icon_padding;

/* a sticky-group is an identifier which bundles several containers to a
Expand Down
6 changes: 0 additions & 6 deletions include/randr.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ void output_init_con(Output *output);
*/
void init_ws_for_output(Output *output);

/**
* Initializes the specified output, assigning the specified workspace to it.
*
*/
//void initialize_output(xcb_connection_t *conn, Output *output, Workspace *workspace);

/**
* (Re-)queries the outputs via RandR and stores them in the list of outputs.
*
Expand Down
15 changes: 6 additions & 9 deletions src/con.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,6 @@ void con_unmark(Con *con, const char *name) {
Con *con_for_window(Con *con, i3Window *window, Match **store_match) {
Con *child;
Match *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) {
Expand Down Expand Up @@ -1047,8 +1045,8 @@ void con_fix_percent(Con *con) {
Con *child;
int children = con_num_children(con);

// calculate how much we have distributed and how many containers
// with a percentage set we have
/* calculate how much we have distributed and how many containers with a
* percentage set we have */
double total = 0.0;
int children_with_percent = 0;
TAILQ_FOREACH (child, &(con->nodes_head), nodes) {
Expand All @@ -1058,8 +1056,8 @@ 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 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) {
if (child->percent <= 0.0) {
Expand All @@ -1072,8 +1070,8 @@ 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 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;
Expand Down Expand Up @@ -2237,7 +2235,6 @@ void con_set_urgency(Con *con, bool urgent) {
} else
DLOG("Discarding urgency WM_HINT because timer is running\n");

//CLIENT_LOG(con);
if (con->window) {
if (con->urgent) {
gettimeofday(&con->window->urgent, NULL);
Expand Down
7 changes: 0 additions & 7 deletions src/config_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ static void clear_stack(struct stack *ctx) {
static void next_state(const cmdp_token *token, struct parser_ctx *ctx) {
cmdp_state _next_state = token->next_state;

//printf("token = name %s identifier %s\n", token->name, token->identifier);
//printf("next_state = %d\n", token->next_state);
if (token->next_state == __CALL) {
struct ConfigResultIR subcommand_output = {
.ctx = ctx,
Expand Down Expand Up @@ -254,7 +252,6 @@ static void parse_config(struct parser_ctx *ctx, const char *input, struct conte
bool token_handled;
linecnt = 1;

// TODO: make this testable
#ifndef TEST_PARSER
struct ConfigResultIR subcommand_output = {
.ctx = ctx,
Expand All @@ -270,8 +267,6 @@ static void parse_config(struct parser_ctx *ctx, const char *input, struct conte
while ((*walk == ' ' || *walk == '\t') && *walk != '\0')
walk++;

//printf("remaining input: %s\n", walk);

cmdp_token_ptr *ptr = &(tokens[ctx->state]);
token_handled = false;
for (c = 0; c < ptr->n; c++) {
Expand Down Expand Up @@ -378,15 +373,13 @@ static void parse_config(struct parser_ctx *ctx, const char *input, struct conte
}

if (strcmp(token->name, "end") == 0) {
//printf("checking for end: *%s*\n", walk);
if (*walk == '\0' || *walk == '\n' || *walk == '\r') {
next_state(token, ctx);
token_handled = true;
/* To make sure we start with an appropriate matching
* datastructure for commands which do *not* specify any
* criteria, we re-initialize the criteria system after
* every command. */
// TODO: make this testable
#ifndef TEST_PARSER
cfg_criteria_init(&(ctx->current_match), &subcommand_output, INITIAL);
#endif
Expand Down
12 changes: 5 additions & 7 deletions src/handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ bool event_is_ignored(const int sequence, const int response_type) {
event->response_type != response_type)
continue;

/* instead of removing a sequence number we better wait until it gets
* garbage collected. it may generate multiple events (there are multiple
* enter_notifies for one configure_request, for example). */
//SLIST_REMOVE(&ignore_events, event, Ignore_Event, ignore_events);
//free(event);
/* Instead of removing & freeing a sequence number we better wait until
* it gets garbage collected. It may generate multiple events (there
* are multiple enter_notifies for one configure_request, for example). */
return true;
}

Expand Down Expand Up @@ -1346,7 +1344,7 @@ static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom)
}

if (handler == NULL) {
//DLOG("Unhandled property notify for atom %d (0x%08x)\n", atom, atom);
/* DLOG("Unhandled property notify for atom %d (0x%08x)\n", atom, atom); */
return;
}

Expand Down Expand Up @@ -1524,7 +1522,7 @@ void handle_event(int type, xcb_generic_event_t *event) {
break;

default:
//DLOG("Unhandled event of type %d\n", type);
/* DLOG("Unhandled event of type %d\n", type); */
break;
}
}
21 changes: 5 additions & 16 deletions src/x.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,6 @@ void x_push_node(Con *con) {
con_state *state;
Rect rect = con->rect;

//DLOG("Pushing changes for node %p / %s\n", con, con->name);
state = state_for_frame(con->frame.id);

if (state->name != NULL) {
Expand Down Expand Up @@ -994,8 +993,9 @@ void x_push_node(Con *con) {
win_depth = con->window->depth;

/* Ensure we have valid dimensions for our surface. */
// TODO This is probably a bug in the condition above as we should never enter this path
// for height == 0. Also, we should probably handle width == 0 the same way.
/* TODO: This is probably a bug in the condition above as we should
* never enter this path for height == 0. Also, we should probably
* handle width == 0 the same way. */
int width = MAX((int32_t)rect.width, 1);
int height = MAX((int32_t)rect.height, 1);

Expand All @@ -1014,8 +1014,8 @@ void x_push_node(Con *con) {
con->pixmap_recreated = true;

/* Don’t render the decoration for windows inside a stack which are
* not visible right now */
// TODO Should this work the same way for L_TABBED?
* not visible right now
* TODO: Should this work the same way for L_TABBED? */
if (!con->parent ||
con->parent->layout != L_STACKED ||
TAILQ_FIRST(&(con->parent->focus_head)) == con)
Expand Down Expand Up @@ -1126,7 +1126,6 @@ static void x_push_node_unmaps(Con *con) {
Con *current;
con_state *state;

//DLOG("Pushing changes (with unmaps) for node %p / %s\n", con, con->name);
state = state_for_frame(con->frame.id);

/* map/unmap if map state changed, also ensure that the child window
Expand Down Expand Up @@ -1202,7 +1201,6 @@ void x_push_changes(Con *con) {
}

DLOG("-- PUSHING WINDOW STACK --\n");
//DLOG("Disabling EnterNotify\n");
/* We need to keep SubstructureRedirect around, otherwise clients can send
* ConfigureWindow requests and get them applied directly instead of having
* them become ConfigureRequests that i3 handles. */
Expand All @@ -1211,7 +1209,6 @@ void x_push_changes(Con *con) {
if (state->mapped)
xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
}
//DLOG("Done, EnterNotify disabled\n");
bool order_changed = false;
bool stacking_changed = false;

Expand Down Expand Up @@ -1241,14 +1238,12 @@ void x_push_changes(Con *con) {
if (con_has_managed_window(state->con))
memcpy(walk++, &(state->con->window->id), sizeof(xcb_window_t));

//DLOG("stack: 0x%08x\n", state->id);
con_state *prev = CIRCLEQ_PREV(state, state);
con_state *old_prev = CIRCLEQ_PREV(state, old_state);
if (prev != old_prev)
order_changed = true;
if ((state->initial || order_changed) && prev != CIRCLEQ_END(&state_head)) {
stacking_changed = true;
//DLOG("Stacking 0x%08x above 0x%08x\n", prev->id, state->id);
uint32_t mask = 0;
mask |= XCB_CONFIG_WINDOW_SIBLING;
mask |= XCB_CONFIG_WINDOW_STACK_MODE;
Expand Down Expand Up @@ -1301,13 +1296,11 @@ void x_push_changes(Con *con) {
warp_to = NULL;
}

//DLOG("Re-enabling EnterNotify\n");
values[0] = FRAME_EVENT_MASK;
CIRCLEQ_FOREACH_REVERSE (state, &state_head, state) {
if (state->mapped)
xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
}
//DLOG("Done, EnterNotify re-enabled\n");

x_deco_recurse(con);

Expand Down Expand Up @@ -1393,9 +1386,6 @@ void x_push_changes(Con *con) {
CIRCLEQ_REMOVE(&old_state_head, state, old_state);
CIRCLEQ_INSERT_TAIL(&old_state_head, state, old_state);
}
//CIRCLEQ_FOREACH(state, &old_state_head, old_state) {
// DLOG("old stack: 0x%08x\n", state->id);
//}

xcb_flush(conn);
}
Expand All @@ -1408,7 +1398,6 @@ void x_push_changes(Con *con) {
void x_raise_con(Con *con) {
con_state *state;
state = state_for_frame(con->frame.id);
//DLOG("raising in new stack: %p / %s / %s / xid %08x\n", con, con->name, con->window ? con->window->name_json : "", state->id);

CIRCLEQ_REMOVE(&state_head, state, state);
CIRCLEQ_INSERT_HEAD(&state_head, state, state);
Expand Down

0 comments on commit a4ac843

Please sign in to comment.