Add libinput-1.14 support

This libinput version adds a new tablet tool type.
This commit is contained in:
Drew DeVault 2019-08-09 10:18:54 +09:00
parent 58b2584863
commit 94f65e354d
4 changed files with 49 additions and 9 deletions

View file

@ -113,6 +113,10 @@ static enum wlr_tablet_tool_type wlr_type_from_libinput_type(
return WLR_TABLET_TOOL_TYPE_MOUSE;
case LIBINPUT_TABLET_TOOL_TYPE_LENS:
return WLR_TABLET_TOOL_TYPE_LENS;
#if LIBINPUT_MINOR >= 14
case LIBINPUT_TABLET_TOOL_TYPE_TOTEM:
return WLR_TABLET_TOOL_TYPE_TOTEM;
#endif
}
assert(false && "UNREACHABLE");

View file

@ -19,14 +19,23 @@
* tablet-unstable-v2 headers, so we can't include them
*/
enum wlr_tablet_tool_type {
WLR_TABLET_TOOL_TYPE_PEN = 1, /**< A generic pen */
WLR_TABLET_TOOL_TYPE_ERASER, /**< Eraser */
WLR_TABLET_TOOL_TYPE_BRUSH, /**< A paintbrush-like tool */
WLR_TABLET_TOOL_TYPE_PENCIL, /**< Physical drawing tool, e.g.
Wacom Inking Pen */
WLR_TABLET_TOOL_TYPE_AIRBRUSH, /**< An airbrush-like tool */
WLR_TABLET_TOOL_TYPE_MOUSE, /**< A mouse bound to the tablet */
WLR_TABLET_TOOL_TYPE_LENS, /**< A mouse tool with a lens */
/** A generic pen */
WLR_TABLET_TOOL_TYPE_PEN = 1,
/** Eraser */
WLR_TABLET_TOOL_TYPE_ERASER,
/** A paintbrush-like tool */
WLR_TABLET_TOOL_TYPE_BRUSH,
/** Physical drawing tool, e.g. Wacom Inking Pen */
WLR_TABLET_TOOL_TYPE_PENCIL,
/** An airbrush-like tool */
WLR_TABLET_TOOL_TYPE_AIRBRUSH,
/** A mouse bound to the tablet */
WLR_TABLET_TOOL_TYPE_MOUSE,
/** A mouse tool with a lens */
WLR_TABLET_TOOL_TYPE_LENS,
/** A rotary device with positional and rotation data */
WLR_TABLET_TOOL_TYPE_TOTEM,
};
struct wlr_tablet_tool {

View file

@ -128,6 +128,15 @@ if logind.found()
wlr_deps += logind
endif
if libinput.found()
ver = libinput.version().split('.')
add_project_arguments([
'-DLIBINPUT_MAJOR=' + ver[0],
'-DLIBINPUT_MINOR=' + ver[1],
'-DLIBINPUT_PATCH=' + ver[2],
], language: 'c')
endif
subdir('protocol')
subdir('render')

View file

@ -42,7 +42,7 @@ static void handle_tablet_tool_v2_set_cursor(struct wl_client *client,
.hotspot_x = hotspot_x,
.hotspot_y = hotspot_y,
.seat_client = tool->seat->seat_client,
};
};
wl_signal_emit(&tool->tool->events.set_cursor, &evt);
}
@ -73,6 +73,9 @@ static enum zwp_tablet_tool_v2_type tablet_type_from_wlr_type(
return ZWP_TABLET_TOOL_V2_TYPE_MOUSE;
case WLR_TABLET_TOOL_TYPE_LENS:
return ZWP_TABLET_TOOL_V2_TYPE_LENS;
default:
/* We skip these devices earlier on */
assert(false && "Unreachable");
}
assert(false && "Unreachable");
@ -196,6 +199,21 @@ struct wlr_tablet_v2_tablet_tool *wlr_tablet_tool_create(
struct wlr_tablet_manager_v2 *manager,
struct wlr_seat *wlr_seat,
struct wlr_tablet_tool *wlr_tool) {
switch (wlr_tool->type) {
case WLR_TABLET_TOOL_TYPE_PEN:
case WLR_TABLET_TOOL_TYPE_ERASER:
case WLR_TABLET_TOOL_TYPE_BRUSH:
case WLR_TABLET_TOOL_TYPE_PENCIL:
case WLR_TABLET_TOOL_TYPE_AIRBRUSH:
case WLR_TABLET_TOOL_TYPE_MOUSE:
case WLR_TABLET_TOOL_TYPE_LENS:
/* supported */
break;
default:
/* Unsupported */
return NULL;
}
struct wlr_tablet_seat_v2 *seat = get_or_create_tablet_seat(manager, wlr_seat);
if (!seat) {
return NULL;