diff options
Diffstat (limited to 'include/sway/tree/container.h')
-rw-r--r-- | include/sway/tree/container.h | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 7e9df59f..ddb2d683 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -46,9 +46,9 @@ struct sway_container_state { | |||
46 | 46 | ||
47 | enum sway_fullscreen_mode fullscreen_mode; | 47 | enum sway_fullscreen_mode fullscreen_mode; |
48 | 48 | ||
49 | struct sway_workspace *workspace; | 49 | struct sway_workspace *workspace; // NULL when hidden in the scratchpad |
50 | struct sway_container *parent; | 50 | struct sway_container *parent; // NULL if container in root of workspace |
51 | list_t *children; | 51 | list_t *children; // struct sway_container |
52 | 52 | ||
53 | struct sway_container *focused_inactive_child; | 53 | struct sway_container *focused_inactive_child; |
54 | bool focused; | 54 | bool focused; |
@@ -60,6 +60,7 @@ struct sway_container_state { | |||
60 | bool border_left; | 60 | bool border_left; |
61 | bool border_right; | 61 | bool border_right; |
62 | 62 | ||
63 | // These are in layout coordinates. | ||
63 | double content_x, content_y; | 64 | double content_x, content_y; |
64 | double content_width, content_height; | 65 | double content_width, content_height; |
65 | }; | 66 | }; |
@@ -68,14 +69,12 @@ struct sway_container { | |||
68 | struct sway_node node; | 69 | struct sway_node node; |
69 | struct sway_view *view; | 70 | struct sway_view *view; |
70 | 71 | ||
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; | 72 | struct sway_container_state current; |
73 | struct sway_container_state pending; | ||
74 | 74 | ||
75 | char *title; // The view's title (unformatted) | 75 | char *title; // The view's title (unformatted) |
76 | char *formatted_title; // The title displayed in the title bar | 76 | char *formatted_title; // The title displayed in the title bar |
77 | 77 | ||
78 | enum sway_container_layout layout; | ||
79 | enum sway_container_layout prev_split_layout; | 78 | enum sway_container_layout prev_split_layout; |
80 | 79 | ||
81 | // Whether stickiness has been enabled on this container. Use | 80 | // Whether stickiness has been enabled on this container. Use |
@@ -86,11 +85,13 @@ struct sway_container { | |||
86 | // For C_ROOT, this has no meaning | 85 | // For C_ROOT, this has no meaning |
87 | // For other types, this is the position in layout coordinates | 86 | // For other types, this is the position in layout coordinates |
88 | // Includes borders | 87 | // Includes borders |
89 | double x, y; | ||
90 | double width, height; | ||
91 | double saved_x, saved_y; | 88 | double saved_x, saved_y; |
92 | double saved_width, saved_height; | 89 | double saved_width, saved_height; |
93 | 90 | ||
91 | // Used when the view changes to CSD unexpectedly. This will be a non-B_CSD | ||
92 | // border which we use to restore when the view returns to SSD. | ||
93 | enum sway_container_border saved_border; | ||
94 | |||
94 | // The share of the space of parent container this container occupies | 95 | // The share of the space of parent container this container occupies |
95 | double width_fraction; | 96 | double width_fraction; |
96 | double height_fraction; | 97 | double height_fraction; |
@@ -100,33 +101,11 @@ struct sway_container { | |||
100 | double child_total_width; | 101 | double child_total_width; |
101 | double child_total_height; | 102 | double child_total_height; |
102 | 103 | ||
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 | 104 | // 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. | 105 | // refuses to resize to the content dimensions then it can be smaller. |
109 | // These are in layout coordinates. | 106 | // These are in layout coordinates. |
110 | double surface_x, surface_y; | 107 | double surface_x, surface_y; |
111 | 108 | ||
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 | 109 | // Outputs currently being intersected |
131 | list_t *outputs; // struct sway_output | 110 | list_t *outputs; // struct sway_output |
132 | 111 | ||
@@ -185,6 +164,11 @@ void container_for_each_child(struct sway_container *container, | |||
185 | void (*f)(struct sway_container *container, void *data), void *data); | 164 | void (*f)(struct sway_container *container, void *data), void *data); |
186 | 165 | ||
187 | /** | 166 | /** |
167 | * Returns the fullscreen container obstructing this container if it exists. | ||
168 | */ | ||
169 | struct sway_container *container_obstructing_fullscreen_container(struct sway_container *container); | ||
170 | |||
171 | /** | ||
188 | * Returns true if the given container is an ancestor of this container. | 172 | * Returns true if the given container is an ancestor of this container. |
189 | */ | 173 | */ |
190 | bool container_has_ancestor(struct sway_container *container, | 174 | bool container_has_ancestor(struct sway_container *container, |
@@ -231,10 +215,17 @@ void container_set_geometry_from_content(struct sway_container *con); | |||
231 | /** | 215 | /** |
232 | * Determine if the given container is itself floating. | 216 | * Determine if the given container is itself floating. |
233 | * This will return false for any descendants of a floating container. | 217 | * This will return false for any descendants of a floating container. |
218 | * | ||
219 | * Uses pending container state. | ||
234 | */ | 220 | */ |
235 | bool container_is_floating(struct sway_container *container); | 221 | bool container_is_floating(struct sway_container *container); |
236 | 222 | ||
237 | /** | 223 | /** |
224 | * Same as above, but for current container state. | ||
225 | */ | ||
226 | bool container_is_current_floating(struct sway_container *container); | ||
227 | |||
228 | /** | ||
238 | * Get a container's box in layout coordinates. | 229 | * Get a container's box in layout coordinates. |
239 | */ | 230 | */ |
240 | void container_get_box(struct sway_container *container, struct wlr_box *box); | 231 | void container_get_box(struct sway_container *container, struct wlr_box *box); |
@@ -299,6 +290,7 @@ bool container_is_fullscreen_or_child(struct sway_container *container); | |||
299 | /** | 290 | /** |
300 | * Return the output which will be used for scale purposes. | 291 | * Return the output which will be used for scale purposes. |
301 | * This is the most recently entered output. | 292 | * This is the most recently entered output. |
293 | * If the container is not on any output, return NULL. | ||
302 | */ | 294 | */ |
303 | struct sway_output *container_get_effective_output(struct sway_container *con); | 295 | struct sway_output *container_get_effective_output(struct sway_container *con); |
304 | 296 | ||