diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-08-18 19:26:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-18 19:26:36 -0400 |
commit | d0a24465d75cc7197ee253e1de9fa961071cd034 (patch) | |
tree | 916f9f40b9f587d3cd24a8d7b2185b5c7808cfa4 | |
parent | Merge pull request #2484 from ianyfan/con-for-each-child-fix (diff) | |
parent | Fix nitpick (diff) | |
download | sway-d0a24465d75cc7197ee253e1de9fa961071cd034.tar.gz sway-d0a24465d75cc7197ee253e1de9fa961071cd034.tar.zst sway-d0a24465d75cc7197ee253e1de9fa961071cd034.zip |
Merge pull request #2466 from RyanDwyer/geometry
Fix geometry
-rw-r--r-- | include/sway/desktop.h | 5 | ||||
-rw-r--r-- | include/sway/tree/view.h | 10 | ||||
-rw-r--r-- | sway/desktop/desktop.c | 18 | ||||
-rw-r--r-- | sway/desktop/output.c | 9 | ||||
-rw-r--r-- | sway/desktop/render.c | 14 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 51 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 20 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 21 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 34 | ||||
-rw-r--r-- | sway/tree/container.c | 5 | ||||
-rw-r--r-- | sway/tree/view.c | 24 |
11 files changed, 151 insertions, 60 deletions
diff --git a/include/sway/desktop.h b/include/sway/desktop.h index 348fb187..c969a76b 100644 --- a/include/sway/desktop.h +++ b/include/sway/desktop.h | |||
@@ -1,8 +1,13 @@ | |||
1 | #include <wlr/types/wlr_surface.h> | 1 | #include <wlr/types/wlr_surface.h> |
2 | 2 | ||
3 | struct sway_container; | 3 | struct sway_container; |
4 | struct sway_view; | ||
4 | 5 | ||
5 | void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, | 6 | void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, |
6 | bool whole); | 7 | bool whole); |
7 | 8 | ||
8 | void desktop_damage_whole_container(struct sway_container *con); | 9 | void desktop_damage_whole_container(struct sway_container *con); |
10 | |||
11 | void desktop_damage_box(struct wlr_box *box); | ||
12 | |||
13 | void desktop_damage_view(struct sway_view *view); | ||
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index c2225bcb..2747e7c4 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -88,6 +88,14 @@ struct sway_view { | |||
88 | struct wlr_buffer *saved_buffer; | 88 | struct wlr_buffer *saved_buffer; |
89 | int saved_buffer_width, saved_buffer_height; | 89 | int saved_buffer_width, saved_buffer_height; |
90 | 90 | ||
91 | // The geometry for whatever the client is committing, regardless of | ||
92 | // transaction state. Updated on every commit. | ||
93 | struct wlr_box geometry; | ||
94 | |||
95 | // The "old" geometry during a transaction. Used to damage the old location | ||
96 | // when a transaction is applied. | ||
97 | struct wlr_box saved_geometry; | ||
98 | |||
91 | bool destroying; | 99 | bool destroying; |
92 | 100 | ||
93 | list_t *executed_criteria; // struct criteria * | 101 | list_t *executed_criteria; // struct criteria * |
@@ -285,8 +293,6 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); | |||
285 | 293 | ||
286 | void view_unmap(struct sway_view *view); | 294 | void view_unmap(struct sway_view *view); |
287 | 295 | ||
288 | void view_update_position(struct sway_view *view, double lx, double ly); | ||
289 | |||
290 | void view_update_size(struct sway_view *view, int width, int height); | 296 | void view_update_size(struct sway_view *view, int width, int height); |
291 | 297 | ||
292 | void view_child_init(struct sway_view_child *child, | 298 | void view_child_init(struct sway_view_child *child, |
diff --git a/sway/desktop/desktop.c b/sway/desktop/desktop.c index 6575519d..72650397 100644 --- a/sway/desktop/desktop.c +++ b/sway/desktop/desktop.c | |||
@@ -22,3 +22,21 @@ void desktop_damage_whole_container(struct sway_container *con) { | |||
22 | } | 22 | } |
23 | } | 23 | } |
24 | } | 24 | } |
25 | |||
26 | void desktop_damage_box(struct wlr_box *box) { | ||
27 | for (int i = 0; i < root_container.children->length; ++i) { | ||
28 | struct sway_container *cont = root_container.children->items[i]; | ||
29 | output_damage_box(cont->sway_output, box); | ||
30 | } | ||
31 | } | ||
32 | |||
33 | void desktop_damage_view(struct sway_view *view) { | ||
34 | desktop_damage_whole_container(view->swayc); | ||
35 | struct wlr_box box = { | ||
36 | .x = view->swayc->current.view_x - view->geometry.x, | ||
37 | .y = view->swayc->current.view_y - view->geometry.y, | ||
38 | .width = view->surface->current.width, | ||
39 | .height = view->surface->current.height, | ||
40 | }; | ||
41 | desktop_damage_box(&box); | ||
42 | } | ||
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 43ed9793..1e4f196b 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -144,15 +144,16 @@ void output_view_for_each_surface(struct sway_output *output, | |||
144 | .user_iterator = iterator, | 144 | .user_iterator = iterator, |
145 | .user_data = user_data, | 145 | .user_data = user_data, |
146 | .output = output, | 146 | .output = output, |
147 | .ox = view->swayc->current.view_x - output->swayc->current.swayc_x, | 147 | .ox = view->swayc->current.view_x - output->swayc->current.swayc_x |
148 | .oy = view->swayc->current.view_y - output->swayc->current.swayc_y, | 148 | - view->geometry.x, |
149 | .oy = view->swayc->current.view_y - output->swayc->current.swayc_y | ||
150 | - view->geometry.y, | ||
149 | .width = view->swayc->current.view_width, | 151 | .width = view->swayc->current.view_width, |
150 | .height = view->swayc->current.view_height, | 152 | .height = view->swayc->current.view_height, |
151 | .rotation = 0, // TODO | 153 | .rotation = 0, // TODO |
152 | }; | 154 | }; |
153 | 155 | ||
154 | view_for_each_surface(view, | 156 | view_for_each_surface(view, output_for_each_surface_iterator, &data); |
155 | output_for_each_surface_iterator, &data); | ||
156 | } | 157 | } |
157 | 158 | ||
158 | void output_view_for_each_popup(struct sway_output *output, | 159 | void output_view_for_each_popup(struct sway_output *output, |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 6e1e31f0..7c48d0d2 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -193,9 +193,11 @@ static void render_view_toplevels(struct sway_view *view, | |||
193 | .alpha = alpha, | 193 | .alpha = alpha, |
194 | }; | 194 | }; |
195 | // Render all toplevels without descending into popups | 195 | // Render all toplevels without descending into popups |
196 | output_surface_for_each_surface(output, view->surface, | 196 | double ox = |
197 | view->swayc->current.view_x - output->wlr_output->lx, | 197 | view->swayc->current.view_x - output->wlr_output->lx - view->geometry.x; |
198 | view->swayc->current.view_y - output->wlr_output->ly, | 198 | double oy = |
199 | view->swayc->current.view_y - output->wlr_output->ly - view->geometry.y; | ||
200 | output_surface_for_each_surface(output, view->surface, ox, oy, | ||
199 | render_surface_iterator, &data); | 201 | render_surface_iterator, &data); |
200 | } | 202 | } |
201 | 203 | ||
@@ -227,8 +229,10 @@ static void render_saved_view(struct sway_view *view, | |||
227 | return; | 229 | return; |
228 | } | 230 | } |
229 | struct wlr_box box = { | 231 | struct wlr_box box = { |
230 | .x = view->swayc->current.view_x - output->swayc->current.swayc_x, | 232 | .x = view->swayc->current.view_x - output->swayc->current.swayc_x - |
231 | .y = view->swayc->current.view_y - output->swayc->current.swayc_y, | 233 | view->saved_geometry.x, |
234 | .y = view->swayc->current.view_y - output->swayc->current.swayc_y - | ||
235 | view->saved_geometry.y, | ||
232 | .width = view->saved_buffer_width, | 236 | .width = view->saved_buffer_width, |
233 | .height = view->saved_buffer_height, | 237 | .height = view->saved_buffer_height, |
234 | }; | 238 | }; |
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index e89f01d8..c300558a 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <time.h> | 6 | #include <time.h> |
7 | #include <wlr/types/wlr_buffer.h> | 7 | #include <wlr/types/wlr_buffer.h> |
8 | #include "sway/debug.h" | 8 | #include "sway/debug.h" |
9 | #include "sway/desktop.h" | ||
9 | #include "sway/desktop/idle_inhibit_v1.h" | 10 | #include "sway/desktop/idle_inhibit_v1.h" |
10 | #include "sway/desktop/transaction.h" | 11 | #include "sway/desktop/transaction.h" |
11 | #include "sway/output.h" | 12 | #include "sway/output.h" |
@@ -169,25 +170,17 @@ static void transaction_apply(struct sway_transaction *transaction) { | |||
169 | transaction->instructions->items[i]; | 170 | transaction->instructions->items[i]; |
170 | struct sway_container *container = instruction->container; | 171 | struct sway_container *container = instruction->container; |
171 | 172 | ||
172 | // Damage the old and new locations | 173 | // Damage the old location |
173 | struct wlr_box old_box = { | 174 | desktop_damage_whole_container(container); |
174 | .x = container->current.swayc_x, | 175 | if (container->type == C_VIEW && container->sway_view->saved_buffer) { |
175 | .y = container->current.swayc_y, | 176 | struct sway_view *view = container->sway_view; |
176 | .width = container->current.swayc_width, | 177 | struct wlr_box box = { |
177 | .height = container->current.swayc_height, | 178 | .x = container->current.view_x - view->saved_geometry.x, |
178 | }; | 179 | .y = container->current.view_y - view->saved_geometry.y, |
179 | struct wlr_box new_box = { | 180 | .width = view->saved_buffer_width, |
180 | .x = instruction->state.swayc_x, | 181 | .height = view->saved_buffer_height, |
181 | .y = instruction->state.swayc_y, | 182 | }; |
182 | .width = instruction->state.swayc_width, | 183 | desktop_damage_box(&box); |
183 | .height = instruction->state.swayc_height, | ||
184 | }; | ||
185 | for (int j = 0; j < root_container.current.children->length; ++j) { | ||
186 | struct sway_container *output = root_container.current.children->items[j]; | ||
187 | if (output->sway_output) { | ||
188 | output_damage_box(output->sway_output, &old_box); | ||
189 | output_damage_box(output->sway_output, &new_box); | ||
190 | } | ||
191 | } | 184 | } |
192 | 185 | ||
193 | // There are separate children lists for each instruction state, the | 186 | // There are separate children lists for each instruction state, the |
@@ -204,6 +197,20 @@ static void transaction_apply(struct sway_transaction *transaction) { | |||
204 | view_remove_saved_buffer(container->sway_view); | 197 | view_remove_saved_buffer(container->sway_view); |
205 | } | 198 | } |
206 | 199 | ||
200 | // Damage the new location | ||
201 | desktop_damage_whole_container(container); | ||
202 | if (container->type == C_VIEW && container->sway_view->surface) { | ||
203 | struct sway_view *view = container->sway_view; | ||
204 | struct wlr_surface *surface = view->surface; | ||
205 | struct wlr_box box = { | ||
206 | .x = container->current.view_x - view->geometry.x, | ||
207 | .y = container->current.view_y - view->geometry.y, | ||
208 | .width = surface->current.width, | ||
209 | .height = surface->current.height, | ||
210 | }; | ||
211 | desktop_damage_box(&box); | ||
212 | } | ||
213 | |||
207 | container->instruction = NULL; | 214 | container->instruction = NULL; |
208 | } | 215 | } |
209 | } | 216 | } |
@@ -297,6 +304,8 @@ static void transaction_commit(struct sway_transaction *transaction) { | |||
297 | } | 304 | } |
298 | if (con->type == C_VIEW) { | 305 | if (con->type == C_VIEW) { |
299 | view_save_buffer(con->sway_view); | 306 | view_save_buffer(con->sway_view); |
307 | memcpy(&con->sway_view->saved_geometry, &con->sway_view->geometry, | ||
308 | sizeof(struct wlr_box)); | ||
300 | } | 309 | } |
301 | con->instruction = instruction; | 310 | con->instruction = instruction; |
302 | } | 311 | } |
@@ -355,7 +364,9 @@ static void set_instruction_ready( | |||
355 | } | 364 | } |
356 | 365 | ||
357 | instruction->container->instruction = NULL; | 366 | instruction->container->instruction = NULL; |
358 | transaction_progress_queue(); | 367 | if (!txn_debug) { |
368 | transaction_progress_queue(); | ||
369 | } | ||
359 | } | 370 | } |
360 | 371 | ||
361 | void transaction_notify_view_ready_by_serial(struct sway_view *view, | 372 | void transaction_notify_view_ready_by_serial(struct sway_view *view, |
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 6a7a3f7f..aae129bd 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <wlr/util/edges.h> | 7 | #include <wlr/util/edges.h> |
8 | #include "log.h" | 8 | #include "log.h" |
9 | #include "sway/decoration.h" | 9 | #include "sway/decoration.h" |
10 | #include "sway/desktop.h" | ||
10 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
11 | #include "sway/input/seat.h" | 12 | #include "sway/input/seat.h" |
12 | #include "sway/server.h" | 13 | #include "sway/server.h" |
@@ -107,7 +108,8 @@ static void get_constraints(struct sway_view *view, double *min_width, | |||
107 | *max_height = state->max_height > 0 ? state->max_height : DBL_MAX; | 108 | *max_height = state->max_height > 0 ? state->max_height : DBL_MAX; |
108 | } | 109 | } |
109 | 110 | ||
110 | static const char *get_string_prop(struct sway_view *view, enum sway_view_prop prop) { | 111 | static const char *get_string_prop(struct sway_view *view, |
112 | enum sway_view_prop prop) { | ||
111 | if (xdg_shell_view_from_view(view) == NULL) { | 113 | if (xdg_shell_view_from_view(view) == NULL) { |
112 | return NULL; | 114 | return NULL; |
113 | } | 115 | } |
@@ -255,8 +257,24 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
255 | } | 257 | } |
256 | 258 | ||
257 | if (view->swayc->instruction) { | 259 | if (view->swayc->instruction) { |
260 | wlr_xdg_surface_get_geometry(xdg_surface, &view->geometry); | ||
258 | transaction_notify_view_ready_by_serial(view, | 261 | transaction_notify_view_ready_by_serial(view, |
259 | xdg_surface->configure_serial); | 262 | xdg_surface->configure_serial); |
263 | } else { | ||
264 | struct wlr_box new_geo; | ||
265 | wlr_xdg_surface_get_geometry(xdg_surface, &new_geo); | ||
266 | |||
267 | if ((new_geo.width != view->width || new_geo.height != view->height) && | ||
268 | container_is_floating(view->swayc)) { | ||
269 | // A floating view has unexpectedly sent a new size | ||
270 | desktop_damage_view(view); | ||
271 | view_update_size(view, new_geo.width, new_geo.height); | ||
272 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
273 | desktop_damage_view(view); | ||
274 | transaction_commit_dirty(); | ||
275 | } else { | ||
276 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
277 | } | ||
260 | } | 278 | } |
261 | 279 | ||
262 | view_damage_from(view); | 280 | view_damage_from(view); |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 5b3c7b2b..277c53a3 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <wlr/types/wlr_xdg_shell_v6.h> | 6 | #include <wlr/types/wlr_xdg_shell_v6.h> |
7 | #include "log.h" | 7 | #include "log.h" |
8 | #include "sway/decoration.h" | 8 | #include "sway/decoration.h" |
9 | #include "sway/desktop.h" | ||
9 | #include "sway/input/input-manager.h" | 10 | #include "sway/input/input-manager.h" |
10 | #include "sway/input/seat.h" | 11 | #include "sway/input/seat.h" |
11 | #include "sway/server.h" | 12 | #include "sway/server.h" |
@@ -106,7 +107,8 @@ static void get_constraints(struct sway_view *view, double *min_width, | |||
106 | *max_height = state->max_height > 0 ? state->max_height : DBL_MAX; | 107 | *max_height = state->max_height > 0 ? state->max_height : DBL_MAX; |
107 | } | 108 | } |
108 | 109 | ||
109 | static const char *get_string_prop(struct sway_view *view, enum sway_view_prop prop) { | 110 | static const char *get_string_prop(struct sway_view *view, |
111 | enum sway_view_prop prop) { | ||
110 | if (xdg_shell_v6_view_from_view(view) == NULL) { | 112 | if (xdg_shell_v6_view_from_view(view) == NULL) { |
111 | return NULL; | 113 | return NULL; |
112 | } | 114 | } |
@@ -250,9 +252,26 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
250 | if (!view->swayc) { | 252 | if (!view->swayc) { |
251 | return; | 253 | return; |
252 | } | 254 | } |
255 | |||
253 | if (view->swayc->instruction) { | 256 | if (view->swayc->instruction) { |
257 | wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &view->geometry); | ||
254 | transaction_notify_view_ready_by_serial(view, | 258 | transaction_notify_view_ready_by_serial(view, |
255 | xdg_surface_v6->configure_serial); | 259 | xdg_surface_v6->configure_serial); |
260 | } else { | ||
261 | struct wlr_box new_geo; | ||
262 | wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &new_geo); | ||
263 | |||
264 | if ((new_geo.width != view->width || new_geo.height != view->height) && | ||
265 | container_is_floating(view->swayc)) { | ||
266 | // A floating view has unexpectedly sent a new size | ||
267 | desktop_damage_view(view); | ||
268 | view_update_size(view, new_geo.width, new_geo.height); | ||
269 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
270 | desktop_damage_view(view); | ||
271 | transaction_commit_dirty(); | ||
272 | } else { | ||
273 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
274 | } | ||
256 | } | 275 | } |
257 | 276 | ||
258 | view_damage_from(view); | 277 | view_damage_from(view); |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 14f59b9c..ce7235e4 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -277,18 +277,44 @@ static const struct sway_view_impl view_impl = { | |||
277 | .destroy = destroy, | 277 | .destroy = destroy, |
278 | }; | 278 | }; |
279 | 279 | ||
280 | static void get_geometry(struct sway_view *view, struct wlr_box *box) { | ||
281 | box->x = box->y = 0; | ||
282 | if (view->surface) { | ||
283 | box->width = view->surface->current.width; | ||
284 | box->height = view->surface->current.height; | ||
285 | } else { | ||
286 | box->width = 0; | ||
287 | box->height = 0; | ||
288 | } | ||
289 | } | ||
290 | |||
280 | static void handle_commit(struct wl_listener *listener, void *data) { | 291 | static void handle_commit(struct wl_listener *listener, void *data) { |
281 | struct sway_xwayland_view *xwayland_view = | 292 | struct sway_xwayland_view *xwayland_view = |
282 | wl_container_of(listener, xwayland_view, commit); | 293 | wl_container_of(listener, xwayland_view, commit); |
283 | struct sway_view *view = &xwayland_view->view; | 294 | struct sway_view *view = &xwayland_view->view; |
284 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 295 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
285 | struct wlr_surface_state *surface_state = &xsurface->surface->current; | 296 | struct wlr_surface_state *state = &xsurface->surface->current; |
286 | 297 | ||
287 | if (view->swayc->instruction) { | 298 | if (view->swayc->instruction) { |
299 | get_geometry(view, &view->geometry); | ||
288 | transaction_notify_view_ready_by_size(view, | 300 | transaction_notify_view_ready_by_size(view, |
289 | surface_state->width, surface_state->height); | 301 | state->width, state->height); |
290 | } else if (container_is_floating(view->swayc)) { | 302 | } else { |
291 | view_update_size(view, surface_state->width, surface_state->height); | 303 | struct wlr_box new_geo; |
304 | get_geometry(view, &new_geo); | ||
305 | |||
306 | if ((new_geo.width != view->width || new_geo.height != view->height) && | ||
307 | container_is_floating(view->swayc)) { | ||
308 | // A floating view has unexpectedly sent a new size | ||
309 | // eg. The Firefox "Save As" dialog when downloading a file | ||
310 | desktop_damage_view(view); | ||
311 | view_update_size(view, new_geo.width, new_geo.height); | ||
312 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
313 | desktop_damage_view(view); | ||
314 | transaction_commit_dirty(); | ||
315 | } else { | ||
316 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
317 | } | ||
292 | } | 318 | } |
293 | 319 | ||
294 | view_damage_from(view); | 320 | view_damage_from(view); |
diff --git a/sway/tree/container.c b/sway/tree/container.c index 9bc4f544..2a428ca5 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -509,8 +509,8 @@ static void surface_at_view(struct sway_container *swayc, double lx, double ly, | |||
509 | return; | 509 | return; |
510 | } | 510 | } |
511 | struct sway_view *sview = swayc->sway_view; | 511 | struct sway_view *sview = swayc->sway_view; |
512 | double view_sx = lx - sview->x; | 512 | double view_sx = lx - sview->x + sview->geometry.x; |
513 | double view_sy = ly - sview->y; | 513 | double view_sy = ly - sview->y + sview->geometry.y; |
514 | 514 | ||
515 | double _sx, _sy; | 515 | double _sx, _sy; |
516 | struct wlr_surface *_surface = NULL; | 516 | struct wlr_surface *_surface = NULL; |
@@ -1065,6 +1065,7 @@ void container_set_geometry_from_floating_view(struct sway_container *con) { | |||
1065 | con->y = view->y - top; | 1065 | con->y = view->y - top; |
1066 | con->width = view->width + border_width * 2; | 1066 | con->width = view->width + border_width * 2; |
1067 | con->height = top + view->height + border_width; | 1067 | con->height = top + view->height + border_width; |
1068 | container_set_dirty(con); | ||
1068 | } | 1069 | } |
1069 | 1070 | ||
1070 | bool container_is_floating(struct sway_container *container) { | 1071 | bool container_is_floating(struct sway_container *container) { |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 4495c150..1c1fdb47 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -615,34 +615,16 @@ void view_unmap(struct sway_view *view) { | |||
615 | view->surface = NULL; | 615 | view->surface = NULL; |
616 | } | 616 | } |
617 | 617 | ||
618 | void view_update_position(struct sway_view *view, double lx, double ly) { | ||
619 | if (view->x == lx && view->y == ly) { | ||
620 | return; | ||
621 | } | ||
622 | container_damage_whole(view->swayc); | ||
623 | view->x = lx; | ||
624 | view->y = ly; | ||
625 | view->swayc->current.view_x = lx; | ||
626 | view->swayc->current.view_y = ly; | ||
627 | if (container_is_floating(view->swayc)) { | ||
628 | container_set_geometry_from_floating_view(view->swayc); | ||
629 | } | ||
630 | container_damage_whole(view->swayc); | ||
631 | } | ||
632 | |||
633 | void view_update_size(struct sway_view *view, int width, int height) { | 618 | void view_update_size(struct sway_view *view, int width, int height) { |
634 | if (view->width == width && view->height == height) { | 619 | if (!sway_assert(container_is_floating(view->swayc), |
620 | "Expected a floating container")) { | ||
635 | return; | 621 | return; |
636 | } | 622 | } |
637 | container_damage_whole(view->swayc); | ||
638 | view->width = width; | 623 | view->width = width; |
639 | view->height = height; | 624 | view->height = height; |
640 | view->swayc->current.view_width = width; | 625 | view->swayc->current.view_width = width; |
641 | view->swayc->current.view_height = height; | 626 | view->swayc->current.view_height = height; |
642 | if (container_is_floating(view->swayc)) { | 627 | container_set_geometry_from_floating_view(view->swayc); |
643 | container_set_geometry_from_floating_view(view->swayc); | ||
644 | } | ||
645 | container_damage_whole(view->swayc); | ||
646 | } | 628 | } |
647 | 629 | ||
648 | static void view_subsurface_create(struct sway_view *view, | 630 | static void view_subsurface_create(struct sway_view *view, |