2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-12-21 23:00:06 -07:00

libinput: vendor libevdev

This commit is contained in:
Dylan Araps 2021-07-09 12:30:40 +03:00
parent 9c2cc22f9c
commit c7067cefb6
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C
5 changed files with 125 additions and 4 deletions

View File

@ -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 \

View File

@ -1,2 +1,4 @@
65a657490de896081935cf0830a9773aa76756b8e9961edeffcce1074706bbe6
15d7b28da8ac71d8bc8c9287c2045fd174267bc740bec10cfda332dc1204e0e0
63f4ea1489858a109080e0b40bd43e4e0903a1e12ea888d581db8c495747c2d0
9667e17dada5e8f7383b547a165a4df9d335fa5540787f53e4f46b45750652b6

View File

@ -1,4 +1,3 @@
libevdev
libudev-zero
linux-headers make
meson make

View File

@ -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;

View File

@ -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