]> git.sur5r.net Git - i3/i3/blob - include/randr.h
Merge branch 'release-4.16.1'
[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  * https://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 <config.h>
15
16 #include "data.h"
17 #include <xcb/randr.h>
18
19 TAILQ_HEAD(outputs_head, xoutput);
20 extern struct outputs_head outputs;
21
22 typedef enum {
23     CLOSEST_OUTPUT = 0,
24     FARTHEST_OUTPUT = 1
25 } output_close_far_t;
26
27 /**
28  * We have just established a connection to the X server and need the initial
29  * XRandR information to setup workspaces for each screen.
30  *
31  */
32 void randr_init(int *event_base, const bool disable_randr15);
33
34 /**
35  * Initializes a CT_OUTPUT Con (searches existing ones from inplace restart
36  * before) to use for the given Output.
37  *
38  */
39 void output_init_con(Output *output);
40
41 /**
42  * Initializes at least one workspace for this output, trying the following
43  * steps until there is at least one workspace:
44  *
45  * • Move existing workspaces, which are assigned to be on the given output, to
46  *   the output.
47  * • Create the first assigned workspace for this output.
48  * • Create the first unused workspace.
49  *
50  */
51 void init_ws_for_output(Output *output, Con *content);
52
53 /**
54  * Initializes the specified output, assigning the specified workspace to it.
55  *
56  */
57 //void initialize_output(xcb_connection_t *conn, Output *output, Workspace *workspace);
58
59 /**
60  * (Re-)queries the outputs via RandR and stores them in the list of outputs.
61  *
62  */
63 void randr_query_outputs(void);
64
65 /**
66  * Disables the output and moves its content.
67  *
68  */
69 void randr_disable_output(Output *output);
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 or NULL.
79  * If require_active is true, only active outputs are considered.
80  *
81  */
82 Output *get_output_by_name(const char *name, const bool require_active);
83
84 /**
85  * Returns the active (!) output which contains the coordinates x, y or NULL
86  * if there is no output which contains these coordinates.
87  *
88  */
89 Output *get_output_containing(unsigned int x, unsigned int y);
90
91 /**
92  * Returns the active output which contains the midpoint of the given rect. If
93  * such an output doesn't exist, returns the output which contains most of the
94  * rectangle or NULL if there is no output which intersects with it.
95  *
96  */
97 Output *get_output_from_rect(Rect rect);
98
99 /**
100  * Returns the active output which spans exactly the area specified by
101  * rect or NULL if there is no output like this.
102  *
103  */
104 Output *get_output_with_dimensions(Rect rect);
105
106 /**
107  * In output_containing_rect, we check if any active output contains part of the container.
108  * We do this by checking if the output rect is intersected by the Rect.
109  * This is the 2-dimensional counterpart of get_output_containing.
110  * Returns the output with the maximum intersecting area.
111  *
112  */
113 Output *output_containing_rect(Rect rect);
114
115 /**
116  * Gets the output which is the next one in the given direction.
117  *
118  * If close_far == CLOSEST_OUTPUT, then the output next to the current one will
119  * selected.  If close_far == FARTHEST_OUTPUT, the output which is the last one
120  * in the given direction will be selected.
121  *
122  * NULL will be returned when no active outputs are present in the direction
123  * specified (note that ‘current’ counts as such an output).
124  *
125  */
126 Output *get_output_next(direction_t direction, Output *current, output_close_far_t close_far);
127
128 /**
129  * Like get_output_next with close_far == CLOSEST_OUTPUT, but wraps.
130  *
131  * For example if get_output_next(D_DOWN, x, FARTHEST_OUTPUT) = NULL, then
132  * get_output_next_wrap(D_DOWN, x) will return the topmost output.
133  *
134  * This function always returns a output: if no active outputs can be found,
135  * current itself is returned.
136  *
137  */
138 Output *get_output_next_wrap(direction_t direction, Output *current);
139
140 /**
141  * Creates an output covering the root window.
142  *
143  */
144 Output *create_root_output(xcb_connection_t *conn);