|
|
@ -23,48 +23,47 @@ void handle_tablet_tool_axis(struct libinput_event *event,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
struct libinput_event_tablet_tool *tevent =
|
|
|
|
struct libinput_event_tablet_tool *tevent =
|
|
|
|
libinput_event_get_tablet_tool_event(event);
|
|
|
|
libinput_event_get_tablet_tool_event(event);
|
|
|
|
struct wlr_event_tablet_tool_axis *wlr_event =
|
|
|
|
struct wlr_event_tablet_tool_axis wlr_event = { 0 };
|
|
|
|
calloc(1, sizeof(struct wlr_event_tablet_tool_axis));
|
|
|
|
wlr_event.time_sec = libinput_event_tablet_tool_get_time(tevent);
|
|
|
|
wlr_event->time_sec = libinput_event_tablet_tool_get_time(tevent);
|
|
|
|
wlr_event.time_usec = libinput_event_tablet_tool_get_time_usec(tevent);
|
|
|
|
wlr_event->time_usec = libinput_event_tablet_tool_get_time_usec(tevent);
|
|
|
|
libinput_device_get_size(device, &wlr_event.width_mm, &wlr_event.height_mm);
|
|
|
|
libinput_device_get_size(device, &wlr_event->width_mm, &wlr_event->height_mm);
|
|
|
|
|
|
|
|
if (libinput_event_tablet_tool_x_has_changed(tevent)) {
|
|
|
|
if (libinput_event_tablet_tool_x_has_changed(tevent)) {
|
|
|
|
wlr_event->updated_axes |= WLR_TABLET_TOOL_AXIS_X;
|
|
|
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_X;
|
|
|
|
wlr_event->x_mm = libinput_event_tablet_tool_get_x(tevent);
|
|
|
|
wlr_event.x_mm = libinput_event_tablet_tool_get_x(tevent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (libinput_event_tablet_tool_y_has_changed(tevent)) {
|
|
|
|
if (libinput_event_tablet_tool_y_has_changed(tevent)) {
|
|
|
|
wlr_event->updated_axes |= WLR_TABLET_TOOL_AXIS_Y;
|
|
|
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_Y;
|
|
|
|
wlr_event->y_mm = libinput_event_tablet_tool_get_y(tevent);
|
|
|
|
wlr_event.y_mm = libinput_event_tablet_tool_get_y(tevent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (libinput_event_tablet_tool_pressure_has_changed(tevent)) {
|
|
|
|
if (libinput_event_tablet_tool_pressure_has_changed(tevent)) {
|
|
|
|
wlr_event->updated_axes |= WLR_TABLET_TOOL_AXIS_PRESSURE;
|
|
|
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_PRESSURE;
|
|
|
|
wlr_event->pressure = libinput_event_tablet_tool_get_pressure(tevent);
|
|
|
|
wlr_event.pressure = libinput_event_tablet_tool_get_pressure(tevent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (libinput_event_tablet_tool_distance_has_changed(tevent)) {
|
|
|
|
if (libinput_event_tablet_tool_distance_has_changed(tevent)) {
|
|
|
|
wlr_event->updated_axes |= WLR_TABLET_TOOL_AXIS_DISTANCE;
|
|
|
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_DISTANCE;
|
|
|
|
wlr_event->distance = libinput_event_tablet_tool_get_distance(tevent);
|
|
|
|
wlr_event.distance = libinput_event_tablet_tool_get_distance(tevent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (libinput_event_tablet_tool_tilt_x_has_changed(tevent)) {
|
|
|
|
if (libinput_event_tablet_tool_tilt_x_has_changed(tevent)) {
|
|
|
|
wlr_event->updated_axes |= WLR_TABLET_TOOL_AXIS_TILT_X;
|
|
|
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_TILT_X;
|
|
|
|
wlr_event->tilt_x = libinput_event_tablet_tool_get_tilt_x(tevent);
|
|
|
|
wlr_event.tilt_x = libinput_event_tablet_tool_get_tilt_x(tevent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (libinput_event_tablet_tool_tilt_y_has_changed(tevent)) {
|
|
|
|
if (libinput_event_tablet_tool_tilt_y_has_changed(tevent)) {
|
|
|
|
wlr_event->updated_axes |= WLR_TABLET_TOOL_AXIS_TILT_Y;
|
|
|
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_TILT_Y;
|
|
|
|
wlr_event->tilt_y = libinput_event_tablet_tool_get_tilt_y(tevent);
|
|
|
|
wlr_event.tilt_y = libinput_event_tablet_tool_get_tilt_y(tevent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (libinput_event_tablet_tool_rotation_has_changed(tevent)) {
|
|
|
|
if (libinput_event_tablet_tool_rotation_has_changed(tevent)) {
|
|
|
|
wlr_event->updated_axes |= WLR_TABLET_TOOL_AXIS_ROTATION;
|
|
|
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_ROTATION;
|
|
|
|
wlr_event->rotation = libinput_event_tablet_tool_get_rotation(tevent);
|
|
|
|
wlr_event.rotation = libinput_event_tablet_tool_get_rotation(tevent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (libinput_event_tablet_tool_slider_has_changed(tevent)) {
|
|
|
|
if (libinput_event_tablet_tool_slider_has_changed(tevent)) {
|
|
|
|
wlr_event->updated_axes |= WLR_TABLET_TOOL_AXIS_SLIDER;
|
|
|
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_SLIDER;
|
|
|
|
wlr_event->slider = libinput_event_tablet_tool_get_slider_position(tevent);
|
|
|
|
wlr_event.slider = libinput_event_tablet_tool_get_slider_position(tevent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (libinput_event_tablet_tool_wheel_has_changed(tevent)) {
|
|
|
|
if (libinput_event_tablet_tool_wheel_has_changed(tevent)) {
|
|
|
|
wlr_event->updated_axes |= WLR_TABLET_TOOL_AXIS_WHEEL;
|
|
|
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_WHEEL;
|
|
|
|
wlr_event->wheel_delta = libinput_event_tablet_tool_get_wheel_delta(tevent);
|
|
|
|
wlr_event.wheel_delta = libinput_event_tablet_tool_get_wheel_delta(tevent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wl_signal_emit(&dev->tablet_tool->events.axis, wlr_event);
|
|
|
|
wl_signal_emit(&dev->tablet_tool->events.axis, &wlr_event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void handle_tablet_tool_proximity(struct libinput_event *event,
|
|
|
|
void handle_tablet_tool_proximity(struct libinput_event *event,
|
|
|
@ -77,20 +76,19 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
struct libinput_event_tablet_tool *tevent =
|
|
|
|
struct libinput_event_tablet_tool *tevent =
|
|
|
|
libinput_event_get_tablet_tool_event(event);
|
|
|
|
libinput_event_get_tablet_tool_event(event);
|
|
|
|
struct wlr_event_tablet_tool_proximity *wlr_event =
|
|
|
|
struct wlr_event_tablet_tool_proximity wlr_event = { 0 };
|
|
|
|
calloc(1, sizeof(struct wlr_event_tablet_tool_proximity));
|
|
|
|
wlr_event.time_sec = libinput_event_tablet_tool_get_time(tevent);
|
|
|
|
wlr_event->time_sec = libinput_event_tablet_tool_get_time(tevent);
|
|
|
|
wlr_event.time_usec = libinput_event_tablet_tool_get_time_usec(tevent);
|
|
|
|
wlr_event->time_usec = libinput_event_tablet_tool_get_time_usec(tevent);
|
|
|
|
|
|
|
|
switch (libinput_event_tablet_tool_get_proximity_state(tevent)) {
|
|
|
|
switch (libinput_event_tablet_tool_get_proximity_state(tevent)) {
|
|
|
|
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT:
|
|
|
|
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT:
|
|
|
|
wlr_event->state = WLR_TABLET_TOOL_PROXIMITY_OUT;
|
|
|
|
wlr_event.state = WLR_TABLET_TOOL_PROXIMITY_OUT;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN:
|
|
|
|
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN:
|
|
|
|
wlr_event->state = WLR_TABLET_TOOL_PROXIMITY_IN;
|
|
|
|
wlr_event.state = WLR_TABLET_TOOL_PROXIMITY_IN;
|
|
|
|
handle_tablet_tool_axis(event, device);
|
|
|
|
handle_tablet_tool_axis(event, device);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wl_signal_emit(&dev->tablet_tool->events.proximity, wlr_event);
|
|
|
|
wl_signal_emit(&dev->tablet_tool->events.proximity, &wlr_event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void handle_tablet_tool_tip(struct libinput_event *event,
|
|
|
|
void handle_tablet_tool_tip(struct libinput_event *event,
|
|
|
@ -104,19 +102,18 @@ void handle_tablet_tool_tip(struct libinput_event *event,
|
|
|
|
handle_tablet_tool_axis(event, device);
|
|
|
|
handle_tablet_tool_axis(event, device);
|
|
|
|
struct libinput_event_tablet_tool *tevent =
|
|
|
|
struct libinput_event_tablet_tool *tevent =
|
|
|
|
libinput_event_get_tablet_tool_event(event);
|
|
|
|
libinput_event_get_tablet_tool_event(event);
|
|
|
|
struct wlr_event_tablet_tool_tip *wlr_event =
|
|
|
|
struct wlr_event_tablet_tool_tip wlr_event = { 0 };
|
|
|
|
calloc(1, sizeof(struct wlr_event_tablet_tool_tip));
|
|
|
|
wlr_event.time_sec = libinput_event_tablet_tool_get_time(tevent);
|
|
|
|
wlr_event->time_sec = libinput_event_tablet_tool_get_time(tevent);
|
|
|
|
wlr_event.time_usec = libinput_event_tablet_tool_get_time_usec(tevent);
|
|
|
|
wlr_event->time_usec = libinput_event_tablet_tool_get_time_usec(tevent);
|
|
|
|
|
|
|
|
switch (libinput_event_tablet_tool_get_tip_state(tevent)) {
|
|
|
|
switch (libinput_event_tablet_tool_get_tip_state(tevent)) {
|
|
|
|
case LIBINPUT_TABLET_TOOL_TIP_UP:
|
|
|
|
case LIBINPUT_TABLET_TOOL_TIP_UP:
|
|
|
|
wlr_event->state = WLR_TABLET_TOOL_TIP_UP;
|
|
|
|
wlr_event.state = WLR_TABLET_TOOL_TIP_UP;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case LIBINPUT_TABLET_TOOL_TIP_DOWN:
|
|
|
|
case LIBINPUT_TABLET_TOOL_TIP_DOWN:
|
|
|
|
wlr_event->state = WLR_TABLET_TOOL_TIP_DOWN;
|
|
|
|
wlr_event.state = WLR_TABLET_TOOL_TIP_DOWN;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wl_signal_emit(&dev->tablet_tool->events.tip, wlr_event);
|
|
|
|
wl_signal_emit(&dev->tablet_tool->events.tip, &wlr_event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void handle_tablet_tool_button(struct libinput_event *event,
|
|
|
|
void handle_tablet_tool_button(struct libinput_event *event,
|
|
|
@ -130,18 +127,17 @@ void handle_tablet_tool_button(struct libinput_event *event,
|
|
|
|
handle_tablet_tool_axis(event, device);
|
|
|
|
handle_tablet_tool_axis(event, device);
|
|
|
|
struct libinput_event_tablet_tool *tevent =
|
|
|
|
struct libinput_event_tablet_tool *tevent =
|
|
|
|
libinput_event_get_tablet_tool_event(event);
|
|
|
|
libinput_event_get_tablet_tool_event(event);
|
|
|
|
struct wlr_event_tablet_tool_button *wlr_event =
|
|
|
|
struct wlr_event_tablet_tool_button wlr_event = { 0 };
|
|
|
|
calloc(1, sizeof(struct wlr_event_tablet_tool_button));
|
|
|
|
wlr_event.time_sec = libinput_event_tablet_tool_get_time(tevent);
|
|
|
|
wlr_event->time_sec = libinput_event_tablet_tool_get_time(tevent);
|
|
|
|
wlr_event.time_usec = libinput_event_tablet_tool_get_time_usec(tevent);
|
|
|
|
wlr_event->time_usec = libinput_event_tablet_tool_get_time_usec(tevent);
|
|
|
|
wlr_event.button = libinput_event_tablet_tool_get_button(tevent);
|
|
|
|
wlr_event->button = libinput_event_tablet_tool_get_button(tevent);
|
|
|
|
|
|
|
|
switch (libinput_event_tablet_tool_get_button_state(tevent)) {
|
|
|
|
switch (libinput_event_tablet_tool_get_button_state(tevent)) {
|
|
|
|
case LIBINPUT_BUTTON_STATE_RELEASED:
|
|
|
|
case LIBINPUT_BUTTON_STATE_RELEASED:
|
|
|
|
wlr_event->state = WLR_BUTTON_RELEASED;
|
|
|
|
wlr_event.state = WLR_BUTTON_RELEASED;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case LIBINPUT_BUTTON_STATE_PRESSED:
|
|
|
|
case LIBINPUT_BUTTON_STATE_PRESSED:
|
|
|
|
wlr_event->state = WLR_BUTTON_PRESSED;
|
|
|
|
wlr_event.state = WLR_BUTTON_PRESSED;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wl_signal_emit(&dev->tablet_tool->events.button, wlr_event);
|
|
|
|
wl_signal_emit(&dev->tablet_tool->events.button, &wlr_event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|