From 19fd6817af1e070cedde6d94d557e0944f8fa44d Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 29 Dec 2015 12:47:12 +0100 Subject: [PATCH] Refactor extern definition of conn and root_screen --- i3bar/include/xcb.h | 2 -- include/i3.h | 2 -- include/libi3.h | 7 +++++++ libi3/dpi.c | 2 -- libi3/font.c | 3 --- libi3/get_mod_mask.c | 2 -- src/floating.c | 2 -- src/resize.c | 2 -- 8 files changed, 7 insertions(+), 15 deletions(-) diff --git a/i3bar/include/xcb.h b/i3bar/include/xcb.h index 0a9bd7e4..03bfc51e 100644 --- a/i3bar/include/xcb.h +++ b/i3bar/include/xcb.h @@ -24,8 +24,6 @@ #define XEMBED_MAPPED (1 << 0) #define XEMBED_EMBEDDED_NOTIFY 0 -xcb_connection_t *xcb_connection; - /* We define xcb_request_failed as a macro to include the relevant line number */ #define xcb_request_failed(cookie, err_msg) _xcb_request_failed(cookie, err_msg, __LINE__) int _xcb_request_failed(xcb_void_cookie_t cookie, char *err_msg, int line); diff --git a/include/i3.h b/include/i3.h index 2a431486..254c4d23 100644 --- a/include/i3.h +++ b/include/i3.h @@ -35,7 +35,6 @@ extern struct rlimit original_rlimit_core; extern bool debug_build; /** The number of file descriptors passed via socket activation. */ extern int listen_fds; -extern xcb_connection_t *conn; extern int conn_screen; /** * The EWMH support window that is used to indicate that an EWMH-compliant @@ -61,7 +60,6 @@ extern TAILQ_HEAD(autostarts_always_head, Autostart) autostarts_always; extern TAILQ_HEAD(ws_assignments_head, Workspace_Assignment) ws_assignments; extern TAILQ_HEAD(assignments_head, Assignment) assignments; extern SLIST_HEAD(stack_wins_head, Stack_Window) stack_wins; -extern xcb_screen_t *root_screen; /* Color depth, visual id and colormap to use when creating windows and * pixmaps. Will use 32 bit depth and an appropriate visual, if available, diff --git a/include/libi3.h b/include/libi3.h index 08b01402..90ed8989 100644 --- a/include/libi3.h +++ b/include/libi3.h @@ -26,6 +26,13 @@ #define DEFAULT_DIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) +/** + * XCB connection and root screen + * + */ +extern xcb_connection_t *conn; +extern xcb_screen_t *root_screen; + /** * Opaque data structure for storing strings. * diff --git a/libi3/dpi.c b/libi3/dpi.c index a347b08f..897e6e40 100644 --- a/libi3/dpi.c +++ b/libi3/dpi.c @@ -8,8 +8,6 @@ #include "libi3.h" #include -extern xcb_screen_t *root_screen; - /* * Convert a logical amount of pixels (e.g. 2 pixels on a “standard” 96 DPI * screen) to a corresponding amount of physical pixels on a standard or retina diff --git a/libi3/font.c b/libi3/font.c index c90f8be0..c09a7fb1 100644 --- a/libi3/font.c +++ b/libi3/font.c @@ -19,9 +19,6 @@ #include "libi3.h" -extern xcb_connection_t *conn; -extern xcb_screen_t *root_screen; - static const i3Font *savedFont = NULL; #if PANGO_SUPPORT diff --git a/libi3/get_mod_mask.c b/libi3/get_mod_mask.c index 3b6976ad..ac71e6b2 100644 --- a/libi3/get_mod_mask.c +++ b/libi3/get_mod_mask.c @@ -12,8 +12,6 @@ #include "libi3.h" -extern xcb_connection_t *conn; - /* * All-in-one function which returns the modifier mask (XCB_MOD_MASK_*) for the * given keysymbol, for example for XCB_NUM_LOCK (usually configured to mod2). diff --git a/src/floating.c b/src/floating.c index 3aa42364..2b8a88d1 100644 --- a/src/floating.c +++ b/src/floating.c @@ -11,8 +11,6 @@ */ #include "all.h" -extern xcb_connection_t *conn; - /* * Calculates sum of heights and sum of widths of all currently active outputs * diff --git a/src/resize.c b/src/resize.c index 31a78354..5d9eb2eb 100644 --- a/src/resize.c +++ b/src/resize.c @@ -11,8 +11,6 @@ */ #include "all.h" -extern xcb_connection_t *conn; - /* * This is an ugly data structure which we need because there is no standard * way of having nested functions (only available as a gcc extension at the