From 90b5f74ef1c65ad30274b575f937174f76f6a045 Mon Sep 17 00:00:00 2001 From: bi4k8 Date: Wed, 14 Dec 2022 01:50:19 +0000 Subject: [PATCH] update the cursor on next commit after xdg surface map we can't update the cursor properly upon map, because windows may not have committed a buffer by then. deferring cursor updates until commit lets us find the buffer in the scene tree and see if the pointer is within it. --- include/view.h | 1 + src/xdg.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/view.h b/include/view.h index 1cbe8b22..70553214 100644 --- a/include/view.h +++ b/include/view.h @@ -46,6 +46,7 @@ struct view { bool mapped; bool been_mapped; + bool committed_since_mapped; bool ssd_enabled; bool minimized; bool maximized; diff --git a/src/xdg.c b/src/xdg.c index 6ae53993..33b8b096 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -66,7 +66,8 @@ handle_commit(struct wl_listener *listener, void *data) struct wlr_box size; wlr_xdg_surface_get_geometry(xdg_surface, &size); - bool update_required = false; + bool update_required = !view->committed_since_mapped; + view->committed_since_mapped = true; if (view->w != size.width || view->h != size.height) { update_required = true; @@ -350,6 +351,7 @@ xdg_toplevel_view_map(struct view *view) view_moved(view); view->been_mapped = true; } + view->committed_since_mapped = false; view->commit.notify = handle_commit; wl_signal_add(&xdg_surface->surface->events.commit, &view->commit);