From a3a8b7bfd8d1616cdf9f7ba911616ca0baeedc67 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 18 Nov 2017 09:09:23 +0100 Subject: Fixed a bug with move-resize, removed xdg-shell ack_configure event Fixed move-resizing a view when only one coordinate changes. --- rootston/desktop.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rootston/desktop.c') 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; -- cgit v1.2.3 From 7375931686e6a58c08a7727ce2f5d88e0be9adfa Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 18 Nov 2017 09:15:48 +0100 Subject: Fix typo making GCC build fail --- rootston/desktop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rootston/desktop.c') diff --git a/rootston/desktop.c b/rootston/desktop.c index be63d7f5..fca801bb 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -103,7 +103,7 @@ 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) { + if (x == view->x && y == view->y) { view_resize(view, width, height); return; } -- cgit v1.2.3 From 272e0858e49bf341b363fdbe59a5f669ba678ce2 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 20 Nov 2017 12:16:10 +0100 Subject: Fix laggy move-resize for wl-shell views --- rootston/desktop.c | 12 ++++++++++-- rootston/wl_shell.c | 19 ++++++++++++++++++- rootston/xwayland.c | 6 +++--- 3 files changed, 31 insertions(+), 6 deletions(-) (limited to 'rootston/desktop.c') diff --git a/rootston/desktop.c b/rootston/desktop.c index b3287ed0..c6a1957c 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -103,7 +103,9 @@ 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 && y == view->y) { + bool update_x = x != view->x; + bool update_y = y != view->y; + if (!update_x && !update_y) { view_resize(view, width, height); return; } @@ -113,7 +115,13 @@ void view_move_resize(struct roots_view *view, double x, double y, return; } - view_move(view, x, y); + view->pending_move_resize.update_x = update_x; + view->pending_move_resize.update_y = update_y; + view->pending_move_resize.x = x; + view->pending_move_resize.y = y; + view->pending_move_resize.width = width; + view->pending_move_resize.height = height; + view_resize(view, width, height); } diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c index 96f461fe..0043219f 100644 --- a/rootston/wl_shell.c +++ b/rootston/wl_shell.c @@ -71,7 +71,24 @@ static void handle_set_state(struct wl_listener *listener, void *data) { } static void handle_surface_commit(struct wl_listener *listener, void *data) { - // TODO do we need to do anything here? + struct roots_wl_shell_surface *roots_surface = + wl_container_of(listener, roots_surface, surface_commit); + struct roots_view *view = roots_surface->view; + struct wlr_surface *wlr_surface = view->wlr_surface; + + int width = wlr_surface->current->width; + int height = wlr_surface->current->height; + + if (view->pending_move_resize.update_x) { + view->x = view->pending_move_resize.x + + view->pending_move_resize.width - width; + 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 - height; + view->pending_move_resize.update_y = false; + } } static void handle_destroy(struct wl_listener *listener, void *data) { diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 372fd951..b2f64879 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -186,10 +186,10 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { struct roots_xwayland_surface *roots_surface = wl_container_of(listener, roots_surface, surface_commit); struct roots_view *view = roots_surface->view; - struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface; + struct wlr_surface *wlr_surface = view->wlr_surface; - int width = xwayland_surface->surface->current->width; - int height = xwayland_surface->surface->current->height; + int width = wlr_surface->current->width; + int height = wlr_surface->current->height; if (view->pending_move_resize.update_x) { view->x = view->pending_move_resize.x + -- cgit v1.2.3