[libmanette] device: Simplify inputs initialization
- From: Adrien Plazas <aplazas src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [libmanette] device: Simplify inputs initialization
 
- Date: Fri, 27 Nov 2020 14:17:16 +0000 (UTC)
 
commit 7cf71161effc7e4bae3c243b70b7ade3605ea8d5
Author: vanadiae <vanadiae35 gmail com>
Date:   Sat Oct 17 21:13:40 2020 +0200
    device: Simplify inputs initialization
    
    This uses has_key() and has_abs() instead of libevdev_has_event_code()
    directly in *_new(), making it simpler to read.
 src/manette-device.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/manette-device.c b/src/manette-device.c
index cabcaf0..5f84b15 100644
--- a/src/manette-device.c
+++ b/src/manette-device.c
@@ -521,12 +521,12 @@ manette_device_new (const gchar  *filename,
 
   // Initialize the axes buttons and hats.
   for (i = BTN_JOYSTICK; i < KEY_MAX; i++)
-    if (libevdev_has_event_code (self->evdev_device, (guint) EV_KEY, i)) {
+    if (has_key (self->evdev_device, i)) {
       self->key_map[i - BTN_MISC] = (guint8) buttons_number;
       buttons_number++;
     }
   for (i = BTN_MISC; i < BTN_JOYSTICK; i++)
-    if (libevdev_has_event_code (self->evdev_device, (guint) EV_KEY, i)) {
+    if (has_key (self->evdev_device, i)) {
       self->key_map[i - BTN_MISC] = (guint8) buttons_number;
       buttons_number++;
     }
@@ -540,7 +540,7 @@ manette_device_new (const gchar  *filename,
 
       continue;
     }
-    if (libevdev_has_event_code (self->evdev_device, (guint) EV_ABS, i)) {
+    if (has_abs (self->evdev_device, i)) {
       const struct input_absinfo *absinfo;
 
       absinfo = libevdev_get_abs_info (self->evdev_device, i);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]