diff --git a/include/rootston/view.h b/include/rootston/view.h index 66616207..058dc73e 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -32,6 +32,7 @@ struct roots_xdg_surface_v6 { struct { uint32_t configure_serial; double x, y; + bool update_x, update_y; uint32_t width, height; } move_resize; }; diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index d0e7957b..6ac84cef 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -125,7 +125,6 @@ struct wlr_xdg_surface_v6 { struct { struct wl_signal commit; struct wl_signal destroy; - struct wl_signal ack_configure; struct wl_signal ping_timeout; struct wl_signal request_maximize; diff --git a/rootston/cursor.c b/rootston/cursor.c index 5949a364..d4c4510a 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -98,13 +98,7 @@ static void roots_cursor_update_position(struct roots_cursor *cursor, uint32_t t height = 0; } - if (active_x != seat->focus->x || - active_y != seat->focus->y) { - view_move_resize(seat->focus, active_x, active_y, - width, height); - } else { - view_resize(seat->focus, width, height); - } + view_move_resize(seat->focus, active_x, active_y, width, height); } break; case ROOTS_CURSOR_ROTATE: diff --git a/rootston/desktop.c b/rootston/desktop.c index 1695d007..be63d7f5 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -103,6 +103,11 @@ void view_resize(struct roots_view *view, uint32_t width, uint32_t height) { void view_move_resize(struct roots_view *view, double x, double y, uint32_t width, uint32_t height) { + if (x == view->x == x && y == view->y) { + view_resize(view, width, height); + return; + } + if (view->move_resize) { view->move_resize(view, x, y, width, height); return; diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index d91fc2d9..5a55b8c4 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -76,15 +76,24 @@ static void move_resize(struct roots_view *view, double x, double y, return; } + bool update_x = x != view->x; + bool update_y = y != view->y; + uint32_t constrained_width, constrained_height; apply_size_constraints(surface, width, height, &constrained_width, &constrained_height); - x = x + width - constrained_width; - y = y + height - constrained_height; + if (update_x) { + x = x + width - constrained_width; + } + if (update_y) { + y = y + height - constrained_height; + } roots_surface->move_resize.x = x; roots_surface->move_resize.y = y; + roots_surface->move_resize.update_x = update_x; + roots_surface->move_resize.update_y = update_y; roots_surface->move_resize.width = constrained_width; roots_surface->move_resize.height = constrained_height; @@ -158,12 +167,20 @@ 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.configure_serial == + if (roots_surface->move_resize.configure_serial > 0 && + 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; + struct wlr_box size; + get_size(view, &size); + + if (roots_surface->move_resize.update_x) { + view->x = roots_surface->move_resize.x + + roots_surface->move_resize.width - size.width; + } + if (roots_surface->move_resize.update_y) { + view->y = roots_surface->move_resize.y + + roots_surface->move_resize.height - size.height; + } roots_surface->move_resize.configure_serial = 0; } } diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index dfe5ddc5..8bb48a24 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -814,8 +814,6 @@ static void xdg_surface_ack_configure(struct wl_client *client, surface->configured = true; surface->configure_serial = serial; - wl_signal_emit(&surface->events.ack_configure, surface); - free(configure); } @@ -1155,7 +1153,6 @@ static void xdg_shell_get_xdg_surface(struct wl_client *wl_client, wl_signal_init(&surface->events.request_show_window_menu); wl_signal_init(&surface->events.commit); wl_signal_init(&surface->events.destroy); - wl_signal_init(&surface->events.ack_configure); wl_signal_init(&surface->events.ping_timeout); wl_signal_add(&surface->surface->events.destroy,