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".
This commit is contained in:
Ronan Pigott 2021-09-03 15:32:30 -07:00
parent 00b10a93f1
commit 54e3c49698

View file

@ -1063,6 +1063,11 @@ static void view_child_handle_surface_map(struct wl_listener *listener,
wl_container_of(listener, child, surface_map); wl_container_of(listener, child, surface_map);
child->mapped = true; child->mapped = true;
view_child_damage(child, 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, 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); wl_signal_add(&view->events.unmap, &child->view_unmap);
child->view_unmap.notify = view_child_handle_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); view_child_init_subsurfaces(child, surface);
} }