Unverified Commit 7f20ab64 authored by Drew DeVault's avatar Drew DeVault Committed by GitHub
Browse files

Merge pull request #960 from Ongy/tablet

tablet-unstable-v2 support
parents 4984ea49 9a6f77fc
......@@ -60,12 +60,12 @@ struct wlr_input_device *wlr_headless_add_input_device(
wlr_touch_init(wlr_device->touch, NULL);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
wlr_device->tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool));
if (wlr_device->tablet_tool == NULL) {
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_tool");
wlr_device->tablet = calloc(1, sizeof(struct wlr_tablet));
if (wlr_device->tablet == NULL) {
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet");
goto error;
}
wlr_tablet_tool_init(wlr_device->tablet_tool, NULL);
wlr_tablet_init(wlr_device->tablet, NULL);
break;
case WLR_INPUT_DEVICE_TABLET_PAD:
wlr_device->tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad));
......
......@@ -130,8 +130,8 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
if (!wlr_dev) {
goto fail;
}
wlr_dev->tablet_tool = create_libinput_tablet_tool(libinput_dev);
if (!wlr_dev->tablet_tool) {
wlr_dev->tablet = create_libinput_tablet(libinput_dev);
if (!wlr_dev->tablet) {
free(wlr_dev);
goto fail;
}
......
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#endif
#include <assert.h>
#include <string.h>
#include <libinput.h>
#include <stdlib.h>
#include <wlr/backend/session.h>
......@@ -8,6 +12,60 @@
#include "backend/libinput.h"
#include "util/signal.h"
// FIXME: Decide on how to alloc/count here
static void add_pad_group_from_libinput(struct wlr_tablet_pad *pad,
struct libinput_device *device, unsigned int index) {
struct libinput_tablet_pad_mode_group *li_group =
libinput_device_tablet_pad_get_mode_group(device, index);
struct wlr_tablet_pad_group *group =
calloc(1, sizeof(struct wlr_tablet_pad_group));
if (!group) {
return;
}
for (size_t i = 0; i < pad->ring_count; ++i) {
if (libinput_tablet_pad_mode_group_has_ring(li_group, i)) {
++group->ring_count;
}
}
group->rings = calloc(sizeof(int), group->ring_count);
size_t ring = 0;
for (size_t i = 0; i < pad->ring_count; ++i) {
if (libinput_tablet_pad_mode_group_has_ring(li_group, i)) {
group->rings[ring++] = i;
}
}
for (size_t i = 0; i < pad->strip_count; ++i) {
if (libinput_tablet_pad_mode_group_has_strip(li_group, i)) {
++group->strip_count;
}
}
group->strips = calloc(sizeof(int), group->strip_count);
size_t strip = 0;
for (size_t i = 0; i < pad->strip_count; ++i) {
if (libinput_tablet_pad_mode_group_has_strip(li_group, i)) {
group->strips[strip++] = i;
}
}
for (size_t i = 0; i < pad->button_count; ++i) {
if (libinput_tablet_pad_mode_group_has_button(li_group, i)) {
++group->button_count;
}
}
group->buttons = calloc(sizeof(int), group->button_count);
size_t button = 0;
for (size_t i = 0; i < pad->button_count; ++i) {
if (libinput_tablet_pad_mode_group_has_button(li_group, i)) {
group->buttons[button++] = i;
}
}
group->mode_count = libinput_tablet_pad_mode_group_get_num_modes(li_group);
wl_list_insert(&pad->groups, &group->link);
}
struct wlr_tablet_pad *create_libinput_tablet_pad(
struct libinput_device *libinput_dev) {
assert(libinput_dev);
......@@ -16,6 +74,24 @@ struct wlr_tablet_pad *create_libinput_tablet_pad(
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_pad");
return NULL;
}
wlr_tablet_pad->button_count =
libinput_device_tablet_pad_get_num_buttons(libinput_dev);
wlr_tablet_pad->ring_count =
libinput_device_tablet_pad_get_num_rings(libinput_dev);
wlr_tablet_pad->strip_count =
libinput_device_tablet_pad_get_num_strips(libinput_dev);
wlr_list_init(&wlr_tablet_pad->paths);
struct udev_device *udev = libinput_device_get_udev_device(libinput_dev);
wlr_list_push(&wlr_tablet_pad->paths, strdup(udev_device_get_syspath(udev)));
wl_list_init(&wlr_tablet_pad->groups);
int groups = libinput_device_tablet_pad_get_num_mode_groups(libinput_dev);
for (int i = 0; i < groups; ++i) {
add_pad_group_from_libinput(wlr_tablet_pad, libinput_dev, i);
}
wlr_tablet_pad_init(wlr_tablet_pad, NULL);
return wlr_tablet_pad;
}
......@@ -35,6 +111,8 @@ void handle_tablet_pad_button(struct libinput_event *event,
usec_to_msec(libinput_event_tablet_pad_get_time_usec(pevent));
wlr_event.button = libinput_event_tablet_pad_get_button_number(pevent);
wlr_event.mode = libinput_event_tablet_pad_get_mode(pevent);
wlr_event.group = libinput_tablet_pad_mode_group_get_index(
libinput_event_tablet_pad_get_mode_group(pevent));
switch (libinput_event_tablet_pad_get_button_state(pevent)) {
case LIBINPUT_BUTTON_STATE_PRESSED:
wlr_event.state = WLR_BUTTON_PRESSED;
......
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#endif
#include <string.h>
#include <assert.h>
#include <libinput.h>
#include <stdlib.h>
#include <wayland-util.h>
#include <wlr/backend/session.h>
#include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/types/wlr_input_device.h>
......@@ -8,16 +13,174 @@
#include "backend/libinput.h"
#include "util/signal.h"
struct wlr_tablet_tool *create_libinput_tablet_tool(
static struct wlr_tablet_impl tablet_impl;
static bool tablet_is_libinput(struct wlr_tablet *tablet) {
return tablet->impl == &tablet_impl;
}
struct wlr_libinput_tablet_tool {
struct wlr_tablet_tool wlr_tool;
struct libinput_tablet_tool *libinput_tool;
bool unique;
// Refcount for destroy + release
size_t pad_refs;
};
// TODO: Maybe this should be a wlr_list? Do we keep it, or want to get rid of
// it?
struct tablet_tool_list_elem {
struct wl_list link;
struct wlr_libinput_tablet_tool *tool;
};
struct wlr_libinput_tablet {
struct wlr_tablet wlr_tablet;
struct wl_list tools; // tablet_tool_list_elem::link
};
static void destroy_tool(struct wlr_libinput_tablet_tool *tool) {
wlr_signal_emit_safe(&tool->wlr_tool.events.destroy, &tool->wlr_tool);
libinput_tablet_tool_ref(tool->libinput_tool);
libinput_tablet_tool_set_user_data(tool->libinput_tool, NULL);
free(tool);
}
static void destroy_tablet(struct wlr_tablet *wlr_tablet) {
assert(tablet_is_libinput(wlr_tablet));
struct wlr_libinput_tablet *tablet =
wl_container_of(wlr_tablet, tablet, wlr_tablet);
struct tablet_tool_list_elem *pos;
struct tablet_tool_list_elem *tmp;
wl_list_for_each_safe(pos, tmp, &tablet->tools, link) {
struct wlr_libinput_tablet_tool *tool = pos->tool;
wl_list_remove(&pos->link);
free(pos);
if (--tool->pad_refs == 0) {
destroy_tool(tool);
}
}
free(tablet);
}
static struct wlr_tablet_impl tablet_impl = {
.destroy = destroy_tablet,
};
struct wlr_tablet *create_libinput_tablet(
struct libinput_device *libinput_dev) {
assert(libinput_dev);
struct wlr_tablet_tool *wlr_tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool));
if (!wlr_tablet_tool) {
struct wlr_libinput_tablet *libinput_tablet =
calloc(1, sizeof(struct wlr_libinput_tablet));
if (!libinput_tablet) {
wlr_log(WLR_ERROR, "Unable to allocate wlr_tablet_tool");
return NULL;
}
wlr_tablet_tool_init(wlr_tablet_tool, NULL);
return wlr_tablet_tool;
struct wlr_tablet *wlr_tablet = &libinput_tablet->wlr_tablet;
wlr_list_init(&wlr_tablet->paths);
struct udev_device *udev = libinput_device_get_udev_device(libinput_dev);
wlr_list_push(&wlr_tablet->paths, strdup(udev_device_get_syspath(udev)));
wlr_tablet->name = strdup(libinput_device_get_name(libinput_dev));
wl_list_init(&libinput_tablet->tools);
wlr_tablet_init(wlr_tablet, &tablet_impl);
return wlr_tablet;
}
static enum wlr_tablet_tool_type wlr_type_from_libinput_type(
enum libinput_tablet_tool_type value) {
switch (value) {
case LIBINPUT_TABLET_TOOL_TYPE_PEN:
return WLR_TABLET_TOOL_TYPE_PEN;
case LIBINPUT_TABLET_TOOL_TYPE_ERASER:
return WLR_TABLET_TOOL_TYPE_ERASER;
case LIBINPUT_TABLET_TOOL_TYPE_BRUSH:
return WLR_TABLET_TOOL_TYPE_BRUSH;
case LIBINPUT_TABLET_TOOL_TYPE_PENCIL:
return WLR_TABLET_TOOL_TYPE_PENCIL;
case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH:
return WLR_TABLET_TOOL_TYPE_AIRBRUSH;
case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:
return WLR_TABLET_TOOL_TYPE_MOUSE;
case LIBINPUT_TABLET_TOOL_TYPE_LENS:
return WLR_TABLET_TOOL_TYPE_LENS;
}
assert(false && "UNREACHABLE");
}
static struct wlr_libinput_tablet_tool *get_wlr_tablet_tool(
struct libinput_tablet_tool *tool) {
struct wlr_libinput_tablet_tool *ret =
libinput_tablet_tool_get_user_data(tool);
if (ret) {
return ret;
}
ret = calloc(1, sizeof(struct wlr_libinput_tablet_tool));
if (!ret) {
return NULL;
}
ret->libinput_tool = libinput_tablet_tool_ref(tool);
ret->wlr_tool.pressure = libinput_tablet_tool_has_pressure(tool);
ret->wlr_tool.distance = libinput_tablet_tool_has_distance(tool);
ret->wlr_tool.tilt = libinput_tablet_tool_has_tilt(tool);
ret->wlr_tool.rotation = libinput_tablet_tool_has_rotation(tool);
ret->wlr_tool.slider = libinput_tablet_tool_has_slider(tool);
ret->wlr_tool.wheel = libinput_tablet_tool_has_wheel(tool);
ret->wlr_tool.hardware_serial = libinput_tablet_tool_get_serial(tool);
ret->wlr_tool.hardware_wacom = libinput_tablet_tool_get_tool_id(tool);
ret->wlr_tool.type = wlr_type_from_libinput_type(
libinput_tablet_tool_get_type(tool));
ret->unique = libinput_tablet_tool_is_unique(tool);
wl_signal_init(&ret->wlr_tool.events.destroy);
libinput_tablet_tool_set_user_data(tool, ret);
return ret;
}
static void ensure_tool_reference(struct wlr_libinput_tablet_tool *tool,
struct wlr_tablet *wlr_dev) {
assert(tablet_is_libinput(wlr_dev));
struct wlr_libinput_tablet *tablet = wl_container_of(wlr_dev, tablet, wlr_tablet);
struct tablet_tool_list_elem *pos;
wl_list_for_each(pos, &tablet->tools, link) {
if (pos->tool == tool) { // We already have a ref
// XXX: We *could* optimize the tool to the front of
// the list here, since we will probably get the next
// couple of events from the same tool.
// BUT the list should always be rather short (probably
// single digit amount of tools) so it might be more
// work than it saves
return;
}
}
struct tablet_tool_list_elem *new =
calloc(1, sizeof(struct tablet_tool_list_elem));
if (!new) {
wlr_log(WLR_ERROR, "Failed to allocate memory for tracking tablet tool");
return;
}
new->tool = tool;
wl_list_insert(&tablet->tools, &new->link);
++tool->pad_refs;
}
void handle_tablet_tool_axis(struct libinput_event *event,
......@@ -31,16 +194,23 @@ void handle_tablet_tool_axis(struct libinput_event *event,
struct libinput_event_tablet_tool *tevent =
libinput_event_get_tablet_tool_event(event);
struct wlr_event_tablet_tool_axis wlr_event = { 0 };
struct wlr_libinput_tablet_tool *tool = get_wlr_tablet_tool(
libinput_event_tablet_tool_get_tool(tevent));
ensure_tool_reference(tool, wlr_dev->tablet);
wlr_event.device = wlr_dev;
wlr_event.tool = &tool->wlr_tool;
wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
if (libinput_event_tablet_tool_x_has_changed(tevent)) {
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_X;
wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1);
wlr_event.dx = libinput_event_tablet_tool_get_dx(tevent);
}
if (libinput_event_tablet_tool_y_has_changed(tevent)) {
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_Y;
wlr_event.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1);
wlr_event.dy = libinput_event_tablet_tool_get_dy(tevent);
}
if (libinput_event_tablet_tool_pressure_has_changed(tevent)) {
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_PRESSURE;
......@@ -70,7 +240,7 @@ void handle_tablet_tool_axis(struct libinput_event *event,
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_WHEEL;
wlr_event.wheel_delta = libinput_event_tablet_tool_get_wheel_delta(tevent);
}
wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.axis, &wlr_event);
wlr_signal_emit_safe(&wlr_dev->tablet->events.axis, &wlr_event);
}
void handle_tablet_tool_proximity(struct libinput_event *event,
......@@ -84,6 +254,11 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
struct libinput_event_tablet_tool *tevent =
libinput_event_get_tablet_tool_event(event);
struct wlr_event_tablet_tool_proximity wlr_event = { 0 };
struct wlr_libinput_tablet_tool *tool = get_wlr_tablet_tool(
libinput_event_tablet_tool_get_tool(tevent));
ensure_tool_reference(tool, wlr_dev->tablet);
wlr_event.tool = &tool->wlr_tool;
wlr_event.device = wlr_dev;
wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
......@@ -93,10 +268,36 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
break;
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN:
wlr_event.state = WLR_TABLET_TOOL_PROXIMITY_IN;
handle_tablet_tool_axis(event, libinput_dev);
break;
}
wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.proximity, &wlr_event);
wlr_signal_emit_safe(&wlr_dev->tablet->events.proximity, &wlr_event);
if (libinput_event_tablet_tool_get_proximity_state(tevent) == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN) {
handle_tablet_tool_axis(event, libinput_dev);
}
// If the tool is not unique, libinput will not find it again after the
// proximity out, so we should destroy it
if (!tool->unique &&
libinput_event_tablet_tool_get_proximity_state(tevent) == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) {
// The tool isn't unique, it can't be on multiple tablets
assert(tool->pad_refs == 1);
assert(tablet_is_libinput(wlr_dev->tablet));
struct wlr_libinput_tablet *tablet =
wl_container_of(wlr_dev->tablet, tablet, wlr_tablet);
struct tablet_tool_list_elem *pos;
struct tablet_tool_list_elem *tmp;
wl_list_for_each_safe(pos, tmp, &tablet->tools, link) {
if (pos->tool == tool) {
wl_list_remove(&pos->link);
free(pos);
break;
}
}
destroy_tool(tool);
}
}
void handle_tablet_tool_tip(struct libinput_event *event,
......@@ -111,7 +312,12 @@ void handle_tablet_tool_tip(struct libinput_event *event,
struct libinput_event_tablet_tool *tevent =
libinput_event_get_tablet_tool_event(event);
struct wlr_event_tablet_tool_tip wlr_event = { 0 };
struct wlr_libinput_tablet_tool *tool = get_wlr_tablet_tool(
libinput_event_tablet_tool_get_tool(tevent));
ensure_tool_reference(tool, wlr_dev->tablet);
wlr_event.device = wlr_dev;
wlr_event.tool = &tool->wlr_tool;
wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
switch (libinput_event_tablet_tool_get_tip_state(tevent)) {
......@@ -122,7 +328,7 @@ void handle_tablet_tool_tip(struct libinput_event *event,
wlr_event.state = WLR_TABLET_TOOL_TIP_DOWN;
break;
}
wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.tip, &wlr_event);
wlr_signal_emit_safe(&wlr_dev->tablet->events.tip, &wlr_event);
}
void handle_tablet_tool_button(struct libinput_event *event,
......@@ -137,7 +343,12 @@ void handle_tablet_tool_button(struct libinput_event *event,
struct libinput_event_tablet_tool *tevent =
libinput_event_get_tablet_tool_event(event);
struct wlr_event_tablet_tool_button wlr_event = { 0 };
struct wlr_libinput_tablet_tool *tool = get_wlr_tablet_tool(
libinput_event_tablet_tool_get_tool(tevent));
ensure_tool_reference(tool, wlr_dev->tablet);
wlr_event.device = wlr_dev;
wlr_event.tool = &tool->wlr_tool;
wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
wlr_event.button = libinput_event_tablet_tool_get_button(tevent);
......@@ -149,5 +360,5 @@ void handle_tablet_tool_button(struct libinput_event *event,
wlr_event.state = WLR_BUTTON_PRESSED;
break;
}
wlr_signal_emit_safe(&wlr_dev->tablet_tool->events.button, &wlr_event);
wlr_signal_emit_safe(&wlr_dev->tablet->events.button, &wlr_event);
}
......@@ -326,11 +326,11 @@ void new_input_notify(struct wl_listener *listener, void *data) {
tstate->destroy.notify = tablet_tool_destroy_notify;
wl_signal_add(&device->events.destroy, &tstate->destroy);
tstate->axis.notify = tablet_tool_axis_notify;
wl_signal_add(&device->tablet_tool->events.axis, &tstate->axis);
wl_signal_add(&device->tablet->events.axis, &tstate->axis);
tstate->proximity.notify = tablet_tool_proximity_notify;
wl_signal_add(&device->tablet_tool->events.proximity, &tstate->proximity);
wl_signal_add(&device->tablet->events.proximity, &tstate->proximity);
tstate->button.notify = tablet_tool_button_notify;
wl_signal_add(&device->tablet_tool->events.button, &tstate->button);
wl_signal_add(&device->tablet->events.button, &tstate->button);
wl_list_insert(&sample->tablet_tools, &tstate->link);
break;
default:
......
......@@ -65,7 +65,7 @@ void handle_touch_motion(struct libinput_event *event,
void handle_touch_cancel(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet_tool *create_libinput_tablet_tool(
struct wlr_tablet *create_libinput_tablet(
struct libinput_device *device);
void handle_tablet_tool_axis(struct libinput_event *event,
struct libinput_device *device);
......
......@@ -40,6 +40,8 @@ struct roots_cursor {
struct wl_listener tool_axis;
struct wl_listener tool_tip;
struct wl_listener tool_proximity;
struct wl_listener tool_button;
struct wl_listener request_set_cursor;
};
......
......@@ -56,6 +56,7 @@ struct roots_desktop {
struct wlr_layer_shell *layer_shell;
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
struct wlr_screencopy_manager_v1 *screencopy;
struct wlr_tablet_manager_v2 *tablet_v2;
struct wl_listener new_output;
struct wl_listener layout_change;
......
......@@ -30,7 +30,8 @@ struct roots_seat {
struct wl_list keyboards;
struct wl_list pointers;
struct wl_list touch;
struct wl_list tablet_tools;
struct wl_list tablets;
struct wl_list tablet_pads;
struct wl_listener new_drag_icon;
struct wl_listener destroy;
......@@ -77,9 +78,11 @@ struct roots_touch {
struct wl_list link;
};
struct roots_tablet_tool {
struct roots_tablet {
struct roots_seat *seat;
struct wlr_input_device *device;
struct wlr_tablet_v2_tablet *tablet_v2;
struct wl_listener device_destroy;
struct wl_listener axis;
struct wl_listener proximity;
......@@ -88,6 +91,37 @@ struct roots_tablet_tool {
struct wl_list link;
};
struct roots_tablet_pad {
struct wl_list link;
struct wlr_tablet_v2_tablet_pad *tablet_v2_pad;
struct roots_seat *seat;
struct wlr_input_device *device;
struct wl_listener device_destroy;
struct wl_listener attach;
struct wl_listener button;
struct wl_listener ring;
struct wl_listener strip;
struct roots_tablet *tablet;
struct wl_listener tablet_destroy;
};
struct roots_tablet_tool {
struct wl_list link;
struct wl_list tool_link;
struct wlr_tablet_v2_tablet_tool *tablet_v2_tool;
struct roots_seat *seat;
struct wl_listener set_cursor;
struct wl_listener tool_destroy;
struct roots_tablet *current_tablet;
struct wl_listener tablet_destroy;
};
struct roots_seat *roots_seat_create(struct roots_input *input, char *name);
void roots_seat_destroy(struct roots_seat *seat);
......
#ifndef TYPES_WLR_TABLET_V2_H
#define TYPES_WLR_TABLET_V2_H
#include "tablet-unstable-v2-protocol.h"
#include <wayland-server.h>
#include <wlr/types/wlr_tablet_v2.h>
struct wlr_tablet_seat_v2 {
struct wl_list link;
struct wlr_seat *wlr_seat;
struct wlr_tablet_manager_v2 *manager;
struct wl_list tablets; // wlr_tablet_v2_tablet::link
struct wl_list tools;
struct wl_list pads;
struct wl_list clients; //wlr_tablet_seat_v2_client::link;
struct wl_listener seat_destroy;
};
struct wlr_tablet_seat_client_v2 {
struct wl_list seat_link;
struct wl_list client_link;
struct wl_client *wl_client;
struct wl_resource *resource;
struct wlr_tablet_manager_client_v2 *client;
struct wlr_seat_client *seat_client;
struct wl_listener seat_client_destroy;
struct wl_list tools; //wlr_tablet_tool_client_v2::link
struct wl_list tablets; //wlr_tablet_client_v2::link
struct wl_list pads; //wlr_tablet_pad_client_v2::link
};
struct wlr_tablet_client_v2 {
struct wl_list seat_link; // wlr_tablet_seat_client_v2::tablet
struct wl_list tablet_link; // wlr_tablet_v2_tablet::clients
struct wl_client *client;
struct wl_resource *resource;
};
struct wlr_tablet_pad_client_v2 {
struct wl_list seat_link;
struct wl_list pad_link;
struct wl_client *client;
struct wl_resource *resource;
struct wlr_tablet_v2_tablet_pad *pad;
size_t button_count;
size_t group_count;
struct wl_resource **groups;
size_t ring_count;
struct wl_resource **rings;