diff options
-rw-r--r-- | sway/desktop/xwayland.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index be9503e5..8b39cf50 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -399,33 +399,30 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
399 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 399 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
400 | struct wlr_surface_state *state = &xsurface->surface->current; | 400 | struct wlr_surface_state *state = &xsurface->surface->current; |
401 | 401 | ||
402 | struct wlr_box new_geo; | ||
403 | get_geometry(view, &new_geo); | ||
404 | bool new_size = new_geo.width != view->geometry.width || | ||
405 | new_geo.height != view->geometry.height || | ||
406 | new_geo.x != view->geometry.x || | ||
407 | new_geo.y != view->geometry.y; | ||
408 | |||
409 | if (new_size) { | ||
410 | // The view has unexpectedly sent a new size | ||
411 | // eg. The Firefox "Save As" dialog when downloading a file | ||
412 | desktop_damage_view(view); | ||
413 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
414 | if (container_is_floating(view->container)) { | ||
415 | view_update_size(view, new_geo.width, new_geo.height); | ||
416 | transaction_commit_dirty(); | ||
417 | } else { | ||
418 | view_center_surface(view); | ||
419 | } | ||
420 | desktop_damage_view(view); | ||
421 | } | ||
422 | |||
402 | if (view->container->node.instruction) { | 423 | if (view->container->node.instruction) { |
403 | get_geometry(view, &view->geometry); | ||
404 | transaction_notify_view_ready_by_geometry(view, | 424 | transaction_notify_view_ready_by_geometry(view, |
405 | xsurface->x, xsurface->y, state->width, state->height); | 425 | xsurface->x, xsurface->y, state->width, state->height); |
406 | } else { | ||
407 | struct wlr_box new_geo; | ||
408 | get_geometry(view, &new_geo); | ||
409 | bool new_size = new_geo.width != view->geometry.width || | ||
410 | new_geo.height != view->geometry.height || | ||
411 | new_geo.x != view->geometry.x || | ||
412 | new_geo.y != view->geometry.y; | ||
413 | |||
414 | if (new_size) { | ||
415 | // The view has unexpectedly sent a new size | ||
416 | // eg. The Firefox "Save As" dialog when downloading a file | ||
417 | desktop_damage_view(view); | ||
418 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
419 | if (container_is_floating(view->container)) { | ||
420 | view_update_size(view, new_geo.width, new_geo.height); | ||
421 | transaction_commit_dirty(); | ||
422 | transaction_notify_view_ready_by_geometry(view, | ||
423 | xsurface->x, xsurface->y, new_geo.width, new_geo.height); | ||
424 | } else { | ||
425 | view_center_surface(view); | ||
426 | } | ||
427 | desktop_damage_view(view); | ||
428 | } | ||
429 | } | 426 | } |
430 | 427 | ||
431 | view_damage_from(view); | 428 | view_damage_from(view); |