|
|
@ -125,39 +125,26 @@ static void exec_xwayland(struct wlr_xwayland *wlr_xwayland) {
|
|
|
|
execvp("Xwayland", argv);
|
|
|
|
execvp("Xwayland", argv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool wlr_xwayland_init(struct wlr_xwayland *wlr_xwayland,
|
|
|
|
|
|
|
|
struct wl_display *wl_display, struct wlr_compositor *compositor);
|
|
|
|
|
|
|
|
static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void xwayland_destroy_event(struct wl_listener *listener, void *data) {
|
|
|
|
|
|
|
|
struct wlr_xwayland *wlr_xwayland = wl_container_of(listener, wlr_xwayland, destroy_listener);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* don't call client destroy */
|
|
|
|
|
|
|
|
wlr_xwayland->client = NULL;
|
|
|
|
|
|
|
|
wl_list_remove(&wlr_xwayland->destroy_listener.link);
|
|
|
|
|
|
|
|
wlr_xwayland_finish(wlr_xwayland);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (time(NULL) - wlr_xwayland->server_start > 5) {
|
|
|
|
|
|
|
|
wlr_xwayland_init(wlr_xwayland, wlr_xwayland->wl_display,
|
|
|
|
|
|
|
|
wlr_xwayland->compositor);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
|
|
|
|
static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
|
|
|
|
if (!wlr_xwayland || wlr_xwayland->display == -1) {
|
|
|
|
if (!wlr_xwayland || wlr_xwayland->display == -1) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (wlr_xwayland->cursor != NULL) {
|
|
|
|
|
|
|
|
free(wlr_xwayland->cursor);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xwm_destroy(wlr_xwayland->xwm);
|
|
|
|
|
|
|
|
|
|
|
|
if (wlr_xwayland->client) {
|
|
|
|
if (wlr_xwayland->client) {
|
|
|
|
wl_list_remove(&wlr_xwayland->destroy_listener.link);
|
|
|
|
wl_list_remove(&wlr_xwayland->client_destroy.link);
|
|
|
|
wl_client_destroy(wlr_xwayland->client);
|
|
|
|
// TODO: this segfaults in /usr/lib/libEGL_mesa.so.0
|
|
|
|
|
|
|
|
//wl_client_destroy(wlr_xwayland->client);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (wlr_xwayland->sigusr1_source) {
|
|
|
|
if (wlr_xwayland->sigusr1_source) {
|
|
|
|
wl_event_source_remove(wlr_xwayland->sigusr1_source);
|
|
|
|
wl_event_source_remove(wlr_xwayland->sigusr1_source);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
xwm_destroy(wlr_xwayland->xwm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
safe_close(wlr_xwayland->x_fd[0]);
|
|
|
|
safe_close(wlr_xwayland->x_fd[0]);
|
|
|
|
safe_close(wlr_xwayland->x_fd[1]);
|
|
|
|
safe_close(wlr_xwayland->x_fd[1]);
|
|
|
|
safe_close(wlr_xwayland->wl_fd[0]);
|
|
|
|
safe_close(wlr_xwayland->wl_fd[0]);
|
|
|
@ -176,6 +163,24 @@ static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool wlr_xwayland_init(struct wlr_xwayland *wlr_xwayland,
|
|
|
|
|
|
|
|
struct wl_display *wl_display, struct wlr_compositor *compositor);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void handle_client_destroy(struct wl_listener *listener, void *data) {
|
|
|
|
|
|
|
|
struct wlr_xwayland *wlr_xwayland =
|
|
|
|
|
|
|
|
wl_container_of(listener, wlr_xwayland, client_destroy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* don't call client destroy */
|
|
|
|
|
|
|
|
wlr_xwayland->client = NULL;
|
|
|
|
|
|
|
|
wl_list_remove(&wlr_xwayland->client_destroy.link);
|
|
|
|
|
|
|
|
wlr_xwayland_finish(wlr_xwayland);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (time(NULL) - wlr_xwayland->server_start > 5) {
|
|
|
|
|
|
|
|
wlr_xwayland_init(wlr_xwayland, wlr_xwayland->wl_display,
|
|
|
|
|
|
|
|
wlr_xwayland->compositor);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
|
|
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
|
|
|
struct wlr_xwayland *wlr_xwayland =
|
|
|
|
struct wlr_xwayland *wlr_xwayland =
|
|
|
|
wl_container_of(listener, wlr_xwayland, display_destroy);
|
|
|
|
wl_container_of(listener, wlr_xwayland, display_destroy);
|
|
|
@ -264,9 +269,9 @@ static bool wlr_xwayland_init(struct wlr_xwayland *wlr_xwayland,
|
|
|
|
|
|
|
|
|
|
|
|
wlr_xwayland->wl_fd[0] = -1; /* not ours anymore */
|
|
|
|
wlr_xwayland->wl_fd[0] = -1; /* not ours anymore */
|
|
|
|
|
|
|
|
|
|
|
|
wlr_xwayland->destroy_listener.notify = xwayland_destroy_event;
|
|
|
|
wlr_xwayland->client_destroy.notify = handle_client_destroy;
|
|
|
|
wl_client_add_destroy_listener(wlr_xwayland->client,
|
|
|
|
wl_client_add_destroy_listener(wlr_xwayland->client,
|
|
|
|
&wlr_xwayland->destroy_listener);
|
|
|
|
&wlr_xwayland->client_destroy);
|
|
|
|
|
|
|
|
|
|
|
|
struct wl_event_loop *loop = wl_display_get_event_loop(wl_display);
|
|
|
|
struct wl_event_loop *loop = wl_display_get_event_loop(wl_display);
|
|
|
|
wlr_xwayland->sigusr1_source = wl_event_loop_add_signal(loop, SIGUSR1,
|
|
|
|
wlr_xwayland->sigusr1_source = wl_event_loop_add_signal(loop, SIGUSR1,
|
|
|
|