types/wlr_tablet_tool: uniformize events name

This commit is contained in:
Simon Zeni 2022-03-09 15:43:28 -05:00 committed by Kirill Primak
parent d1f543a9d8
commit e732c5c895
6 changed files with 40 additions and 41 deletions

View File

@ -130,9 +130,8 @@ void handle_tablet_tool_axis(struct libinput_event *event,
struct tablet_tool *tool = struct tablet_tool *tool =
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent)); get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
struct wlr_event_tablet_tool_axis wlr_event = { 0 }; struct wlr_tablet_tool_axis_event wlr_event = { 0 };
wlr_event.tablet = wlr_tablet;
wlr_event.device = &wlr_tablet->base;
wlr_event.tool = &tool->wlr_tool; wlr_event.tool = &tool->wlr_tool;
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)); usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
@ -185,9 +184,9 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
struct tablet_tool *tool = struct tablet_tool *tool =
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent)); get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
struct wlr_event_tablet_tool_proximity wlr_event = { 0 }; struct wlr_tablet_tool_proximity_event wlr_event = { 0 };
wlr_event.tablet = wlr_tablet;
wlr_event.tool = &tool->wlr_tool; wlr_event.tool = &tool->wlr_tool;
wlr_event.device = &wlr_tablet->base;
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)); usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1); wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1);
@ -227,8 +226,8 @@ void handle_tablet_tool_tip(struct libinput_event *event,
struct tablet_tool *tool = struct tablet_tool *tool =
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent)); get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
struct wlr_event_tablet_tool_tip wlr_event = { 0 }; struct wlr_tablet_tool_tip_event wlr_event = { 0 };
wlr_event.device = &wlr_tablet->base; wlr_event.tablet = wlr_tablet;
wlr_event.tool = &tool->wlr_tool; wlr_event.tool = &tool->wlr_tool;
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)); usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
@ -255,8 +254,8 @@ void handle_tablet_tool_button(struct libinput_event *event,
struct tablet_tool *tool = struct tablet_tool *tool =
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent)); get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
struct wlr_event_tablet_tool_button wlr_event = { 0 }; struct wlr_tablet_tool_button_event wlr_event = { 0 };
wlr_event.device = &wlr_tablet->base; wlr_event.tablet = wlr_tablet;
wlr_event.tool = &tool->wlr_tool; wlr_event.tool = &tool->wlr_tool;
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)); usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));

View File

