From 8af4e2e3e67e4e28e9ffad162984c0cc1414d771 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 17 Aug 2018 10:23:29 +1000 Subject: [PATCH] Handle xwayland views sending new sizes in their commits --- sway/desktop/xwayland.c | 12 ++++++++++-- sway/tree/container.c | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index dca62fb1..b5df907d 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -282,11 +282,19 @@ static void handle_commit(struct wl_listener *listener, void *data) { wl_container_of(listener, xwayland_view, commit); struct sway_view *view = &xwayland_view->view; struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; - struct wlr_surface_state *surface_state = &xsurface->surface->current; + struct wlr_surface_state *state = &xsurface->surface->current; if (view->swayc->instruction) { transaction_notify_view_ready_by_size(view, - surface_state->width, surface_state->height); + state->width, state->height); + } else if ((state->width != view->width || state->height != view->height) && + container_is_floating(view->swayc)) { + // eg. The Firefox "Save As" dialog when downloading a file + // It maps at a small size then changes afterwards. + view->width = state->width; + view->height = state->height; + container_set_geometry_from_floating_view(view->swayc); + transaction_commit_dirty(); } view_damage_from(view); diff --git a/sway/tree/container.c b/sway/tree/container.c index 1dc4be4b..b3368a2e 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -1089,6 +1089,7 @@ void container_set_geometry_from_floating_view(struct sway_container *con) { con->y = view->y - top; con->width = view->width + border_width * 2; con->height = top + view->height + border_width; + container_set_dirty(con); } bool container_is_floating(struct sway_container *container) {