Instead of assuming the name of wayland display server by iterating
arbitrary number of names, it uses values of WAYLAND_DISPLAY and
WAYLAND_SOCKET environments.
The library of wayland-client uses these values when trying to connect
to wayland server.
Change-Id: Ieea1e2e55755ec10b6743568abf274e6a64aaf28
static struct ds_backend *
create_wl_backend(struct wl_display *display)
{
- struct ds_backend *backend = NULL;
- char name[512];
- int i;
-
- for (i = 0; i < 5; i++) {
- snprintf(name, sizeof name, "wayland-%d", i);
- backend = ds_wl_backend_create(display, name);
- if (backend)
- break;
- }
+ if (!getenv("WAYLAND_DISPLAY") && !getenv("WAYLAND_SOCKET"))
+ return NULL;
- return backend;
+ return ds_wl_backend_create(display, NULL);
}
static void