swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 1da0ef13fddc572accea12439a4471b4d2f64ddd
parent 4926291e357cec86e91b804124ce533fb5a9b7aa
Author: Michael Forney <mforney@mforney.org>
Date:   Tue,  9 Feb 2016 09:27:42 -0800

xserver: Handle xwayland client destroy

If the xwayland client process dies or quits, libwayland-server will
automatically destroy the client. When this happens, make sure not to
try to destroy it again.

Fixes michaelforney/velox#19.

Diffstat:
Mlibswc/xserver.c | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libswc/xserver.c b/libswc/xserver.c @@ -196,6 +196,15 @@ handle_usr1(int signal_number, void *data) return 0; } +static void +handle_client_destroy(struct wl_listener *listener, void *data) { + swc_xserver.client = NULL; +} + +static struct wl_listener client_destroy_listener = { + .notify = handle_client_destroy, +}; + bool xserver_initialize(void) { @@ -229,6 +238,7 @@ xserver_initialize(void) if (!(swc_xserver.client = wl_client_create(swc.display, wl[0]))) goto error4; + wl_client_add_destroy_listener(swc_xserver.client, &client_destroy_listener); xserver.wm_fd = wm[0]; /* Start the X server */ @@ -304,6 +314,7 @@ xserver_finalize(void) { if (xserver.xwm_initialized) xwm_finalize(); + if (swc_xserver.client) + wl_client_destroy(swc_xserver.client); close_display(); - wl_client_destroy(swc_xserver.client); }