diff options
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r-- | sway/desktop/xwayland.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 6447b711..70929d48 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "sway/input/seat.h" | 11 | #include "sway/input/seat.h" |
12 | #include "sway/output.h" | 12 | #include "sway/output.h" |
13 | #include "sway/server.h" | 13 | #include "sway/server.h" |
14 | #include "sway/tree/arrange.h" | ||
14 | #include "sway/tree/container.h" | 15 | #include "sway/tree/container.h" |
15 | #include "sway/tree/layout.h" | 16 | #include "sway/tree/layout.h" |
16 | #include "sway/tree/view.h" | 17 | #include "sway/tree/view.h" |
@@ -167,19 +168,18 @@ static uint32_t get_int_prop(struct sway_view *view, enum sway_view_prop prop) { | |||
167 | } | 168 | } |
168 | } | 169 | } |
169 | 170 | ||
170 | static void configure(struct sway_view *view, double lx, double ly, int width, | 171 | static uint32_t configure(struct sway_view *view, double lx, double ly, int width, |
171 | int height) { | 172 | int height) { |
172 | struct sway_xwayland_view *xwayland_view = xwayland_view_from_view(view); | 173 | struct sway_xwayland_view *xwayland_view = xwayland_view_from_view(view); |
173 | if (xwayland_view == NULL) { | 174 | if (xwayland_view == NULL) { |
174 | return; | 175 | return 0; |
175 | } | 176 | } |
176 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 177 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
177 | 178 | ||
178 | xwayland_view->pending_lx = lx; | ||
179 | xwayland_view->pending_ly = ly; | ||
180 | xwayland_view->pending_width = width; | ||
181 | xwayland_view->pending_height = height; | ||
182 | wlr_xwayland_surface_configure(xsurface, lx, ly, width, height); | 179 | wlr_xwayland_surface_configure(xsurface, lx, ly, width, height); |
180 | |||
181 | // xwayland doesn't give us a serial for the configure | ||
182 | return 0; | ||
183 | } | 183 | } |
184 | 184 | ||
185 | static void set_activated(struct sway_view *view, bool activated) { | 185 | static void set_activated(struct sway_view *view, bool activated) { |
@@ -250,15 +250,19 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
250 | wl_container_of(listener, xwayland_view, commit); | 250 | wl_container_of(listener, xwayland_view, commit); |
251 | struct sway_view *view = &xwayland_view->view; | 251 | struct sway_view *view = &xwayland_view->view; |
252 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 252 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
253 | if (view->swayc && container_is_floating(view->swayc)) { | 253 | |
254 | view_update_size(view, xsurface->width, xsurface->height); | 254 | // Don't allow xwayland views to do resize or reposition themselves if |
255 | } else { | 255 | // they're involved in a transaction. Once the transaction has finished |
256 | view_update_size(view, xwayland_view->pending_width, | 256 | // they'll apply the next time a commit happens. |
257 | xwayland_view->pending_height); | 257 | if (view->instructions->length) { |
258 | if (view->swayc && container_is_floating(view->swayc)) { | ||
259 | view_update_size(view, xsurface->width, xsurface->height); | ||
260 | } else { | ||
261 | view_update_size(view, view->swayc->width, view->swayc->height); | ||
262 | } | ||
263 | view_update_position(view, view->x, view->y); | ||
264 | view_damage_from(view); | ||
258 | } | 265 | } |
259 | view_update_position(view, | ||
260 | xwayland_view->pending_lx, xwayland_view->pending_ly); | ||
261 | view_damage_from(view); | ||
262 | } | 266 | } |
263 | 267 | ||
264 | static void handle_unmap(struct wl_listener *listener, void *data) { | 268 | static void handle_unmap(struct wl_listener *listener, void *data) { |
@@ -289,6 +293,7 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
289 | if (xsurface->fullscreen) { | 293 | if (xsurface->fullscreen) { |
290 | view_set_fullscreen(view, true); | 294 | view_set_fullscreen(view, true); |
291 | } | 295 | } |
296 | arrange_and_commit(view->swayc); | ||
292 | } | 297 | } |
293 | 298 | ||
294 | static void handle_destroy(struct wl_listener *listener, void *data) { | 299 | static void handle_destroy(struct wl_listener *listener, void *data) { |
@@ -309,7 +314,8 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { | |||
309 | return; | 314 | return; |
310 | } | 315 | } |
311 | // TODO: Let floating views do whatever | 316 | // TODO: Let floating views do whatever |
312 | configure(view, view->swayc->x, view->swayc->y, view->width, view->height); | 317 | configure(view, view->swayc->current.view_x, view->swayc->current.view_y, |
318 | view->swayc->current.view_width, view->swayc->current.view_height); | ||
313 | } | 319 | } |
314 | 320 | ||
315 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { | 321 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { |
@@ -321,6 +327,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data) | |||
321 | return; | 327 | return; |
322 | } | 328 | } |
323 | view_set_fullscreen(view, xsurface->fullscreen); | 329 | view_set_fullscreen(view, xsurface->fullscreen); |
330 | arrange_and_commit(view->swayc); | ||
324 | } | 331 | } |
325 | 332 | ||
326 | static void handle_set_title(struct wl_listener *listener, void *data) { | 333 | static void handle_set_title(struct wl_listener *listener, void *data) { |