frontend: Return user-data pointer from Xwayland init
Return a void * from wet_load_xwayland, so we can later pass it back to explicitly call the cleanup. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
eff5e7e0f3
commit
10f6b99ac0
|
@ -3740,10 +3740,10 @@ copy_command_line(int argc, char * const argv[])
|
|||
}
|
||||
|
||||
#if !defined(BUILD_XWAYLAND)
|
||||
int
|
||||
void *
|
||||
wet_load_xwayland(struct weston_compositor *comp)
|
||||
{
|
||||
return -1;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3882,6 +3882,7 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data)
|
|||
struct weston_log_context *log_ctx = NULL;
|
||||
struct weston_log_subscriber *logger = NULL;
|
||||
struct weston_log_subscriber *flight_rec = NULL;
|
||||
void *wet_xwl = NULL;
|
||||
sigset_t mask;
|
||||
struct sigaction action;
|
||||
|
||||
|
@ -4136,7 +4137,8 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data)
|
|||
false);
|
||||
}
|
||||
if (xwayland) {
|
||||
if (wet_load_xwayland(wet.compositor) < 0)
|
||||
wet_xwl = wet_load_xwayland(wet.compositor);
|
||||
if (!wet_xwl)
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ wet_get_libexec_path(const char *name);
|
|||
char *
|
||||
wet_get_bindir_path(const char *name);
|
||||
|
||||
int
|
||||
void *
|
||||
wet_load_xwayland(struct weston_compositor *comp);
|
||||
|
||||
struct text_backend;
|
||||
|
|
|
@ -238,7 +238,7 @@ wxw_compositor_destroy(struct wl_listener *listener, void *data)
|
|||
free(wxw);
|
||||
}
|
||||
|
||||
int
|
||||
void *
|
||||
wet_load_xwayland(struct weston_compositor *comp)
|
||||
{
|
||||
const struct weston_xwayland_api *api;
|
||||
|
@ -246,32 +246,32 @@ wet_load_xwayland(struct weston_compositor *comp)
|
|||
struct wet_xwayland *wxw;
|
||||
|
||||
if (weston_compositor_load_xwayland(comp) < 0)
|
||||
return -1;
|
||||
return NULL;
|
||||
|
||||
api = weston_xwayland_get_api(comp);
|
||||
if (!api) {
|
||||
weston_log("Failed to get the xwayland module API.\n");
|
||||
return -1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xwayland = api->get(comp);
|
||||
if (!xwayland) {
|
||||
weston_log("Failed to get the xwayland object.\n");
|
||||
return -1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxw = zalloc(sizeof *wxw);
|
||||
if (!wxw)
|
||||
return -1;
|
||||
return NULL;
|
||||
|
||||
wxw->compositor = comp;
|
||||
wxw->api = api;
|
||||
wxw->xwayland = xwayland;
|
||||
wxw->compositor_destroy_listener.notify = wxw_compositor_destroy;
|
||||
if (api->listen(xwayland, wxw, spawn_xserver) < 0)
|
||||
return -1;
|
||||
return NULL;
|
||||
|
||||
wl_signal_add(&comp->destroy_signal, &wxw->compositor_destroy_listener);
|
||||
|
||||
return 0;
|
||||
return wxw;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue