xwayland: await configure before moving (issue #11)

This commit is contained in:
Johan Malm 2020-12-23 18:36:40 +00:00
parent 7c29bcb45e
commit 9c3159fddc

View file

@ -10,6 +10,17 @@ handle_commit(struct wl_listener *listener, void *data)
/* Must receive commit signal before accessing surface->current* */ /* Must receive commit signal before accessing surface->current* */
view->w = view->surface->current.width; view->w = view->surface->current.width;
view->h = view->surface->current.height; view->h = view->surface->current.height;
if (view->pending_move_resize.update_x) {
view->x = view->pending_move_resize.x +
view->pending_move_resize.width - view->w;
view->pending_move_resize.update_x = false;
}
if (view->pending_move_resize.update_y) {
view->y = view->pending_move_resize.y +
view->pending_move_resize.height - view->h;
view->pending_move_resize.update_y = false;
}
} }
static void static void
@ -50,8 +61,12 @@ handle_request_configure(struct wl_listener *listener, void *data)
static void static void
configure(struct view *view, struct wlr_box geo) configure(struct view *view, struct wlr_box geo)
{ {
view->x = geo.x; view->pending_move_resize.update_x = geo.x != view->x;
view->y = geo.y; view->pending_move_resize.update_y = geo.y != view->y;
view->pending_move_resize.x = geo.x;
view->pending_move_resize.y = geo.y;
view->pending_move_resize.width = geo.width;
view->pending_move_resize.height = geo.height;
wlr_xwayland_surface_configure(view->xwayland_surface, (int16_t)geo.x, wlr_xwayland_surface_configure(view->xwayland_surface, (int16_t)geo.x,
(int16_t)geo.y, (uint16_t)geo.width, (int16_t)geo.y, (uint16_t)geo.width,
(uint16_t)geo.height); (uint16_t)geo.height);