Ensure to move the view when configured

This commit is contained in:
emersion 2017-11-17 23:52:42 +01:00
parent 27937add76
commit e2843d87c8
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
4 changed files with 40 additions and 36 deletions

View file

@ -83,14 +83,13 @@ static void move_resize(struct roots_view *view, double x, double y,
x = x + width - constrained_width;
y = y + height - constrained_height;
roots_surface->move_resize.needs_move = true;
roots_surface->move_resize.x = x;
roots_surface->move_resize.y = y;
roots_surface->move_resize.width = constrained_width;
roots_surface->move_resize.height = constrained_height;
wlr_xdg_toplevel_v6_set_size(surface, constrained_width,
constrained_height);
roots_surface->move_resize.configure_serial = wlr_xdg_toplevel_v6_set_size(
surface, constrained_width, constrained_height);
}
static void maximize(struct roots_view *view, bool maximized) {
@ -159,12 +158,13 @@ static void handle_commit(struct wl_listener *listener, void *data) {
struct roots_view *view = roots_surface->view;
struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6;
if (roots_surface->move_resize.needs_move) {
if (roots_surface->move_resize.configure_serial ==
surface->configure_serial) {
view->x = roots_surface->move_resize.x +
roots_surface->move_resize.width - surface->geometry->width;
view->y = roots_surface->move_resize.y +
roots_surface->move_resize.height - surface->geometry->height;
roots_surface->move_resize.needs_move = false;
roots_surface->move_resize.configure_serial = 0;
}
}