mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
Add libinput-1.14 support
This libinput version adds a new tablet tool type.
This commit is contained in:
parent
58b2584863
commit
94f65e354d
4 changed files with 49 additions and 9 deletions
|
@ -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')
|
||||||
|
|
||||||
|
|
|
@ -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…
Reference in a new issue