| 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 |
* outputs.c: Maintaining the outputs list |
| 8 |
* |
| 9 |
*/ |
| 10 |
#pragma once |
| 11 |
|
| 12 |
#include <config.h> |
| 13 |
|
| 14 |
#include <xcb/xcb.h> |
| 15 |
#include <cairo/cairo-xcb.h> |
| 16 |
|
| 17 |
#include "common.h" |
| 18 |
|
| 19 |
typedef struct i3_output i3_output; |
| 20 |
|
| 21 |
SLIST_HEAD(outputs_head, i3_output); |
| 22 |
extern struct outputs_head* outputs; |
| 23 |
|
| 24 |
/* |
| 25 |
* Parse the received JSON string |
| 26 |
* |
| 27 |
*/ |
| 28 |
void parse_outputs_json(const unsigned char* json, size_t size); |
| 29 |
|
| 30 |
/* |
| 31 |
* Initiate the outputs list |
| 32 |
* |
| 33 |
*/ |
| 34 |
void init_outputs(void); |
| 35 |
|
| 36 |
/* |
| 37 |
* free() all outputs data structures. |
| 38 |
* |
| 39 |
*/ |
| 40 |
void free_outputs(void); |
| 41 |
|
| 42 |
/* |
| 43 |
* Returns the output with the given name |
| 44 |
* |
| 45 |
*/ |
| 46 |
i3_output* get_output_by_name(char* name); |
| 47 |
|
| 48 |
/* |
| 49 |
* Returns true if the output has the currently focused workspace |
| 50 |
* |
| 51 |
*/ |
| 52 |
bool output_has_focus(i3_output* output); |
| 53 |
|
| 54 |
struct i3_output { |
| 55 |
char* name; /* Name of the output */ |
| 56 |
bool active; /* If the output is active */ |
| 57 |
bool primary; /* If it is the primary output */ |
| 58 |
bool visible; /* If the bar is visible on this output */ |
| 59 |
int ws; /* The number of the currently visible ws */ |
| 60 |
rect rect; /* The rect (relative to the root window) */ |
| 61 |
|
| 62 |
/* Off-screen buffer for preliminary rendering of the bar. */ |
| 63 |
surface_t buffer; |
| 64 |
/* Off-screen buffer for pre-rendering the statusline, separated to make clipping easier. */ |
| 65 |
surface_t statusline_buffer; |
| 66 |
/* How much of statusline_buffer's horizontal space was used on last statusline render. */ |
| 67 |
int statusline_width; |
| 68 |
/* The actual window on which we draw. */ |
| 69 |
surface_t bar; |
| 70 |
|
| 71 |
struct ws_head* workspaces; /* The workspaces on this output */ |
| 72 |
struct tc_head* trayclients; /* The tray clients on this output */ |
| 73 |
|
| 74 |
SLIST_ENTRY(i3_output) slist; /* Pointer for the SLIST-Macro */ |
| 75 |
}; |