[gnome-games] gamepad: Add libevdev VAPI



commit 39c494807492e827c543ccbc7b181efb81865de1
Author: Megh Parikh <meghprkh gmail com>
Date:   Mon Jul 18 20:18:48 2016 +0530

    gamepad: Add libevdev VAPI
    
    This library is responsible for the interface with the Linux Evdev API
    which allows us to access the gamepad events.
    
    This is part of a series of commits to add gamepad support.

 configure.ac                    |    1 +
 src/Makefile.am                 |    4 ++++
 src/gamepad/linux/libevdev.vapi |   37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 85bde58..9e0a185 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,7 @@ PKG_CHECK_MODULES(GNOME_GAMES, [
        glib-2.0 >= $GLIB_MIN_VERSION
        grilo-0.3
        gtk+-3.0
+       libevdev
        retro-gobject-0.6
        retro-gtk-0.6
        tracker-sparql-1.0
diff --git a/src/Makefile.am b/src/Makefile.am
index 08ee53b..e71bdb9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -103,6 +103,7 @@ gnome_games_SOURCES = \
 
 gnome_games_VALAFLAGS = \
        --target-glib=@GLIB_MIN_VERSION@ \
+       --vapidir=gamepad/linux/ \
        --pkg gio-2.0 \
        --pkg glib-2.0 \
        --pkg grilo-0.3 \
@@ -110,6 +111,9 @@ gnome_games_VALAFLAGS = \
        --pkg tracker-sparql-1.0 \
        --pkg retro-gobject-0.6 \
        --pkg retro-gtk-0.6 \
+       --pkg libevdev \
+       --pkg linux \
+       --pkg posix \
        --gresources $(gresource_file) \
        --vapi $(vapi_file) \
        -H $(header_file) \
diff --git a/src/gamepad/linux/libevdev.vapi b/src/gamepad/linux/libevdev.vapi
new file mode 100644
index 0000000..4c042a1
--- /dev/null
+++ b/src/gamepad/linux/libevdev.vapi
@@ -0,0 +1,37 @@
+// This file is part of GNOME Games. License: GPLv3
+
+[CCode (cheader_filename = "libevdev/libevdev.h")]
+namespace Libevdev {
+       [CCode (cname = "libevdev_read_flag", cprefix = "LIBEVDEV_READ_FLAG_", has_type_id = false)]
+       [Flags]
+       public enum ReadFlag {
+               SYNC,
+               NORMAL,
+               FORCE_SYNC,
+               BLOCKING
+       }
+
+       [CCode (cname = "struct libevdev", cprefix = "libevdev_", free_function = "libevdev_free")]
+       [Compact]
+       public class Evdev {
+               [CCode (cname = "libevdev_new")]
+               public Evdev ();
+
+               public int get_fd ();
+               public int set_fd (int fd);
+
+               public string name { get; set; }
+
+               public int id_bustype { get; set; }
+               public int id_vendor { get; set; }
+               public int id_product { get; set; }
+               public int id_version { get; set; }
+
+               public unowned Linux.Input.AbsInfo? get_abs_info (uint code);
+               public bool has_event_code (uint type, uint code);
+               public int has_event_pending ();
+               public int next_event (uint flags, out Linux.Input.Event ev);
+
+               public static unowned string event_code_get_name(uint type, uint code);
+       }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]