rename wlr_tablet_tool to wlr_tablet

The previous naming was based on the input-device capability names from
libinput.
With code that uses the libinput_tablet_tool and mapping into tablet-v2,
this is confusing, so the name is changed to follow the names used in
the protocol.
This commit is contained in:
Markus Ongyerth 2018-06-16 11:19:48 +02:00
parent b84288af16
commit d9e978e1b3
15 changed files with 93 additions and 91 deletions

View file

@ -59,13 +59,13 @@ struct wlr_tablet_v2_tablet *wlr_tablet_create(
if (!seat) {
return NULL;
}
struct wlr_tablet_tool *tool = wlr_device->tablet_tool;
struct wlr_tablet *wlr_tablet = wlr_device->tablet;
struct wlr_tablet_v2_tablet *tablet = calloc(1, sizeof(struct wlr_tablet_v2_tablet));
if (!tablet) {
return NULL;
}
tablet->wlr_tool = tool;
tablet->wlr_tablet = wlr_tablet;
tablet->wlr_device = wlr_device;
wl_list_init(&tablet->clients);
@ -107,14 +107,15 @@ void add_tablet_client(struct wlr_tablet_seat_client_v2 *seat,
zwp_tablet_seat_v2_send_tablet_added(seat->resource, client->resource);
// Send the expected events
if (tablet->wlr_tool->name) {
zwp_tablet_v2_send_name(client->resource, tablet->wlr_tool->name);
if (tablet->wlr_tablet->name) {
zwp_tablet_v2_send_name(client->resource,
tablet->wlr_tablet->name);
}
zwp_tablet_v2_send_id(client->resource,
tablet->wlr_device->vendor, tablet->wlr_device->product);
for (size_t i = 0; i < tablet->wlr_tool->paths.length; ++i) {
for (size_t i = 0; i < tablet->wlr_tablet->paths.length; ++i) {
zwp_tablet_v2_send_path(client->resource,
tablet->wlr_tool->paths.items[i]);
tablet->wlr_tablet->paths.items[i]);
}
zwp_tablet_v2_send_done(client->resource);

View file

@ -192,7 +192,7 @@ static void handle_wlr_tablet_tool_destroy(struct wl_listener *listener, void *d
struct wlr_tablet_v2_tablet_tool *wlr_tablet_tool_create(
struct wlr_tablet_manager_v2 *manager,
struct wlr_seat *wlr_seat,
struct wlr_tablet_tool_tool *wlr_tool) {
struct wlr_tablet_tool *wlr_tool) {
struct wlr_tablet_seat_v2 *seat = get_or_create_tablet_seat(manager, wlr_seat);
if (!seat) {
return NULL;

View file

@ -551,19 +551,19 @@ static struct wlr_cursor_device *cursor_device_create(
wl_signal_add(&device->touch->events.cancel, &c_device->touch_cancel);
c_device->touch_cancel.notify = handle_touch_cancel;
} else if (device->type == WLR_INPUT_DEVICE_TABLET_TOOL) {
wl_signal_add(&device->tablet_tool->events.tip,
wl_signal_add(&device->tablet->events.tip,
&c_device->tablet_tool_tip);
c_device->tablet_tool_tip.notify = handle_tablet_tool_tip;
wl_signal_add(&device->tablet_tool->events.proximity,
wl_signal_add(&device->tablet->events.proximity,
&c_device->tablet_tool_proximity);
c_device->tablet_tool_proximity.notify = handle_tablet_tool_proximity;
wl_signal_add(&device->tablet_tool->events.axis,
wl_signal_add(&device->tablet->events.axis,
&c_device->tablet_tool_axis);
c_device->tablet_tool_axis.notify = handle_tablet_tool_axis;
wl_signal_add(&device->tablet_tool->events.button,
wl_signal_add(&device->tablet->events.button,
&c_device->tablet_tool_button);
c_device->tablet_tool_button.notify = handle_tablet_tool_button;
}

View file

@ -44,7 +44,7 @@ void wlr_input_device_destroy(struct wlr_input_device *dev) {
wlr_touch_destroy(dev->touch);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
wlr_tablet_tool_destroy(dev->tablet_tool);
wlr_tablet_destroy(dev->tablet);
break;
case WLR_INPUT_DEVICE_TABLET_PAD:
wlr_tablet_pad_destroy(dev->tablet_pad);

View file

@ -4,26 +4,26 @@
#include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/types/wlr_tablet_tool.h>
void wlr_tablet_tool_init(struct wlr_tablet_tool *tool,
struct wlr_tablet_tool_impl *impl) {
tool->impl = impl;
wl_signal_init(&tool->events.axis);
wl_signal_init(&tool->events.proximity);
wl_signal_init(&tool->events.tip);
wl_signal_init(&tool->events.button);
void wlr_tablet_init(struct wlr_tablet *tablet,
struct wlr_tablet_impl *impl) {
tablet->impl = impl;
wl_signal_init(&tablet->events.axis);
wl_signal_init(&tablet->events.proximity);
wl_signal_init(&tablet->events.tip);
wl_signal_init(&tablet->events.button);
}
void wlr_tablet_tool_destroy(struct wlr_tablet_tool *tool) {
if (!tool) {
void wlr_tablet_destroy(struct wlr_tablet *tablet) {
if (!tablet) {
return;
}
wlr_list_for_each(&tool->paths, free);
wlr_list_finish(&tool->paths);
wlr_list_for_each(&tablet->paths, free);
wlr_list_finish(&tablet->paths);
if (tool->impl && tool->impl->destroy) {
tool->impl->destroy(tool);
if (tablet->impl && tablet->impl->destroy) {
tablet->impl->destroy(tablet);
} else {
free(tool);
free(tablet);
}
}