diff options
Diffstat (limited to 'include/sway/tree')
-rw-r--r-- | include/sway/tree/container.h | 102 | ||||
-rw-r--r-- | include/sway/tree/node.h | 13 | ||||
-rw-r--r-- | include/sway/tree/root.h | 50 | ||||
-rw-r--r-- | include/sway/tree/view.h | 121 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 8 |
5 files changed, 148 insertions, 146 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); | |||
146 | struct sway_container *container_find_child(struct sway_container *container, | 161 | struct 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 | */ | ||
154 | struct sway_container *container_at(struct sway_workspace *workspace, | ||
155 | double lx, double ly, struct wlr_surface **surface, | ||
156 | double *sx, double *sy); | ||
157 | |||
158 | struct sway_container *tiling_container_at( | ||
159 | struct sway_node *parent, double lx, double ly, | ||
160 | struct wlr_surface **surface, double *sx, double *sy); | ||
161 | |||
162 | void container_for_each_child(struct sway_container *container, | 164 | void 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 | ||
176 | void container_update_textures_recursive(struct sway_container *con); | 178 | void container_update_textures_recursive(struct sway_container *con); |
177 | 179 | ||
178 | void container_damage_whole(struct sway_container *container); | ||
179 | |||
180 | void container_reap_empty(struct sway_container *con); | 180 | void container_reap_empty(struct sway_container *con); |
181 | 181 | ||
182 | struct sway_container *container_flatten(struct sway_container *container); | 182 | struct sway_container *container_flatten(struct sway_container *container); |
183 | 183 | ||
184 | void container_update_title_textures(struct sway_container *container); | 184 | void container_update_title_bar(struct sway_container *container); |
185 | |||
186 | void container_update_marks(struct sway_container *container); | ||
185 | 187 | ||
186 | size_t container_build_representation(enum sway_container_layout layout, | 188 | size_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); | |||
196 | void floating_calculate_constraints(int *min_width, int *max_width, | 198 | void 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 | ||
201 | void floating_fix_coordinates(struct sway_container *con, | ||
202 | struct wlr_box *old, struct wlr_box *new); | ||
203 | |||
199 | void container_floating_resize_and_center(struct sway_container *con); | 204 | void container_floating_resize_and_center(struct sway_container *con); |
200 | 205 | ||
201 | void container_floating_set_default_size(struct sway_container *con); | 206 | void container_floating_set_default_size(struct sway_container *con); |
@@ -215,11 +220,6 @@ void container_set_geometry_from_content(struct sway_container *con); | |||
215 | bool container_is_floating(struct sway_container *container); | 220 | bool container_is_floating(struct sway_container *container); |
216 | 221 | ||
217 | /** | 222 | /** |
218 | * Same as above, but for current container state. | ||
219 | */ | ||
220 | bool 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 | */ |
225 | void container_get_box(struct sway_container *container, struct wlr_box *box); | 225 | void 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 | */ |
282 | bool container_is_fullscreen_or_child(struct sway_container *container); | 282 | bool 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 | */ | ||
289 | struct sway_output *container_get_effective_output(struct sway_container *con); | ||
290 | |||
291 | void container_discover_outputs(struct sway_container *con); | ||
292 | |||
293 | enum sway_container_layout container_parent_layout(struct sway_container *con); | 284 | enum sway_container_layout container_parent_layout(struct sway_container *con); |
294 | 285 | ||
295 | enum sway_container_layout container_current_parent_layout( | ||
296 | struct sway_container *con); | ||
297 | |||
298 | list_t *container_get_siblings(struct sway_container *container); | 286 | list_t *container_get_siblings(struct sway_container *container); |
299 | 287 | ||
300 | int container_sibling_index(struct sway_container *child); | 288 | int container_sibling_index(struct sway_container *child); |
301 | 289 | ||
302 | list_t *container_get_current_siblings(struct sway_container *container); | ||
303 | |||
304 | void container_handle_fullscreen_reparent(struct sway_container *con); | 290 | void container_handle_fullscreen_reparent(struct sway_container *con); |
305 | 291 | ||
306 | void container_add_child(struct sway_container *parent, | 292 | void container_add_child(struct sway_container *parent, |
@@ -348,8 +334,6 @@ bool container_has_mark(struct sway_container *container, char *mark); | |||
348 | 334 | ||
349 | void container_add_mark(struct sway_container *container, char *mark); | 335 | void container_add_mark(struct sway_container *container, char *mark); |
350 | 336 | ||
351 | void container_update_marks_textures(struct sway_container *container); | ||
352 | |||
353 | void container_raise_floating(struct sway_container *con); | 337 | void container_raise_floating(struct sway_container *con); |
354 | 338 | ||
355 | bool container_is_scratchpad_hidden(struct sway_container *con); | 339 | bool container_is_scratchpad_hidden(struct sway_container *con); |
@@ -373,4 +357,10 @@ bool container_is_sticky_or_child(struct sway_container *con); | |||
373 | */ | 357 | */ |
374 | int container_squash(struct sway_container *con); | 358 | int container_squash(struct sway_container *con); |
375 | 359 | ||
360 | void container_arrange_title_bar(struct sway_container *con); | ||
361 | |||
362 | void container_update(struct sway_container *con); | ||
363 | |||
364 | void container_update_itself_and_parents(struct sway_container *con); | ||
365 | |||
376 | #endif | 366 | #endif |
diff --git a/include/sway/tree/node.h b/include/sway/tree/node.h index 470ee3b5..e2dbcdf0 100644 --- a/include/sway/tree/node.h +++ b/include/sway/tree/node.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _SWAY_NODE_H | 1 | #ifndef _SWAY_NODE_H |
2 | #define _SWAY_NODE_H | 2 | #define _SWAY_NODE_H |
3 | #include <wayland-server-core.h> | ||
3 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <wlr/types/wlr_scene.h> | ||
4 | #include "list.h" | 6 | #include "list.h" |
5 | 7 | ||
6 | #define MIN_SANE_W 100 | 8 | #define MIN_SANE_W 100 |
@@ -74,4 +76,15 @@ list_t *node_get_children(struct sway_node *node); | |||
74 | 76 | ||
75 | bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor); | 77 | bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor); |
76 | 78 | ||
79 | // when destroying a sway tree, it's not known which order the tree will be | ||
80 | // destroyed. To prevent freeing of scene_nodes recursing up the tree, | ||
81 | // let's use this helper function to disown them to the staging node. | ||
82 | void scene_node_disown_children(struct wlr_scene_tree *tree); | ||
83 | |||
84 | // a helper function used to allocate tree nodes. If an allocation failure | ||
85 | // occurs a flag is flipped that can be checked later to destroy a parent | ||
86 | // of this scene node preventing memory leaks. | ||
87 | struct wlr_scene_tree *alloc_scene_tree(struct wlr_scene_tree *parent, | ||
88 | bool *failed); | ||
89 | |||
77 | #endif | 90 | #endif |
diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index 5d4a2f2d..15df0f55 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include <wayland-util.h> | 4 | #include <wayland-util.h> |
5 | #include <wlr/types/wlr_output_layout.h> | 5 | #include <wlr/types/wlr_output_layout.h> |
6 | #include <wlr/types/wlr_scene.h> | ||
6 | #include <wlr/render/wlr_texture.h> | 7 | #include <wlr/render/wlr_texture.h> |
7 | #include "sway/tree/container.h" | 8 | #include "sway/tree/container.h" |
8 | #include "sway/tree/node.h" | 9 | #include "sway/tree/node.h" |
@@ -16,10 +17,44 @@ struct sway_root { | |||
16 | struct wlr_output_layout *output_layout; | 17 | struct wlr_output_layout *output_layout; |
17 | 18 | ||
18 | struct wl_listener output_layout_change; | 19 | struct wl_listener output_layout_change; |
20 | |||
21 | // scene node layout: | ||
22 | // - root | ||
23 | // - staging | ||
24 | // - layer shell stuff | ||
25 | // - tiling | ||
26 | // - floating | ||
27 | // - fullscreen stuff | ||
28 | // - seat stuff | ||
29 | // - ext_session_lock | ||
30 | struct wlr_scene *root_scene; | ||
31 | |||
32 | // since wlr_scene nodes can't be orphaned and must always | ||
33 | // have a parent, use this staging scene_tree so that a | ||
34 | // node always have a valid parent. Nothing in this | ||
35 | // staging node will be visible. | ||
36 | struct wlr_scene_tree *staging; | ||
37 | |||
38 | // tree containing all layers the compositor will render. Cursor handling | ||
39 | // will end up iterating this tree. | ||
40 | struct wlr_scene_tree *layer_tree; | ||
41 | |||
42 | struct { | ||
43 | struct wlr_scene_tree *shell_background; | ||
44 | struct wlr_scene_tree *shell_bottom; | ||
45 | struct wlr_scene_tree *tiling; | ||
46 | struct wlr_scene_tree *floating; | ||
47 | struct wlr_scene_tree *shell_top; | ||
48 | struct wlr_scene_tree *fullscreen; | ||
49 | struct wlr_scene_tree *fullscreen_global; | ||
19 | #if HAVE_XWAYLAND | 50 | #if HAVE_XWAYLAND |
20 | struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link | 51 | struct wlr_scene_tree *unmanaged; |
21 | #endif | 52 | #endif |
22 | struct wl_list drag_icons; // sway_drag_icon::link | 53 | struct wlr_scene_tree *shell_overlay; |
54 | struct wlr_scene_tree *popup; | ||
55 | struct wlr_scene_tree *seat; | ||
56 | struct wlr_scene_tree *session_lock; | ||
57 | } layers; | ||
23 | 58 | ||
24 | // Includes disabled outputs | 59 | // Includes disabled outputs |
25 | struct wl_list all_outputs; // sway_output::link | 60 | struct wl_list all_outputs; // sway_output::link |
@@ -28,6 +63,7 @@ struct sway_root { | |||
28 | double width, height; | 63 | double width, height; |
29 | 64 | ||
30 | list_t *outputs; // struct sway_output | 65 | list_t *outputs; // struct sway_output |
66 | list_t *non_desktop_outputs; // struct sway_output_non_desktop | ||
31 | list_t *scratchpad; // struct sway_container | 67 | list_t *scratchpad; // struct sway_container |
32 | 68 | ||
33 | // For when there's no connected outputs | 69 | // For when there's no connected outputs |
@@ -40,7 +76,7 @@ struct sway_root { | |||
40 | } events; | 76 | } events; |
41 | }; | 77 | }; |
42 | 78 | ||
43 | struct sway_root *root_create(void); | 79 | struct sway_root *root_create(struct wl_display *display); |
44 | 80 | ||
45 | void root_destroy(struct sway_root *root); | 81 | void root_destroy(struct sway_root *root); |
46 | 82 | ||
@@ -68,12 +104,6 @@ void root_scratchpad_show(struct sway_container *con); | |||
68 | */ | 104 | */ |
69 | void root_scratchpad_hide(struct sway_container *con); | 105 | void root_scratchpad_hide(struct sway_container *con); |
70 | 106 | ||
71 | struct sway_workspace *root_workspace_for_pid(pid_t pid); | ||
72 | |||
73 | void root_record_workspace_pid(pid_t pid); | ||
74 | |||
75 | void root_remove_workspace_pid(pid_t pid); | ||
76 | |||
77 | void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data), | 107 | void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data), |
78 | void *data); | 108 | void *data); |
79 | 109 | ||
@@ -91,6 +121,4 @@ struct sway_container *root_find_container( | |||
91 | 121 | ||
92 | void root_get_box(struct sway_root *root, struct wlr_box *box); | 122 | void root_get_box(struct sway_root *root, struct wlr_box *box); |
93 | 123 | ||
94 | void root_rename_pid_workspaces(const char *old_name, const char *new_name); | ||
95 | |||
96 | #endif | 124 | #endif |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 95708a04..7faacdcc 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -2,7 +2,8 @@ | |||
2 | #define _SWAY_VIEW_H | 2 | #define _SWAY_VIEW_H |
3 | #include <wayland-server-core.h> | 3 | #include <wayland-server-core.h> |
4 | #include <wlr/types/wlr_compositor.h> | 4 | #include <wlr/types/wlr_compositor.h> |
5 | #include "config.h" | 5 | #include <wlr/types/wlr_scene.h> |
6 | #include "sway/config.h" | ||
6 | #if HAVE_XWAYLAND | 7 | #if HAVE_XWAYLAND |
7 | #include <wlr/xwayland.h> | 8 | #include <wlr/xwayland.h> |
8 | #endif | 9 | #endif |
@@ -45,10 +46,6 @@ struct sway_view_impl { | |||
45 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); | 46 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); |
46 | void (*set_resizing)(struct sway_view *view, bool resizing); | 47 | void (*set_resizing)(struct sway_view *view, bool resizing); |
47 | bool (*wants_floating)(struct sway_view *view); | 48 | bool (*wants_floating)(struct sway_view *view); |
48 | void (*for_each_surface)(struct sway_view *view, | ||
49 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
50 | void (*for_each_popup_surface)(struct sway_view *view, | ||
51 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
52 | bool (*is_transient_for)(struct sway_view *child, | 49 | bool (*is_transient_for)(struct sway_view *child, |
53 | struct sway_view *ancestor); | 50 | struct sway_view *ancestor); |
54 | void (*close)(struct sway_view *view); | 51 | void (*close)(struct sway_view *view); |
@@ -56,24 +53,20 @@ struct sway_view_impl { | |||
56 | void (*destroy)(struct sway_view *view); | 53 | void (*destroy)(struct sway_view *view); |
57 | }; | 54 | }; |
58 | 55 | ||
59 | struct sway_saved_buffer { | ||
60 | struct wlr_client_buffer *buffer; | ||
61 | int x, y; | ||
62 | int width, height; | ||
63 | enum wl_output_transform transform; | ||
64 | struct wlr_fbox source_box; | ||
65 | struct wl_list link; // sway_view::saved_buffers | ||
66 | }; | ||
67 | |||
68 | struct sway_view { | 56 | struct sway_view { |
69 | enum sway_view_type type; | 57 | enum sway_view_type type; |
70 | const struct sway_view_impl *impl; | 58 | const struct sway_view_impl *impl; |
71 | 59 | ||
60 | struct wlr_scene_tree *scene_tree; | ||
61 | struct wlr_scene_tree *content_tree; | ||
62 | struct wlr_scene_tree *saved_surface_tree; | ||
63 | |||
72 | struct sway_container *container; // NULL if unmapped and transactions finished | 64 | struct sway_container *container; // NULL if unmapped and transactions finished |
73 | struct wlr_surface *surface; // NULL for unmapped views | 65 | struct wlr_surface *surface; // NULL for unmapped views |
74 | struct sway_xdg_decoration *xdg_decoration; | 66 | struct sway_xdg_decoration *xdg_decoration; |
75 | 67 | ||
76 | pid_t pid; | 68 | pid_t pid; |
69 | struct launcher_ctx *ctx; | ||
77 | 70 | ||
78 | // The size the view would want to be if it weren't tiled. | 71 | // The size the view would want to be if it weren't tiled. |
79 | // Used when changing a view from tiled to floating. | 72 | // Used when changing a view from tiled to floating. |
@@ -87,15 +80,11 @@ struct sway_view { | |||
87 | bool allow_request_urgent; | 80 | bool allow_request_urgent; |
88 | struct wl_event_source *urgent_timer; | 81 | struct wl_event_source *urgent_timer; |
89 | 82 | ||
90 | struct wl_list saved_buffers; // sway_saved_buffer::link | ||
91 | |||
92 | // The geometry for whatever the client is committing, regardless of | 83 | // The geometry for whatever the client is committing, regardless of |
93 | // transaction state. Updated on every commit. | 84 | // transaction state. Updated on every commit. |
94 | struct wlr_box geometry; | 85 | struct wlr_box geometry; |
95 | 86 | ||
96 | // The "old" geometry during a transaction. Used to damage the old location | 87 | struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel; |
97 | // when a transaction is applied. | ||
98 | struct wlr_box saved_geometry; | ||
99 | 88 | ||
100 | struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel; | 89 | struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel; |
101 | struct wl_listener foreign_activate_request; | 90 | struct wl_listener foreign_activate_request; |
@@ -118,8 +107,6 @@ struct sway_view { | |||
118 | struct wl_signal unmap; | 107 | struct wl_signal unmap; |
119 | } events; | 108 | } events; |
120 | 109 | ||
121 | struct wl_listener surface_new_subsurface; | ||
122 | |||
123 | int max_render_time; // In milliseconds | 110 | int max_render_time; // In milliseconds |
124 | 111 | ||
125 | enum seat_config_shortcuts_inhibit shortcuts_inhibit; | 112 | enum seat_config_shortcuts_inhibit shortcuts_inhibit; |
@@ -131,6 +118,7 @@ struct sway_xdg_shell_view { | |||
131 | struct wl_listener commit; | 118 | struct wl_listener commit; |
132 | struct wl_listener request_move; | 119 | struct wl_listener request_move; |
133 | struct wl_listener request_resize; | 120 | struct wl_listener request_resize; |
121 | struct wl_listener request_maximize; | ||
134 | struct wl_listener request_fullscreen; | 122 | struct wl_listener request_fullscreen; |
135 | struct wl_listener set_title; | 123 | struct wl_listener set_title; |
136 | struct wl_listener set_app_id; | 124 | struct wl_listener set_app_id; |
@@ -143,6 +131,8 @@ struct sway_xdg_shell_view { | |||
143 | struct sway_xwayland_view { | 131 | struct sway_xwayland_view { |
144 | struct sway_view view; | 132 | struct sway_view view; |
145 | 133 | ||
134 | struct wlr_scene_tree *surface_tree; | ||
135 | |||
146 | struct wl_listener commit; | 136 | struct wl_listener commit; |
147 | struct wl_listener request_move; | 137 | struct wl_listener request_move; |
148 | struct wl_listener request_resize; | 138 | struct wl_listener request_resize; |
@@ -154,72 +144,55 @@ struct sway_xwayland_view { | |||
154 | struct wl_listener set_title; | 144 | struct wl_listener set_title; |
155 | struct wl_listener set_class; | 145 | struct wl_listener set_class; |
156 | struct wl_listener set_role; | 146 | struct wl_listener set_role; |
147 | struct wl_listener set_startup_id; | ||
157 | struct wl_listener set_window_type; | 148 | struct wl_listener set_window_type; |
158 | struct wl_listener set_hints; | 149 | struct wl_listener set_hints; |
159 | struct wl_listener set_decorations; | 150 | struct wl_listener set_decorations; |
151 | struct wl_listener associate; | ||
152 | struct wl_listener dissociate; | ||
160 | struct wl_listener map; | 153 | struct wl_listener map; |
161 | struct wl_listener unmap; | 154 | struct wl_listener unmap; |
162 | struct wl_listener destroy; | 155 | struct wl_listener destroy; |
163 | struct wl_listener override_redirect; | 156 | struct wl_listener override_redirect; |
157 | |||
158 | struct wl_listener surface_tree_destroy; | ||
164 | }; | 159 | }; |
165 | 160 | ||
166 | struct sway_xwayland_unmanaged { | 161 | struct sway_xwayland_unmanaged { |
167 | struct wlr_xwayland_surface *wlr_xwayland_surface; | 162 | struct wlr_xwayland_surface *wlr_xwayland_surface; |
168 | struct wl_list link; | ||
169 | 163 | ||
170 | int lx, ly; | 164 | struct wlr_scene_surface *surface_scene; |
171 | 165 | ||
172 | struct wl_listener request_activate; | 166 | struct wl_listener request_activate; |
173 | struct wl_listener request_configure; | 167 | struct wl_listener request_configure; |
174 | struct wl_listener request_fullscreen; | 168 | struct wl_listener request_fullscreen; |
175 | struct wl_listener commit; | ||
176 | struct wl_listener set_geometry; | 169 | struct wl_listener set_geometry; |
170 | struct wl_listener associate; | ||
171 | struct wl_listener dissociate; | ||
177 | struct wl_listener map; | 172 | struct wl_listener map; |
178 | struct wl_listener unmap; | 173 | struct wl_listener unmap; |
179 | struct wl_listener destroy; | 174 | struct wl_listener destroy; |
180 | struct wl_listener override_redirect; | 175 | struct wl_listener override_redirect; |
181 | }; | 176 | }; |
182 | #endif | 177 | #endif |
183 | struct sway_view_child; | ||
184 | |||
185 | struct sway_view_child_impl { | ||
186 | void (*get_view_coords)(struct sway_view_child *child, int *sx, int *sy); | ||
187 | void (*destroy)(struct sway_view_child *child); | ||
188 | }; | ||
189 | |||
190 | /** | ||
191 | * A view child is a surface in the view tree, such as a subsurface or a popup. | ||
192 | */ | ||
193 | struct sway_view_child { | ||
194 | const struct sway_view_child_impl *impl; | ||
195 | struct wl_list link; | ||
196 | 178 | ||
179 | struct sway_popup_desc { | ||
180 | struct wlr_scene_node *relative; | ||
197 | struct sway_view *view; | 181 | struct sway_view *view; |
198 | struct sway_view_child *parent; | ||
199 | struct wl_list children; // sway_view_child::link | ||
200 | struct wlr_surface *surface; | ||
201 | bool mapped; | ||
202 | |||
203 | struct wl_listener surface_commit; | ||
204 | struct wl_listener surface_new_subsurface; | ||
205 | struct wl_listener surface_map; | ||
206 | struct wl_listener surface_unmap; | ||
207 | struct wl_listener surface_destroy; | ||
208 | struct wl_listener view_unmap; | ||
209 | }; | ||
210 | |||
211 | struct sway_subsurface { | ||
212 | struct sway_view_child child; | ||
213 | |||
214 | struct wl_listener destroy; | ||
215 | }; | 182 | }; |
216 | 183 | ||
217 | struct sway_xdg_popup { | 184 | struct sway_xdg_popup { |
218 | struct sway_view_child child; | 185 | struct sway_view *view; |
219 | 186 | ||
187 | struct wlr_scene_tree *scene_tree; | ||
188 | struct wlr_scene_tree *xdg_surface_tree; | ||
220 | struct wlr_xdg_popup *wlr_xdg_popup; | 189 | struct wlr_xdg_popup *wlr_xdg_popup; |
221 | 190 | ||
191 | struct sway_popup_desc desc; | ||
192 | |||
193 | struct wl_listener surface_commit; | ||
222 | struct wl_listener new_popup; | 194 | struct wl_listener new_popup; |
195 | struct wl_listener reposition; | ||
223 | struct wl_listener destroy; | 196 | struct wl_listener destroy; |
224 | }; | 197 | }; |
225 | 198 | ||
@@ -268,7 +241,12 @@ void view_set_activated(struct sway_view *view, bool activated); | |||
268 | /** | 241 | /** |
269 | * Called when the view requests to be focused. | 242 | * Called when the view requests to be focused. |
270 | */ | 243 | */ |
271 | void view_request_activate(struct sway_view *view); | 244 | void view_request_activate(struct sway_view *view, struct sway_seat *seat); |
245 | |||
246 | /* | ||
247 | * Called when the view requests urgent state | ||
248 | */ | ||
249 | void view_request_urgent(struct sway_view *view); | ||
272 | 250 | ||
273 | /** | 251 | /** |
274 | * If possible, instructs the client to change their decoration mode. | 252 | * If possible, instructs the client to change their decoration mode. |
@@ -287,23 +265,9 @@ void view_close(struct sway_view *view); | |||
287 | 265 | ||
288 | void view_close_popups(struct sway_view *view); | 266 | void view_close_popups(struct sway_view *view); |
289 | 267 | ||
290 | void view_damage_from(struct sway_view *view); | ||
291 | |||
292 | /** | ||
293 | * Iterate all surfaces of a view (toplevels + popups). | ||
294 | */ | ||
295 | void view_for_each_surface(struct sway_view *view, | ||
296 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
297 | |||
298 | /** | ||
299 | * Iterate all popup surfaces of a view. | ||
300 | */ | ||
301 | void view_for_each_popup_surface(struct sway_view *view, | ||
302 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
303 | |||
304 | // view implementation | 268 | // view implementation |
305 | 269 | ||
306 | void view_init(struct sway_view *view, enum sway_view_type type, | 270 | bool view_init(struct sway_view *view, enum sway_view_type type, |
307 | const struct sway_view_impl *impl); | 271 | const struct sway_view_impl *impl); |
308 | 272 | ||
309 | void view_destroy(struct sway_view *view); | 273 | void view_destroy(struct sway_view *view); |
@@ -325,14 +289,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
325 | void view_unmap(struct sway_view *view); | 289 | void view_unmap(struct sway_view *view); |
326 | 290 | ||
327 | void view_update_size(struct sway_view *view); | 291 | void view_update_size(struct sway_view *view); |
328 | void view_center_surface(struct sway_view *view); | 292 | void view_center_and_clip_surface(struct sway_view *view); |
329 | |||
330 | void view_child_init(struct sway_view_child *child, | ||
331 | const struct sway_view_child_impl *impl, struct sway_view *view, | ||
332 | struct wlr_surface *surface); | ||
333 | |||
334 | void view_child_destroy(struct sway_view_child *child); | ||
335 | |||
336 | 293 | ||
337 | struct sway_view *view_from_wlr_xdg_surface( | 294 | struct sway_view *view_from_wlr_xdg_surface( |
338 | struct wlr_xdg_surface *xdg_surface); | 295 | struct wlr_xdg_surface *xdg_surface); |
@@ -342,6 +299,8 @@ struct sway_view *view_from_wlr_xwayland_surface( | |||
342 | #endif | 299 | #endif |
343 | struct sway_view *view_from_wlr_surface(struct wlr_surface *surface); | 300 | struct sway_view *view_from_wlr_surface(struct wlr_surface *surface); |
344 | 301 | ||
302 | void view_update_app_id(struct sway_view *view); | ||
303 | |||
345 | /** | 304 | /** |
346 | * Re-read the view's title property and update any relevant title bars. | 305 | * Re-read the view's title property and update any relevant title bars. |
347 | * The force argument makes it recreate the title bars even if the title hasn't | 306 | * The force argument makes it recreate the title bars even if the title hasn't |
@@ -371,4 +330,8 @@ void view_save_buffer(struct sway_view *view); | |||
371 | 330 | ||
372 | bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor); | 331 | bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor); |
373 | 332 | ||
333 | void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx); | ||
334 | |||
335 | void view_send_frame_done(struct sway_view *view); | ||
336 | |||
374 | #endif | 337 | #endif |
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index b3d93a81..58bde20c 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define _SWAY_WORKSPACE_H | 2 | #define _SWAY_WORKSPACE_H |
3 | 3 | ||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include <wlr/types/wlr_scene.h> | ||
6 | #include "sway/config.h" | ||
5 | #include "sway/tree/container.h" | 7 | #include "sway/tree/container.h" |
6 | #include "sway/tree/node.h" | 8 | #include "sway/tree/node.h" |
7 | 9 | ||
@@ -22,6 +24,12 @@ struct sway_workspace_state { | |||
22 | 24 | ||
23 | struct sway_workspace { | 25 | struct sway_workspace { |
24 | struct sway_node node; | 26 | struct sway_node node; |
27 | |||
28 | struct { | ||
29 | struct wlr_scene_tree *tiling; | ||
30 | struct wlr_scene_tree *fullscreen; | ||
31 | } layers; | ||
32 | |||
25 | struct sway_container *fullscreen; | 33 | struct sway_container *fullscreen; |
26 | 34 | ||
27 | char *name; | 35 | char *name; |