mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-08 19:28:03 +02:00
tablet: insert "STATE" into proximity/tip states
Makes it even longer, but at least it's consistent with button and key state. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
This commit is contained in:
parent
c5b87828ee
commit
0b124a1a5d
6 changed files with 26 additions and 26 deletions
|
|
@ -513,7 +513,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
|
||||||
tablet_notify_proximity(&device->base,
|
tablet_notify_proximity(&device->base,
|
||||||
time,
|
time,
|
||||||
tool,
|
tool,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN,
|
||||||
tablet->changed_axes,
|
tablet->changed_axes,
|
||||||
axes);
|
axes);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1230,7 +1230,7 @@ tablet_flush(struct tablet_dispatch *tablet,
|
||||||
tablet_notify_proximity(&device->base,
|
tablet_notify_proximity(&device->base,
|
||||||
time,
|
time,
|
||||||
tool,
|
tool,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT,
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT,
|
||||||
tablet->changed_axes,
|
tablet->changed_axes,
|
||||||
tablet->axes);
|
tablet->axes);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2170,7 +2170,7 @@ tablet_notify_axis(struct libinput_device *device,
|
||||||
*axis_event = (struct libinput_event_tablet_tool) {
|
*axis_event = (struct libinput_event_tablet_tool) {
|
||||||
.time = time,
|
.time = time,
|
||||||
.tool = tool,
|
.tool = tool,
|
||||||
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
|
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN,
|
||||||
.tip_state = tip_state,
|
.tip_state = tip_state,
|
||||||
.wheel_discrete = wheel_discrete,
|
.wheel_discrete = wheel_discrete,
|
||||||
};
|
};
|
||||||
|
|
@ -2238,7 +2238,7 @@ tablet_notify_tip(struct libinput_device *device,
|
||||||
.time = time,
|
.time = time,
|
||||||
.tool = tool,
|
.tool = tool,
|
||||||
.tip_state = tip_state,
|
.tip_state = tip_state,
|
||||||
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
|
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN,
|
||||||
};
|
};
|
||||||
memcpy(tip_event->axes,
|
memcpy(tip_event->axes,
|
||||||
axes,
|
axes,
|
||||||
|
|
@ -2276,7 +2276,7 @@ tablet_notify_button(struct libinput_device *device,
|
||||||
.button = button,
|
.button = button,
|
||||||
.state = state,
|
.state = state,
|
||||||
.seat_button_count = seat_button_count,
|
.seat_button_count = seat_button_count,
|
||||||
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
|
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN,
|
||||||
.tip_state = tip_state,
|
.tip_state = tip_state,
|
||||||
};
|
};
|
||||||
memcpy(button_event->axes, axes, sizeof(button_event->axes));
|
memcpy(button_event->axes, axes, sizeof(button_event->axes));
|
||||||
|
|
|
||||||
|
|
@ -197,8 +197,8 @@ enum libinput_tablet_tool_type {
|
||||||
* distance (a few cm) off the surface.
|
* distance (a few cm) off the surface.
|
||||||
*/
|
*/
|
||||||
enum libinput_tablet_tool_proximity_state {
|
enum libinput_tablet_tool_proximity_state {
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT = 0,
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT = 0,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN = 1,
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -284,9 +284,9 @@ enum libinput_event_type {
|
||||||
* with @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS events.
|
* with @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS events.
|
||||||
*
|
*
|
||||||
* Some tools may always be in proximity. For these tools, events of
|
* Some tools may always be in proximity. For these tools, events of
|
||||||
* type @ref LIBINPUT_TABLET_TOOL_PROXIMITY_IN are sent only once after @ref
|
* type @ref LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN are sent only once after @ref
|
||||||
* LIBINPUT_EVENT_DEVICE_ADDED, and events of type @ref
|
* LIBINPUT_EVENT_DEVICE_ADDED, and events of type @ref
|
||||||
* LIBINPUT_TABLET_TOOL_PROXIMITY_OUT are sent only once before @ref
|
* LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT are sent only once before @ref
|
||||||
* LIBINPUT_EVENT_DEVICE_REMOVED.
|
* LIBINPUT_EVENT_DEVICE_REMOVED.
|
||||||
*
|
*
|
||||||
* If the tool that comes into proximity supports x/y coordinates,
|
* If the tool that comes into proximity supports x/y coordinates,
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ START_TEST(tip_down_prox_in)
|
||||||
tablet_event = litest_is_tablet_event(event,
|
tablet_event = litest_is_tablet_event(event,
|
||||||
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
||||||
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tablet_event),
|
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tablet_event),
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||||
libinput_event_destroy(event);
|
libinput_event_destroy(event);
|
||||||
|
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
|
|
@ -150,7 +150,7 @@ START_TEST(tip_up_prox_out)
|
||||||
tablet_event = litest_is_tablet_event(event,
|
tablet_event = litest_is_tablet_event(event,
|
||||||
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
||||||
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tablet_event),
|
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tablet_event),
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||||
libinput_event_destroy(event);
|
libinput_event_destroy(event);
|
||||||
|
|
||||||
litest_assert_empty_queue(li);
|
litest_assert_empty_queue(li);
|
||||||
|
|
@ -601,7 +601,7 @@ START_TEST(proximity_in_out)
|
||||||
libinput_event_get_tablet_tool_event(event);
|
libinput_event_get_tablet_tool_event(event);
|
||||||
|
|
||||||
if (libinput_event_tablet_tool_get_proximity_state(t) ==
|
if (libinput_event_tablet_tool_get_proximity_state(t) ==
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT)
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT)
|
||||||
have_proximity_out = true;
|
have_proximity_out = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -641,7 +641,7 @@ START_TEST(proximity_in_button_down)
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
|
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||||
litest_assert_tablet_button_event(li,
|
litest_assert_tablet_button_event(li,
|
||||||
BTN_STYLUS,
|
BTN_STYLUS,
|
||||||
LIBINPUT_BUTTON_STATE_PRESSED);
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
|
@ -674,7 +674,7 @@ START_TEST(proximity_out_button_up)
|
||||||
BTN_STYLUS,
|
BTN_STYLUS,
|
||||||
LIBINPUT_BUTTON_STATE_RELEASED);
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||||
litest_assert_empty_queue(li);
|
litest_assert_empty_queue(li);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
@ -892,13 +892,13 @@ START_TEST(proximity_range_enter)
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
|
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||||
|
|
||||||
litest_axis_set_value(axes, ABS_DISTANCE, 90);
|
litest_axis_set_value(axes, ABS_DISTANCE, 90);
|
||||||
litest_tablet_motion(dev, 10, 10, axes);
|
litest_tablet_motion(dev, 10, 10, axes);
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||||
|
|
||||||
litest_tablet_proximity_out(dev);
|
litest_tablet_proximity_out(dev);
|
||||||
litest_assert_empty_queue(li);
|
litest_assert_empty_queue(li);
|
||||||
|
|
@ -927,13 +927,13 @@ START_TEST(proximity_range_in_out)
|
||||||
litest_pop_event_frame(dev);
|
litest_pop_event_frame(dev);
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||||
|
|
||||||
litest_axis_set_value(axes, ABS_DISTANCE, 90);
|
litest_axis_set_value(axes, ABS_DISTANCE, 90);
|
||||||
litest_tablet_motion(dev, 10, 10, axes);
|
litest_tablet_motion(dev, 10, 10, axes);
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||||
|
|
||||||
litest_tablet_motion(dev, 30, 30, axes);
|
litest_tablet_motion(dev, 30, 30, axes);
|
||||||
litest_assert_empty_queue(li);
|
litest_assert_empty_queue(li);
|
||||||
|
|
@ -942,11 +942,11 @@ START_TEST(proximity_range_in_out)
|
||||||
litest_tablet_motion(dev, 10, 10, axes);
|
litest_tablet_motion(dev, 10, 10, axes);
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||||
|
|
||||||
litest_tablet_proximity_out(dev);
|
litest_tablet_proximity_out(dev);
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||||
litest_assert_empty_queue(li);
|
litest_assert_empty_queue(li);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
@ -1022,7 +1022,7 @@ START_TEST(proximity_range_button_press)
|
||||||
BTN_STYLUS,
|
BTN_STYLUS,
|
||||||
LIBINPUT_BUTTON_STATE_RELEASED);
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||||
|
|
||||||
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
||||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||||
|
|
@ -1062,7 +1062,7 @@ START_TEST(proximity_range_button_release)
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
|
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||||
/* expect fake button press */
|
/* expect fake button press */
|
||||||
litest_assert_tablet_button_event(li,
|
litest_assert_tablet_button_event(li,
|
||||||
BTN_STYLUS,
|
BTN_STYLUS,
|
||||||
|
|
@ -1078,7 +1078,7 @@ START_TEST(proximity_range_button_release)
|
||||||
|
|
||||||
litest_tablet_proximity_out(dev);
|
litest_tablet_proximity_out(dev);
|
||||||
litest_assert_tablet_proximity_event(li,
|
litest_assert_tablet_proximity_event(li,
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -449,10 +449,10 @@ print_proximity_event(struct libinput_event *ev)
|
||||||
|
|
||||||
print_event_time(libinput_event_tablet_tool_get_time(t));
|
print_event_time(libinput_event_tablet_tool_get_time(t));
|
||||||
|
|
||||||
if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_IN) {
|
if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN) {
|
||||||
print_tablet_axes(t);
|
print_tablet_axes(t);
|
||||||
state_str = "proximity-in";
|
state_str = "proximity-in";
|
||||||
} else if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_OUT) {
|
} else if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) {
|
||||||
state_str = "proximity-out";
|
state_str = "proximity-out";
|
||||||
printf("\t");
|
printf("\t");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -605,7 +605,7 @@ handle_event_tablet(struct libinput_event *ev, struct window *w)
|
||||||
switch (libinput_event_get_type(ev)) {
|
switch (libinput_event_get_type(ev)) {
|
||||||
case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY:
|
case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY:
|
||||||
if (libinput_event_tablet_tool_get_proximity_state(t) ==
|
if (libinput_event_tablet_tool_get_proximity_state(t) ==
|
||||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT) {
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) {
|
||||||
w->tool.x_in = 0;
|
w->tool.x_in = 0;
|
||||||
w->tool.y_in = 0;
|
w->tool.y_in = 0;
|
||||||
w->tool.x_down = 0;
|
w->tool.x_down = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue