mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-27 01:00:06 +01: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,
|
||||
time,
|
||||
tool,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN,
|
||||
tablet->changed_axes,
|
||||
axes);
|
||||
} else {
|
||||
|
|
@ -1230,7 +1230,7 @@ tablet_flush(struct tablet_dispatch *tablet,
|
|||
tablet_notify_proximity(&device->base,
|
||||
time,
|
||||
tool,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT,
|
||||
tablet->changed_axes,
|
||||
tablet->axes);
|
||||
|
||||
|
|
|
|||
|
|
@ -2170,7 +2170,7 @@ tablet_notify_axis(struct libinput_device *device,
|
|||
*axis_event = (struct libinput_event_tablet_tool) {
|
||||
.time = time,
|
||||
.tool = tool,
|
||||
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
|
||||
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN,
|
||||
.tip_state = tip_state,
|
||||
.wheel_discrete = wheel_discrete,
|
||||
};
|
||||
|
|
@ -2238,7 +2238,7 @@ tablet_notify_tip(struct libinput_device *device,
|
|||
.time = time,
|
||||
.tool = tool,
|
||||
.tip_state = tip_state,
|
||||
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
|
||||
.proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN,
|
||||
};
|
||||
memcpy(tip_event->axes,
|
||||
axes,
|
||||
|
|
@ -2276,7 +2276,7 @@ tablet_notify_button(struct libinput_device *device,
|
|||
.button = button,
|
||||
.state = state,
|
||||
.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,
|
||||
};
|
||||
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.
|
||||
*/
|
||||
enum libinput_tablet_tool_proximity_state {
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT = 0,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN = 1,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT = 0,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -284,9 +284,9 @@ enum libinput_event_type {
|
|||
* with @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS events.
|
||||
*
|
||||
* 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_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.
|
||||
*
|
||||
* 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,
|
||||
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
||||
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_dispatch(li);
|
||||
|
|
@ -150,7 +150,7 @@ START_TEST(tip_up_prox_out)
|
|||
tablet_event = litest_is_tablet_event(event,
|
||||
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
||||
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);
|
||||
|
||||
litest_assert_empty_queue(li);
|
||||
|
|
@ -601,7 +601,7 @@ START_TEST(proximity_in_out)
|
|||
libinput_event_get_tablet_tool_event(event);
|
||||
|
||||
if (libinput_event_tablet_tool_get_proximity_state(t) ==
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT)
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT)
|
||||
have_proximity_out = true;
|
||||
}
|
||||
|
||||
|
|
@ -641,7 +641,7 @@ START_TEST(proximity_in_button_down)
|
|||
libinput_dispatch(li);
|
||||
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||
litest_assert_tablet_button_event(li,
|
||||
BTN_STYLUS,
|
||||
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||
|
|
@ -674,7 +674,7 @@ START_TEST(proximity_out_button_up)
|
|||
BTN_STYLUS,
|
||||
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||
litest_assert_empty_queue(li);
|
||||
}
|
||||
END_TEST
|
||||
|
|
@ -892,13 +892,13 @@ START_TEST(proximity_range_enter)
|
|||
libinput_dispatch(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_tablet_motion(dev, 10, 10, axes);
|
||||
libinput_dispatch(li);
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||
|
||||
litest_tablet_proximity_out(dev);
|
||||
litest_assert_empty_queue(li);
|
||||
|
|
@ -927,13 +927,13 @@ START_TEST(proximity_range_in_out)
|
|||
litest_pop_event_frame(dev);
|
||||
libinput_dispatch(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_tablet_motion(dev, 10, 10, axes);
|
||||
libinput_dispatch(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_assert_empty_queue(li);
|
||||
|
|
@ -942,11 +942,11 @@ START_TEST(proximity_range_in_out)
|
|||
litest_tablet_motion(dev, 10, 10, axes);
|
||||
libinput_dispatch(li);
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||
|
||||
litest_tablet_proximity_out(dev);
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||
litest_assert_empty_queue(li);
|
||||
}
|
||||
END_TEST
|
||||
|
|
@ -1022,7 +1022,7 @@ START_TEST(proximity_range_button_press)
|
|||
BTN_STYLUS,
|
||||
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
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_SYN, SYN_REPORT, 0);
|
||||
|
|
@ -1062,7 +1062,7 @@ START_TEST(proximity_range_button_release)
|
|||
libinput_dispatch(li);
|
||||
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||
/* expect fake button press */
|
||||
litest_assert_tablet_button_event(li,
|
||||
BTN_STYLUS,
|
||||
|
|
@ -1078,7 +1078,7 @@ START_TEST(proximity_range_button_release)
|
|||
|
||||
litest_tablet_proximity_out(dev);
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
|
|||
|
|
@ -449,10 +449,10 @@ print_proximity_event(struct libinput_event *ev)
|
|||
|
||||
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);
|
||||
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";
|
||||
printf("\t");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ handle_event_tablet(struct libinput_event *ev, struct window *w)
|
|||
switch (libinput_event_get_type(ev)) {
|
||||
case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY:
|
||||
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.y_in = 0;
|
||||
w->tool.x_down = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue