From 4a354b94f977526291b8741b9184bc3c6d1ceb73 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Thu, 13 Jun 2019 17:50:30 +0800 Subject: [PATCH] implementation of all extra input events --- include/customial.h | 53 ++++++++- include/window.h | 255 ++++++++++++++++++++++++++++++++++++++++- src/ial/ial-libinput.c | 226 ++++++++++++++++++++++++++++++++++-- 3 files changed, 522 insertions(+), 12 deletions(-) diff --git a/include/customial.h b/include/customial.h index d23e9f07..2455c605 100644 --- a/include/customial.h +++ b/include/customial.h @@ -119,6 +119,51 @@ #define IAL_EVENT_GESTURE_PINCH_UPDATE 0x0084 #define IAL_EVENT_GESTURE_PINCH_END 0x0085 +#ifndef TABLET_TOOL_X + #define TABLET_TOOL_PROXIMITY_STATE_INVALID 0 + #define TABLET_TOOL_PROXIMITY_STATE_OUT 1 + #define TABLET_TOOL_PROXIMITY_STATE_IN 2 + + #define TABLET_TOOL_TIP_INVALID 0 + #define TABLET_TOOL_TIP_UP 1 + #define TABLET_TOOL_TIP_DOWN 2 + + #define TABLET_BUTTON_STATE_INVALID 0 + #define TABLET_BUTTON_STATE_RELEASED 1 + #define TABLET_BUTTON_STATE_PRESSED 2 + + #define TABLET_PAD_RING_SOURCE_UNKNOWN 0 + #define TABLET_PAD_RING_SOURCE_FINGER 1 + + #define TABLET_PAD_STRIP_SOURCE_UNKNOWN 0 + #define TABLET_PAD_STRIP_SOURCE_FINGER 1 + + #define TABLET_TOOL_CHANGED_X (1 << 0) + #define TABLET_TOOL_CHANGED_Y (1 << 1) + #define TABLET_TOOL_CHANGED_PRESSURE (1 << 2) + #define TABLET_TOOL_CHANGED_DISTANCE (1 << 3) + #define TABLET_TOOL_CHANGED_TILT_X (1 << 4) + #define TABLET_TOOL_CHANGED_TILT_Y (1 << 5) + #define TABLET_TOOL_CHANGED_ROTATION (1 << 6) + #define TABLET_TOOL_CHANGED_SLIDER (1 << 7) + #define TABLET_TOOL_CHANGED_SIZE_MAJOR (1 << 8) + #define TABLET_TOOL_CHANGED_SIZE_MINOR (1 << 9) + #define TABLET_TOOL_CHANGED_WHEEL (1 << 10) + + #define TABLET_TOOL_X 0 + #define TABLET_TOOL_Y 1 + #define TABLET_TOOL_PRESSURE 2 + #define TABLET_TOOL_DISTANCE 3 + #define TABLET_TOOL_TILT_X 4 + #define TABLET_TOOL_TILT_Y 5 + #define TABLET_TOOL_ROTATION 6 + #define TABLET_TOOL_SLIDER 7 + #define TABLET_TOOL_SIZE_MAJOR 8 + #define TABLET_TOOL_SIZE_MINOR 9 + #define TABLET_TOOL_WHEEL 10 + +#endif + #define IAL_EVENT_TABLET_TOOL_AXIS 0x0090 #define IAL_EVENT_TABLET_TOOL_PROXIMITY 0x0091 #define IAL_EVENT_TABLET_TOOL_TIP 0x0092 @@ -132,17 +177,23 @@ #define IAL_EVENT_USER_UPDATE 0x009B #define IAL_EVENT_USER_END 0x009C +#define NR_PACKED_SUB_EVENTS 16 + typedef struct _EXTRA_INPUT_EVENT { int event; WPARAM wparam; LPARAM lparam; + + // for tablet tool messages + unsigned int params_mask; + WPARAM wparams[NR_PACKED_SUB_EVENTS]; + LPARAM lparams[NR_PACKED_SUB_EVENTS]; } EXTRA_INPUT_EVENT; #define IAL_LEN_MDEV 127 typedef struct tagINPUT { char* id; - //char* mdev; // Initialization and termination BOOL (*init_input) (struct tagINPUT *input, const char* mdev, const char* mtype); diff --git a/include/window.h b/include/window.h index fdd5aea3..b30891a5 100644 --- a/include/window.h +++ b/include/window.h @@ -1418,7 +1418,7 @@ extern DWORD __mg_interval_time; * - Button messages: the messages generated by a button on joystick. * - Multi-touch messages: the messages generated by a multi-touch panel. * - Gesture messages: the gesture messages. - * - Tablet messages: the messages generated by a tablet. + * - Tablet tool messages: the messages generated by a tablet tool. * - Tablet pad messages: the messages generated by a tablet pad. * - Switch messages: the messages generated by a switch. * - User-defined messages: the messages generated by a user-defined device. @@ -1594,20 +1594,273 @@ extern DWORD __mg_interval_time; */ #define MSG_EXIN_SWITCH_TOGGLE 0x007A +/** + * \def MSG_EXIN_GESTURE_SWIPE_BEGIN + * \brief Indicates the beginning of a swipe gesture. + * + * \code + * MSG_EXIN_GESTURE_SWIPE_BEGIN + * int nr_figures = wParam; + * \endcode + * + * \param nr_figures The number of fingers used for the gesture. + */ #define MSG_EXIN_GESTURE_SWIPE_BEGIN 0x0080 + +/** + * \def MSG_EXIN_GESTURE_SWIPE_UPDATE + * \brief Indicates update of a swipe gesture. + * + * \code + * MSG_EXIN_GESTURE_SWIPE_UPDATE + * int nr_figures = (int)wParam; + * int dx = LOSWORD(lParam); + * int dx = HISWORD(lParam); + * \endcode + * + * \param nr_figures The number of fingers used for the gesture. + * \param dx, dy The motion delta between the last and the current + * MSG_EXIN_GESTURE_SWIPE_UPDATE message. + */ #define MSG_EXIN_GESTURE_SWIPE_UPDATE 0x0081 + +/** + * \def MSG_EXIN_GESTURE_SWIPE_END + * \brief Indicates the end of a swipe gesture. + * + * \code + * MSG_EXIN_GESTURE_SWIPE_END + * int nr_figures = (int)wParam; + * BOOL is_cancelled = (BOOL)lParam; + * \endcode + * + * \param nr_figures The number of fingers used for the gesture. + * \param is_cancelled TRUE if the gesture ended normally, or if it was cancelled. + */ #define MSG_EXIN_GESTURE_SWIPE_END 0x0082 + +/** + * \def MSG_EXIN_GESTURE_PINCH_BEGIN + * \brief Indicates the beginning of a pinch gesture. + * + * \code + * MSG_EXIN_GESTURE_PINCH_BEGIN + * int nr_figures = (int)wParam; + * unsigned int scale = (unsigned int)lParam; + * \endcode + * + * \param nr_figures The number of fingers used for the gesture. + * \param scale The absolute scale of a pinch gesture. + * The scale is the division of the current distance between + * the fingers and the distance at the start of the gesture. + * Note that the initial scale value is 100. + */ #define MSG_EXIN_GESTURE_PINCH_BEGIN 0x0083 + +/** + * \def MSG_EXIN_GESTURE_PINCH_UPDATE + * \brief Indicates the beginning of a pinch gesture. + * + * \code + * MSG_EXIN_GESTURE_PINCH_UPDATE + * unsigned int scale = LOWORD(wParam); + * int da = HISWORD(wParam); + * int dx = LOSWORD(lParam); + * int dy = HISWORD(lParam); + * \endcode + * + * \param scale The absolute scale of a pinch gesture. + * The scale is the division of the current distance between + * the fingers and the distance at the start of the gesture. + * Note that the initial scale value is 100. + * \param da The angle delta in 1/50 degrees between the last and the current + * MSG_EXIN_GESTURE_PINCH_UPDATE message. + * \param dx, dy The motion delta between the last and the current + * MSG_EXIN_GESTURE_PINCH_UPDATE message. + */ #define MSG_EXIN_GESTURE_PINCH_UPDATE 0x0084 + +/** + * \def MSG_EXIN_GESTURE_PINCH_END + * \brief Indicates the end of a swipe gesture. + * + * \code + * MSG_EXIN_GESTURE_PINCH_END + * int nr_figures = (int)LOSWORD(wParam); + * BOOL is_cancelled = (BOOL)HISWORD(wParam); + * unsigned int scale = (unsigned int)scale; + * \endcode + * + * \param nr_figures The number of fingers used for the gesture. + * \param is_cancelled TRUE if the gesture ended normally, or if it was cancelled. + * \param scale The absolute scale of a pinch gesture. + * The scale is the division of the current distance between + * the fingers and the distance at the start of the gesture. + * Note that the initial scale value is 100. + */ #define MSG_EXIN_GESTURE_PINCH_END 0x0085 +#define TABLET_TOOL_X 0 +#define TABLET_TOOL_Y 1 +#define TABLET_TOOL_PRESSURE 2 +#define TABLET_TOOL_DISTANCE 3 +#define TABLET_TOOL_TILT_X 4 +#define TABLET_TOOL_TILT_Y 5 +#define TABLET_TOOL_ROTATION 6 +#define TABLET_TOOL_SLIDER 7 +#define TABLET_TOOL_SIZE_MAJOR 8 +#define TABLET_TOOL_SIZE_MINOR 9 +#define TABLET_TOOL_WHEEL 10 + +#define TABLET_TOOL_PROXIMITY_STATE_INVALID 0 +#define TABLET_TOOL_PROXIMITY_STATE_OUT 1 +#define TABLET_TOOL_PROXIMITY_STATE_IN 2 + +#define TABLET_TOOL_TIP_INVALID 0 +#define TABLET_TOOL_TIP_UP 1 +#define TABLET_TOOL_TIP_DOWN 2 + +#define TABLET_BUTTON_STATE_INVALID 0 +#define TABLET_BUTTON_STATE_RELEASED 1 +#define TABLET_BUTTON_STATE_PRESSED 2 + +/** + * \def MSG_EXIN_TABLET_TOOL_AXIS + * \brief Indicates an axis has changed state. + * + * \code + * MSG_EXIN_TABLET_TOOL_AXIS + * int which = (int)wParam; + * long value = (long)lParam; + * \endcode + * + * \param which The axis identifier, can be one of the following values: + * \param value The value of the axis. + */ #define MSG_EXIN_TABLET_TOOL_AXIS 0x0090 + +/** + * \def MSG_EXIN_TABLET_TOOL_PROXIMITY + * \brief Indicates that a tool has come in or out of proximity of the tablet. + * + * \code + * MSG_EXIN_TABLET_TOOL_PROXIMITY + * int state = (int)LOSWORD(wParam); + * int which = (int)HISWORD(wParam); + * long value = (long)lParam; + * \endcode + * + * \param state The proximity state, can be + * \param which The axis identifier, can be one of the following values: + * \param value The value of the axis. + */ #define MSG_EXIN_TABLET_TOOL_PROXIMITY 0x0091 + +/** + * \def MSG_EXIN_TABLET_TOOL_TIP + * \brief Indicates that a tool has come in contact with the surface of the tablet. + * + * \code + * MSG_EXIN_TABLET_TOOL_TIP + * int state = (int)LOSWORD(wParam); + * int which = (int)HISWORD(wParam); + * long value = (long)lParam; + * \endcode + * + * \param which The axis identifier, can be one of the following values: + * \param value The value of the axis. + */ #define MSG_EXIN_TABLET_TOOL_TIP 0x0092 + +/** + * \def MSG_EXIN_TABLET_TOOL_BUTTON + * \brief Indicates that a tool has changed a logical button state on the tablet. + * + * \code + * MSG_EXIN_TABLET_TOOL_BUTTON + * unsigned int button = (unsigned int)wParam; + * int state = (int)lParam; + * \endcode + * + * \param button The button identifier, which is a semantic button code as defined + * in . + * \param state The button state, can be TABLET_BUTTON_STATE_RELEASED or + * TABLET_BUTTON_STATE_PRESSED. + */ #define MSG_EXIN_TABLET_TOOL_BUTTON 0x0093 +/** + * \def MSG_EXIN_TABLET_PAD_BUTTON + * \brief Indicates that a button pressed on the tablet pad. + * + * \code + * MSG_EXIN_TABLET_PAD_BUTTON + * unsigned int mode = (unsigned int)wParam; + * unsigned int button_number = (unsigned int)LOSWORD(lParam); + * int button_state = (int)HISWORD(lParam); + * \endcode + * + * \param mode The mode the button that triggered this event is in. + * \param button_number The button number, which is NOT a semantic button code + * as defined in . + * \param button_state The button state, can be TABLET_BUTTON_STATE_RELEASED or + * TABLET_BUTTON_STATE_PRESSED. + */ #define MSG_EXIN_TABLET_PAD_BUTTON 0x0094 + +#define TABLET_PAD_RING_SOURCE_UNKNOWN 0 +#define TABLET_PAD_RING_SOURCE_FINGER 1 + +/** + * \def MSG_EXIN_TABLET_PAD_RING + * \brief Indicates that a status change on the tablet ring. + * + * \code + * MSG_EXIN_TABLET_PAD_RING + * unsigned int mode = (unsigned int)LOWORD(wParam); + * unsigned int source = (unsigned int)HIWORD(wParam); + * int position = (int)LOSWORD(lParam); + * unsigned int number = (unsigned int)HIWORD(lParam); + * \endcode + * + * \param mode The mode the ring that triggered this event is in. + * \param source The source of the event, can be TABLET_PAD_RING_SOURCE_UNKNOWN + * or TABLET_PAD_RING_SOURCE_FINGER. + * \param position The current position of the ring, in 1/50 degrees + * counterclockwise from the northern-most point of the ring in + * the tablet's current logical orientation. + * When the source is TABLET_PAD_RING_SOURCE_FINGER and the finger is lifted + * from the ring the value will be less than 0. + * \param number The number of the ring that has changed state, + * with 0 being the first ring + */ #define MSG_EXIN_TABLET_PAD_RING 0x0095 + +#define TABLET_PAD_STRIP_SOURCE_UNKNOWN 0 +#define TABLET_PAD_STRIP_SOURCE_FINGER 1 + +/** + * \def MSG_EXIN_TABLET_PAD_STRIP + * \brief Indicates that a status change on the tablet strip. + * + * \code + * MSG_EXIN_TABLET_PAD_STRIP + * unsigned int mode = (unsigned int)LOWORD(wParam); + * unsigned int source = (unsigned int)HIWORD(wParam); + * int position = (int)LOSWORD(lParam); + * unsigned int number = (unsigned int)HIWORD(lParam); + * \endcode + * + * \param mode The mode the strip that triggered this event is in. + * \param source The source of the event, can be TABLET_PAD_STRIP_SOURCE_UNKNOWN + * or TABLET_PAD_STRIP_SOURCE_FINGER. + * \param position The current position of the strip, + * normalized to the range [0, 100]. + * When the source is TABLET_PAD_STRIP_SOURCE_FINGER and the finger is lifted + * from the strip, the value will be less than 0. + * \param number The number of the strip that has changed state, + * with 0 being the first strip. + */ #define MSG_EXIN_TABLET_PAD_STRIP 0x0096 #define MSG_EXIN_USER_BEGIN 0x009A diff --git a/src/ial/ial-libinput.c b/src/ial/ial-libinput.c index 9b627e4b..9cdd5b71 100644 --- a/src/ial/ial-libinput.c +++ b/src/ial/ial-libinput.c @@ -810,31 +810,237 @@ static int wait_event_ex (int maxfd, fd_set *in, fd_set *out, fd_set *except, break; } - case LIBINPUT_EVENT_TABLET_TOOL_AXIS: { - break; - } - - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: { - break; - } - + case LIBINPUT_EVENT_TABLET_TOOL_AXIS: + case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: case LIBINPUT_EVENT_TABLET_TOOL_TIP: { + struct libinput_event_tablet_tool* tool_event; + int state = 0; + double tmp; + + tool_event = libinput_event_get_tablet_tool_event(event); + + if (type == LIBINPUT_EVENT_TABLET_TOOL_AXIS) + extra->event = IAL_EVENT_TABLET_TOOL_AXIS; + else if (type == LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY) { + extra->event = IAL_EVENT_TABLET_TOOL_PROXIMITY; + switch (libinput_event_tablet_tool_get_proximity_state(tool_event)) { + case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT: + state = TABLET_TOOL_PROXIMITY_STATE_OUT; + break; + case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN: + state = TABLET_TOOL_PROXIMITY_STATE_IN; + break; + } + } + else { + extra->event = IAL_EVENT_TABLET_TOOL_TIP; + switch (libinput_event_tablet_tool_get_tip_state(tool_event)) { + case LIBINPUT_TABLET_TOOL_TIP_UP: + state = TABLET_TOOL_TIP_UP; + break; + case LIBINPUT_TABLET_TOOL_TIP_DOWN: + state = TABLET_TOOL_TIP_DOWN; + break; + } + } + + tool_event = libinput_event_get_tablet_tool_event(event); + + extra->event = IAL_EVENT_TABLET_TOOL_AXIS; + if (libinput_event_tablet_tool_x_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_X; + tmp = libinput_event_tablet_tool_get_x_transformed(tool_event, + my_ctxt.max_x - my_ctxt.min_x + 1); + extra->wparams[TABLET_TOOL_X] = MAKELONG(state, TABLET_TOOL_X); + extra->lparams[TABLET_TOOL_X] = (int)(tmp * 10); + } + + if (libinput_event_tablet_tool_y_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_X; + tmp = libinput_event_tablet_tool_get_y_transformed(tool_event, + my_ctxt.max_y - my_ctxt.min_y + 1); + extra->wparams[TABLET_TOOL_Y] = MAKELONG(state, TABLET_TOOL_X); + extra->lparams[TABLET_TOOL_Y] = (int)(tmp * 10); + } + + if (libinput_event_tablet_tool_pressure_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_PRESSURE; + tmp = libinput_event_tablet_tool_get_pressure(tool_event); + extra->wparams[TABLET_TOOL_PRESSURE] = MAKELONG(state, TABLET_TOOL_PRESSURE); + extra->lparams[TABLET_TOOL_PRESSURE] = (int)(tmp * 1000); + } + + if (libinput_event_tablet_tool_distance_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_DISTANCE; + tmp = libinput_event_tablet_tool_get_distance(tool_event); + extra->wparams[TABLET_TOOL_DISTANCE] = MAKELONG(state, TABLET_TOOL_DISTANCE); + extra->lparams[TABLET_TOOL_DISTANCE] = (int)(tmp * 1000); + } + + if (libinput_event_tablet_tool_tilt_x_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_TILT_X; + tmp = libinput_event_tablet_tool_get_tilt_x(tool_event); + extra->wparams[TABLET_TOOL_TILT_X] = MAKELONG(state, TABLET_TOOL_TILT_X); + extra->lparams[TABLET_TOOL_TILT_X] = (int)(tmp * 50); + } + + if (libinput_event_tablet_tool_tilt_y_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_TILT_Y; + tmp = libinput_event_tablet_tool_get_tilt_y(tool_event); + extra->wparams[TABLET_TOOL_TILT_Y] = MAKELONG(state, TABLET_TOOL_TILT_Y); + extra->lparams[TABLET_TOOL_TILT_Y] = (int)(tmp * 50); + } + + if (libinput_event_tablet_tool_rotation_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_ROTATION; + tmp = libinput_event_tablet_tool_get_rotation(tool_event); + extra->wparams[TABLET_TOOL_ROTATION] = MAKELONG(state, TABLET_TOOL_ROTATION); + extra->lparams[TABLET_TOOL_ROTATION] = (int)(tmp * 50); + } + + if (libinput_event_tablet_tool_slider_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_SLIDER; + tmp = libinput_event_tablet_tool_get_slider_position(tool_event); + extra->wparams[TABLET_TOOL_SLIDER] = MAKELONG(state, TABLET_TOOL_SLIDER); + extra->lparams[TABLET_TOOL_SLIDER] = (int)(tmp * 1000); + } + +#if 0 + if (libinput_event_tablet_tool_size_major_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_SIZE_MAJOR; + tmp = libinput_event_tablet_tool_get_size_major(tool_event); + extra->wparams[TABLET_TOOL_SIZE_MAJOR] = MAKELONG(state, TABLET_TOOL_SIZE_MAJOR); + extra->lparams[TABLET_TOOL_SIZE_MAJOR] = (int)(tmp * 100); + } + + if (libinput_event_tablet_tool_size_minor_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_SIZE_MINOR; + tmp = libinput_event_tablet_tool_get_size_minor(tool_event); + extra->wparams[TABLET_TOOL_SIZE_MINOR] = MAKELONG(state, TABLET_TOOL_SIZE_MINOR); + extra->lparams[TABLET_TOOL_SIZE_MINOR] = (int)(tmp * 100); + } +#endif + + if (libinput_event_tablet_tool_wheel_has_changed(tool_event)) { + extra->params_mask |= TABLET_TOOL_CHANGED_WHEEL; + tmp = libinput_event_tablet_tool_get_wheel_delta(tool_event); + extra->wparams[TABLET_TOOL_WHEEL] = MAKELONG(state, TABLET_TOOL_WHEEL); + extra->lparams[TABLET_TOOL_WHEEL] = (int)(tmp * 100); + } + + if (extra->params_mask) { + retval = IAL_EVENT_EXTRA; + } break; } case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: { + struct libinput_event_tablet_tool* tool_event; + uint32_t button_code; + int button_state = TABLET_BUTTON_STATE_INVALID; + + tool_event = libinput_event_get_tablet_tool_event(event); + + button_code = libinput_event_tablet_tool_get_button(tool_event); + switch (libinput_event_tablet_tool_get_button_state(tool_event)) { + case LIBINPUT_BUTTON_STATE_RELEASED: + button_state = TABLET_BUTTON_STATE_RELEASED; + break; + case LIBINPUT_BUTTON_STATE_PRESSED: + button_state = TABLET_BUTTON_STATE_PRESSED; + break; + } + + extra->event = IAL_EVENT_TABLET_TOOL_BUTTON; + extra->wparam = button_code; + extra->lparam = button_state; + retval = IAL_EVENT_EXTRA; break; } case LIBINPUT_EVENT_TABLET_PAD_BUTTON: { + struct libinput_event_tablet_pad* pad_event; + uint32_t button_number; + int button_state = TABLET_BUTTON_STATE_INVALID; + + pad_event = libinput_event_get_tablet_pad_event(event); + + button_number = libinput_event_tablet_pad_get_button_number(pad_event); + switch (libinput_event_tablet_pad_get_button_state(pad_event)) { + case LIBINPUT_BUTTON_STATE_RELEASED: + button_state = TABLET_BUTTON_STATE_RELEASED; + break; + case LIBINPUT_BUTTON_STATE_PRESSED: + button_state = TABLET_BUTTON_STATE_PRESSED; + break; + } + + extra->event = IAL_EVENT_TABLET_PAD_BUTTON; + extra->wparam = libinput_event_tablet_pad_get_mode(pad_event); + extra->lparam = MAKELONG(button_number, button_state); + retval = IAL_EVENT_EXTRA; break; } case LIBINPUT_EVENT_TABLET_PAD_RING: { + struct libinput_event_tablet_pad* pad_event; + unsigned int mode; + int source = TABLET_PAD_RING_SOURCE_UNKNOWN; + uint32_t number; + double tmp; + int position; + + pad_event = libinput_event_get_tablet_pad_event(event); + + mode = libinput_event_tablet_pad_get_mode(pad_event); + switch (libinput_event_tablet_pad_get_ring_source(pad_event)) { + case LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN: + source = TABLET_PAD_RING_SOURCE_UNKNOWN; + break; + case LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER: + source = TABLET_PAD_RING_SOURCE_FINGER; + break; + } + + number = libinput_event_tablet_pad_get_ring_number(pad_event); + tmp = libinput_event_tablet_pad_get_ring_position(pad_event); + position = (int)(tmp * 50); + + extra->event = IAL_EVENT_TABLET_PAD_RING; + extra->wparam = MAKELONG(mode, source); + extra->lparam = MAKELONG(position, number); + retval = IAL_EVENT_EXTRA; break; } case LIBINPUT_EVENT_TABLET_PAD_STRIP: { + struct libinput_event_tablet_pad* pad_event; + unsigned int mode; + int source = TABLET_PAD_STRIP_SOURCE_UNKNOWN; + uint32_t number; + double tmp; + int position; + + pad_event = libinput_event_get_tablet_pad_event(event); + + mode = libinput_event_tablet_pad_get_mode(pad_event); + switch (libinput_event_tablet_pad_get_strip_source(pad_event)) { + case LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN: + source = TABLET_PAD_STRIP_SOURCE_UNKNOWN; + break; + case LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER: + source = TABLET_PAD_STRIP_SOURCE_FINGER; + break; + } + + number = libinput_event_tablet_pad_get_strip_number(pad_event); + tmp = libinput_event_tablet_pad_get_strip_position(pad_event); + position = (int)(tmp * 100); + + extra->event = IAL_EVENT_TABLET_PAD_RING; + extra->wparam = MAKELONG(mode, source); + extra->lparam = MAKELONG(position, number); + retval = IAL_EVENT_EXTRA; break; } @@ -956,8 +1162,8 @@ static int wait_event_ex (int maxfd, fd_set *in, fd_set *out, fd_set *except, is_cancelled = libinput_event_gesture_get_cancelled(gst_event); extra->event = IAL_EVENT_GESTURE_PINCH_END; - extra->wparam = nr_figs; - extra->lparam = MAKELONG(is_cancelled, scale); + extra->wparam = MAKELONG(nr_figs, is_cancelled); + extra->lparam = scale; retval = IAL_EVENT_EXTRA; break; }