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.c37
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 @@
#include "sway/input/seat.h"
#include "sway/output.h"
#include "sway/server.h"
+#include "sway/tree/arrange.h"
#include "sway/tree/container.h"
#include "sway/tree/layout.h"
#include "sway/tree/view.h"
@@ -167,19 +168,18 @@ static uint32_t get_int_prop(struct sway_view *view, enum sway_view_prop prop) {
}
}
-static void configure(struct sway_view *view, double lx, double ly, int width,
+static uint32_t configure(struct sway_view *view, double lx, double ly, int width,
int height) {
struct sway_xwayland_view *xwayland_view = xwayland_view_from_view(view);
if (xwayland_view == NULL) {
- return;
+ return 0;
}
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
- xwayland_view->pending_lx = lx;
- xwayland_view->pending_ly = ly;
- xwayland_view->pending_width = width;
- xwayland_view->pending_height = height;
wlr_xwayland_surface_configure(xsurface, lx, ly, width, height);
+
+ // xwayland doesn't give us a serial for the configure
+ return 0;
}
static void set_activated(struct sway_view *view, bool activated) {
@@ -250,15 +250,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;
- if (view->swayc && container_is_floating(view->swayc)) {
- view_update_size(view, xsurface->width, xsurface->height);
- } else {
- view_update_size(view, xwayland_view->pending_width,
- xwayland_view->pending_height);
+
+ // Don't allow xwayland views to do resize or reposition themselves if
+ // they're involved in a transaction. Once the transaction has finished
+ // they'll apply the next time a commit happens.
+ if (view->instructions->length) {
+ if (view->swayc && container_is_floating(view->swayc)) {
+ view_update_size(view, xsurface->width, xsurface->height);
+ } else {
+ view_update_size(view, view->swayc->width, view->swayc->height);
+ }
+ view_update_position(view, view->x, view->y);
+ view_damage_from(view);
}
- view_update_position(view,
- xwayland_view->pending_lx, xwayland_view->pending_ly);
- view_damage_from(view);
}
static void handle_unmap(struct wl_listener *listener, void *data) {
@@ -289,6 +293,7 @@ static void handle_map(struct wl_listener *listener, void *data) {
if (xsurface->fullscreen) {
view_set_fullscreen(view, true);
}
+ arrange_and_commit(view->swayc);
}
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) {
return;
}
// TODO: Let floating views do whatever
- configure(view, view->swayc->x, view->swayc->y, view->width, view->height);
+ configure(view, view->swayc->current.view_x, view->swayc->current.view_y,
+ view->swayc->current.view_width, view->swayc->current.view_height);
}
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)
return;
}
view_set_fullscreen(view, xsurface->fullscreen);
+ arrange_and_commit(view->swayc);
}
static void handle_set_title(struct wl_listener *listener, void *data) {