From c7067cefb6320aaee1808764c3ed1d8a91d6d513 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 9 Jul 2021 12:30:40 +0300 Subject: [PATCH] libinput: vendor libevdev --- wayland/libinput/build | 10 +- wayland/libinput/checksums | 2 + wayland/libinput/depends | 1 - wayland/libinput/patches/evdev-wrap.patch | 114 ++++++++++++++++++++++ wayland/libinput/sources | 2 + 5 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 wayland/libinput/patches/evdev-wrap.patch diff --git a/wayland/libinput/build b/wayland/libinput/build index 1b288316..bc951209 100755 --- a/wayland/libinput/build +++ b/wayland/libinput/build @@ -1,9 +1,11 @@ #!/bin/sh -e +patch -p1 < evdev-wrap.patch + export CFLAGS="$CFLAGS -fPIC" -( - cd mtdev +for pkg in mtdev evdev; do ( + cd "$pkg" ./configure \ --prefix=/usr \ @@ -12,10 +14,11 @@ export CFLAGS="$CFLAGS -fPIC" make make DESTDIR="$OLDPWD" install -) +) done export PKG_CONFIG_PATH="$PWD/usr/lib/pkgconfig" export CFLAGS="$CFLAGS -I$PWD/usr/include -L$PWD/usr/lib" +export CFLAGS="$CFLAGS -I$PWD/usr/include/libevdev-1.0" export DESTDIR="$1" meson \ @@ -23,6 +26,7 @@ meson \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --libexecdir=/usr/lib \ + -Ddefault_library=both \ -Ddebug-gui=false \ -Ddocumentation=false \ -Dtests=false \ diff --git a/wayland/libinput/checksums b/wayland/libinput/checksums index 597dea2f..5e518fc0 100644 --- a/wayland/libinput/checksums +++ b/wayland/libinput/checksums @@ -1,2 +1,4 @@ 65a657490de896081935cf0830a9773aa76756b8e9961edeffcce1074706bbe6 15d7b28da8ac71d8bc8c9287c2045fd174267bc740bec10cfda332dc1204e0e0 +63f4ea1489858a109080e0b40bd43e4e0903a1e12ea888d581db8c495747c2d0 +9667e17dada5e8f7383b547a165a4df9d335fa5540787f53e4f46b45750652b6 diff --git a/wayland/libinput/depends b/wayland/libinput/depends index 5b2d635a..2c1e0885 100644 --- a/wayland/libinput/depends +++ b/wayland/libinput/depends @@ -1,4 +1,3 @@ -libevdev libudev-zero linux-headers make meson make diff --git a/wayland/libinput/patches/evdev-wrap.patch b/wayland/libinput/patches/evdev-wrap.patch new file mode 100644 index 00000000..f40e001f --- /dev/null +++ b/wayland/libinput/patches/evdev-wrap.patch @@ -0,0 +1,114 @@ +diff --git a/src/evdev.c b/src/evdev.c +index 0f892b8..12fdaf2 100644 +--- a/src/evdev.c ++++ b/src/evdev.c +@@ -133,6 +133,17 @@ evdev_update_key_down_count(struct evdev_device *device, + return key_count; + } + ++int ++evdev_event_code_from_name(unsigned int type, const char *name) ++{ ++ return libevdev_event_code_from_name(type, name); ++} ++ ++const char * ++evdev_event_code_get_name (unsigned int type, unsigned int code) { ++ return libevdev_event_code_get_name(type, code); ++} ++ + enum libinput_switch_state + evdev_device_switch_get_state(struct evdev_device *device, + enum libinput_switch sw) +diff --git a/src/evdev.h b/src/evdev.h +index 0a4798f..352c22b 100644 +--- a/src/evdev.h ++++ b/src/evdev.h +@@ -401,6 +401,12 @@ evdev_device_has_model_quirk(struct evdev_device *device, + return result; + } + ++int ++evdev_event_code_from_name(unsigned int type, const char *name); ++ ++const char * ++evdev_event_code_get_name (unsigned int type, unsigned int code); ++ + void + evdev_transform_absolute(struct evdev_device *device, + struct device_coords *point); +diff --git a/src/libinput.c b/src/libinput.c +index b4164e2..b2ff1f3 100644 +--- a/src/libinput.c ++++ b/src/libinput.c +@@ -310,6 +310,17 @@ log_msg_ratelimit(struct libinput *libinput, + us2ms(ratelimit->interval)); + } + ++LIBINPUT_EXPORT int ++libinput_event_code_from_name(unsigned int type, const char *name) ++{ ++ return evdev_event_code_from_name(type, name); ++} ++ ++LIBINPUT_EXPORT const char * ++libinput_event_code_get_name (unsigned int type, unsigned int code) { ++ return evdev_event_code_get_name(type, code); ++} ++ + LIBINPUT_EXPORT void + libinput_log_set_priority(struct libinput *libinput, + enum libinput_log_priority priority) +diff --git a/src/libinput.h b/src/libinput.h +index a15d627..edb8849 100644 +--- a/src/libinput.h ++++ b/src/libinput.h +@@ -416,6 +416,35 @@ enum libinput_tablet_tool_tip_state { + */ + struct libinput_tablet_pad_mode_group; + ++ ++/** ++ * @ingroup base ++ * ++ * A wrapper around libevdev_event_code_from_name for use in sway. ++ * For use in KISS Linux. ++ * ++ * @param type The event type (EV_* constant) where to look for the name. ++ * @param name A non-NULL string describing an input-event code, zero-terminated. ++ * ++ * @return The given code constant for the passed name or -1 if not found. ++ */ ++int ++libinput_event_code_from_name(unsigned int type, const char *name); ++ ++/** ++ * @ingroup base ++ * ++ * A wrapper around libevdev_event_code_get_name for use in sway. ++ * For use in KISS Linux. ++ * ++ * @param type The event type for the code to query (EV_SYN, EV_REL, etc.) ++ * @param code The event code to return the name for (e.g. ABS_X) ++ * ++ * @return The name of the given event code or NULL for an invalid type or code. ++ */ ++const char * ++libinput_event_code_get_name(unsigned int type, unsigned int code); ++ + /** + * @ingroup tablet_pad_modes + * +diff --git a/src/libinput.sym b/src/libinput.sym +index b45838e..ce88063 100644 +--- a/src/libinput.sym ++++ b/src/libinput.sym +@@ -61,6 +61,8 @@ global: + libinput_device_set_user_data; + libinput_device_unref; + libinput_dispatch; ++ libinput_event_code_from_name; ++ libinput_event_code_get_name; + libinput_event_destroy; + libinput_event_device_notify_get_base_event; + libinput_event_get_context; diff --git a/wayland/libinput/sources b/wayland/libinput/sources index e5281dfd..386f149d 100644 --- a/wayland/libinput/sources +++ b/wayland/libinput/sources @@ -1,2 +1,4 @@ https://github.com/wayland-project/libinput/archive/1.18.0.tar.gz https://bitmath.org/code/mtdev/mtdev-1.1.6.tar.bz2 mtdev +https://freedesktop.org/software/libevdev/libevdev-1.11.0.tar.xz evdev +patches/evdev-wrap.patch