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.
This commit is contained in:
bi4k8 2022-12-14 01:50:19 +00:00
parent 4f0b72c341
commit 90b5f74ef1
2 changed files with 4 additions and 1 deletions

View file

@ -46,6 +46,7 @@ struct view {
bool mapped; bool mapped;
bool been_mapped; bool been_mapped;
bool committed_since_mapped;
bool ssd_enabled; bool ssd_enabled;
bool minimized; bool minimized;
bool maximized; bool maximized;

View file

@ -66,7 +66,8 @@ handle_commit(struct wl_listener *listener, void *data)
struct wlr_box size; struct wlr_box size;
wlr_xdg_surface_get_geometry(xdg_surface, &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) { if (view->w != size.width || view->h != size.height) {
update_required = true; update_required = true;
@ -350,6 +351,7 @@ xdg_toplevel_view_map(struct view *view)
view_moved(view); view_moved(view);
view->been_mapped = true; view->been_mapped = true;
} }
view->committed_since_mapped = false;
view->commit.notify = handle_commit; view->commit.notify = handle_commit;
wl_signal_add(&xdg_surface->surface->events.commit, &view->commit); wl_signal_add(&xdg_surface->surface->events.commit, &view->commit);