From 61b91a5721e87f0a102e234f87727acf8bee55c6 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 29 Dec 2017 17:33:11 +0100 Subject: [PATCH] xwayland restart: copy seat and events over This is very ugly, there must be a better way to do that (not memset it?) Meanwhile, this fixes rootston xwayland on restart --- xwayland/xwayland.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c index 6dc71689..a0b6d1c3 100644 --- a/xwayland/xwayland.c +++ b/xwayland/xwayland.c @@ -169,6 +169,14 @@ static void handle_client_destroy(struct wl_listener *listener, void *data) { struct wlr_xwayland *wlr_xwayland = wl_container_of(listener, wlr_xwayland, client_destroy); + struct wlr_seat *seat = wlr_xwayland->seat; + struct wl_list new_surface_signals; + struct wl_listener *new_surface_listener, *next; + wl_list_init(&new_surface_signals); + wl_list_for_each_safe(new_surface_listener, next, &wlr_xwayland->events.new_surface.listener_list, link) { + wl_list_remove(&new_surface_listener->link); + wl_list_insert(&new_surface_signals, &new_surface_listener->link); + } // Don't call client destroy: it's being destroyed already wlr_xwayland->client = NULL; wl_list_remove(&wlr_xwayland->client_destroy.link); @@ -179,6 +187,13 @@ static void handle_client_destroy(struct wl_listener *listener, void *data) { wlr_log(L_INFO, "Restarting Xwayland"); wlr_xwayland_init(wlr_xwayland, wlr_xwayland->wl_display, wlr_xwayland->compositor); + wl_list_for_each_safe(new_surface_listener, next, &new_surface_signals, link) { + wl_list_remove(&new_surface_listener->link); + wl_signal_add(&wlr_xwayland->events.new_surface, new_surface_listener); + } + if (seat) { + wlr_xwayland_set_seat(wlr_xwayland, seat); + } } }