diff --git a/CMakeLists.txt b/CMakeLists.txt index 3632d40..07d4ada 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ add_executable(f00bar xcb.c xcb.h yml.c yml.h - bar/bar.c bar.h + bar/bar.c bar/private.h bar.h ) # Make global symbols in f00bar visible to dlopen:ed plugins diff --git a/bar/bar.c b/bar/bar.c index 14af0f1..39d48fb 100644 --- a/bar/bar.c +++ b/bar/bar.c @@ -1,4 +1,5 @@ #include "../bar.h" +#include "private.h" #include #include @@ -12,74 +13,11 @@ #include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - #define LOG_MODULE "bar" #define LOG_ENABLE_DBG 0 #include "../log.h" #include "../xcb.h" -struct private { - /* From bar_config */ - char *monitor; - enum bar_location location; - int height; - int left_spacing, right_spacing; - int left_margin, right_margin; - - struct rgba background; - - struct { - int width; - struct rgba color; - } border; - - struct { - struct module **mods; - struct exposable **exps; - size_t count; - } left; - struct { - struct module **mods; - struct exposable **exps; - size_t count; - } center; - struct { - struct module **mods; - struct exposable **exps; - size_t count; - } right; - - /* Calculated run-time */ - int x, y; - int width; - int height_with_border; - - /* Name of currently active cursor */ - char *cursor_name; - - cairo_t *cairo; - cairo_surface_t *cairo_surface; - - /* Backend specifics */ - xcb_connection_t *conn; - - xcb_window_t win; - xcb_colormap_t colormap; - xcb_pixmap_t pixmap; - xcb_gc_t gc; - xcb_cursor_context_t *cursor_ctx; - xcb_cursor_t cursor; -}; /* * Calculate total width of left/center/rigth groups. diff --git a/bar/private.h b/bar/private.h new file mode 100644 index 0000000..7415e06 --- /dev/null +++ b/bar/private.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +struct private { + /* From bar_config */ + char *monitor; + enum bar_location location; + int height; + int left_spacing, right_spacing; + int left_margin, right_margin; + + struct rgba background; + + struct { + int width; + struct rgba color; + } border; + + struct { + struct module **mods; + struct exposable **exps; + size_t count; + } left; + struct { + struct module **mods; + struct exposable **exps; + size_t count; + } center; + struct { + struct module **mods; + struct exposable **exps; + size_t count; + } right; + + /* Calculated run-time */ + int x, y; + int width; + int height_with_border; + + /* Name of currently active cursor */ + char *cursor_name; + + cairo_t *cairo; + cairo_surface_t *cairo_surface; + + /* Backend specifics */ + xcb_connection_t *conn; + + xcb_window_t win; + xcb_colormap_t colormap; + xcb_pixmap_t pixmap; + xcb_gc_t gc; + xcb_cursor_context_t *cursor_ctx; + xcb_cursor_t cursor; +};