diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-17 10:23:29 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-18 10:39:38 +1000 |
commit | 8af4e2e3e67e4e28e9ffad162984c0cc1414d771 (patch) | |
tree | e00c1f301e0f4bfc7c2dbbcb1df12525bf476d07 | |
parent | Add get_geometry for xdg_shell_v6 (diff) | |
download | sway-8af4e2e3e67e4e28e9ffad162984c0cc1414d771.tar.gz sway-8af4e2e3e67e4e28e9ffad162984c0cc1414d771.tar.zst sway-8af4e2e3e67e4e28e9ffad162984c0cc1414d771.zip |
Handle xwayland views sending new sizes in their commits
-rw-r--r-- | sway/desktop/xwayland.c | 12 | ||||
-rw-r--r-- | 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) { | |||
282 | wl_container_of(listener, xwayland_view, commit); | 282 | wl_container_of(listener, xwayland_view, commit); |
283 | struct sway_view *view = &xwayland_view->view; | 283 | struct sway_view *view = &xwayland_view->view; |
284 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 284 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
285 | struct wlr_surface_state *surface_state = &xsurface->surface->current; | 285 | struct wlr_surface_state *state = &xsurface->surface->current; |
286 | 286 | ||
287 | if (view->swayc->instruction) { | 287 | if (view->swayc->instruction) { |
288 | transaction_notify_view_ready_by_size(view, | 288 | transaction_notify_view_ready_by_size(view, |
289 | surface_state->width, surface_state->height); | 289 | state->width, state->height); |
290 | } else if ((state->width != view->width || state->height != view->height) && | ||
291 | container_is_floating(view->swayc)) { | ||
292 | // eg. The Firefox "Save As" dialog when downloading a file | ||
293 | // It maps at a small size then changes afterwards. | ||
294 | view->width = state->width; | ||
295 | view->height = state->height; | ||
296 | container_set_geometry_from_floating_view(view->swayc); | ||
297 | transaction_commit_dirty(); | ||
290 | } | 298 | } |
291 | 299 | ||
292 | view_damage_from(view); | 300 | 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) { | |||
1089 | con->y = view->y - top; | 1089 | con->y = view->y - top; |
1090 | con->width = view->width + border_width * 2; | 1090 | con->width = view->width + border_width * 2; |
1091 | con->height = top + view->height + border_width; | 1091 | con->height = top + view->height + border_width; |
1092 | container_set_dirty(con); | ||
1092 | } | 1093 | } |
1093 | 1094 | ||
1094 | bool container_is_floating(struct sway_container *container) { | 1095 | bool container_is_floating(struct sway_container *container) { |