aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index e0c44b39..ce7235e4 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -277,6 +277,17 @@ static const struct sway_view_impl view_impl = {
.destroy = destroy,
};
+static void get_geometry(struct sway_view *view, struct wlr_box *box) {
+ box->x = box->y = 0;
+ if (view->surface) {
+ box->width = view->surface->current.width;
+ box->height = view->surface->current.height;
+ } else {
+ box->width = 0;
+ box->height = 0;
+ }
+}
+
static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_xwayland_view *xwayland_view =
wl_container_of(listener, xwayland_view, commit);
@@ -285,18 +296,25 @@ static void handle_commit(struct wl_listener *listener, void *data) {
struct wlr_surface_state *state = &xsurface->surface->current;
if (view->swayc->instruction) {
+ get_geometry(view, &view->geometry);
transaction_notify_view_ready_by_size(view,
state->width, state->height);
- } else if ((state->width != view->width || state->height != view->height) &&
+ } else {
+ struct wlr_box new_geo;
+ get_geometry(view, &new_geo);
+
+ if ((new_geo.width != view->width || new_geo.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;
- view->swayc->current.view_width = state->width;
- view->swayc->current.view_height = state->height;
- container_set_geometry_from_floating_view(view->swayc);
- transaction_commit_dirty();
+ // A floating view has unexpectedly sent a new size
+ // eg. The Firefox "Save As" dialog when downloading a file
+ desktop_damage_view(view);
+ view_update_size(view, new_geo.width, new_geo.height);
+ memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
+ desktop_damage_view(view);
+ transaction_commit_dirty();
+ } else {
+ memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
+ }
}
view_damage_from(view);