]> git.sur5r.net Git - i3/i3/blob - i3bar/include/xcb.h
Make i3bar get its config from i3 via IPC
[i3/i3] / i3bar / include / xcb.h
1 /*
2  * i3bar - an xcb-based status- and ws-bar for i3
3  *
4  * © 2010-2011 Axel Wagner and contributors
5  *
6  * See file LICNSE for license information
7  *
8  */
9 #ifndef XCB_H_
10 #define XCB_H_
11
12 #include <stdint.h>
13 //#include "outputs.h"
14
15 #ifdef XCB_COMPAT
16 #define XCB_ATOM_CARDINAL CARDINAL
17 #endif
18
19 #define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
20 #define _NET_SYSTEM_TRAY_ORIENTATION_VERT 1
21 #define SYSTEM_TRAY_REQUEST_DOCK    0
22 #define SYSTEM_TRAY_BEGIN_MESSAGE   1
23 #define SYSTEM_TRAY_CANCEL_MESSAGE  2
24 #define XEMBED_MAPPED                   (1 << 0)
25 #define XEMBED_EMBEDDED_NOTIFY          0
26
27 struct xcb_color_strings_t {
28     char *bar_fg;
29     char *bar_bg;
30     char *active_ws_fg;
31     char *active_ws_bg;
32     char *inactive_ws_fg;
33     char *inactive_ws_bg;
34     char *focus_ws_bg;
35     char *focus_ws_fg;
36     char *urgent_ws_bg;
37     char *urgent_ws_fg;
38 };
39
40 typedef struct xcb_colors_t xcb_colors_t;
41
42 /*
43  * Early initialization of the connection to X11: Everything which does not
44  * depend on 'config'.
45  *
46  */
47 char *init_xcb_early();
48
49 /**
50  * Initialization which depends on 'config' being usable. Called after the
51  * configuration has arrived.
52  *
53  */
54 void init_xcb_late(char *fontname);
55
56 /*
57  * Initialize the colors
58  *
59  */
60 void init_colors(const struct xcb_color_strings_t *colors);
61
62 /*
63  * Cleanup the xcb-stuff.
64  * Called once, before the program terminates.
65  *
66  */
67 void clean_xcb();
68
69 /*
70  * Get the earlier requested atoms and save them in the prepared data-structure
71  *
72  */
73 void get_atoms();
74
75 /*
76  * Destroy the bar of the specified output
77  *
78  */
79 void destroy_window(i3_output *output);
80
81 /*
82  * Reallocate the statusline-buffer
83  *
84  */
85 void realloc_sl_buffer();
86
87 /*
88  * Reconfigure all bars and create new for newly activated outputs
89  *
90  */
91 void reconfig_windows();
92
93 /*
94  * Render the bars, with buttons and statusline
95  *
96  */
97 void draw_bars();
98
99 /*
100  * Redraw the bars, i.e. simply copy the buffer to the barwindow
101  *
102  */
103 void redraw_bars();
104
105 /*
106  * Predicts the length of text based on cached data.
107  * The string has to be encoded in ucs2 and glyph_len has to be the length
108  * of the string (in glyphs).
109  *
110  */
111 uint32_t predict_text_extents(xcb_char2b_t *text, uint32_t length);
112
113 #endif