Handle xwayland views sending new sizes in their commits

master
Ryan Dwyer 6 years ago
parent 9ee89f11c4
commit 8af4e2e3e6

@ -282,11 +282,19 @@ static void handle_commit(struct wl_listener *listener, void *data) {
wl_container_of(listener, xwayland_view, commit); wl_container_of(listener, xwayland_view, commit);
struct sway_view *view = &xwayland_view->view; struct sway_view *view = &xwayland_view->view;
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; 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) { if (view->swayc->instruction) {
transaction_notify_view_ready_by_size(view, 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_damage_from(view);

@ -1089,6 +1089,7 @@ void container_set_geometry_from_floating_view(struct sway_container *con) {
con->y = view->y - top; con->y = view->y - top;
con->width = view->width + border_width * 2; con->width = view->width + border_width * 2;
con->height = top + view->height + border_width; con->height = top + view->height + border_width;
container_set_dirty(con);
} }
bool container_is_floating(struct sway_container *container) { bool container_is_floating(struct sway_container *container) {

Loading…
Cancel
Save