aboutsummaryrefslogtreecommitdiffstats
path: root/include/sway/tree/container.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sway/tree/container.h')
-rw-r--r--include/sway/tree/container.h102
1 files changed, 46 insertions, 56 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 751612e2..93f6bfbb 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -3,6 +3,7 @@
3#include <stdint.h> 3#include <stdint.h>
4#include <sys/types.h> 4#include <sys/types.h>
5#include <wlr/types/wlr_compositor.h> 5#include <wlr/types/wlr_compositor.h>
6#include <wlr/types/wlr_scene.h>
6#include "list.h" 7#include "list.h"
7#include "sway/tree/node.h" 8#include "sway/tree/node.h"
8 9
@@ -68,11 +69,39 @@ 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
72 struct wlr_scene_tree *scene_tree;
73
74 struct {
75 struct wlr_scene_tree *tree;
76
77 struct wlr_scene_tree *border;
78 struct wlr_scene_tree *background;
79
80 struct sway_text_node *title_text;
81 struct sway_text_node *marks_text;
82 } title_bar;
83
84 struct {
85 struct wlr_scene_tree *tree;
86
87 struct wlr_scene_rect *top;
88 struct wlr_scene_rect *bottom;
89 struct wlr_scene_rect *left;
90 struct wlr_scene_rect *right;
91 } border;
92
93 struct wlr_scene_tree *content_tree;
94 struct wlr_scene_buffer *output_handler;
95
96 struct wl_listener output_enter;
97 struct wl_listener output_leave;
98
71 struct sway_container_state current; 99 struct sway_container_state current;
72 struct sway_container_state pending; 100 struct sway_container_state pending;
73 101
74 char *title; // The view's title (unformatted) 102 char *title; // The view's title (unformatted)
75 char *formatted_title; // The title displayed in the title bar 103 char *formatted_title; // The title displayed in the title bar
104 int title_width;
76 105
77 enum sway_container_layout prev_split_layout; 106 enum sway_container_layout prev_split_layout;
78 107
@@ -100,33 +129,19 @@ struct sway_container {
100 double child_total_width; 129 double child_total_width;
101 double child_total_height; 130 double child_total_height;
102 131
103 // In most cases this is the same as the content x and y, but if the view
104 // refuses to resize to the content dimensions then it can be smaller.
105 // These are in layout coordinates.
106 double surface_x, surface_y;
107
108 // Outputs currently being intersected
109 list_t *outputs; // struct sway_output
110
111 // Indicates that the container is a scratchpad container. 132 // Indicates that the container is a scratchpad container.
112 // Both hidden and visible scratchpad containers have scratchpad=true. 133 // Both hidden and visible scratchpad containers have scratchpad=true.
113 // Hidden scratchpad containers have a NULL parent. 134 // Hidden scratchpad containers have a NULL parent.
114 bool scratchpad; 135 bool scratchpad;
115 136
116 float alpha; 137 // Stores last output size and position for adjusting coordinates of
138 // scratchpad windows.
139 // Unused for non-scratchpad windows.
140 struct wlr_box transform;
117 141
118 struct wlr_texture *title_focused; 142 float alpha;
119 struct wlr_texture *title_focused_inactive;
120 struct wlr_texture *title_focused_tab_title;
121 struct wlr_texture *title_unfocused;
122 struct wlr_texture *title_urgent;
123 143
124 list_t *marks; // char * 144 list_t *marks; // char *
125 struct wlr_texture *marks_focused;
126 struct wlr_texture *marks_focused_inactive;
127 struct wlr_texture *marks_focused_tab_title;
128 struct wlr_texture *marks_unfocused;
129 struct wlr_texture *marks_urgent;
130 145
131 struct { 146 struct {
132 struct wl_signal destroy; 147 struct wl_signal destroy;
@@ -146,19 +161,6 @@ void container_begin_destroy(struct sway_container *con);
146struct sway_container *container_find_child(struct sway_container *container, 161struct sway_container *container_find_child(struct sway_container *container,
147 bool (*test)(struct sway_container *view, void *data), void *data); 162 bool (*test)(struct sway_container *view, void *data), void *data);
148 163
149/**
150 * Find a container at the given coordinates. Returns the surface and
151 * surface-local coordinates of the given layout coordinates if the container
152 * is a view and the view contains a surface at those coordinates.
153 */
154struct sway_container *container_at(struct sway_workspace *workspace,
155 double lx, double ly, struct wlr_surface **surface,
156 double *sx, double *sy);
157
158struct sway_container *tiling_container_at(
159 struct sway_node *parent, double lx, double ly,
160 struct wlr_surface **surface, double *sx, double *sy);
161
162void container_for_each_child(struct sway_container *container, 164void container_for_each_child(struct sway_container *container,
163 void (*f)(struct sway_container *container, void *data), void *data); 165 void (*f)(struct sway_container *container, void *data), void *data);
164 166
@@ -175,13 +177,13 @@ bool container_has_ancestor(struct sway_container *container,
175 177
176void container_update_textures_recursive(struct sway_container *con); 178void container_update_textures_recursive(struct sway_container *con);
177 179
178void container_damage_whole(struct sway_container *container);
179
180void container_reap_empty(struct sway_container *con); 180void container_reap_empty(struct sway_container *con);
181 181
182struct sway_container *container_flatten(struct sway_container *container); 182struct sway_container *container_flatten(struct sway_container *container);
183 183
184void container_update_title_textures(struct sway_container *container); 184void container_update_title_bar(struct sway_container *container);
185
186void container_update_marks(struct sway_container *container);
185 187
186size_t container_build_representation(enum sway_container_layout layout, 188size_t container_build_representation(enum sway_container_layout layout,
187 list_t *children, char *buffer); 189 list_t *children, char *buffer);
@@ -196,6 +198,9 @@ size_t container_titlebar_height(void);
196void floating_calculate_constraints(int *min_width, int *max_width, 198void floating_calculate_constraints(int *min_width, int *max_width,
197 int *min_height, int *max_height); 199 int *min_height, int *max_height);
198 200
201void floating_fix_coordinates(struct sway_container *con,
202 struct wlr_box *old, struct wlr_box *new);
203
199void container_floating_resize_and_center(struct sway_container *con); 204void container_floating_resize_and_center(struct sway_container *con);
200 205
201void container_floating_set_default_size(struct sway_container *con); 206void container_floating_set_default_size(struct sway_container *con);
@@ -215,11 +220,6 @@ void container_set_geometry_from_content(struct sway_container *con);
215bool container_is_floating(struct sway_container *container); 220bool container_is_floating(struct sway_container *container);
216 221
217/** 222/**
218 * Same as above, but for current container state.
219 */
220bool container_is_current_floating(struct sway_container *container);
221
222/**
223 * Get a container's box in layout coordinates. 223 * Get a container's box in layout coordinates.
224 */ 224 */
225void container_get_box(struct sway_container *container, struct wlr_box *box); 225void container_get_box(struct sway_container *container, struct wlr_box *box);
@@ -281,26 +281,12 @@ bool container_is_floating_or_child(struct sway_container *container);
281 */ 281 */
282bool container_is_fullscreen_or_child(struct sway_container *container); 282bool container_is_fullscreen_or_child(struct sway_container *container);
283 283
284/**
285 * Return the output which will be used for scale purposes.
286 * This is the most recently entered output.
287 * If the container is not on any output, return NULL.
288 */
289struct sway_output *container_get_effective_output(struct sway_container *con);
290
291void container_discover_outputs(struct sway_container *con);
292
293enum sway_container_layout container_parent_layout(struct sway_container *con); 284enum sway_container_layout container_parent_layout(struct sway_container *con);
294 285
295enum sway_container_layout container_current_parent_layout(
296 struct sway_container *con);
297
298list_t *container_get_siblings(struct sway_container *container); 286list_t *container_get_siblings(struct sway_container *container);
299 287
300int container_sibling_index(struct sway_container *child); 288int container_sibling_index(struct sway_container *child);
301 289
302list_t *container_get_current_siblings(struct sway_container *container);
303
304void container_handle_fullscreen_reparent(struct sway_container *con); 290void container_handle_fullscreen_reparent(struct sway_container *con);
305 291
306void container_add_child(struct sway_container *parent, 292void container_add_child(struct sway_container *parent,
@@ -348,8 +334,6 @@ bool container_has_mark(struct sway_container *container, char *mark);
348 334
349void container_add_mark(struct sway_container *container, char *mark); 335void container_add_mark(struct sway_container *container, char *mark);
350 336
351void container_update_marks_textures(struct sway_container *container);
352
353void container_raise_floating(struct sway_container *con); 337void container_raise_floating(struct sway_container *con);
354 338
355bool container_is_scratchpad_hidden(struct sway_container *con); 339bool container_is_scratchpad_hidden(struct sway_container *con);
@@ -373,4 +357,10 @@ bool container_is_sticky_or_child(struct sway_container *con);
373 */ 357 */
374int container_squash(struct sway_container *con); 358int container_squash(struct sway_container *con);
375 359
360void container_arrange_title_bar(struct sway_container *con);
361
362void container_update(struct sway_container *con);
363
364void container_update_itself_and_parents(struct sway_container *con);
365
376#endif 366#endif