From 54e3c4969835c7af1e83eeb8d3051fae8aabb3fc Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Fri, 3 Sep 2021 15:32:30 -0700 Subject: [PATCH] view: wait until surface is mapped to send enter Based on observation, this is what weston does. I'm not sure if it's useful to send enter on surface creation before the surface is mapped, howver the wayland protocol seems to encourage it, saying explicitly enter should be send on "creation". --- sway/tree/view.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sway/tree/view.c b/sway/tree/view.c index 3ab971f79..6478b2616 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -1063,6 +1063,11 @@ static void view_child_handle_surface_map(struct wl_listener *listener, wl_container_of(listener, child, surface_map); child->mapped = true; view_child_damage(child, true); + + struct sway_workspace *workspace = child->view->container->pending.workspace; + if (workspace) { + wlr_surface_send_enter(child->surface, workspace->output->wlr_output); + } } static void view_child_handle_surface_unmap(struct wl_listener *listener, @@ -1107,11 +1112,6 @@ void view_child_init(struct sway_view_child *child, wl_signal_add(&view->events.unmap, &child->view_unmap); child->view_unmap.notify = view_child_handle_view_unmap; - struct sway_workspace *workspace = child->view->container->pending.workspace; - if (workspace) { - wlr_surface_send_enter(child->surface, workspace->output->wlr_output); - } - view_child_init_subsurfaces(child, surface); }