diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-24 22:30:44 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-01 23:14:58 +1000 |
commit | 1f2e399ade77070a2d0b82856ad9a3eef96b8676 (patch) | |
tree | c469197e140051aea912cb173723c7e55ce1e410 /include | |
parent | Send frame done to floating views (diff) | |
download | sway-1f2e399ade77070a2d0b82856ad9a3eef96b8676.tar.gz sway-1f2e399ade77070a2d0b82856ad9a3eef96b8676.tar.zst sway-1f2e399ade77070a2d0b82856ad9a3eef96b8676.zip |
Implement floating
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/tree/container.h | 22 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 3 | ||||
-rw-r--r-- | include/sway/tree/view.h | 10 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 4 |
4 files changed, 34 insertions, 5 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index a4ffd25b..b802e1d1 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -75,8 +75,13 @@ struct sway_container { | |||
75 | enum sway_container_layout layout; | 75 | enum sway_container_layout layout; |
76 | enum sway_container_layout prev_layout; | 76 | enum sway_container_layout prev_layout; |
77 | 77 | ||
78 | // Allow the container to be automatically removed if it's empty. True by | ||
79 | // default, false for the magic floating container that each workspace has. | ||
80 | bool reapable; | ||
81 | |||
78 | // Saves us from searching the list of children/floating in the parent | 82 | // Saves us from searching the list of children/floating in the parent |
79 | bool is_floating; | 83 | bool is_floating; |
84 | bool is_sticky; | ||
80 | 85 | ||
81 | // For C_ROOT, this has no meaning | 86 | // For C_ROOT, this has no meaning |
82 | // For C_OUTPUT, this is the output position in layout coordinates | 87 | // For C_OUTPUT, this is the output position in layout coordinates |
@@ -174,6 +179,13 @@ struct sway_container *container_at(struct sway_container *container, | |||
174 | double *sx, double *sy); | 179 | double *sx, double *sy); |
175 | 180 | ||
176 | /** | 181 | /** |
182 | * Same as container_at, but only checks floating views and expects coordinates | ||
183 | * to be layout coordinates, as that's what floating views use. | ||
184 | */ | ||
185 | struct sway_container *floating_container_at(double lx, double ly, | ||
186 | struct wlr_surface **surface, double *sx, double *sy); | ||
187 | |||
188 | /** | ||
177 | * Apply the function for each descendant of the container breadth first. | 189 | * Apply the function for each descendant of the container breadth first. |
178 | */ | 190 | */ |
179 | void container_for_each_descendant_bfs(struct sway_container *container, | 191 | void container_for_each_descendant_bfs(struct sway_container *container, |
@@ -229,4 +241,14 @@ void container_notify_subtree_changed(struct sway_container *container); | |||
229 | */ | 241 | */ |
230 | size_t container_titlebar_height(void); | 242 | size_t container_titlebar_height(void); |
231 | 243 | ||
244 | void container_set_floating(struct sway_container *container, bool enable); | ||
245 | |||
246 | void container_set_geometry_from_view(struct sway_container *container); | ||
247 | |||
248 | /** | ||
249 | * Determine if the given container is itself floating or has a floating | ||
250 | * ancestor. | ||
251 | */ | ||
252 | bool container_self_or_parent_floating(struct sway_container *container); | ||
253 | |||
232 | #endif | 254 | #endif |
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index 33d0a5d0..2e0f2abf 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h | |||
@@ -46,9 +46,6 @@ struct sway_container *container_add_sibling(struct sway_container *parent, | |||
46 | 46 | ||
47 | struct sway_container *container_remove_child(struct sway_container *child); | 47 | struct sway_container *container_remove_child(struct sway_container *child); |
48 | 48 | ||
49 | void container_add_floating(struct sway_container *workspace, | ||
50 | struct sway_container *child); | ||
51 | |||
52 | struct sway_container *container_replace_child(struct sway_container *child, | 49 | struct sway_container *container_replace_child(struct sway_container *child, |
53 | struct sway_container *new_child); | 50 | struct sway_container *new_child); |
54 | 51 | ||
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index a8bf4955..6990e5b6 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -32,7 +32,9 @@ struct sway_view_impl { | |||
32 | void (*configure)(struct sway_view *view, double ox, double oy, int width, | 32 | void (*configure)(struct sway_view *view, double ox, double oy, int width, |
33 | int height); | 33 | int height); |
34 | void (*set_activated)(struct sway_view *view, bool activated); | 34 | void (*set_activated)(struct sway_view *view, bool activated); |
35 | void (*set_maximized)(struct sway_view *view, bool maximized); | ||
35 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); | 36 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); |
37 | bool (*wants_floating)(struct sway_view *view); | ||
36 | void (*for_each_surface)(struct sway_view *view, | 38 | void (*for_each_surface)(struct sway_view *view, |
37 | wlr_surface_iterator_func_t iterator, void *user_data); | 39 | wlr_surface_iterator_func_t iterator, void *user_data); |
38 | void (*close)(struct sway_view *view); | 40 | void (*close)(struct sway_view *view); |
@@ -50,6 +52,10 @@ struct sway_view { | |||
50 | double x, y; | 52 | double x, y; |
51 | int width, height; | 53 | int width, height; |
52 | 54 | ||
55 | // The size the view would want to be if it weren't tiled. | ||
56 | // Used when changing a view from tiled to floating. | ||
57 | int natural_width, natural_height; | ||
58 | |||
53 | bool is_fullscreen; | 59 | bool is_fullscreen; |
54 | 60 | ||
55 | char *title_format; | 61 | char *title_format; |
@@ -214,6 +220,8 @@ void view_autoconfigure(struct sway_view *view); | |||
214 | 220 | ||
215 | void view_set_activated(struct sway_view *view, bool activated); | 221 | void view_set_activated(struct sway_view *view, bool activated); |
216 | 222 | ||
223 | void view_set_maximized(struct sway_view *view, bool maximized); | ||
224 | |||
217 | void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen); | 225 | void view_set_fullscreen_raw(struct sway_view *view, bool fullscreen); |
218 | 226 | ||
219 | void view_set_fullscreen(struct sway_view *view, bool fullscreen); | 227 | void view_set_fullscreen(struct sway_view *view, bool fullscreen); |
@@ -236,7 +244,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); | |||
236 | 244 | ||
237 | void view_unmap(struct sway_view *view); | 245 | void view_unmap(struct sway_view *view); |
238 | 246 | ||
239 | void view_update_position(struct sway_view *view, double ox, double oy); | 247 | void view_update_position(struct sway_view *view, double lx, double ly); |
240 | 248 | ||
241 | void view_update_size(struct sway_view *view, int width, int height); | 249 | void view_update_size(struct sway_view *view, int width, int height); |
242 | 250 | ||
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index ece0ab5c..81321fc8 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -8,7 +8,7 @@ struct sway_view; | |||
8 | struct sway_workspace { | 8 | struct sway_workspace { |
9 | struct sway_container *swayc; | 9 | struct sway_container *swayc; |
10 | struct sway_view *fullscreen; | 10 | struct sway_view *fullscreen; |
11 | list_t *floating; | 11 | struct sway_container *floating; |
12 | }; | 12 | }; |
13 | 13 | ||
14 | extern char *prev_workspace_name; | 14 | extern char *prev_workspace_name; |
@@ -31,4 +31,6 @@ struct sway_container *workspace_prev(struct sway_container *current); | |||
31 | 31 | ||
32 | bool workspace_is_visible(struct sway_container *ws); | 32 | bool workspace_is_visible(struct sway_container *ws); |
33 | 33 | ||
34 | bool workspace_is_empty(struct sway_container *ws); | ||
35 | |||
34 | #endif | 36 | #endif |