2010-08-07 18:05:16 +02:00
|
|
|
/*
|
2011-10-25 22:19:38 +02:00
|
|
|
* vim:ts=4:sw=4:expandtab
|
2010-08-07 18:05:16 +02:00
|
|
|
*
|
2011-10-25 22:19:38 +02:00
|
|
|
* i3bar - an xcb-based status- and ws-bar for i3
|
2015-04-04 02:17:56 +02:00
|
|
|
* © 2010 Axel Wagner and contributors (see also: LICENSE)
|
2010-08-07 18:05:16 +02:00
|
|
|
*
|
2011-10-25 22:19:38 +02:00
|
|
|
* xcb.c: Communicating with X
|
2010-08-07 18:05:16 +02:00
|
|
|
*
|
|
|
|
*/
|
2013-12-29 03:11:50 +01:00
|
|
|
#pragma once
|
2010-07-22 01:15:18 +02:00
|
|
|
|
2010-10-24 05:24:51 +02:00
|
|
|
#include <stdint.h>
|
2010-11-04 12:27:10 +01:00
|
|
|
//#include "outputs.h"
|
2010-10-24 05:24:51 +02:00
|
|
|
|
2011-08-17 01:32:29 +02:00
|
|
|
#ifdef XCB_COMPAT
|
|
|
|
#define XCB_ATOM_CARDINAL CARDINAL
|
|
|
|
#endif
|
|
|
|
|
2011-08-17 00:58:00 +02:00
|
|
|
#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
|
|
|
|
#define _NET_SYSTEM_TRAY_ORIENTATION_VERT 1
|
2014-06-19 11:20:32 +02:00
|
|
|
#define SYSTEM_TRAY_REQUEST_DOCK 0
|
|
|
|
#define SYSTEM_TRAY_BEGIN_MESSAGE 1
|
|
|
|
#define SYSTEM_TRAY_CANCEL_MESSAGE 2
|
|
|
|
#define XEMBED_MAPPED (1 << 0)
|
|
|
|
#define XEMBED_EMBEDDED_NOTIFY 0
|
2011-08-17 00:05:05 +02:00
|
|
|
|
2015-09-05 23:38:15 +02:00
|
|
|
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);
|
|
|
|
|
2010-11-04 12:27:10 +01:00
|
|
|
struct xcb_color_strings_t {
|
2010-10-24 05:24:51 +02:00
|
|
|
char *bar_fg;
|
|
|
|
char *bar_bg;
|
2013-01-27 21:27:21 +01:00
|
|
|
char *sep_fg;
|
2010-10-24 05:24:51 +02:00
|
|
|
char *active_ws_fg;
|
|
|
|
char *active_ws_bg;
|
2012-01-20 22:36:50 +01:00
|
|
|
char *active_ws_border;
|
2010-10-24 05:24:51 +02:00
|
|
|
char *inactive_ws_fg;
|
|
|
|
char *inactive_ws_bg;
|
2012-01-20 22:36:50 +01:00
|
|
|
char *inactive_ws_border;
|
2011-03-20 19:29:30 +01:00
|
|
|
char *focus_ws_bg;
|
|
|
|
char *focus_ws_fg;
|
2012-01-20 22:36:50 +01:00
|
|
|
char *focus_ws_border;
|
2010-10-24 05:24:51 +02:00
|
|
|
char *urgent_ws_bg;
|
|
|
|
char *urgent_ws_fg;
|
2012-01-20 22:36:50 +01:00
|
|
|
char *urgent_ws_border;
|
2015-05-31 16:07:23 +02:00
|
|
|
char *binding_mode_bg;
|
|
|
|
char *binding_mode_fg;
|
|
|
|
char *binding_mode_border;
|
2010-10-24 05:24:51 +02:00
|
|
|
};
|
|
|
|
|
2010-11-04 12:27:10 +01:00
|
|
|
typedef struct xcb_colors_t xcb_colors_t;
|
2010-10-24 05:24:51 +02:00
|
|
|
|
2015-04-03 22:54:59 +02:00
|
|
|
/* Cached width of the custom separator if one was set */
|
|
|
|
int separator_symbol_width;
|
|
|
|
|
2010-08-07 02:10:05 +02:00
|
|
|
/*
|
2011-10-19 23:58:19 +02:00
|
|
|
* Early initialization of the connection to X11: Everything which does not
|
|
|
|
* depend on 'config'.
|
2010-08-07 02:10:05 +02:00
|
|
|
*
|
|
|
|
*/
|
2011-10-19 23:58:19 +02:00
|
|
|
char *init_xcb_early();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialization which depends on 'config' being usable. Called after the
|
|
|
|
* configuration has arrived.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void init_xcb_late(char *fontname);
|
2010-08-07 02:10:05 +02:00
|
|
|
|
2010-10-24 05:24:51 +02:00
|
|
|
/*
|
|
|
|
* Initialize the colors
|
|
|
|
*
|
|
|
|
*/
|
2010-11-04 12:27:10 +01:00
|
|
|
void init_colors(const struct xcb_color_strings_t *colors);
|
2010-10-24 05:24:51 +02:00
|
|
|
|
2010-08-07 02:10:05 +02:00
|
|
|
/*
|
2015-03-23 20:56:49 +01:00
|
|
|
* Cleanup the xcb stuff.
|
2010-08-07 02:10:05 +02:00
|
|
|
* Called once, before the program terminates.
|
|
|
|
*
|
|
|
|
*/
|
2012-08-23 12:55:28 +02:00
|
|
|
void clean_xcb(void);
|
2010-08-07 02:10:05 +02:00
|
|
|
|
|
|
|
/*
|
2015-03-23 20:56:49 +01:00
|
|
|
* Get the earlier requested atoms and save them in the prepared data structure
|
2010-08-07 02:10:05 +02:00
|
|
|
*
|
|
|
|
*/
|
2012-08-23 12:55:28 +02:00
|
|
|
void get_atoms(void);
|
2010-08-07 02:10:05 +02:00
|
|
|
|
2012-04-22 20:43:52 +02:00
|
|
|
/*
|
|
|
|
* Reparents all tray clients of the specified output to the root window. This
|
|
|
|
* is either used when shutting down, when an output appears (xrandr --output
|
|
|
|
* VGA1 --off) or when the primary output changes.
|
|
|
|
*
|
|
|
|
* Applications using the tray will start the protocol from the beginning again
|
|
|
|
* afterwards.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void kick_tray_clients(i3_output *output);
|
|
|
|
|
2013-01-02 23:09:52 +01:00
|
|
|
/*
|
|
|
|
* We need to set the _NET_SYSTEM_TRAY_COLORS atom on the tray selection window
|
2015-03-24 13:41:16 +01:00
|
|
|
* to make GTK+ 3 applets with symbolic icons visible. If the colors are unset,
|
2013-01-02 23:09:52 +01:00
|
|
|
* they assume a light background.
|
|
|
|
* See also https://bugzilla.gnome.org/show_bug.cgi?id=679591
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void init_tray_colors(void);
|
|
|
|
|
2010-08-07 02:10:05 +02:00
|
|
|
/*
|
|
|
|
* Destroy the bar of the specified output
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void destroy_window(i3_output *output);
|
|
|
|
|
2011-03-19 22:27:35 +01:00
|
|
|
/*
|
2015-03-23 20:56:49 +01:00
|
|
|
* Reallocate the statusline buffer
|
2011-03-19 22:27:35 +01:00
|
|
|
*
|
|
|
|
*/
|
2012-08-23 12:55:28 +02:00
|
|
|
void realloc_sl_buffer(void);
|
2011-03-19 22:27:35 +01:00
|
|
|
|
2010-08-07 02:10:05 +02:00
|
|
|
/*
|
|
|
|
* Reconfigure all bars and create new for newly activated outputs
|
|
|
|
*
|
|
|
|
*/
|
2013-05-29 18:02:46 +02:00
|
|
|
void reconfig_windows(bool redraw_bars);
|
2010-08-07 02:10:05 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Render the bars, with buttons and statusline
|
|
|
|
*
|
|
|
|
*/
|
2012-08-21 13:51:40 +02:00
|
|
|
void draw_bars(bool force_unhide);
|
2010-08-07 02:10:05 +02:00
|
|
|
|
2010-08-22 10:24:32 +02:00
|
|
|
/*
|
|
|
|
* Redraw the bars, i.e. simply copy the buffer to the barwindow
|
|
|
|
*
|
|
|
|
*/
|
2012-08-23 12:55:28 +02:00
|
|
|
void redraw_bars(void);
|
2010-08-22 10:24:32 +02:00
|
|
|
|
2012-11-10 13:41:39 +01:00
|
|
|
/*
|
|
|
|
* Set the current binding mode
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void set_current_mode(struct mode *mode);
|