forked from external/yambar
bar: break out 'private' struct definition to a header file
This commit is contained in:
parent
aa21991323
commit
2d104e4a7d
3 changed files with 67 additions and 64 deletions
|
@ -44,7 +44,7 @@ add_executable(f00bar
|
||||||
xcb.c xcb.h
|
xcb.c xcb.h
|
||||||
yml.c yml.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
|
# Make global symbols in f00bar visible to dlopen:ed plugins
|
||||||
|
|
64
bar/bar.c
64
bar/bar.c
|
@ -1,4 +1,5 @@
|
||||||
#include "../bar.h"
|
#include "../bar.h"
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -12,74 +13,11 @@
|
||||||
|
|
||||||
#include <sys/eventfd.h>
|
#include <sys/eventfd.h>
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
|
||||||
#include <xcb/randr.h>
|
|
||||||
#include <xcb/render.h>
|
|
||||||
#include <xcb/xcb_aux.h>
|
|
||||||
#include <xcb/xcb_cursor.h>
|
|
||||||
#include <xcb/xcb_event.h>
|
|
||||||
#include <xcb/xcb_ewmh.h>
|
|
||||||
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <cairo-xcb.h>
|
|
||||||
|
|
||||||
#define LOG_MODULE "bar"
|
#define LOG_MODULE "bar"
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
#include "../log.h"
|
#include "../log.h"
|
||||||
#include "../xcb.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.
|
* Calculate total width of left/center/rigth groups.
|
||||||
|
|
65
bar/private.h
Normal file
65
bar/private.h
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <xcb/xcb.h>
|
||||||
|
#include <xcb/randr.h>
|
||||||
|
#include <xcb/render.h>
|
||||||
|
#include <xcb/xcb_aux.h>
|
||||||
|
#include <xcb/xcb_cursor.h>
|
||||||
|
#include <xcb/xcb_event.h>
|
||||||
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
|
||||||
|
#include <cairo.h>
|
||||||
|
#include <cairo-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;
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue