Don't quit if xwayland not found

This commit is contained in:
Krsna Mahapatra 2022-07-11 16:23:55 -04:00
parent f1ba0a89fc
commit f21b20112c

View file

@ -397,17 +397,29 @@ server_init(struct server *server)
wlr_xwayland_create(server->wl_display, compositor, true); wlr_xwayland_create(server->wl_display, compositor, true);
if (!server->xwayland) { if (!server->xwayland) {
wlr_log(WLR_ERROR, "cannot create xwayland server"); wlr_log(WLR_ERROR, "cannot create xwayland server");
exit(EXIT_FAILURE); // exit(EXIT_FAILURE);
} } else {
server->new_xwayland_surface.notify = xwayland_surface_new; server->new_xwayland_surface.notify = xwayland_surface_new;
wl_signal_add(&server->xwayland->events.new_surface, wl_signal_add(&server->xwayland->events.new_surface,
&server->new_xwayland_surface); &server->new_xwayland_surface);
if (setenv("DISPLAY", server->xwayland->display_name, true) < 0) { if (setenv("DISPLAY", server->xwayland->display_name, true) < 0) {
wlr_log_errno(WLR_ERROR, "unable to set DISPLAY for xwayland"); wlr_log_errno(WLR_ERROR, "unable to set DISPLAY for xwayland");
} else { } else {
wlr_log(WLR_DEBUG, "xwayland is running on display %s", wlr_log(WLR_DEBUG, "xwayland is running on display %s",
server->xwayland->display_name); server->xwayland->display_name);
}
struct wlr_xcursor *xcursor;
xcursor = wlr_xcursor_manager_get_xcursor(server->seat.xcursor_manager,
XCURSOR_DEFAULT, 1);
if (xcursor) {
struct wlr_xcursor_image *image = xcursor->images[0];
wlr_xwayland_set_cursor(server->xwayland, image->buffer,
image->width * 4, image->width,
image->height, image->hotspot_x,
image->hotspot_y);
}
} }
#endif #endif
@ -415,19 +427,6 @@ server_init(struct server *server)
wlr_log(WLR_ERROR, "cannot load xcursor theme"); wlr_log(WLR_ERROR, "cannot load xcursor theme");
} }
#if HAVE_XWAYLAND
struct wlr_xcursor *xcursor;
xcursor = wlr_xcursor_manager_get_xcursor(server->seat.xcursor_manager,
XCURSOR_DEFAULT, 1);
if (xcursor) {
struct wlr_xcursor_image *image = xcursor->images[0];
wlr_xwayland_set_cursor(server->xwayland, image->buffer,
image->width * 4, image->width,
image->height, image->hotspot_x,
image->hotspot_y);
}
#endif
/* used when handling SIGHUP */ /* used when handling SIGHUP */
g_server = server; g_server = server;
} }
@ -459,7 +458,9 @@ server_start(struct server *server)
} }
#if HAVE_XWAYLAND #if HAVE_XWAYLAND
wlr_xwayland_set_seat(server->xwayland, server->seat.seat); if (server->xwayland) {
wlr_xwayland_set_seat(server->xwayland, server->seat.seat);
}
#endif #endif
} }