Add libinput-1.14 support

This libinput version adds a new tablet tool type.
master
Drew DeVault 5 years ago
parent 58b2584863
commit 94f65e354d

@ -113,6 +113,10 @@ static enum wlr_tablet_tool_type wlr_type_from_libinput_type(
return WLR_TABLET_TOOL_TYPE_MOUSE; return WLR_TABLET_TOOL_TYPE_MOUSE;
case LIBINPUT_TABLET_TOOL_TYPE_LENS: case LIBINPUT_TABLET_TOOL_TYPE_LENS:
return WLR_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"); assert(false && "UNREACHABLE");

@ -19,14 +19,23 @@
* tablet-unstable-v2 headers, so we can't include them * tablet-unstable-v2 headers, so we can't include them
*/ */
enum wlr_tablet_tool_type { enum wlr_tablet_tool_type {
WLR_TABLET_TOOL_TYPE_PEN = 1, /**< A generic pen */ /** A generic pen */
WLR_TABLET_TOOL_TYPE_ERASER, /**< Eraser */ WLR_TABLET_TOOL_TYPE_PEN = 1,
WLR_TABLET_TOOL_TYPE_BRUSH, /**< A paintbrush-like tool */ /** Eraser */
WLR_TABLET_TOOL_TYPE_PENCIL, /**< Physical drawing tool, e.g. WLR_TABLET_TOOL_TYPE_ERASER,
Wacom Inking Pen */ /** A paintbrush-like tool */
WLR_TABLET_TOOL_TYPE_AIRBRUSH, /**< An airbrush-like tool */ WLR_TABLET_TOOL_TYPE_BRUSH,
WLR_TABLET_TOOL_TYPE_MOUSE, /**< A mouse bound to the tablet */ /** Physical drawing tool, e.g. Wacom Inking Pen */
WLR_TABLET_TOOL_TYPE_LENS, /**< A mouse tool with a lens */ 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 { struct wlr_tablet_tool {

@ -128,6 +128,15 @@ if logind.found()
wlr_deps += logind wlr_deps += logind
endif 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('protocol')
subdir('render') subdir('render')

@ -42,7 +42,7 @@ static void handle_tablet_tool_v2_set_cursor(struct wl_client *client,
.hotspot_x = hotspot_x, .hotspot_x = hotspot_x,
.hotspot_y = hotspot_y, .hotspot_y = hotspot_y,
.seat_client = tool->seat->seat_client, .seat_client = tool->seat->seat_client,
}; };
wl_signal_emit(&tool->tool->events.set_cursor, &evt); 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; return ZWP_TABLET_TOOL_V2_TYPE_MOUSE;
case WLR_TABLET_TOOL_TYPE_LENS: case WLR_TABLET_TOOL_TYPE_LENS:
return ZWP_TABLET_TOOL_V2_TYPE_LENS; return ZWP_TABLET_TOOL_V2_TYPE_LENS;
default:
/* We skip these devices earlier on */
assert(false && "Unreachable");
} }
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_tablet_manager_v2 *manager,
struct wlr_seat *wlr_seat, struct wlr_seat *wlr_seat,
struct wlr_tablet_tool *wlr_tool) { 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); struct wlr_tablet_seat_v2 *seat = get_or_create_tablet_seat(manager, wlr_seat);
if (!seat) { if (!seat) {
return NULL; return NULL;

Loading…
Cancel
Save