From d11e862919241bb5738f4e01ef226e0a4135eade Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sat, 25 Jan 2020 15:47:36 +0100 Subject: [PATCH 1/5] Delete duplicate definition of ewmh_window See #3914 --- src/x.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/x.c b/src/x.c index 43824bbc..8d89eafd 100644 --- a/src/x.c +++ b/src/x.c @@ -14,8 +14,6 @@ #define MAX(x, y) ((x) > (y) ? (x) : (y)) #endif -xcb_window_t ewmh_window; - /* Stores the X11 window ID of the currently focused window */ xcb_window_t focused_id = XCB_NONE; From e9f011397a508b4e3d75fd5fb46e06a87d84348e Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sat, 25 Jan 2020 15:59:37 +0100 Subject: [PATCH 2/5] libi3: Make visual_type extern See #3914 --- i3-config-wizard/main.c | 1 + i3-input/main.c | 5 +++-- i3-nagbar/main.c | 5 +++-- libi3/draw_util.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/i3-config-wizard/main.c b/i3-config-wizard/main.c index 7c1f00a3..f999de30 100644 --- a/i3-config-wizard/main.c +++ b/i3-config-wizard/main.c @@ -68,6 +68,7 @@ } while (0) #include "xcb.h" +xcb_visualtype_t *visual_type = NULL; #include "libi3.h" #define TEXT_PADDING logical_px(4) diff --git a/i3-input/main.c b/i3-input/main.c index f15a74ab..e495fe10 100644 --- a/i3-input/main.c +++ b/i3-input/main.c @@ -8,8 +8,6 @@ * to i3. * */ -#include "libi3.h" - #include #include #include @@ -27,6 +25,9 @@ #include #include +xcb_visualtype_t *visual_type = NULL; +#include "libi3.h" + #include #include "keysym2ucs.h" diff --git a/i3-nagbar/main.c b/i3-nagbar/main.c index c7b23da5..5099cf54 100644 --- a/i3-nagbar/main.c +++ b/i3-nagbar/main.c @@ -8,8 +8,6 @@ * when the user has an error in their configuration file. * */ -#include "libi3.h" - #include #include #include @@ -32,6 +30,9 @@ #include #include +xcb_visualtype_t *visual_type = NULL; +#include "libi3.h" + #define SN_API_NOT_YET_FROZEN 1 #include diff --git a/libi3/draw_util.c b/libi3/draw_util.c index f88360dc..092ac967 100644 --- a/libi3/draw_util.c +++ b/libi3/draw_util.c @@ -16,7 +16,7 @@ #include /* The default visual_type to use if none is specified when creating the surface. Must be defined globally. */ -xcb_visualtype_t *visual_type; +extern xcb_visualtype_t *visual_type; /* Forward declarations */ static void draw_util_set_source_color(surface_t *surface, color_t color); From d14e59b3a766b17ade2d09afcb5c5d572d85a20c Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sat, 25 Jan 2020 16:26:54 +0100 Subject: [PATCH 3/5] i3bar: Make header declarations extern See #3914 --- i3bar/include/common.h | 6 +++--- i3bar/include/configuration.h | 2 +- i3bar/include/outputs.h | 2 +- i3bar/include/xcb.h | 2 +- i3bar/src/config.c | 1 + i3bar/src/main.c | 2 ++ i3bar/src/outputs.c | 1 + i3bar/src/xcb.c | 3 +++ 8 files changed, 13 insertions(+), 6 deletions(-) diff --git a/i3bar/include/common.h b/i3bar/include/common.h index fe7444a3..222f42dd 100644 --- a/i3bar/include/common.h +++ b/i3bar/include/common.h @@ -17,7 +17,7 @@ typedef struct rect_t rect; -struct ev_loop *main_loop; +extern struct ev_loop *main_loop; struct rect_t { int x; @@ -82,8 +82,8 @@ struct status_block { blocks; }; -TAILQ_HEAD(statusline_head, status_block) -statusline_head; +extern TAILQ_HEAD(statusline_head, status_block) + statusline_head; #include "child.h" #include "ipc.h" diff --git a/i3bar/include/configuration.h b/i3bar/include/configuration.h index aeb7db19..70167247 100644 --- a/i3bar/include/configuration.h +++ b/i3bar/include/configuration.h @@ -74,7 +74,7 @@ typedef struct config_t { S_SHOW = 1 } hidden_state; } config_t; -config_t config; +extern config_t config; /** * Start parsing the received bar configuration JSON string diff --git a/i3bar/include/outputs.h b/i3bar/include/outputs.h index 29a7bcd3..5bb19c40 100644 --- a/i3bar/include/outputs.h +++ b/i3bar/include/outputs.h @@ -19,7 +19,7 @@ typedef struct i3_output i3_output; SLIST_HEAD(outputs_head, i3_output); -struct outputs_head* outputs; +extern struct outputs_head* outputs; /* * Start parsing the received JSON string diff --git a/i3bar/include/xcb.h b/i3bar/include/xcb.h index 760ebcdb..0e3ca22d 100644 --- a/i3bar/include/xcb.h +++ b/i3bar/include/xcb.h @@ -53,7 +53,7 @@ struct xcb_color_strings_t { typedef struct xcb_colors_t xcb_colors_t; /* Cached width of the custom separator if one was set */ -int separator_symbol_width; +extern int separator_symbol_width; /* * Early initialization of the connection to X11: Everything which does not diff --git a/i3bar/src/config.c b/i3bar/src/config.c index 26004071..29b0908b 100644 --- a/i3bar/src/config.c +++ b/i3bar/src/config.c @@ -19,6 +19,7 @@ #include +config_t config; static char *cur_key; static bool parsing_bindings; static bool parsing_tray_outputs; diff --git a/i3bar/src/main.c b/i3bar/src/main.c index aa6bdbea..65cb00ff 100644 --- a/i3bar/src/main.c +++ b/i3bar/src/main.c @@ -17,6 +17,8 @@ #include #include +struct ev_loop *main_loop; + /* * Having verboselog(), errorlog() and debuglog() is necessary when using libi3. * diff --git a/i3bar/src/outputs.c b/i3bar/src/outputs.c index 4c9ce651..2fa3195c 100644 --- a/i3bar/src/outputs.c +++ b/i3bar/src/outputs.c @@ -252,6 +252,7 @@ static yajl_callbacks outputs_callbacks = { .yajl_end_map = outputs_end_map_cb, }; +struct outputs_head *outputs; /* * Initiate the outputs list * diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index 6b135e44..7b97beea 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -140,6 +140,9 @@ static const int tray_loff_px = 2; /* Vertical offset between the bar and a separator */ static const int sep_voff_px = 4; +/* Cached width of the custom separator if one was set */ +int separator_symbol_width; + int _xcb_request_failed(xcb_void_cookie_t cookie, char *err_msg, int line) { xcb_generic_error_t *err; if ((err = xcb_request_check(xcb_connection, cookie)) != NULL) { From 2eac53fada7a8ac8fc28b0b9e894c5f2899b8aa2 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sat, 1 Feb 2020 17:29:44 +0100 Subject: [PATCH 4/5] atoms: Properly declare as global variables See #3914 --- include/xcb.h | 2 +- src/main.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/xcb.h b/include/xcb.h index 53c932bf..32110c7d 100644 --- a/include/xcb.h +++ b/include/xcb.h @@ -56,7 +56,7 @@ XCB_EVENT_MASK_FOCUS_CHANGE | \ XCB_EVENT_MASK_ENTER_WINDOW) -#define xmacro(atom) xcb_atom_t A_##atom; +#define xmacro(atom) extern xcb_atom_t A_##atom; #include "atoms.xmacro" #undef xmacro diff --git a/src/main.c b/src/main.c index 42d15735..e4c6b2c9 100644 --- a/src/main.c +++ b/src/main.c @@ -93,6 +93,11 @@ bool shape_supported = true; bool force_xinerama = false; +/* Define all atoms as global variables */ +#define xmacro(atom) xcb_atom_t A_##atom; +#include "atoms.xmacro" +#undef xmacro + /* * This callback is only a dummy, see xcb_prepare_cb. * See also man libev(3): "ev_prepare" and "ev_check" - customise your event loop From cb1012e608a57e0873b58fb3e24cceabe43e1231 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Sat, 1 Feb 2020 17:41:19 +0100 Subject: [PATCH 5/5] Travis: Default to -fno-common See #3914 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0133fc71..b56bf684 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ install: 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-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 -Wstrict-prototypes -Wmissing-prototypes -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 -fno-common"' - 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 - ./travis/skip-pkg.sh || docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${BASENAME} ./travis/debian-build.sh deb/debian-amd64/DIST