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: I0579dab7eadcd3580b0ee0ebadb9175fc0bcd0a5
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