aboutsummaryrefslogtreecommitdiff
path: root/xwayland/xwayland.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-12-08 00:59:37 +0100
committeremersion <contact@emersion.fr>2017-12-08 00:59:37 +0100
commit18eb1eee3f97e169ff5fca67625452cbd81627c5 (patch)
tree831ef5d92c1e781ad2d1af9870a0076c6a74e27d /xwayland/xwayland.c
parent9d43adaafa6bbe63116b3feba796844169f91b25 (diff)
Listen to display destroy in xwayland, rename wlr_egl_free
Diffstat (limited to 'xwayland/xwayland.c')
-rw-r--r--xwayland/xwayland.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c
index ecec785c..778b959d 100644
--- a/xwayland/xwayland.c
+++ b/xwayland/xwayland.c
@@ -147,6 +147,7 @@ static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
if (!wlr_xwayland || wlr_xwayland->display == -1) {
return;
}
+
if (wlr_xwayland->client) {
wl_list_remove(&wlr_xwayland->destroy_listener.link);
wl_client_destroy(wlr_xwayland->client);
@@ -164,6 +165,8 @@ static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
safe_close(wlr_xwayland->wm_fd[0]);
safe_close(wlr_xwayland->wm_fd[1]);
+ wl_list_remove(&wlr_xwayland->display_destroy.link);
+
unlink_display_sockets(wlr_xwayland->display);
wlr_xwayland->display = -1;
unsetenv("DISPLAY");
@@ -173,6 +176,12 @@ static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
*/
}
+static void handle_display_destroy(struct wl_listener *listener, void *data) {
+ struct wlr_xwayland *wlr_xwayland =
+ wl_container_of(listener, wlr_xwayland, display_destroy);
+ wlr_xwayland_destroy(wlr_xwayland);
+}
+
static int xserver_handle_ready(int signal_number, void *data) {
struct wlr_xwayland *wlr_xwayland = data;
@@ -227,6 +236,9 @@ static bool wlr_xwayland_init(struct wlr_xwayland *wlr_xwayland,
wl_signal_init(&wlr_xwayland->events.new_surface);
wl_signal_init(&wlr_xwayland->events.ready);
+ wlr_xwayland->display_destroy.notify = handle_display_destroy;
+ wl_display_add_destroy_listener(wl_display, &wlr_xwayland->display_destroy);
+
wlr_xwayland->display = open_display_sockets(wlr_xwayland->x_fd);
if (wlr_xwayland->display < 0) {
wlr_xwayland_finish(wlr_xwayland);
@@ -253,10 +265,12 @@ static bool wlr_xwayland_init(struct wlr_xwayland *wlr_xwayland,
wlr_xwayland->wl_fd[0] = -1; /* not ours anymore */
wlr_xwayland->destroy_listener.notify = xwayland_destroy_event;
- wl_client_add_destroy_listener(wlr_xwayland->client, &wlr_xwayland->destroy_listener);
+ wl_client_add_destroy_listener(wlr_xwayland->client,
+ &wlr_xwayland->destroy_listener);
struct wl_event_loop *loop = wl_display_get_event_loop(wl_display);
- wlr_xwayland->sigusr1_source = wl_event_loop_add_signal(loop, SIGUSR1, xserver_handle_ready, wlr_xwayland);
+ wlr_xwayland->sigusr1_source = wl_event_loop_add_signal(loop, SIGUSR1,
+ xserver_handle_ready, wlr_xwayland);
if ((wlr_xwayland->pid = fork()) == 0) {
/* Double-fork, but we need to forward SIGUSR1 once Xserver(1)