mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-21 23:50:45 +01:00
tablet: drop LIBINPUT_TABLET_AXIS_NONE from the API
This constant isn't used in the public API, let's drop it. To make it easier to use it internally and avoid accidental boolean comparisions with axes, bump all real axes up to start at 1. Internally that means we drop the AXIS_CNT since it'd be misleading and instead use MAX or MAX + 1 everywhere. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
parent
162a39e318
commit
1c3de35abb
5 changed files with 20 additions and 17 deletions
|
|
@ -75,7 +75,7 @@ tablet_mark_all_axes_changed(struct tablet_dispatch *tablet,
|
|||
{
|
||||
enum libinput_tablet_axis a;
|
||||
|
||||
for (a = 0; a < LIBINPUT_TABLET_AXIS_CNT; a++) {
|
||||
for (a = LIBINPUT_TABLET_AXIS_X; a <= LIBINPUT_TABLET_AXIS_MAX; a++) {
|
||||
if (libevdev_has_event_code(device->evdev,
|
||||
EV_ABS,
|
||||
axis_to_evcode(a)))
|
||||
|
|
@ -151,7 +151,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
|
|||
bool axis_update_needed = false;
|
||||
int a;
|
||||
|
||||
for (a = 0; a < LIBINPUT_TABLET_AXIS_CNT; a++) {
|
||||
for (a = LIBINPUT_TABLET_AXIS_X; a <= LIBINPUT_TABLET_AXIS_MAX; a++) {
|
||||
const struct input_absinfo *absinfo;
|
||||
|
||||
if (!bit_is_set(tablet->changed_axes, a))
|
||||
|
|
@ -596,7 +596,9 @@ tablet_init(struct tablet_dispatch *tablet,
|
|||
tablet->current_tool_type = LIBINPUT_TOOL_NONE;
|
||||
list_init(&tablet->tool_list);
|
||||
|
||||
for (axis = 0; axis < LIBINPUT_TABLET_AXIS_CNT; axis++) {
|
||||
for (axis = LIBINPUT_TABLET_AXIS_X;
|
||||
axis <= LIBINPUT_TABLET_AXIS_MAX;
|
||||
axis++) {
|
||||
if (libevdev_has_event_code(device->evdev,
|
||||
EV_ABS,
|
||||
axis_to_evcode(axis)))
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include "evdev.h"
|
||||
|
||||
#define LIBINPUT_TABLET_AXIS_NONE 0
|
||||
|
||||
enum tablet_status {
|
||||
TABLET_NONE = 0,
|
||||
TABLET_AXES_UPDATED = 1 << 0,
|
||||
|
|
@ -46,9 +48,9 @@ struct tablet_dispatch {
|
|||
struct evdev_dispatch base;
|
||||
struct evdev_device *device;
|
||||
unsigned char status;
|
||||
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_AXIS_CNT)];
|
||||
double axes[LIBINPUT_TABLET_AXIS_CNT];
|
||||
unsigned char axis_caps[NCHARS(LIBINPUT_TABLET_AXIS_CNT)];
|
||||
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_AXIS_MAX + 1)];
|
||||
double axes[LIBINPUT_TABLET_AXIS_MAX + 1];
|
||||
unsigned char axis_caps[NCHARS(LIBINPUT_TABLET_AXIS_MAX + 1)];
|
||||
|
||||
/* Only used for tablets that don't report serial numbers */
|
||||
struct list tool_list;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include "libinput.h"
|
||||
#include "libinput-util.h"
|
||||
|
||||
#define LIBINPUT_TABLET_AXIS_CNT LIBINPUT_TABLET_AXIS_TILT_Y + 1
|
||||
#define LIBINPUT_TABLET_AXIS_MAX LIBINPUT_TABLET_AXIS_TILT_Y
|
||||
|
||||
struct libinput_source;
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ struct libinput_tool {
|
|||
struct list link;
|
||||
uint32_t serial;
|
||||
enum libinput_tool_type type;
|
||||
unsigned char axis_caps[NCHARS(LIBINPUT_TABLET_AXIS_CNT)];
|
||||
unsigned char axis_caps[NCHARS(LIBINPUT_TABLET_AXIS_MAX + 1)];
|
||||
int refcount;
|
||||
void *user_data;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ struct libinput_event_tablet {
|
|||
enum libinput_button_state state;
|
||||
uint32_t seat_button_count;
|
||||
uint32_t time;
|
||||
double axes[LIBINPUT_TABLET_AXIS_CNT];
|
||||
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_AXIS_CNT)];
|
||||
double axes[LIBINPUT_TABLET_AXIS_MAX + 1];
|
||||
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_AXIS_MAX + 1)];
|
||||
struct libinput_tool *tool;
|
||||
enum libinput_tool_proximity_state proximity_state;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -137,13 +137,12 @@ enum libinput_pointer_axis_source {
|
|||
* LIBINPUT_DEVICE_CAP_TABLET capability.
|
||||
*/
|
||||
enum libinput_tablet_axis {
|
||||
LIBINPUT_TABLET_AXIS_NONE = -1,
|
||||
LIBINPUT_TABLET_AXIS_X = 0,
|
||||
LIBINPUT_TABLET_AXIS_Y = 1,
|
||||
LIBINPUT_TABLET_AXIS_DISTANCE = 2,
|
||||
LIBINPUT_TABLET_AXIS_PRESSURE = 3,
|
||||
LIBINPUT_TABLET_AXIS_TILT_X = 4,
|
||||
LIBINPUT_TABLET_AXIS_TILT_Y = 5,
|
||||
LIBINPUT_TABLET_AXIS_X = 1,
|
||||
LIBINPUT_TABLET_AXIS_Y = 2,
|
||||
LIBINPUT_TABLET_AXIS_DISTANCE = 3,
|
||||
LIBINPUT_TABLET_AXIS_PRESSURE = 4,
|
||||
LIBINPUT_TABLET_AXIS_TILT_X = 5,
|
||||
LIBINPUT_TABLET_AXIS_TILT_Y = 6,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue