]> git.sur5r.net Git - i3/i3/blob - i3bar/include/xcb.h
3746204ca33ef7c9a40bc85066d49ee465505d1e
[i3/i3] / i3bar / include / xcb.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3bar - an xcb-based status- and ws-bar for i3
5  * © 2010 Axel Wagner and contributors (see also: LICENSE)
6  *
7  * xcb.c: Communicating with X
8  *
9  */
10 #pragma once
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 xcb_connection_t *xcb_connection;
28
29 /* We define xcb_request_failed as a macro to include the relevant line number */
30 #define xcb_request_failed(cookie, err_msg) _xcb_request_failed(cookie, err_msg, __LINE__)
31 int _xcb_request_failed(xcb_void_cookie_t cookie, char *err_msg, int line);
32
33 struct xcb_color_strings_t {
34     char *bar_fg;
35     char *bar_bg;
36     char *sep_fg;
37     char *active_ws_fg;
38     char *active_ws_bg;
39     char *active_ws_border;
40     char *inactive_ws_fg;
41     char *inactive_ws_bg;
42     char *inactive_ws_border;
43     char *focus_ws_bg;
44     char *focus_ws_fg;
45     char *focus_ws_border;
46     char *urgent_ws_bg;
47     char *urgent_ws_fg;
48     char *urgent_ws_border;
49     char *binding_mode_bg;
50     char *binding_mode_fg;
51     char *binding_mode_border;
52 };
53
54 typedef struct xcb_colors_t xcb_colors_t;
55
56 /* Cached width of the custom separator if one was set */
57 int separator_symbol_width;
58
59 /*
60  * Early initialization of the connection to X11: Everything which does not
61  * depend on 'config'.
62  *
63  */
64 char *init_xcb_early();
65
66 /**
67  * Initialization which depends on 'config' being usable. Called after the
68  * configuration has arrived.
69  *
70  */
71 void init_xcb_late(char *fontname);
72
73 /*
74  * Initialize the colors
75  *
76  */
77 void init_colors(const struct xcb_color_strings_t *colors);
78
79 /*
80  * Cleanup the xcb stuff.
81  * Called once, before the program terminates.
82  *
83  */
84 void clean_xcb(void);
85
86 /*
87  * Get the earlier requested atoms and save them in the prepared data structure
88  *
89  */
90 void get_atoms(void);
91
92 /*
93  * Reparents all tray clients of the specified output to the root window. This
94  * is either used when shutting down, when an output appears (xrandr --output
95  * VGA1 --off) or when the primary output changes.
96  *
97  * Applications using the tray will start the protocol from the beginning again
98  * afterwards.
99  *
100  */
101 void kick_tray_clients(i3_output *output);
102
103 /*
104  * We need to set the _NET_SYSTEM_TRAY_COLORS atom on the tray selection window
105  * to make GTK+ 3 applets with symbolic icons visible. If the colors are unset,
106  * they assume a light background.
107  * See also https://bugzilla.gnome.org/show_bug.cgi?id=679591
108  *
109  */
110 void init_tray_colors(void);
111
112 /*
113  * Destroy the bar of the specified output
114  *
115  */
116 void destroy_window(i3_output *output);
117
118 /*
119  * Reallocate the statusline buffer
120  *
121  */
122 void realloc_sl_buffer(void);
123
124 /*
125  * Reconfigure all bars and create new for newly activated outputs
126  *
127  */
128 void reconfig_windows(bool redraw_bars);
129
130 /*
131  * Render the bars, with buttons and statusline
132  *
133  */
134 void draw_bars(bool force_unhide);
135
136 /*
137  * Redraw the bars, i.e. simply copy the buffer to the barwindow
138  *
139  */
140 void redraw_bars(void);
141
142 /*
143  * Set the current binding mode
144  *
145  */
146 void set_current_mode(struct mode *mode);