commit
db0add0f11
|
@ -35,7 +35,7 @@ install:
|
||||||
script:
|
script:
|
||||||
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-safe-wrappers.sh
|
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-safe-wrappers.sh
|
||||||
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-formatting.sh
|
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-formatting.sh
|
||||||
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror"'
|
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} /bin/sh -c 'autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror"'
|
||||||
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-spelling.pl
|
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/check-spelling.pl
|
||||||
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} ./travis/run-tests.sh
|
- docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${BASENAME} ./travis/run-tests.sh
|
||||||
- ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/debian-build.sh deb/debian-amd64/DIST
|
- ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/debian-build.sh deb/debian-amd64/DIST
|
||||||
|
|
|
@ -104,7 +104,7 @@ static struct xkb_keymap *xkb_keymap;
|
||||||
static uint8_t xkb_base_event;
|
static uint8_t xkb_base_event;
|
||||||
static uint8_t xkb_base_error;
|
static uint8_t xkb_base_error;
|
||||||
|
|
||||||
static void finish();
|
static void finish(void);
|
||||||
|
|
||||||
#include "GENERATED_config_enums.h"
|
#include "GENERATED_config_enums.h"
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ static const char *get_string(const char *identifier) {
|
||||||
|
|
||||||
static void clear_stack(void) {
|
static void clear_stack(void) {
|
||||||
for (int c = 0; c < 10; c++) {
|
for (int c = 0; c < 10; c++) {
|
||||||
if (stack[c].type == STACK_STR && stack[c].val.str != NULL)
|
if (stack[c].type == STACK_STR)
|
||||||
free(stack[c].val.str);
|
free(stack[c].val.str);
|
||||||
stack[c].identifier = NULL;
|
stack[c].identifier = NULL;
|
||||||
stack[c].val.str = NULL;
|
stack[c].val.str = NULL;
|
||||||
|
@ -482,7 +482,7 @@ static void txt(int col, int row, char *text, color_t fg, color_t bg) {
|
||||||
* Handles expose events, that is, draws the window contents.
|
* Handles expose events, that is, draws the window contents.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int handle_expose() {
|
static int handle_expose(void) {
|
||||||
const color_t black = draw_util_hex_to_color("#000000");
|
const color_t black = draw_util_hex_to_color("#000000");
|
||||||
const color_t white = draw_util_hex_to_color("#FFFFFF");
|
const color_t white = draw_util_hex_to_color("#FFFFFF");
|
||||||
const color_t green = draw_util_hex_to_color("#00FF00");
|
const color_t green = draw_util_hex_to_color("#00FF00");
|
||||||
|
@ -641,7 +641,7 @@ static void handle_button_press(xcb_button_press_event_t *event) {
|
||||||
* Creates the config file and tells i3 to reload.
|
* Creates the config file and tells i3 to reload.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void finish() {
|
static void finish(void) {
|
||||||
printf("creating \"%s\"...\n", config_path);
|
printf("creating \"%s\"...\n", config_path);
|
||||||
|
|
||||||
struct xkb_context *xkb_context;
|
struct xkb_context *xkb_context;
|
||||||
|
|
|
@ -156,7 +156,7 @@ static int handle_key_release(void *ignored, xcb_connection_t *conn, xcb_key_rel
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void finish_input() {
|
static void finish_input(void) {
|
||||||
char *command = (char *)concat_strings(glyphs_utf8, input_position);
|
char *command = (char *)concat_strings(glyphs_utf8, input_position);
|
||||||
|
|
||||||
/* count the occurrences of %s in the string */
|
/* count the occurrences of %s in the string */
|
||||||
|
|
|
@ -103,10 +103,10 @@ void debuglog(char *fmt, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Starts the given application by passing it through a shell. We use double fork
|
* Starts the given application by passing it through a shell. We use double
|
||||||
* to avoid zombie processes. As the started application’s parent exits (immediately),
|
* fork to avoid zombie processes. As the started application’s parent exits
|
||||||
* the application is reparented to init (process-id 1), which correctly handles
|
* (immediately), the application is reparented to init (process-id 1), which
|
||||||
* childs, so we don’t have to do it :-).
|
* correctly handles children, so we don’t have to do it :-).
|
||||||
*
|
*
|
||||||
* The shell is determined by looking for the SHELL environment variable. If it
|
* The shell is determined by looking for the SHELL environment variable. If it
|
||||||
* does not exist, /bin/sh is used.
|
* does not exist, /bin/sh is used.
|
||||||
|
|
|
@ -60,7 +60,7 @@ int separator_symbol_width;
|
||||||
* depend on 'config'.
|
* depend on 'config'.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
char *init_xcb_early();
|
char *init_xcb_early(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization which depends on 'config' being usable. Called after the
|
* Initialization which depends on 'config' being usable. Called after the
|
||||||
|
|
|
@ -133,7 +133,7 @@ finish:
|
||||||
* Stop and free() the stdin- and SIGCHLD-watchers
|
* Stop and free() the stdin- and SIGCHLD-watchers
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cleanup(void) {
|
static void cleanup(void) {
|
||||||
if (stdin_io != NULL) {
|
if (stdin_io != NULL) {
|
||||||
ev_io_stop(main_loop, stdin_io);
|
ev_io_stop(main_loop, stdin_io);
|
||||||
FREE(stdin_io);
|
FREE(stdin_io);
|
||||||
|
@ -400,7 +400,7 @@ static bool read_json_input(unsigned char *input, int length) {
|
||||||
* in statusline
|
* in statusline
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
static void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||||
int rec;
|
int rec;
|
||||||
unsigned char *buffer = get_buffer(watcher, &rec);
|
unsigned char *buffer = get_buffer(watcher, &rec);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
|
@ -420,7 +420,7 @@ void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||||
* whether this is JSON or plain text
|
* whether this is JSON or plain text
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void stdin_io_first_line_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
static void stdin_io_first_line_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||||
int rec;
|
int rec;
|
||||||
unsigned char *buffer = get_buffer(watcher, &rec);
|
unsigned char *buffer = get_buffer(watcher, &rec);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
|
@ -457,7 +457,7 @@ void stdin_io_first_line_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||||
* anymore
|
* anymore
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void child_sig_cb(struct ev_loop *loop, ev_child *watcher, int revents) {
|
static void child_sig_cb(struct ev_loop *loop, ev_child *watcher, int revents) {
|
||||||
int exit_status = WEXITSTATUS(watcher->rstatus);
|
int exit_status = WEXITSTATUS(watcher->rstatus);
|
||||||
|
|
||||||
ELOG("Child (pid: %d) unexpectedly exited with status %d\n",
|
ELOG("Child (pid: %d) unexpectedly exited with status %d\n",
|
||||||
|
@ -477,7 +477,7 @@ void child_sig_cb(struct ev_loop *loop, ev_child *watcher, int revents) {
|
||||||
draw_bars(false);
|
draw_bars(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void child_write_output(void) {
|
static void child_write_output(void) {
|
||||||
if (child.click_events) {
|
if (child.click_events) {
|
||||||
const unsigned char *output;
|
const unsigned char *output;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -580,7 +580,7 @@ void start_child(char *command) {
|
||||||
atexit(kill_child_at_exit);
|
atexit(kill_child_at_exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void child_click_events_initialize(void) {
|
static void child_click_events_initialize(void) {
|
||||||
if (!child.click_events_init) {
|
if (!child.click_events_init) {
|
||||||
yajl_gen_array_open(gen);
|
yajl_gen_array_open(gen);
|
||||||
child_write_output();
|
child_write_output();
|
||||||
|
@ -588,7 +588,7 @@ void child_click_events_initialize(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void child_click_events_key(const char *key) {
|
static void child_click_events_key(const char *key) {
|
||||||
yajl_gen_string(gen, (const unsigned char *)key, strlen(key));
|
yajl_gen_string(gen, (const unsigned char *)key, strlen(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ typedef void (*handler_t)(char *);
|
||||||
* Since i3 does not give us much feedback on commands, we do not much
|
* Since i3 does not give us much feedback on commands, we do not much
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_command_reply(char *reply) {
|
static void got_command_reply(char *reply) {
|
||||||
/* TODO: Error handling for command replies */
|
/* TODO: Error handling for command replies */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void got_command_reply(char *reply) {
|
||||||
* Called, when we get a reply with workspaces data
|
* Called, when we get a reply with workspaces data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_workspace_reply(char *reply) {
|
static void got_workspace_reply(char *reply) {
|
||||||
DLOG("Got workspace data!\n");
|
DLOG("Got workspace data!\n");
|
||||||
parse_workspaces_json(reply);
|
parse_workspaces_json(reply);
|
||||||
draw_bars(false);
|
draw_bars(false);
|
||||||
|
@ -53,7 +53,7 @@ void got_workspace_reply(char *reply) {
|
||||||
* Since i3 does not give us much feedback on commands, we do not much
|
* Since i3 does not give us much feedback on commands, we do not much
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_subscribe_reply(char *reply) {
|
static void got_subscribe_reply(char *reply) {
|
||||||
DLOG("Got subscribe reply: %s\n", reply);
|
DLOG("Got subscribe reply: %s\n", reply);
|
||||||
/* TODO: Error handling for subscribe commands */
|
/* TODO: Error handling for subscribe commands */
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ void got_subscribe_reply(char *reply) {
|
||||||
* Called, when we get a reply with outputs data
|
* Called, when we get a reply with outputs data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_output_reply(char *reply) {
|
static void got_output_reply(char *reply) {
|
||||||
DLOG("Clearing old output configuration...\n");
|
DLOG("Clearing old output configuration...\n");
|
||||||
free_outputs();
|
free_outputs();
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void got_output_reply(char *reply) {
|
||||||
* Called when we get the configuration for our bar instance
|
* Called when we get the configuration for our bar instance
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_bar_config(char *reply) {
|
static void got_bar_config(char *reply) {
|
||||||
DLOG("Received bar config \"%s\"\n", reply);
|
DLOG("Received bar config \"%s\"\n", reply);
|
||||||
/* We initiate the main function by requesting infos about the outputs and
|
/* We initiate the main function by requesting infos about the outputs and
|
||||||
* workspaces. Everything else (creating the bars, showing the right workspace-
|
* workspaces. Everything else (creating the bars, showing the right workspace-
|
||||||
|
@ -132,7 +132,7 @@ handler_t reply_handlers[] = {
|
||||||
* Called, when a workspace event arrives (i.e. the user changed the workspace)
|
* Called, when a workspace event arrives (i.e. the user changed the workspace)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_workspace_event(char *event) {
|
static void got_workspace_event(char *event) {
|
||||||
DLOG("Got workspace event!\n");
|
DLOG("Got workspace event!\n");
|
||||||
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_WORKSPACES, NULL);
|
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_WORKSPACES, NULL);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ void got_workspace_event(char *event) {
|
||||||
* Called, when an output event arrives (i.e. the screen configuration changed)
|
* Called, when an output event arrives (i.e. the screen configuration changed)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_output_event(char *event) {
|
static void got_output_event(char *event) {
|
||||||
DLOG("Got output event!\n");
|
DLOG("Got output event!\n");
|
||||||
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL);
|
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL);
|
||||||
if (!config.disable_ws) {
|
if (!config.disable_ws) {
|
||||||
|
@ -153,7 +153,7 @@ void got_output_event(char *event) {
|
||||||
* Called, when a mode event arrives (i3 changed binding mode).
|
* Called, when a mode event arrives (i3 changed binding mode).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_mode_event(char *event) {
|
static void got_mode_event(char *event) {
|
||||||
DLOG("Got mode event!\n");
|
DLOG("Got mode event!\n");
|
||||||
parse_mode_json(event);
|
parse_mode_json(event);
|
||||||
draw_bars(false);
|
draw_bars(false);
|
||||||
|
@ -163,7 +163,7 @@ void got_mode_event(char *event) {
|
||||||
* Called, when a barconfig_update event arrives (i.e. i3 changed the bar hidden_state or mode)
|
* Called, when a barconfig_update event arrives (i.e. i3 changed the bar hidden_state or mode)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_bar_config_update(char *event) {
|
static void got_bar_config_update(char *event) {
|
||||||
/* check whether this affect this bar instance by checking the bar_id */
|
/* check whether this affect this bar instance by checking the bar_id */
|
||||||
char *expected_id;
|
char *expected_id;
|
||||||
sasprintf(&expected_id, "\"id\":\"%s\"", config.bar_id);
|
sasprintf(&expected_id, "\"id\":\"%s\"", config.bar_id);
|
||||||
|
@ -213,7 +213,7 @@ handler_t event_handlers[] = {
|
||||||
* Called, when we get a message from i3
|
* Called, when we get a message from i3
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
|
static void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
|
||||||
DLOG("Got data!\n");
|
DLOG("Got data!\n");
|
||||||
int fd = watcher->fd;
|
int fd = watcher->fd;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ void debuglog(char *fmt, ...) {
|
||||||
* Glob path, i.e. expand ~
|
* Glob path, i.e. expand ~
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
char *expand_path(char *path) {
|
static char *expand_path(char *path) {
|
||||||
static glob_t globbuf;
|
static glob_t globbuf;
|
||||||
if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0) {
|
if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0) {
|
||||||
ELOG("glob() failed\n");
|
ELOG("glob() failed\n");
|
||||||
|
@ -55,7 +55,7 @@ char *expand_path(char *path) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_usage(char *elf_name) {
|
static void print_usage(char *elf_name) {
|
||||||
printf("Usage: %s -b bar_id [-s sock_path] [-h] [-v]\n", elf_name);
|
printf("Usage: %s -b bar_id [-s sock_path] [-h] [-v]\n", elf_name);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("-b, --bar_id <bar_id>\tBar ID for which to get the configuration\n");
|
printf("-b, --bar_id <bar_id>\tBar ID for which to get the configuration\n");
|
||||||
|
@ -76,7 +76,7 @@ void print_usage(char *elf_name) {
|
||||||
* in main() with that
|
* in main() with that
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void sig_cb(struct ev_loop *loop, ev_signal *watcher, int revents) {
|
static void sig_cb(struct ev_loop *loop, ev_signal *watcher, int revents) {
|
||||||
switch (watcher->signum) {
|
switch (watcher->signum) {
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
DLOG("Got a SIGTERM, stopping\n");
|
DLOG("Got a SIGTERM, stopping\n");
|
||||||
|
|
|
@ -146,13 +146,13 @@ int _xcb_request_failed(xcb_void_cookie_t cookie, char *err_msg, int line) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_sep_offset(struct status_block *block) {
|
static uint32_t get_sep_offset(struct status_block *block) {
|
||||||
if (!block->no_separator && block->sep_block_width > 0)
|
if (!block->no_separator && block->sep_block_width > 0)
|
||||||
return block->sep_block_width / 2 + block->sep_block_width % 2;
|
return block->sep_block_width / 2 + block->sep_block_width % 2;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_tray_width(struct tc_head *trayclients) {
|
static int get_tray_width(struct tc_head *trayclients) {
|
||||||
trayclient *trayclient;
|
trayclient *trayclient;
|
||||||
int tray_width = 0;
|
int tray_width = 0;
|
||||||
TAILQ_FOREACH_REVERSE(trayclient, trayclients, tc_head, tailq) {
|
TAILQ_FOREACH_REVERSE(trayclient, trayclients, tc_head, tailq) {
|
||||||
|
@ -193,7 +193,7 @@ static void draw_separator(i3_output *output, uint32_t x, struct status_block *b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t predict_statusline_length(bool use_short_text) {
|
static uint32_t predict_statusline_length(bool use_short_text) {
|
||||||
uint32_t width = 0;
|
uint32_t width = 0;
|
||||||
struct status_block *block;
|
struct status_block *block;
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ uint32_t predict_statusline_length(bool use_short_text) {
|
||||||
/*
|
/*
|
||||||
* Redraws the statusline to the output's statusline_buffer
|
* Redraws the statusline to the output's statusline_buffer
|
||||||
*/
|
*/
|
||||||
void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focus_colors, bool use_short_text) {
|
static void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focus_colors, bool use_short_text) {
|
||||||
struct status_block *block;
|
struct status_block *block;
|
||||||
|
|
||||||
color_t bar_color = (use_focus_colors ? colors.focus_bar_bg : colors.bar_bg);
|
color_t bar_color = (use_focus_colors ? colors.focus_bar_bg : colors.bar_bg);
|
||||||
|
@ -330,7 +330,7 @@ void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focus_color
|
||||||
* Hides all bars (unmaps them)
|
* Hides all bars (unmaps them)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void hide_bars(void) {
|
static void hide_bars(void) {
|
||||||
if ((config.hide_on_modifier == M_DOCK) || (config.hidden_state == S_SHOW && config.hide_on_modifier == M_HIDE)) {
|
if ((config.hide_on_modifier == M_DOCK) || (config.hidden_state == S_SHOW && config.hide_on_modifier == M_HIDE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ void hide_bars(void) {
|
||||||
* Unhides all bars (maps them)
|
* Unhides all bars (maps them)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void unhide_bars(void) {
|
static void unhide_bars(void) {
|
||||||
if (config.hide_on_modifier != M_HIDE) {
|
if (config.hide_on_modifier != M_HIDE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ static bool execute_custom_command(xcb_keycode_t input_code, bool event_is_relea
|
||||||
* wheel was used and change the workspace appropriately
|
* wheel was used and change the workspace appropriately
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void handle_button(xcb_button_press_event_t *event) {
|
static void handle_button(xcb_button_press_event_t *event) {
|
||||||
/* Determine, which bar was clicked */
|
/* Determine, which bar was clicked */
|
||||||
i3_output *walk;
|
i3_output *walk;
|
||||||
xcb_window_t bar = event->event;
|
xcb_window_t bar = event->event;
|
||||||
|
@ -1080,7 +1080,7 @@ static void handle_resize_request(xcb_resize_request_event_t *event) {
|
||||||
* events from X11, handle them, then flush our outgoing queue.
|
* events from X11, handle them, then flush our outgoing queue.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void xcb_prep_cb(struct ev_loop *loop, ev_prepare *watcher, int revents) {
|
static void xcb_prep_cb(struct ev_loop *loop, ev_prepare *watcher, int revents) {
|
||||||
xcb_generic_event_t *event;
|
xcb_generic_event_t *event;
|
||||||
|
|
||||||
if (xcb_connection_has_error(xcb_connection)) {
|
if (xcb_connection_has_error(xcb_connection)) {
|
||||||
|
@ -1177,7 +1177,7 @@ void xcb_prep_cb(struct ev_loop *loop, ev_prepare *watcher, int revents) {
|
||||||
* are triggered
|
* are triggered
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void xcb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
static void xcb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1185,7 +1185,7 @@ void xcb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||||
* depend on 'config'.
|
* depend on 'config'.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
char *init_xcb_early() {
|
char *init_xcb_early(void) {
|
||||||
/* FIXME: xcb_connect leaks memory */
|
/* FIXME: xcb_connect leaks memory */
|
||||||
xcb_connection = xcb_connect(NULL, &screen);
|
xcb_connection = xcb_connect(NULL, &screen);
|
||||||
if (xcb_connection_has_error(xcb_connection)) {
|
if (xcb_connection_has_error(xcb_connection)) {
|
||||||
|
@ -1248,7 +1248,7 @@ char *init_xcb_early() {
|
||||||
* in xcb.
|
* in xcb.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void register_xkb_keyevents() {
|
static void register_xkb_keyevents(void) {
|
||||||
const xcb_query_extension_reply_t *extreply;
|
const xcb_query_extension_reply_t *extreply;
|
||||||
extreply = xcb_get_extension_data(conn, &xcb_xkb_id);
|
extreply = xcb_get_extension_data(conn, &xcb_xkb_id);
|
||||||
if (!extreply->present) {
|
if (!extreply->present) {
|
||||||
|
@ -1272,7 +1272,7 @@ void register_xkb_keyevents() {
|
||||||
* Deregister from xkb keyevents.
|
* Deregister from xkb keyevents.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void deregister_xkb_keyevents() {
|
static void deregister_xkb_keyevents(void) {
|
||||||
xcb_xkb_select_events(conn,
|
xcb_xkb_select_events(conn,
|
||||||
XCB_XKB_ID_USE_CORE_KBD,
|
XCB_XKB_ID_USE_CORE_KBD,
|
||||||
0,
|
0,
|
||||||
|
@ -1338,7 +1338,7 @@ static void send_tray_clientmessage(void) {
|
||||||
* atom. Afterwards, tray clients will send ClientMessages to our window.
|
* atom. Afterwards, tray clients will send ClientMessages to our window.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void init_tray(void) {
|
static void init_tray(void) {
|
||||||
DLOG("Initializing system tray functionality\n");
|
DLOG("Initializing system tray functionality\n");
|
||||||
/* request the tray manager atom for the X11 display we are running on */
|
/* request the tray manager atom for the X11 display we are running on */
|
||||||
char atomname[strlen("_NET_SYSTEM_TRAY_S") + 11];
|
char atomname[strlen("_NET_SYSTEM_TRAY_S") + 11];
|
||||||
|
@ -1567,7 +1567,7 @@ void destroy_window(i3_output *output) {
|
||||||
|
|
||||||
/* Strut partial tells i3 where to reserve space for i3bar. This is determined
|
/* Strut partial tells i3 where to reserve space for i3bar. This is determined
|
||||||
* by the `position` bar config directive. */
|
* by the `position` bar config directive. */
|
||||||
xcb_void_cookie_t config_strut_partial(i3_output *output) {
|
static xcb_void_cookie_t config_strut_partial(i3_output *output) {
|
||||||
/* A local struct to save the strut_partial property */
|
/* A local struct to save the strut_partial property */
|
||||||
struct {
|
struct {
|
||||||
uint32_t left;
|
uint32_t left;
|
||||||
|
|
|
@ -314,13 +314,13 @@ void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name);
|
||||||
*/
|
*/
|
||||||
void cmd_bar(I3_CMD, const char *bar_type, const char *bar_value, const char *bar_id);
|
void cmd_bar(I3_CMD, const char *bar_type, const char *bar_value, const char *bar_id);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Implementation of 'shmlog <size>|toggle|on|off'
|
* Implementation of 'shmlog <size>|toggle|on|off'
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cmd_shmlog(I3_CMD, const char *argument);
|
void cmd_shmlog(I3_CMD, const char *argument);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Implementation of 'debuglog toggle|on|off'
|
* Implementation of 'debuglog toggle|on|off'
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include <yajl/yajl_gen.h>
|
#include <yajl/yajl_gen.h>
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Holds an intermediate represenation of the result of a call to any command.
|
* Holds an intermediate represenation of the result of a call to any command.
|
||||||
* When calling parse_command("floating enable, border none"), the parser will
|
* When calling parse_command("floating enable, border none"), the parser will
|
||||||
* internally use this struct when calling cmd_floating and cmd_border.
|
* internally use this struct when calling cmd_floating and cmd_border.
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
*/
|
*/
|
||||||
Con *con_new_skeleton(Con *parent, i3Window *window);
|
Con *con_new_skeleton(Con *parent, i3Window *window);
|
||||||
|
|
||||||
/* A wrapper for con_new_skeleton, to retain the old con_new behaviour
|
/**
|
||||||
|
* A wrapper for con_new_skeleton, to retain the old con_new behaviour
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Con *con_new(Con *parent, i3Window *window);
|
Con *con_new(Con *parent, i3Window *window);
|
||||||
|
@ -220,7 +221,7 @@ void con_mark_toggle(Con *con, const char *mark, mark_mode_t mode);
|
||||||
*/
|
*/
|
||||||
void con_mark(Con *con, const char *mark, mark_mode_t mode);
|
void con_mark(Con *con, const char *mark, mark_mode_t mode);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Removes marks from containers.
|
* Removes marks from containers.
|
||||||
* If con is NULL, all containers are considered.
|
* If con is NULL, all containers are considered.
|
||||||
* If name is NULL, this removes all existing marks.
|
* If name is NULL, this removes all existing marks.
|
||||||
|
@ -402,7 +403,7 @@ Con *con_descend_focused(Con *con);
|
||||||
*/
|
*/
|
||||||
Con *con_descend_tiling_focused(Con *con);
|
Con *con_descend_tiling_focused(Con *con);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns the leftmost, rightmost, etc. container in sub-tree. For example, if
|
* Returns the leftmost, rightmost, etc. container in sub-tree. For example, if
|
||||||
* direction is D_LEFT, then we return the rightmost container and if direction
|
* direction is D_LEFT, then we return the rightmost container and if direction
|
||||||
* is D_RIGHT, we return the leftmost container. This is because if we are
|
* is D_RIGHT, we return the leftmost container. This is because if we are
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
SLIST_HEAD(variables_head, Variable);
|
SLIST_HEAD(variables_head, Variable);
|
||||||
extern pid_t config_error_nagbar_pid;
|
extern pid_t config_error_nagbar_pid;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* An intermediate reprsentation of the result of a parse_config call.
|
* An intermediate reprsentation of the result of a parse_config call.
|
||||||
* Currently unused, but the JSON output will be useful in the future when we
|
* Currently unused, but the JSON output will be useful in the future when we
|
||||||
* implement a config parsing IPC command.
|
* implement a config parsing IPC command.
|
||||||
|
|
|
@ -427,7 +427,7 @@ void ungrab_all_keys(xcb_connection_t *conn);
|
||||||
* Sends the current bar configuration as an event to all barconfig_update listeners.
|
* Sends the current bar configuration as an event to all barconfig_update listeners.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void update_barconfig();
|
void update_barconfig(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kills the configerror i3-nagbar process, if any.
|
* Kills the configerror i3-nagbar process, if any.
|
||||||
|
|
|
@ -343,7 +343,7 @@ uint32_t get_colorpixel(const char *hex) __attribute__((const));
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Taken from FreeBSD
|
* Taken from FreeBSD
|
||||||
* Returns a pointer to a new string which is a duplicate of the
|
* Returns a pointer to a new string which is a duplicate of the
|
||||||
* string, but only copies at most n characters.
|
* string, but only copies at most n characters.
|
||||||
|
@ -472,7 +472,7 @@ xcb_visualtype_t *get_visualtype(xcb_screen_t *screen);
|
||||||
* release version), based on the git version number.
|
* release version), based on the git version number.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool is_debug_build() __attribute__((const));
|
bool is_debug_build(void) __attribute__((const));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of a temporary file with the specified prefix.
|
* Returns the name of a temporary file with the specified prefix.
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Initializes the Match data structure. This function is necessary because the
|
* Initializes the Match data structure. This function is necessary because the
|
||||||
* members representing boolean values (like dock) need to be initialized with
|
* members representing boolean values (like dock) need to be initialized with
|
||||||
* -1 instead of 0.
|
* -1 instead of 0.
|
||||||
|
|
|
@ -137,7 +137,7 @@ Output *get_output_next(direction_t direction, Output *current, output_close_far
|
||||||
*/
|
*/
|
||||||
Output *get_output_next_wrap(direction_t direction, Output *current);
|
Output *get_output_next_wrap(direction_t direction, Output *current);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Creates an output covering the root window.
|
* Creates an output covering the root window.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,7 +12,10 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
/* This is used to keep a state to pass around when rendering a con in render_con(). */
|
/**
|
||||||
|
* This is used to keep a state to pass around when rendering a con in render_con().
|
||||||
|
*
|
||||||
|
*/
|
||||||
typedef struct render_params {
|
typedef struct render_params {
|
||||||
/* A copy of the coordinates of the container which is being rendered. */
|
/* A copy of the coordinates of the container which is being rendered. */
|
||||||
int x;
|
int x;
|
||||||
|
@ -39,7 +42,8 @@ typedef struct render_params {
|
||||||
*/
|
*/
|
||||||
void render_con(Con *con, bool render_fullscreen);
|
void render_con(Con *con, bool render_fullscreen);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns the height for the decorations
|
* Returns the height for the decorations
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
int render_deco_height(void);
|
int render_deco_height(void);
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
/* Default shmlog size if not set by user. */
|
/* Default shmlog size if not set by user. */
|
||||||
extern const int default_shmlog_size;
|
extern const int default_shmlog_size;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Header of the shmlog file. Used by i3/src/log.c and i3/i3-dump-log/main.c.
|
* Header of the shmlog file. Used by i3/src/log.c and i3/i3-dump-log/main.c.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* Starts the given application by passing it through a shell. We use double
|
* Starts the given application by passing it through a shell. We use double
|
||||||
* fork to avoid zombie processes. As the started application’s parent exits
|
* fork to avoid zombie processes. As the started application’s parent exits
|
||||||
* (immediately), the application is reparented to init (process-id 1), which
|
* (immediately), the application is reparented to init (process-id 1), which
|
||||||
* correctly handles childs, so we don’t have to do it :-).
|
* correctly handles children, so we don’t have to do it :-).
|
||||||
*
|
*
|
||||||
* The shell used to start applications is the system's bourne shell (i.e.,
|
* The shell used to start applications is the system's bourne shell (i.e.,
|
||||||
* /bin/sh).
|
* /bin/sh).
|
||||||
|
|
|
@ -125,7 +125,7 @@ void i3_restart(bool forget_layout);
|
||||||
|
|
||||||
#if defined(__OpenBSD__) || defined(__APPLE__)
|
#if defined(__OpenBSD__) || defined(__APPLE__)
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Taken from FreeBSD
|
* Taken from FreeBSD
|
||||||
* Find the first occurrence of the byte string s in byte string l.
|
* Find the first occurrence of the byte string s in byte string l.
|
||||||
*
|
*
|
||||||
|
|
|
@ -49,14 +49,12 @@ void init_dpi(void) {
|
||||||
dpi = 0;
|
dpi = 0;
|
||||||
goto init_dpi_end;
|
goto init_dpi_end;
|
||||||
}
|
}
|
||||||
dpi = (long)round(in_dpi);
|
dpi = lround(in_dpi);
|
||||||
|
|
||||||
DLOG("Found Xft.dpi = %ld.\n", dpi);
|
DLOG("Found Xft.dpi = %ld.\n", dpi);
|
||||||
|
|
||||||
init_dpi_end:
|
init_dpi_end:
|
||||||
if (resource != NULL) {
|
|
||||||
free(resource);
|
free(resource);
|
||||||
}
|
|
||||||
|
|
||||||
if (database != NULL) {
|
if (database != NULL) {
|
||||||
xcb_xrm_database_free(database);
|
xcb_xrm_database_free(database);
|
||||||
|
|
|
@ -121,7 +121,7 @@ static void draw_util_set_source_color(surface_t *surface, color_t color) {
|
||||||
cairo_set_source_rgba(surface->cr, color.red, color.green, color.blue, color.alpha);
|
cairo_set_source_rgba(surface->cr, color.red, color.green, color.blue, color.alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Draw the given text using libi3.
|
* Draw the given text using libi3.
|
||||||
* This function also marks the surface dirty which is needed if other means of
|
* This function also marks the surface dirty which is needed if other means of
|
||||||
* drawing are used. This will be the case when using XCB to draw text.
|
* drawing are used. This will be the case when using XCB to draw text.
|
||||||
|
@ -140,7 +140,7 @@ void draw_util_text(i3String *text, surface_t *surface, color_t fg_color, color_
|
||||||
cairo_surface_mark_dirty(surface->surface);
|
cairo_surface_mark_dirty(surface->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Draws a filled rectangle.
|
* Draws a filled rectangle.
|
||||||
* This function is a convenience wrapper and takes care of flushing the
|
* This function is a convenience wrapper and takes care of flushing the
|
||||||
* surface as well as restoring the cairo state.
|
* surface as well as restoring the cairo state.
|
||||||
|
@ -167,7 +167,7 @@ void draw_util_rectangle(surface_t *surface, color_t color, double x, double y,
|
||||||
cairo_restore(surface->cr);
|
cairo_restore(surface->cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Clears a surface with the given color.
|
* Clears a surface with the given color.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -191,7 +191,7 @@ void draw_util_clear_surface(surface_t *surface, color_t color) {
|
||||||
cairo_restore(surface->cr);
|
cairo_restore(surface->cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Copies a surface onto another surface.
|
* Copies a surface onto another surface.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -224,9 +224,7 @@ i3Font load_font(const char *pattern, const bool fallback) {
|
||||||
error->error_code);
|
error->error_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
|
||||||
free(error);
|
free(error);
|
||||||
}
|
|
||||||
|
|
||||||
font.pattern = sstrdup(pattern);
|
font.pattern = sstrdup(pattern);
|
||||||
LOG("Using X font %s\n", pattern);
|
LOG("Using X font %s\n", pattern);
|
||||||
|
@ -275,7 +273,6 @@ void free_font(void) {
|
||||||
case FONT_TYPE_XCB: {
|
case FONT_TYPE_XCB: {
|
||||||
/* Close the font and free the info */
|
/* Close the font and free the info */
|
||||||
xcb_close_font(conn, savedFont->specific.xcb.id);
|
xcb_close_font(conn, savedFont->specific.xcb.id);
|
||||||
if (savedFont->specific.xcb.info)
|
|
||||||
free(savedFont->specific.xcb.info);
|
free(savedFont->specific.xcb.info);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* release version), based on the git version number.
|
* release version), based on the git version number.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool is_debug_build() {
|
bool is_debug_build(void) {
|
||||||
/* i3_version contains either something like this:
|
/* i3_version contains either something like this:
|
||||||
* "4.0.2 (2011-11-11, branch "release")".
|
* "4.0.2 (2011-11-11, branch "release")".
|
||||||
* or: "4.0.2-123-gCOFFEEBABE (2011-11-11, branch "next")".
|
* or: "4.0.2-123-gCOFFEEBABE (2011-11-11, branch "next")".
|
||||||
|
|
|
@ -99,7 +99,7 @@ i3String *i3string_from_ucs2(const xcb_char2b_t *from_ucs2, size_t num_glyphs) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Copies the given i3string.
|
* Copies the given i3string.
|
||||||
* Note that this will not free the source string.
|
* Note that this will not free the source string.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -859,8 +859,6 @@ static int fill_rmlvo_from_root(struct xkb_rule_names *xkb_names) {
|
||||||
xcb_intern_atom_reply_t *atom_reply;
|
xcb_intern_atom_reply_t *atom_reply;
|
||||||
size_t content_max_words = 256;
|
size_t content_max_words = 256;
|
||||||
|
|
||||||
xcb_window_t root = root_screen->root;
|
|
||||||
|
|
||||||
atom_reply = xcb_intern_atom_reply(
|
atom_reply = xcb_intern_atom_reply(
|
||||||
conn, xcb_intern_atom(conn, 0, strlen("_XKB_RULES_NAMES"), "_XKB_RULES_NAMES"), NULL);
|
conn, xcb_intern_atom(conn, 0, strlen("_XKB_RULES_NAMES"), "_XKB_RULES_NAMES"), NULL);
|
||||||
if (atom_reply == NULL)
|
if (atom_reply == NULL)
|
||||||
|
|
|
@ -330,7 +330,7 @@ void cmd_move_con_to_workspace(I3_CMD, const char *which) {
|
||||||
ysuccess(true);
|
ysuccess(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Implementation of 'move [window|container] [to] workspace back_and_forth'.
|
* Implementation of 'move [window|container] [to] workspace back_and_forth'.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -2034,7 +2034,7 @@ void cmd_rename_workspace(I3_CMD, const char *old_name, const char *new_name) {
|
||||||
* Implementation of 'bar mode dock|hide|invisible|toggle [<bar_id>]'
|
* Implementation of 'bar mode dock|hide|invisible|toggle [<bar_id>]'
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool cmd_bar_mode(const char *bar_mode, const char *bar_id) {
|
static bool cmd_bar_mode(const char *bar_mode, const char *bar_id) {
|
||||||
int mode = M_DOCK;
|
int mode = M_DOCK;
|
||||||
bool toggle = false;
|
bool toggle = false;
|
||||||
if (strcmp(bar_mode, "dock") == 0)
|
if (strcmp(bar_mode, "dock") == 0)
|
||||||
|
@ -2079,7 +2079,7 @@ bool cmd_bar_mode(const char *bar_mode, const char *bar_id) {
|
||||||
* Implementation of 'bar hidden_state hide|show|toggle [<bar_id>]'
|
* Implementation of 'bar hidden_state hide|show|toggle [<bar_id>]'
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool cmd_bar_hidden_state(const char *bar_hidden_state, const char *bar_id) {
|
static bool cmd_bar_hidden_state(const char *bar_hidden_state, const char *bar_id) {
|
||||||
int hidden_state = S_SHOW;
|
int hidden_state = S_SHOW;
|
||||||
bool toggle = false;
|
bool toggle = false;
|
||||||
if (strcmp(bar_hidden_state, "hide") == 0)
|
if (strcmp(bar_hidden_state, "hide") == 0)
|
||||||
|
|
|
@ -157,7 +157,7 @@ static long get_long(const char *identifier) {
|
||||||
// TODO move to a common util
|
// TODO move to a common util
|
||||||
static void clear_stack(void) {
|
static void clear_stack(void) {
|
||||||
for (int c = 0; c < 10; c++) {
|
for (int c = 0; c < 10; c++) {
|
||||||
if (stack[c].type == STACK_STR && stack[c].val.str != NULL)
|
if (stack[c].type == STACK_STR)
|
||||||
free(stack[c].val.str);
|
free(stack[c].val.str);
|
||||||
stack[c].identifier = NULL;
|
stack[c].identifier = NULL;
|
||||||
stack[c].val.str = NULL;
|
stack[c].val.str = NULL;
|
||||||
|
|
|
@ -312,7 +312,7 @@ bool con_has_managed_window(Con *con) {
|
||||||
return (con != NULL && con->window != NULL && con->window->id != XCB_WINDOW_NONE && con_get_workspace(con) != NULL);
|
return (con != NULL && con->window != NULL && con->window->id != XCB_WINDOW_NONE && con_get_workspace(con) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns true if this node has regular or floating children.
|
* Returns true if this node has regular or floating children.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -526,7 +526,7 @@ Con *con_get_fullscreen_covering_ws(Con *ws) {
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns true if the container is internal, such as __i3_scratch
|
* Returns true if the container is internal, such as __i3_scratch
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -896,7 +896,7 @@ int con_num_children(Con *con) {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Returns the number of visible non-floating children of this container.
|
* Returns the number of visible non-floating children of this container.
|
||||||
* For example, if the container contains a hsplit which has two children,
|
* For example, if the container contains a hsplit which has two children,
|
||||||
* this will return 2 instead of 1.
|
* this will return 2 instead of 1.
|
||||||
|
|
|
@ -18,7 +18,7 @@ Config config;
|
||||||
struct modes_head modes;
|
struct modes_head modes;
|
||||||
struct barconfig_head barconfigs = TAILQ_HEAD_INITIALIZER(barconfigs);
|
struct barconfig_head barconfigs = TAILQ_HEAD_INITIALIZER(barconfigs);
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Ungrabs all keys, to be called before re-grabbing the keys because of a
|
* Ungrabs all keys, to be called before re-grabbing the keys because of a
|
||||||
* mapping_notify event or a configuration file reload
|
* mapping_notify event or a configuration file reload
|
||||||
*
|
*
|
||||||
|
@ -32,7 +32,7 @@ void ungrab_all_keys(xcb_connection_t *conn) {
|
||||||
* Sends the current bar configuration as an event to all barconfig_update listeners.
|
* Sends the current bar configuration as an event to all barconfig_update listeners.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void update_barconfig() {
|
void update_barconfig(void) {
|
||||||
Barconfig *current;
|
Barconfig *current;
|
||||||
TAILQ_FOREACH(current, &barconfigs, configs) {
|
TAILQ_FOREACH(current, &barconfigs, configs) {
|
||||||
ipc_send_barconfig_update_event(current);
|
ipc_send_barconfig_update_event(current);
|
||||||
|
|
|
@ -171,7 +171,7 @@ static long get_long(const char *identifier) {
|
||||||
|
|
||||||
static void clear_stack(void) {
|
static void clear_stack(void) {
|
||||||
for (int c = 0; c < 10; c++) {
|
for (int c = 0; c < 10; c++) {
|
||||||
if (stack[c].type == STACK_STR && stack[c].val.str != NULL)
|
if (stack[c].type == STACK_STR)
|
||||||
free(stack[c].val.str);
|
free(stack[c].val.str);
|
||||||
stack[c].identifier = NULL;
|
stack[c].identifier = NULL;
|
||||||
stack[c].val.str = NULL;
|
stack[c].val.str = NULL;
|
||||||
|
|
|
@ -59,7 +59,7 @@ static void floating_set_hint_atom(Con *con, bool floating) {
|
||||||
xcb_flush(conn);
|
xcb_flush(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Called when a floating window is created or resized.
|
* Called when a floating window is created or resized.
|
||||||
* This function resizes the window if its size is higher or lower than the
|
* This function resizes the window if its size is higher or lower than the
|
||||||
* configured maximum/minimum size, respectively.
|
* configured maximum/minimum size, respectively.
|
||||||
|
@ -899,13 +899,17 @@ bool floating_reposition(Con *con, Rect newrect) {
|
||||||
|
|
||||||
con->rect = newrect;
|
con->rect = newrect;
|
||||||
|
|
||||||
floating_maybe_reassign_ws(con);
|
bool reassigned = floating_maybe_reassign_ws(con);
|
||||||
|
|
||||||
/* If this is a scratchpad window, don't auto center it from now on. */
|
/* If this is a scratchpad window, don't auto center it from now on. */
|
||||||
if (con->scratchpad_state == SCRATCHPAD_FRESH)
|
if (con->scratchpad_state == SCRATCHPAD_FRESH)
|
||||||
con->scratchpad_state = SCRATCHPAD_CHANGED;
|
con->scratchpad_state = SCRATCHPAD_CHANGED;
|
||||||
|
|
||||||
tree_render();
|
/* Workspace change will already result in a tree_render. */
|
||||||
|
if (!reassigned) {
|
||||||
|
render_con(con, false);
|
||||||
|
x_push_node(con);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -949,7 +949,7 @@ static void handle_client_message(xcb_client_message_event_t *event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool handle_window_type(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
static bool handle_window_type(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
||||||
xcb_atom_t atom, xcb_get_property_reply_t *reply) {
|
xcb_atom_t atom, xcb_get_property_reply_t *reply) {
|
||||||
Con *con;
|
Con *con;
|
||||||
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
||||||
|
|
|
@ -1580,7 +1580,7 @@ void ipc_send_workspace_event(const char *change, Con *current, Con *old) {
|
||||||
y(free);
|
y(free);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* For the window events we send, along the usual "change" field,
|
* For the window events we send, along the usual "change" field,
|
||||||
* also the window container, in "container".
|
* also the window container, in "container".
|
||||||
*/
|
*/
|
||||||
|
@ -1610,7 +1610,7 @@ void ipc_send_window_event(const char *property, Con *con) {
|
||||||
setlocale(LC_NUMERIC, "");
|
setlocale(LC_NUMERIC, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* For the barconfig update events, we send the serialized barconfig.
|
* For the barconfig update events, we send the serialized barconfig.
|
||||||
*/
|
*/
|
||||||
void ipc_send_barconfig_update_event(Barconfig *barconfig) {
|
void ipc_send_barconfig_update_event(Barconfig *barconfig) {
|
||||||
|
|
|
@ -153,8 +153,7 @@ static int json_end_map(void *ctx) {
|
||||||
free(marks[i]);
|
free(marks[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(marks);
|
FREE(marks);
|
||||||
marks = NULL;
|
|
||||||
num_marks = 0;
|
num_marks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
* RLIM_INFINITY for i3 debugging versions. */
|
* RLIM_INFINITY for i3 debugging versions. */
|
||||||
struct rlimit original_rlimit_core;
|
struct rlimit original_rlimit_core;
|
||||||
|
|
||||||
/** The number of file descriptors passed via socket activation. */
|
/* The number of file descriptors passed via socket activation. */
|
||||||
int listen_fds;
|
int listen_fds;
|
||||||
|
|
||||||
/* We keep the xcb_prepare watcher around to be able to enable and disable it
|
/* We keep the xcb_prepare watcher around to be able to enable and disable it
|
||||||
|
|
10
src/manage.c
10
src/manage.c
|
@ -246,17 +246,13 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||||
|
|
||||||
DLOG("Initial geometry: (%d, %d, %d, %d)\n", geom->x, geom->y, geom->width, geom->height);
|
DLOG("Initial geometry: (%d, %d, %d, %d)\n", geom->x, geom->y, geom->width, geom->height);
|
||||||
|
|
||||||
Con *nc = NULL;
|
|
||||||
Match *match = NULL;
|
|
||||||
Assignment *assignment;
|
|
||||||
|
|
||||||
/* TODO: two matches for one container */
|
|
||||||
|
|
||||||
/* See if any container swallows this new window */
|
/* See if any container swallows this new window */
|
||||||
nc = con_for_window(search_at, cwindow, &match);
|
Match *match = NULL;
|
||||||
|
Con *nc = con_for_window(search_at, cwindow, &match);
|
||||||
const bool match_from_restart_mode = (match && match->restart_mode);
|
const bool match_from_restart_mode = (match && match->restart_mode);
|
||||||
if (nc == NULL) {
|
if (nc == NULL) {
|
||||||
Con *wm_desktop_ws = NULL;
|
Con *wm_desktop_ws = NULL;
|
||||||
|
Assignment *assignment;
|
||||||
|
|
||||||
/* If not, check if it is assigned to a specific workspace */
|
/* If not, check if it is assigned to a specific workspace */
|
||||||
if ((assignment = assignment_for(cwindow, A_TO_WORKSPACE)) ||
|
if ((assignment = assignment_for(cwindow, A_TO_WORKSPACE)) ||
|
||||||
|
|
|
@ -550,7 +550,7 @@ static void output_change_mode(xcb_connection_t *conn, Output *output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If default_orientation is NO_ORIENTATION, we change the orientation of
|
/* If default_orientation is NO_ORIENTATION, we change the orientation of
|
||||||
* the workspaces and their childs depending on output resolution. This is
|
* the workspaces and their children depending on output resolution. This is
|
||||||
* only done for workspaces with maximum one child. */
|
* only done for workspaces with maximum one child. */
|
||||||
if (config.default_orientation == NO_ORIENTATION) {
|
if (config.default_orientation == NO_ORIENTATION) {
|
||||||
TAILQ_FOREACH(workspace, &(content->nodes_head), nodes) {
|
TAILQ_FOREACH(workspace, &(content->nodes_head), nodes) {
|
||||||
|
|
|
@ -62,14 +62,13 @@ static int sighandler_backtrace(void) {
|
||||||
|
|
||||||
char *filename = NULL;
|
char *filename = NULL;
|
||||||
int suffix = 0;
|
int suffix = 0;
|
||||||
struct stat bt;
|
|
||||||
/* Find a unique filename for the backtrace (since the PID of i3 stays the
|
/* Find a unique filename for the backtrace (since the PID of i3 stays the
|
||||||
* same), so that we don’t overwrite earlier backtraces. */
|
* same), so that we don’t overwrite earlier backtraces. */
|
||||||
do {
|
do {
|
||||||
FREE(filename);
|
FREE(filename);
|
||||||
sasprintf(&filename, "%s/i3-backtrace.%d.%d.txt", tmpdir, pid_parent, suffix);
|
sasprintf(&filename, "%s/i3-backtrace.%d.%d.txt", tmpdir, pid_parent, suffix);
|
||||||
suffix++;
|
suffix++;
|
||||||
} while (stat(filename, &bt) == 0);
|
} while (path_exists(filename));
|
||||||
|
|
||||||
pid_t pid_gdb = fork();
|
pid_t pid_gdb = fork();
|
||||||
if (pid_gdb < 0) {
|
if (pid_gdb < 0) {
|
||||||
|
@ -130,7 +129,7 @@ static int sighandler_backtrace(void) {
|
||||||
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
|
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
|
||||||
DLOG("GDB did not run properly\n");
|
DLOG("GDB did not run properly\n");
|
||||||
return -1;
|
return -1;
|
||||||
} else if (stat(filename, &bt) == -1) {
|
} else if (!path_exists(filename)) {
|
||||||
DLOG("GDB executed successfully, but no backtrace was generated\n");
|
DLOG("GDB executed successfully, but no backtrace was generated\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +299,7 @@ static void sighandler_handle_key_press(xcb_key_press_event_t *event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_signal(int sig, siginfo_t *info, void *data) {
|
static void handle_signal(int sig, siginfo_t *info, void *data) {
|
||||||
DLOG("i3 crashed. SIG: %d\n", sig);
|
DLOG("i3 crashed. SIG: %d\n", sig);
|
||||||
|
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
|
|
|
@ -95,7 +95,7 @@ static int _prune_startup_sequences(void) {
|
||||||
return active_sequences;
|
return active_sequences;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Deletes a startup sequence, ignoring whether its timeout has elapsed.
|
* Deletes a startup sequence, ignoring whether its timeout has elapsed.
|
||||||
* Useful when e.g. a window is moved between workspaces and its children
|
* Useful when e.g. a window is moved between workspaces and its children
|
||||||
* shouldn't spawn on the original workspace.
|
* shouldn't spawn on the original workspace.
|
||||||
|
@ -118,10 +118,10 @@ void startup_sequence_delete(struct Startup_Sequence *sequence) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Starts the given application by passing it through a shell. We use double fork
|
* Starts the given application by passing it through a shell. We use double
|
||||||
* to avoid zombie processes. As the started application’s parent exits (immediately),
|
* fork to avoid zombie processes. As the started application’s parent exits
|
||||||
* the application is reparented to init (process-id 1), which correctly handles
|
* (immediately), the application is reparented to init (process-id 1), which
|
||||||
* childs, so we don’t have to do it :-).
|
* correctly handles children, so we don’t have to do it :-).
|
||||||
*
|
*
|
||||||
* The shell used to start applications is the system's bourne shell (i.e.,
|
* The shell used to start applications is the system's bourne shell (i.e.,
|
||||||
* /bin/sh).
|
* /bin/sh).
|
||||||
|
@ -257,7 +257,7 @@ void startup_monitor_event(SnMonitorEvent *event, void *userdata) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Renames workspaces that are mentioned in the startup sequences.
|
* Renames workspaces that are mentioned in the startup sequences.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -273,7 +273,7 @@ void startup_sequence_rename_workspace(const char *old_name, const char *new_nam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Gets the stored startup sequence for the _NET_STARTUP_ID of a given window.
|
* Gets the stored startup sequence for the _NET_STARTUP_ID of a given window.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -217,7 +217,7 @@ static char **add_argument(char **original, char *opt_char, char *opt_arg, char
|
||||||
#define y(x, ...) yajl_gen_##x(gen, ##__VA_ARGS__)
|
#define y(x, ...) yajl_gen_##x(gen, ##__VA_ARGS__)
|
||||||
#define ystr(str) yajl_gen_string(gen, (unsigned char *)str, strlen(str))
|
#define ystr(str) yajl_gen_string(gen, (unsigned char *)str, strlen(str))
|
||||||
|
|
||||||
char *store_restart_layout(void) {
|
static char *store_restart_layout(void) {
|
||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
yajl_gen gen = yajl_gen_alloc(NULL);
|
yajl_gen gen = yajl_gen_alloc(NULL);
|
||||||
|
|
||||||
|
@ -501,8 +501,7 @@ ssize_t slurp(const char *path, char **buf) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if ((ssize_t)n != stbuf.st_size) {
|
if ((ssize_t)n != stbuf.st_size) {
|
||||||
ELOG("File \"%s\" could not be read entirely: got %zd, want %" PRIi64 "\n", path, n, (int64_t)stbuf.st_size);
|
ELOG("File \"%s\" could not be read entirely: got %zd, want %" PRIi64 "\n", path, n, (int64_t)stbuf.st_size);
|
||||||
free(*buf);
|
FREE(*buf);
|
||||||
*buf = NULL;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (ssize_t)n;
|
return (ssize_t)n;
|
||||||
|
|
|
@ -308,7 +308,7 @@ bool workspace_is_visible(Con *ws) {
|
||||||
* XXX: we need to clean up all this recursive walking code.
|
* XXX: we need to clean up all this recursive walking code.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Con *_get_sticky(Con *con, const char *sticky_group, Con *exclude) {
|
static Con *_get_sticky(Con *con, const char *sticky_group, Con *exclude) {
|
||||||
Con *current;
|
Con *current;
|
||||||
|
|
||||||
TAILQ_FOREACH(current, &(con->nodes_head), nodes) {
|
TAILQ_FOREACH(current, &(con->nodes_head), nodes) {
|
||||||
|
@ -914,7 +914,7 @@ Con *workspace_attach_to(Con *ws) {
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Creates a new container and re-parents all of children from the given
|
* Creates a new container and re-parents all of children from the given
|
||||||
* workspace into it.
|
* workspace into it.
|
||||||
*
|
*
|
||||||
|
@ -949,7 +949,7 @@ Con *workspace_encapsulate(Con *ws) {
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Move the given workspace to the specified output.
|
* Move the given workspace to the specified output.
|
||||||
* This returns true if and only if moving the workspace was successful.
|
* This returns true if and only if moving the workspace was successful.
|
||||||
*/
|
*/
|
||||||
|
|
10
src/x.c
10
src/x.c
|
@ -42,7 +42,7 @@ typedef struct con_state {
|
||||||
bool child_mapped;
|
bool child_mapped;
|
||||||
bool is_hidden;
|
bool is_hidden;
|
||||||
|
|
||||||
/** The con for which this state is. */
|
/* The con for which this state is. */
|
||||||
Con *con;
|
Con *con;
|
||||||
|
|
||||||
/* For reparenting, we have a flag (need_reparent) and the X ID of the old
|
/* For reparenting, we have a flag (need_reparent) and the X ID of the old
|
||||||
|
@ -504,14 +504,12 @@ void x_draw_decoration(Con *con) {
|
||||||
/* 3: draw a rectangle in border color around the client */
|
/* 3: draw a rectangle in border color around the client */
|
||||||
if (p->border_style != BS_NONE && p->con_is_leaf) {
|
if (p->border_style != BS_NONE && p->con_is_leaf) {
|
||||||
/* We might hide some borders adjacent to the screen-edge */
|
/* We might hide some borders adjacent to the screen-edge */
|
||||||
adjacent_t borders_to_hide = ADJ_NONE;
|
adjacent_t borders_to_hide = con_adjacent_borders(con) & config.hide_edge_borders;
|
||||||
borders_to_hide = con_adjacent_borders(con) & config.hide_edge_borders;
|
|
||||||
|
|
||||||
Rect br = con_border_style_rect(con);
|
Rect br = con_border_style_rect(con);
|
||||||
|
|
||||||
/* These rectangles represent the border around the child window
|
/* These rectangles represent the border around the child window
|
||||||
* (left, bottom and right part). We don’t just fill the whole
|
* (left, bottom and right part). We don’t just fill the whole
|
||||||
* rectangle because some childs are not freely resizable and we want
|
* rectangle because some children are not freely resizable and we want
|
||||||
* their background color to "shine through". */
|
* their background color to "shine through". */
|
||||||
if (!(borders_to_hide & ADJ_LEFT_SCREEN_EDGE)) {
|
if (!(borders_to_hide & ADJ_LEFT_SCREEN_EDGE)) {
|
||||||
draw_util_rectangle(&(con->frame_buffer), p->color->child_border, 0, 0, br.x, r->height);
|
draw_util_rectangle(&(con->frame_buffer), p->color->child_border, 0, 0, br.x, r->height);
|
||||||
|
@ -1254,7 +1252,7 @@ void x_set_name(Con *con, const char *name) {
|
||||||
* Set up the I3_SHMLOG_PATH atom.
|
* Set up the I3_SHMLOG_PATH atom.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void update_shmlog_atom() {
|
void update_shmlog_atom(void) {
|
||||||
if (*shmlogname == '\0') {
|
if (*shmlogname == '\0') {
|
||||||
xcb_delete_property(conn, root, A_I3_SHMLOG_PATH);
|
xcb_delete_property(conn, root, A_I3_SHMLOG_PATH);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,7 +34,7 @@ static void read_server_x11_packet_cb(EV_P_ ev_io *w, int revents);
|
||||||
|
|
||||||
static char *sun_path = NULL;
|
static char *sun_path = NULL;
|
||||||
|
|
||||||
void cleanup_socket(void) {
|
static void cleanup_socket(void) {
|
||||||
if (sun_path != NULL) {
|
if (sun_path != NULL) {
|
||||||
unlink(sun_path);
|
unlink(sun_path);
|
||||||
free(sun_path);
|
free(sun_path);
|
||||||
|
|
|
@ -67,11 +67,8 @@ my $tmp = fresh_workspace;
|
||||||
my ($first_floating, $second_floating);
|
my ($first_floating, $second_floating);
|
||||||
|
|
||||||
synced_warp_pointer(0, 0);
|
synced_warp_pointer(0, 0);
|
||||||
$first_floating = open_floating_window;
|
$first_floating = open_floating_window(rect => [ 1, 1, 100, 100 ]);
|
||||||
$first_floating->rect(X11::XCB::Rect->new(x => 1, y => 1, width => 100, height => 100));
|
$second_floating = open_floating_window(rect => [ 50, 50, 100, 100 ]);
|
||||||
$second_floating = open_floating_window;
|
|
||||||
$second_floating->rect(X11::XCB::Rect->new(x => 50, y => 50, width => 100, height => 100));
|
|
||||||
sync_with_i3;
|
|
||||||
$first = open_window;
|
$first = open_window;
|
||||||
|
|
||||||
is($x->input_focus, $first->id, 'first (tiling) window focused');
|
is($x->input_focus, $first->id, 'first (tiling) window focused');
|
||||||
|
|
Loading…
Reference in New Issue