diff options
Diffstat (limited to 'include/sway/tree/container.h')
-rw-r--r-- | include/sway/tree/container.h | 60 |
1 files changed, 22 insertions, 38 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 7e9df59f..97fa98c1 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _SWAY_CONTAINER_H | 2 | #define _SWAY_CONTAINER_H |
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <wlr/types/wlr_box.h> | ||
6 | #include <wlr/types/wlr_surface.h> | 5 | #include <wlr/types/wlr_surface.h> |
7 | #include "list.h" | 6 | #include "list.h" |
8 | #include "sway/tree/node.h" | 7 | #include "sway/tree/node.h" |
@@ -46,9 +45,9 @@ struct sway_container_state { | |||
46 | 45 | ||
47 | enum sway_fullscreen_mode fullscreen_mode; | 46 | enum sway_fullscreen_mode fullscreen_mode; |
48 | 47 | ||
49 | struct sway_workspace *workspace; | 48 | struct sway_workspace *workspace; // NULL when hidden in the scratchpad |
50 | struct sway_container *parent; | 49 | struct sway_container *parent; // NULL if container in root of workspace |
51 | list_t *children; | 50 | list_t *children; // struct sway_container |
52 | 51 | ||
53 | struct sway_container *focused_inactive_child; | 52 | struct sway_container *focused_inactive_child; |
54 | bool focused; | 53 | bool focused; |
@@ -60,6 +59,7 @@ struct sway_container_state { | |||
60 | bool border_left; | 59 | bool border_left; |
61 | bool border_right; | 60 | bool border_right; |
62 | 61 | ||
62 | // These are in layout coordinates. | ||
63 | double content_x, content_y; | 63 | double content_x, content_y; |
64 | double content_width, content_height; | 64 | double content_width, content_height; |
65 | }; | 65 | }; |
@@ -68,14 +68,12 @@ struct sway_container { | |||
68 | struct sway_node node; | 68 | struct sway_node node; |
69 | struct sway_view *view; | 69 | struct sway_view *view; |
70 | 70 | ||
71 | // The pending state is the main container properties, and the current state is in the below struct. | ||
72 | // This means most places of the code can refer to the main variables (pending state) and it'll just work. | ||
73 | struct sway_container_state current; | 71 | struct sway_container_state current; |
72 | struct sway_container_state pending; | ||
74 | 73 | ||
75 | char *title; // The view's title (unformatted) | 74 | char *title; // The view's title (unformatted) |
76 | char *formatted_title; // The title displayed in the title bar | 75 | char *formatted_title; // The title displayed in the title bar |
77 | 76 | ||
78 | enum sway_container_layout layout; | ||
79 | enum sway_container_layout prev_split_layout; | 77 | enum sway_container_layout prev_split_layout; |
80 | 78 | ||
81 | // Whether stickiness has been enabled on this container. Use | 79 | // Whether stickiness has been enabled on this container. Use |
@@ -86,11 +84,13 @@ struct sway_container { | |||
86 | // For C_ROOT, this has no meaning | 84 | // For C_ROOT, this has no meaning |
87 | // For other types, this is the position in layout coordinates | 85 | // For other types, this is the position in layout coordinates |
88 | // Includes borders | 86 | // Includes borders |
89 | double x, y; | ||
90 | double width, height; | ||
91 | double saved_x, saved_y; | 87 | double saved_x, saved_y; |
92 | double saved_width, saved_height; | 88 | double saved_width, saved_height; |
93 | 89 | ||
90 | // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD | ||
91 | // border which we use to restore when the view returns to SSD. | ||
92 | enum sway_container_border saved_border; | ||
93 | |||
94 | // The share of the space of parent container this container occupies | 94 | // The share of the space of parent container this container occupies |
95 | double width_fraction; | 95 | double width_fraction; |
96 | double height_fraction; | 96 | double height_fraction; |
@@ -100,33 +100,11 @@ struct sway_container { | |||
100 | double child_total_width; | 100 | double child_total_width; |
101 | double child_total_height; | 101 | double child_total_height; |
102 | 102 | ||
103 | // These are in layout coordinates. | ||
104 | double content_x, content_y; | ||
105 | int content_width, content_height; | ||
106 | |||
107 | // In most cases this is the same as the content x and y, but if the view | 103 | // In most cases this is the same as the content x and y, but if the view |
108 | // refuses to resize to the content dimensions then it can be smaller. | 104 | // refuses to resize to the content dimensions then it can be smaller. |
109 | // These are in layout coordinates. | 105 | // These are in layout coordinates. |
110 | double surface_x, surface_y; | 106 | double surface_x, surface_y; |
111 | 107 | ||
112 | enum sway_fullscreen_mode fullscreen_mode; | ||
113 | |||
114 | enum sway_container_border border; | ||
115 | |||
116 | // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD | ||
117 | // border which we use to restore when the view returns to SSD. | ||
118 | enum sway_container_border saved_border; | ||
119 | |||
120 | int border_thickness; | ||
121 | bool border_top; | ||
122 | bool border_bottom; | ||
123 | bool border_left; | ||
124 | bool border_right; | ||
125 | |||
126 | struct sway_workspace *workspace; // NULL when hidden in the scratchpad | ||
127 | struct sway_container *parent; // NULL if container in root of workspace | ||
128 | list_t *children; // struct sway_container | ||
129 | |||
130 | // Outputs currently being intersected | 108 | // Outputs currently being intersected |
131 | list_t *outputs; // struct sway_output | 109 | list_t *outputs; // struct sway_output |
132 | 110 | ||
@@ -141,8 +119,6 @@ struct sway_container { | |||
141 | struct wlr_texture *title_focused_inactive; | 119 | struct wlr_texture *title_focused_inactive; |
142 | struct wlr_texture *title_unfocused; | 120 | struct wlr_texture *title_unfocused; |
143 | struct wlr_texture *title_urgent; | 121 | struct wlr_texture *title_urgent; |
144 | size_t title_height; | ||
145 | size_t title_baseline; | ||
146 | 122 | ||
147 | list_t *marks; // char * | 123 | list_t *marks; // char * |
148 | struct wlr_texture *marks_focused; | 124 | struct wlr_texture *marks_focused; |
@@ -185,6 +161,11 @@ void container_for_each_child(struct sway_container *container, | |||
185 | void (*f)(struct sway_container *container, void *data), void *data); | 161 | void (*f)(struct sway_container *container, void *data), void *data); |
186 | 162 | ||
187 | /** | 163 | /** |
164 | * Returns the fullscreen container obstructing this container if it exists. | ||
165 | */ | ||
166 | struct sway_container *container_obstructing_fullscreen_container(struct sway_container *container); | ||
167 | |||
168 | /** | ||
188 | * Returns true if the given container is an ancestor of this container. | 169 | * Returns true if the given container is an ancestor of this container. |
189 | */ | 170 | */ |
190 | bool container_has_ancestor(struct sway_container *container, | 171 | bool container_has_ancestor(struct sway_container *container, |
@@ -200,11 +181,6 @@ struct sway_container *container_flatten(struct sway_container *container); | |||
200 | 181 | ||
201 | void container_update_title_textures(struct sway_container *container); | 182 | void container_update_title_textures(struct sway_container *container); |
202 | 183 | ||
203 | /** | ||
204 | * Calculate the container's title_height property. | ||
205 | */ | ||
206 | void container_calculate_title_height(struct sway_container *container); | ||
207 | |||
208 | size_t container_build_representation(enum sway_container_layout layout, | 184 | size_t container_build_representation(enum sway_container_layout layout, |
209 | list_t *children, char *buffer); | 185 | list_t *children, char *buffer); |
210 | 186 | ||
@@ -231,10 +207,17 @@ void container_set_geometry_from_content(struct sway_container *con); | |||
231 | /** | 207 | /** |
232 | * Determine if the given container is itself floating. | 208 | * Determine if the given container is itself floating. |
233 | * This will return false for any descendants of a floating container. | 209 | * This will return false for any descendants of a floating container. |
210 | * | ||
211 | * Uses pending container state. | ||
234 | */ | 212 | */ |
235 | bool container_is_floating(struct sway_container *container); | 213 | bool container_is_floating(struct sway_container *container); |
236 | 214 | ||
237 | /** | 215 | /** |
216 | * Same as above, but for current container state. | ||
217 | */ | ||
218 | bool container_is_current_floating(struct sway_container *container); | ||
219 | |||
220 | /** | ||
238 | * Get a container's box in layout coordinates. | 221 | * Get a container's box in layout coordinates. |
239 | */ | 222 | */ |
240 | void container_get_box(struct sway_container *container, struct wlr_box *box); | 223 | void container_get_box(struct sway_container *container, struct wlr_box *box); |
@@ -299,6 +282,7 @@ bool container_is_fullscreen_or_child(struct sway_container *container); | |||
299 | /** | 282 | /** |
300 | * Return the output which will be used for scale purposes. | 283 | * Return the output which will be used for scale purposes. |
301 | * This is the most recently entered output. | 284 | * This is the most recently entered output. |
285 | * If the container is not on any output, return NULL. | ||
302 | */ | 286 | */ |
303 | struct sway_output *container_get_effective_output(struct sway_container *con); | 287 | struct sway_output *container_get_effective_output(struct sway_container *con); |
304 | 288 | ||