diff options
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r-- | sway/desktop/xwayland.c | 34 |
1 files changed, 30 insertions, 4 deletions
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); |