weston-info: Report the seat name provided by the compositor

Rob Bradford 12 years ago committed by Kristian Høgsberg
parent e445ae69f2
commit 14a7601340
  1. 13
      clients/weston-info.c

@ -84,6 +84,7 @@ struct seat_info {
struct wl_seat *seat; struct wl_seat *seat;
uint32_t capabilities; uint32_t capabilities;
char *name;
}; };
struct weston_info { struct weston_info {
@ -233,6 +234,7 @@ print_seat_info(void *data)
print_global_info(data); print_global_info(data);
printf("\tname: %s\n", seat->name);
printf("\tcapabilities:"); printf("\tcapabilities:");
if (seat->capabilities & WL_SEAT_CAPABILITY_POINTER) if (seat->capabilities & WL_SEAT_CAPABILITY_POINTER)
@ -253,8 +255,17 @@ seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
seat->capabilities = caps; seat->capabilities = caps;
} }
static void
seat_handle_name(void *data, struct wl_seat *wl_seat,
const char *name)
{
struct seat_info *seat = data;
seat->name = strdup(name);
}
static const struct wl_seat_listener seat_listener = { static const struct wl_seat_listener seat_listener = {
seat_handle_capabilities, seat_handle_capabilities,
seat_handle_name,
}; };
static void static void
@ -266,7 +277,7 @@ add_seat_info(struct weston_info *info, uint32_t id, uint32_t version)
seat->global.print = print_seat_info; seat->global.print = print_seat_info;
seat->seat = wl_registry_bind(info->registry, seat->seat = wl_registry_bind(info->registry,
id, &wl_seat_interface, 1); id, &wl_seat_interface, 2);
wl_seat_add_listener(seat->seat, &seat_listener, seat); wl_seat_add_listener(seat->seat, &seat_listener, seat);
info->roundtrip_needed = true; info->roundtrip_needed = true;

Loading…
Cancel
Save