From 47d0d18db9156781cec933b315a58e7bf583e6a1 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Fri, 30 Jul 2021 14:18:14 +0300 Subject: [PATCH] xdg-shell: notify txn system on cache event --- include/sway/tree/view.h | 1 + sway/desktop/xdg_shell.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 0f0ace9c1..d1a0a3d08 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -117,6 +117,7 @@ struct sway_xdg_shell_view { struct sway_view view; struct wl_listener ack_configure; + struct wl_listener cache; struct wl_listener commit; struct wl_listener request_move; struct wl_listener request_resize; diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index a4b479a22..6e7cdf173 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -290,6 +290,13 @@ static void handle_ack_configure(struct wl_listener *listener, void *data) { } } +static void handle_cache(struct wl_listener *listener, void *data) { + struct sway_xdg_shell_view *xdg_shell_view = + wl_container_of(listener, xdg_shell_view, cache); + struct sway_view *view = &xdg_shell_view->view; + transaction_notify_view_ready(view); +} + static void handle_commit(struct wl_listener *listener, void *data) { struct sway_xdg_shell_view *xdg_shell_view = wl_container_of(listener, xdg_shell_view, commit); @@ -318,10 +325,6 @@ static void handle_commit(struct wl_listener *listener, void *data) { desktop_damage_view(view); } - if (view->container->node.instruction) { - transaction_notify_view_ready(view); - } - view_damage_from(view); } @@ -429,6 +432,7 @@ static void handle_unmap(struct wl_listener *listener, void *data) { view_unmap(view); wl_list_remove(&xdg_shell_view->ack_configure.link); + wl_list_remove(&xdg_shell_view->cache.link); wl_list_remove(&xdg_shell_view->commit.link); wl_list_remove(&xdg_shell_view->new_popup.link); wl_list_remove(&xdg_shell_view->request_fullscreen.link); @@ -473,6 +477,10 @@ static void handle_map(struct wl_listener *listener, void *data) { wl_signal_add(&xdg_surface->events.ack_configure, &xdg_shell_view->ack_configure); + xdg_shell_view->cache.notify = handle_cache; + wl_signal_add(&xdg_surface->surface->events.cache, + &xdg_shell_view->cache); + xdg_shell_view->commit.notify = handle_commit; wl_signal_add(&xdg_surface->surface->events.commit, &xdg_shell_view->commit);