|
|
|
@ -161,7 +161,7 @@ static uint32_t get_sep_offset(struct status_block *block) {
|
|
|
|
|
static int get_tray_width(struct tc_head *trayclients) {
|
|
|
|
|
trayclient *trayclient;
|
|
|
|
|
int tray_width = 0;
|
|
|
|
|
TAILQ_FOREACH_REVERSE(trayclient, trayclients, tc_head, tailq) {
|
|
|
|
|
TAILQ_FOREACH_REVERSE (trayclient, trayclients, tc_head, tailq) {
|
|
|
|
|
if (!trayclient->mapped)
|
|
|
|
|
continue;
|
|
|
|
|
tray_width += icon_size + logical_px(config.tray_padding);
|
|
|
|
@ -203,7 +203,7 @@ static uint32_t predict_statusline_length(bool use_short_text) {
|
|
|
|
|
uint32_t width = 0;
|
|
|
|
|
struct status_block *block;
|
|
|
|
|
|
|
|
|
|
TAILQ_FOREACH(block, &statusline_head, blocks) {
|
|
|
|
|
TAILQ_FOREACH (block, &statusline_head, blocks) {
|
|
|
|
|
i3String *text = block->full_text;
|
|
|
|
|
struct status_block_render_desc *render = &block->full_render;
|
|
|
|
|
if (use_short_text && block->short_text != NULL) {
|
|
|
|
@ -266,7 +266,7 @@ static void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focu
|
|
|
|
|
uint32_t x = 0 - clip_left;
|
|
|
|
|
|
|
|
|
|
/* Draw the text of each block */
|
|
|
|
|
TAILQ_FOREACH(block, &statusline_head, blocks) {
|
|
|
|
|
TAILQ_FOREACH (block, &statusline_head, blocks) {
|
|
|
|
|
i3String *text = block->full_text;
|
|
|
|
|
struct status_block_render_desc *render = &block->full_render;
|
|
|
|
|
if (use_short_text && block->short_text != NULL) {
|
|
|
|
@ -343,7 +343,7 @@ static void hide_bars(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i3_output *walk;
|
|
|
|
|
SLIST_FOREACH(walk, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (walk, outputs, slist) {
|
|
|
|
|
if (!walk->active) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -368,7 +368,7 @@ static void unhide_bars(void) {
|
|
|
|
|
|
|
|
|
|
cont_child();
|
|
|
|
|
|
|
|
|
|
SLIST_FOREACH(walk, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (walk, outputs, slist) {
|
|
|
|
|
if (walk->bar.id == XCB_NONE) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -448,7 +448,7 @@ void init_colors(const struct xcb_color_strings_t *new_colors) {
|
|
|
|
|
|
|
|
|
|
static bool execute_custom_command(xcb_keycode_t input_code, bool event_is_release) {
|
|
|
|
|
binding_t *binding;
|
|
|
|
|
TAILQ_FOREACH(binding, &(config.bindings), bindings) {
|
|
|
|
|
TAILQ_FOREACH (binding, &(config.bindings), bindings) {
|
|
|
|
|
if ((binding->input_code != input_code) || (binding->release != event_is_release))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
@ -466,7 +466,7 @@ static void child_handle_button(xcb_button_press_event_t *event, i3_output *outp
|
|
|
|
|
/* x of the start of the current block relative to the statusline. */
|
|
|
|
|
uint32_t last_block_x = 0;
|
|
|
|
|
struct status_block *block;
|
|
|
|
|
TAILQ_FOREACH(block, &statusline_head, blocks) {
|
|
|
|
|
TAILQ_FOREACH (block, &statusline_head, blocks) {
|
|
|
|
|
i3String *text;
|
|
|
|
|
struct status_block_render_desc *render;
|
|
|
|
|
if (output->statusline_short_text && block->short_text != NULL) {
|
|
|
|
@ -521,7 +521,7 @@ static void handle_button(xcb_button_press_event_t *event) {
|
|
|
|
|
/* Determine, which bar was clicked */
|
|
|
|
|
i3_output *walk;
|
|
|
|
|
xcb_window_t bar = event->event;
|
|
|
|
|
SLIST_FOREACH(walk, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (walk, outputs, slist) {
|
|
|
|
|
if (walk->bar.id == bar) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -541,7 +541,7 @@ static void handle_button(xcb_button_press_event_t *event) {
|
|
|
|
|
int workspace_width = 0;
|
|
|
|
|
i3_ws *cur_ws = NULL, *clicked_ws = NULL, *ws_walk;
|
|
|
|
|
|
|
|
|
|
TAILQ_FOREACH(ws_walk, walk->workspaces, tailq) {
|
|
|
|
|
TAILQ_FOREACH (ws_walk, walk->workspaces, tailq) {
|
|
|
|
|
int w = predict_button_width(ws_walk->name_width);
|
|
|
|
|
if (x >= workspace_width && x <= workspace_width + w)
|
|
|
|
|
clicked_ws = ws_walk;
|
|
|
|
@ -614,7 +614,7 @@ static void handle_button(xcb_button_press_event_t *event) {
|
|
|
|
|
/* if no workspace was clicked, focus our currently visible
|
|
|
|
|
* workspace if it is not already focused */
|
|
|
|
|
if (cur_ws == NULL) {
|
|
|
|
|
TAILQ_FOREACH(cur_ws, walk->workspaces, tailq) {
|
|
|
|
|
TAILQ_FOREACH (cur_ws, walk->workspaces, tailq) {
|
|
|
|
|
if (cur_ws->visible && !cur_ws->focused)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -672,7 +672,7 @@ static void handle_visibility_notify(xcb_visibility_notify_event_t *event) {
|
|
|
|
|
int num_visible = 0;
|
|
|
|
|
i3_output *output;
|
|
|
|
|
|
|
|
|
|
SLIST_FOREACH(output, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (output, outputs, slist) {
|
|
|
|
|
if (!output->active) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -729,14 +729,14 @@ static int reorder_trayclients_cmp(const void *_a, const void *_b) {
|
|
|
|
|
*/
|
|
|
|
|
static void configure_trayclients(void) {
|
|
|
|
|
i3_output *output;
|
|
|
|
|
SLIST_FOREACH(output, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (output, outputs, slist) {
|
|
|
|
|
if (!output->active) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
trayclient *client;
|
|
|
|
|
TAILQ_FOREACH(client, output->trayclients, tailq) {
|
|
|
|
|
TAILQ_FOREACH (client, output->trayclients, tailq) {
|
|
|
|
|
if (client->mapped) {
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
@ -744,7 +744,7 @@ static void configure_trayclients(void) {
|
|
|
|
|
|
|
|
|
|
int idx = 0;
|
|
|
|
|
trayclient **trayclients = smalloc(count * sizeof(trayclient *));
|
|
|
|
|
TAILQ_FOREACH(client, output->trayclients, tailq) {
|
|
|
|
|
TAILQ_FOREACH (client, output->trayclients, tailq) {
|
|
|
|
|
if (client->mapped) {
|
|
|
|
|
trayclients[idx++] = client;
|
|
|
|
|
}
|
|
|
|
@ -769,13 +769,13 @@ static void configure_trayclients(void) {
|
|
|
|
|
|
|
|
|
|
static trayclient *trayclient_and_output_from_window(xcb_window_t win, i3_output **output) {
|
|
|
|
|
i3_output *o_walk;
|
|
|
|
|
SLIST_FOREACH(o_walk, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (o_walk, outputs, slist) {
|
|
|
|
|
if (!o_walk->active) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trayclient *client;
|
|
|
|
|
TAILQ_FOREACH(client, o_walk->trayclients, tailq) {
|
|
|
|
|
TAILQ_FOREACH (client, o_walk->trayclients, tailq) {
|
|
|
|
|
if (client->win == win) {
|
|
|
|
|
if (output) {
|
|
|
|
|
*output = o_walk;
|
|
|
|
@ -1118,12 +1118,12 @@ static void handle_property_notify(xcb_property_notify_event_t *event) {
|
|
|
|
|
static void handle_configuration_change(xcb_window_t window) {
|
|
|
|
|
trayclient *trayclient;
|
|
|
|
|
i3_output *output;
|
|
|
|
|
SLIST_FOREACH(output, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (output, outputs, slist) {
|
|
|
|
|
if (!output->active)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
int clients = 0;
|
|
|
|
|
TAILQ_FOREACH_REVERSE(trayclient, output->trayclients, tc_head, tailq) {
|
|
|
|
|
TAILQ_FOREACH_REVERSE (trayclient, output->trayclients, tc_head, tailq) {
|
|
|
|
|
if (!trayclient->mapped)
|
|
|
|
|
continue;
|
|
|
|
|
clients++;
|
|
|
|
@ -1733,7 +1733,7 @@ static i3_output *get_tray_output(void) {
|
|
|
|
|
i3_output *output = NULL;
|
|
|
|
|
if (TAILQ_EMPTY(&(config.tray_outputs))) {
|
|
|
|
|
/* No tray_output specified, use first active output. */
|
|
|
|
|
SLIST_FOREACH(output, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (output, outputs, slist) {
|
|
|
|
|
if (output->active) {
|
|
|
|
|
return output;
|
|
|
|
|
}
|
|
|
|
@ -1747,8 +1747,8 @@ static i3_output *get_tray_output(void) {
|
|
|
|
|
/* If one or more tray_output assignments were specified, we ensure that at
|
|
|
|
|
* least one of them is actually an output managed by this instance. */
|
|
|
|
|
tray_output_t *tray_output;
|
|
|
|
|
TAILQ_FOREACH(tray_output, &(config.tray_outputs), tray_outputs) {
|
|
|
|
|
SLIST_FOREACH(output, outputs, slist) {
|
|
|
|
|
TAILQ_FOREACH (tray_output, &(config.tray_outputs), tray_outputs) {
|
|
|
|
|
SLIST_FOREACH (output, outputs, slist) {
|
|
|
|
|
if (output->active &&
|
|
|
|
|
(strcasecmp(output->name, tray_output->output) == 0 ||
|
|
|
|
|
(strcasecmp(tray_output->output, "primary") == 0 && output->primary))) {
|
|
|
|
@ -1769,7 +1769,7 @@ void reconfig_windows(bool redraw_bars) {
|
|
|
|
|
uint32_t values[6];
|
|
|
|
|
|
|
|
|
|
i3_output *walk;
|
|
|
|
|
SLIST_FOREACH(walk, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (walk, outputs, slist) {
|
|
|
|
|
if (!walk->active) {
|
|
|
|
|
/* If an output is not active, we destroy its bar */
|
|
|
|
|
/* FIXME: Maybe we rather want to unmap? */
|
|
|
|
@ -2032,7 +2032,7 @@ void draw_bars(bool unhide) {
|
|
|
|
|
uint32_t short_statusline_width = predict_statusline_length(true);
|
|
|
|
|
|
|
|
|
|
i3_output *outputs_walk;
|
|
|
|
|
SLIST_FOREACH(outputs_walk, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (outputs_walk, outputs, slist) {
|
|
|
|
|
int workspace_width = 0;
|
|
|
|
|
|
|
|
|
|
if (!outputs_walk->active) {
|
|
|
|
@ -2051,7 +2051,7 @@ void draw_bars(bool unhide) {
|
|
|
|
|
|
|
|
|
|
if (!config.disable_ws) {
|
|
|
|
|
i3_ws *ws_walk;
|
|
|
|
|
TAILQ_FOREACH(ws_walk, outputs_walk->workspaces, tailq) {
|
|
|
|
|
TAILQ_FOREACH (ws_walk, outputs_walk->workspaces, tailq) {
|
|
|
|
|
DLOG("Drawing button for WS %s at x = %d, len = %d\n",
|
|
|
|
|
i3string_as_utf8(ws_walk->name), workspace_width, ws_walk->name_width);
|
|
|
|
|
color_t fg_color = colors.inactive_ws_fg;
|
|
|
|
@ -2145,7 +2145,7 @@ void draw_bars(bool unhide) {
|
|
|
|
|
*/
|
|
|
|
|
void redraw_bars(void) {
|
|
|
|
|
i3_output *outputs_walk;
|
|
|
|
|
SLIST_FOREACH(outputs_walk, outputs, slist) {
|
|
|
|
|
SLIST_FOREACH (outputs_walk, outputs, slist) {
|
|
|
|
|
if (!outputs_walk->active) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|