Handle xwayland views sending new sizes in their commits

This commit is contained in:
Ryan Dwyer 2018-08-17 10:23:29 +10:00
parent 9ee89f11c4
commit 8af4e2e3e6
2 changed files with 11 additions and 2 deletions

View File

@ -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);

View File

@ -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) {