]> git.sur5r.net Git - i3/i3/blob - include/randr.h
Merge branch 'master' into next
[i3/i3] / include / randr.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * For more information on RandR, please see the X.org RandR specification at
8  * http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt
9  * (take your time to read it completely, it answers all questions).
10  *
11  */
12 #ifndef I3_RANDR_H
13 #define I3_RANDR_H
14
15 #include "data.h"
16 #include <xcb/randr.h>
17
18 TAILQ_HEAD(outputs_head, xoutput);
19 extern struct outputs_head outputs;
20
21 typedef enum {
22     CLOSEST_OUTPUT = 0,
23     FARTHEST_OUTPUT = 1
24 } output_close_far_t;
25
26 /**
27  * We have just established a connection to the X server and need the initial
28  * XRandR information to setup workspaces for each screen.
29  *
30  */
31 void randr_init(int *event_base);
32
33 /**
34  * Disables RandR support by creating exactly one output with the size of the
35  * X11 screen.
36  *
37  */
38 void disable_randr(xcb_connection_t *conn);
39
40 /**
41  * Initializes a CT_OUTPUT Con (searches existing ones from inplace restart
42  * before) to use for the given Output.
43  *
44  */
45 void output_init_con(Output *output);
46
47 /**
48  * Initializes at least one workspace for this output, trying the following
49  * steps until there is at least one workspace:
50  *
51  * • Move existing workspaces, which are assigned to be on the given output, to
52  *   the output.
53  * • Create the first assigned workspace for this output.
54  * • Create the first unused workspace.
55  *
56  */
57 void init_ws_for_output(Output *output, Con *content);
58
59 /**
60  * Initializes the specified output, assigning the specified workspace to it.
61  *
62  */
63 //void initialize_output(xcb_connection_t *conn, Output *output, Workspace *workspace);
64
65 /**
66  * (Re-)queries the outputs via RandR and stores them in the list of outputs.
67  *
68  */
69 void randr_query_outputs(void);
70
71 /**
72  * Returns the first output which is active.
73  *
74  */
75 Output *get_first_output(void);
76
77 /**
78  * Returns the output with the given name if it is active (!) or NULL.
79  *
80  */
81 Output *get_output_by_name(const char *name);
82
83 /**
84  * Returns the active (!) output which contains the coordinates x, y or NULL
85  * if there is no output which contains these coordinates.
86  *
87  */
88 Output *get_output_containing(int x, int y);
89
90 /**
91  * Gets the output which is the next one in the given direction.
92  *
93  * If close_far == CLOSEST_OUTPUT, then the output next to the current one will
94  * selected.  If close_far == FARTHEST_OUTPUT, the output which is the last one
95  * in the given direction will be selected.
96  *
97  * NULL will be returned when no active outputs are present in the direction
98  * specified (note that ‘current’ counts as such an output).
99  *
100  */
101 Output *get_output_next(direction_t direction, Output *current, output_close_far_t close_far);
102
103 /**
104  * Like get_output_next with close_far == CLOSEST_OUTPUT, but wraps.
105  *
106  * For example if get_output_next(D_DOWN, x, FARTHEST_OUTPUT) = NULL, then
107  * get_output_next_wrap(D_DOWN, x) will return the topmost output.
108  *
109  * This function always returns a output: if no active outputs can be found,
110  * current itself is returned.
111  *
112  */
113 Output *get_output_next_wrap(direction_t direction, Output *current);
114
115 #endif