@ -582,8 +582,8 @@ static void handle_tablet_tool_button(void *data,
struct wlr_wl_seat *seat = tool->seat; struct wlr_wl_seat *seat = tool->seat;
struct wlr_tablet *tablet = &seat->wlr_tablet; struct wlr_tablet *tablet = &seat->wlr_tablet;
struct wlr_event_tablet_tool_button evt = { struct wlr_tablet_tool_button_event evt = {
.device = &tablet->base, .tablet = tablet,
.tool = &seat->wlr_tablet_tool, .tool = &seat->wlr_tablet_tool,
.time_msec = get_current_time_msec(), .time_msec = get_current_time_msec(),
.button = button, .button = button,
@ -620,8 +620,8 @@ static void handle_tablet_tool_frame(void *data,
struct wlr_tablet *tablet = &seat->wlr_tablet; struct wlr_tablet *tablet = &seat->wlr_tablet;
if (tool->is_in) { if (tool->is_in) {
struct wlr_event_tablet_tool_proximity evt = { struct wlr_tablet_tool_proximity_event evt = {
.device = &tablet->base, .tablet = tablet,
.tool = &seat->wlr_tablet_tool, .tool = &seat->wlr_tablet_tool,
.time_msec = time, .time_msec = time,
.x = tool->x, .x = tool->x,
@ -633,8 +633,8 @@ static void handle_tablet_tool_frame(void *data,
} }
{ {
struct wlr_event_tablet_tool_axis evt = { struct wlr_tablet_tool_axis_event evt = {
.device = &tablet->base, .tablet = tablet,
.tool = &seat->wlr_tablet_tool, .tool = &seat->wlr_tablet_tool,
.time_msec = time, .time_msec = time,
.updated_axes = 0, .updated_axes = 0,
@ -696,8 +696,8 @@ static void handle_tablet_tool_frame(void *data,
* Downside: Here we have the frame time, if we sent right away, we * Downside: Here we have the frame time, if we sent right away, we
* need to generate the time */ * need to generate the time */
if (tool->is_down) { if (tool->is_down) {
struct wlr_event_tablet_tool_tip evt = { struct wlr_tablet_tool_tip_event evt = {
.device = &tablet->base, .tablet = tablet,
.tool = &seat->wlr_tablet_tool, .tool = &seat->wlr_tablet_tool,
.time_msec = time, .time_msec = time,
.x = tool->x, .x = tool->x,
@ -709,8 +709,8 @@ static void handle_tablet_tool_frame(void *data,
} }
if (tool->is_up) { if (tool->is_up) {
struct wlr_event_tablet_tool_tip evt = { struct wlr_tablet_tool_tip_event evt = {
.device = &tablet->base, .tablet = tablet,
.tool = &seat->wlr_tablet_tool, .tool = &seat->wlr_tablet_tool,
.time_msec = time, .time_msec = time,
.x = tool->x, .x = tool->x,
@ -722,8 +722,8 @@ static void handle_tablet_tool_frame(void *data,
} }
if (tool->is_out) { if (tool->is_out) {
struct wlr_event_tablet_tool_proximity evt = { struct wlr_tablet_tool_proximity_event evt = {
.device = &tablet->base, .tablet = tablet,
.tool = &seat->wlr_tablet_tool, .tool = &seat->wlr_tablet_tool,
.time_msec = time, .time_msec = time,
.x = tool->x, .x = tool->x,

View File

@ -217,11 +217,11 @@ static void handle_touch_cancel(struct wl_listener *listener, void *data) {
static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) { static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
struct sample_state *sample = struct sample_state *sample =
wl_container_of(listener, sample, tablet_tool_axis); wl_container_of(listener, sample, tablet_tool_axis);
struct wlr_event_tablet_tool_axis *event = data; struct wlr_tablet_tool_axis_event *event = data;
if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X) && if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X) &&
(event->updated_axes & WLR_TABLET_TOOL_AXIS_Y)) { (event->updated_axes & WLR_TABLET_TOOL_AXIS_Y)) {
wlr_cursor_warp_absolute(sample->cursor, wlr_cursor_warp_absolute(sample->cursor, &event->tablet->base,
event->device, event->x, event->y); event->x, event->y);
} }
} }

View File

@ -136,7 +136,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
static void tablet_tool_axis_notify(struct wl_listener *listener, void *data) { static void tablet_tool_axis_notify(struct wl_listener *listener, void *data) {
struct tablet_tool_state *tstate = wl_container_of(listener, tstate, axis); struct tablet_tool_state *tstate = wl_container_of(listener, tstate, axis);
struct wlr_event_tablet_tool_axis *event = data; struct wlr_tablet_tool_axis_event *event = data;
struct sample_state *sample = tstate->sample; struct sample_state *sample = tstate->sample;
if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) { if ((event->updated_axes & WLR_TABLET_TOOL_AXIS_X)) {
sample->x = event->x; sample->x = event->x;
@ -160,14 +160,14 @@ static void tablet_tool_axis_notify(struct wl_listener *listener, void *data) {
static void tablet_tool_proximity_notify(struct wl_listener *listener, void *data) { static void tablet_tool_proximity_notify(struct wl_listener *listener, void *data) {
struct tablet_tool_state *tstate = wl_container_of(listener, tstate, proximity); struct tablet_tool_state *tstate = wl_container_of(listener, tstate, proximity);
struct wlr_event_tablet_tool_proximity *event = data; struct wlr_tablet_tool_proximity_event *event = data;
struct sample_state *sample = tstate->sample; struct sample_state *sample = tstate->sample;
sample->proximity = event->state == WLR_TABLET_TOOL_PROXIMITY_IN; sample->proximity = event->state == WLR_TABLET_TOOL_PROXIMITY_IN;
} }
static void tablet_tool_button_notify(struct wl_listener *listener, void *data) { static void tablet_tool_button_notify(struct wl_listener *listener, void *data) {
struct tablet_tool_state *tstate = wl_container_of(listener, tstate, button); struct tablet_tool_state *tstate = wl_container_of(listener, tstate, button);
struct wlr_event_tablet_tool_button *event = data; struct wlr_tablet_tool_button_event *event = data;
struct sample_state *sample = tstate->sample; struct sample_state *sample = tstate->sample;
if (event->state == WLR_BUTTON_RELEASED) { if (event->state == WLR_BUTTON_RELEASED) {
sample->button = false; sample->button = false;

View File

@ -90,8 +90,8 @@ enum wlr_tablet_tool_axes {
WLR_TABLET_TOOL_AXIS_WHEEL = 1 << 8, WLR_TABLET_TOOL_AXIS_WHEEL = 1 << 8,
}; };
struct wlr_event_tablet_tool_axis { struct wlr_tablet_tool_axis_event {
struct wlr_input_device *device; struct wlr_tablet *tablet;
struct wlr_tablet_tool *tool; struct wlr_tablet_tool *tool;
uint32_t time_msec; uint32_t time_msec;
@ -113,8 +113,8 @@ enum wlr_tablet_tool_proximity_state {
WLR_TABLET_TOOL_PROXIMITY_IN, WLR_TABLET_TOOL_PROXIMITY_IN,
}; };
struct wlr_event_tablet_tool_proximity { struct wlr_tablet_tool_proximity_event {
struct wlr_input_device *device; struct wlr_tablet *tablet;
struct wlr_tablet_tool *tool; struct wlr_tablet_tool *tool;
uint32_t time_msec; uint32_t time_msec;
// From 0..1 // From 0..1
@ -123,12 +123,12 @@ struct wlr_event_tablet_tool_proximity {
}; };
enum wlr_tablet_tool_tip_state { enum wlr_tablet_tool_tip_state {
WLR_TABLET_TOOL_TIP_UP, WLR_TABLET_TOOL_TIP_UP = 1 << 0,
WLR_TABLET_TOOL_TIP_DOWN, WLR_TABLET_TOOL_TIP_DOWN = 1 << 1,
}; };
struct wlr_event_tablet_tool_tip { struct wlr_tablet_tool_tip_event {
struct wlr_input_device *device; struct wlr_tablet *tablet;
struct wlr_tablet_tool *tool; struct wlr_tablet_tool *tool;
uint32_t time_msec; uint32_t time_msec;
// From 0..1 // From 0..1
@ -136,8 +136,8 @@ struct wlr_event_tablet_tool_tip {
enum wlr_tablet_tool_tip_state state; enum wlr_tablet_tool_tip_state state;
}; };
struct wlr_event_tablet_tool_button { struct wlr_tablet_tool_button_event {
struct wlr_input_device *device; struct wlr_tablet *tablet;
struct wlr_tablet_tool *tool; struct wlr_tablet_tool *tool;
uint32_t time_msec; uint32_t time_msec;
uint32_t button; uint32_t button;

View File

@ -556,7 +556,7 @@ static void handle_touch_frame(struct wl_listener *listener, void *data) {
} }
static void handle_tablet_tool_tip(struct wl_listener *listener, void *data) { static void handle_tablet_tool_tip(struct wl_listener *listener, void *data) {
struct wlr_event_tablet_tool_tip *event = data; struct wlr_tablet_tool_tip_event *event = data;
struct wlr_cursor_device *device; struct wlr_cursor_device *device;
device = wl_container_of(listener, device, tablet_tool_tip); device = wl_container_of(listener, device, tablet_tool_tip);
@ -569,7 +569,7 @@ static void handle_tablet_tool_tip(struct wl_listener *listener, void *data) {
} }
static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) { static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
struct wlr_event_tablet_tool_axis *event = data; struct wlr_tablet_tool_axis_event *event = data;
struct wlr_cursor_device *device; struct wlr_cursor_device *device;
device = wl_container_of(listener, device, tablet_tool_axis); device = wl_container_of(listener, device, tablet_tool_axis);
@ -605,7 +605,7 @@ static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
static void handle_tablet_tool_button(struct wl_listener *listener, static void handle_tablet_tool_button(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_event_tablet_tool_button *event = data; struct wlr_tablet_tool_button *event = data;
struct wlr_cursor_device *device; struct wlr_cursor_device *device;
device = wl_container_of(listener, device, tablet_tool_button); device = wl_container_of(listener, device, tablet_tool_button);
wlr_signal_emit_safe(&device->cursor->events.tablet_tool_button, event); wlr_signal_emit_safe(&device->cursor->events.tablet_tool_button, event);
@ -613,7 +613,7 @@ static void handle_tablet_tool_button(struct wl_listener *listener,
static void handle_tablet_tool_proximity(struct wl_listener *listener, static void handle_tablet_tool_proximity(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_event_tablet_tool_proximity *event = data; struct wlr_tablet_tool_proximity_event *event = data;
struct wlr_cursor_device *device; struct wlr_cursor_device *device;
device = wl_container_of(listener, device, tablet_tool_proximity); device = wl_container_of(listener, device, tablet_tool_proximity);