]> git.sur5r.net Git - i3/i3/blob - include/randr.h
Merge branch 'next' into master
[i3/i3] / include / randr.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 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 #pragma once
13
14 #include "data.h"
15 #include <xcb/randr.h>
16
17 TAILQ_HEAD(outputs_head, xoutput);
18 extern struct outputs_head outputs;
19
20 typedef enum {
21     CLOSEST_OUTPUT = 0,
22     FARTHEST_OUTPUT = 1
23 } output_close_far_t;
24
25 /**
26  * We have just established a connection to the X server and need the initial
27  * XRandR information to setup workspaces for each screen.
28  *
29  */
30 void randr_init(int *event_base);
31
32 /**
33  * Initializes a CT_OUTPUT Con (searches existing ones from inplace restart
34  * before) to use for the given Output.
35  *
36  */
37 void output_init_con(Output *output);
38
39 /**
40  * Initializes at least one workspace for this output, trying the following
41  * steps until there is at least one workspace:
42  *
43  * • Move existing workspaces, which are assigned to be on the given output, to
44  *   the output.
45  * • Create the first assigned workspace for this output.
46  * • Create the first unused workspace.
47  *
48  */
49 void init_ws_for_output(Output *output, Con *content);
50
51 /**
52  * Initializes the specified output, assigning the specified workspace to it.
53  *
54  */
55 //void initialize_output(xcb_connection_t *conn, Output *output, Workspace *workspace);
56
57 /**
58  * (Re-)queries the outputs via RandR and stores them in the list of outputs.
59  *
60  */
61 void randr_query_outputs(void);
62
63 /**
64  * Returns the first output which is active.
65  *
66  */
67 Output *get_first_output(void);
68
69 /**
70  * Returns the output with the given name if it is active (!) or NULL.
71  *
72  */
73 Output *get_output_by_name(const char *name);
74
75 /**
76  * Returns the active (!) output which contains the coordinates x, y or NULL
77  * if there is no output which contains these coordinates.
78  *
79  */
80 Output *get_output_containing(unsigned int x, unsigned int y);
81
82 /*
83  * In contained_by_output, we check if any active output contains part of the container.
84  * We do this by checking if the output rect is intersected by the Rect.
85  * This is the 2-dimensional counterpart of get_output_containing.
86  * Since we don't actually need the outputs intersected by the given Rect (There could
87  * be many), we just return true or false for convenience.
88  *
89  */
90 bool contained_by_output(Rect rect);
91
92 /**
93  * Gets the output which is the next one in the given direction.
94  *
95  * If close_far == CLOSEST_OUTPUT, then the output next to the current one will
96  * selected.  If close_far == FARTHEST_OUTPUT, the output which is the last one
97  * in the given direction will be selected.
98  *
99  * NULL will be returned when no active outputs are present in the direction
100  * specified (note that ‘current’ counts as such an output).
101  *
102  */
103 Output *get_output_next(direction_t direction, Output *current, output_close_far_t close_far);
104
105 /**
106  * Like get_output_next with close_far == CLOSEST_OUTPUT, but wraps.
107  *
108  * For example if get_output_next(D_DOWN, x, FARTHEST_OUTPUT) = NULL, then
109  * get_output_next_wrap(D_DOWN, x) will return the topmost output.
110  *
111  * This function always returns a output: if no active outputs can be found,
112  * current itself is returned.
113  *
114  */
115 Output *get_output_next_wrap(direction_t direction, Output *current);
116
117 /*
118  * Creates an output covering the root window.
119  *
120  */
121 Output *create_root_output(xcb_connection_t *conn);