summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/Makefile_Elput.am28
-rw-r--r--src/lib/elput/Elput.h74
-rw-r--r--src/lib/elput/elput.c55
-rw-r--r--src/lib/elput/elput_private.h57
5 files changed, 215 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3aaa2ce944..c08d77cd5d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -70,6 +70,7 @@ include Makefile_Ethumb.am
70include Makefile_Ethumb_Client.am 70include Makefile_Ethumb_Client.am
71include Makefile_Elocation.am 71include Makefile_Elocation.am
72include Makefile_Elementary.am 72include Makefile_Elementary.am
73include Makefile_Elput.am
73 74
74include Makefile_Eina_Cxx.am 75include Makefile_Eina_Cxx.am
75include Makefile_Ecore_Cxx.am 76include Makefile_Ecore_Cxx.am
diff --git a/src/Makefile_Elput.am b/src/Makefile_Elput.am
new file mode 100644
index 0000000000..73fe8f9982
--- /dev/null
+++ b/src/Makefile_Elput.am
@@ -0,0 +1,28 @@
1if HAVE_ELPUT
2
3### Library
4
5lib_LTLIBRARIES += lib/elput/libelput.la
6
7installed_elputmainheadersdir = $(includedir)/elput-@VMAJ@
8dist_installed_elputmainheaders_DATA = \
9 lib/elput/Elput.h
10
11lib_elput_libelput_la_SOURCES = \
12lib/elput/elput.c \
13lib/elput/elput_private.h
14
15lib_elput_libelput_la_CPPFLAGS = \
16 -I$(top_builddir)/src/lib/efl \
17 @ELPUT_CFLAGS@ @EFL_CFLAGS@ \
18 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
19 -DMODULE_ARCH=\"$(MODULE_ARCH)\"
20
21lib_elput_libelput_la_LIBADD = @ELPUT_LIBS@
22if HAVE_SYSTEMD
23lib_elput_libelput_la_LIBADD += @SYSTEMD_LIBS@
24endif
25lib_elput_libelput_la_DEPENDENCIES = @ELPUT_INTERNAL_LIBS@
26lib_elput_libelput_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
27
28endif
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
new file mode 100644
index 0000000000..7c88e4bed6
--- /dev/null
+++ b/src/lib/elput/Elput.h
@@ -0,0 +1,74 @@
1#ifndef _ELPUT_H
2# define _ELPUT_H
3
4# ifdef EAPI
5# undef EAPI
6# endif
7
8# ifdef _MSC_VER
9# ifdef BUILDING_DLL
10# define EAPI __declspec(dllexport)
11# else // ifdef BUILDING_DLL
12# define EAPI __declspec(dllimport)
13# endif // ifdef BUILDING_DLL
14# else // ifdef _MSC_VER
15# ifdef __GNUC__
16# if __GNUC__ >= 4
17# define EAPI __attribute__ ((visibility("default")))
18# else // if __GNUC__ >= 4
19# define EAPI
20# endif // if __GNUC__ >= 4
21# else // ifdef __GNUC__
22# define EAPI
23# endif // ifdef __GNUC__
24# endif // ifdef _MSC_VER
25
26# ifdef EFL_BETA_API_SUPPORT
27
28/**
29 * @file
30 * @brief Ecore functions for dealing with libinput
31 *
32 * @defgroup Elput_Group Elput - libinput integration
33 * @ingrup Ecore
34 *
35 * Elput provides a wrapper and functions for using libinput
36 *
37 * @li @ref Elput_Init_Group
38 *
39 */
40
41/**
42 * @defgroup Elput_Init_Group Library Init and Shutdown functions
43 *
44 * Functions that start and shutdown the Elput library
45 */
46
47/**
48 * Initialize the Elput library
49 *
50 * @return The number of times the library has been initialized without being
51 * shutdown. 0 is returned if an error occurs.
52 *
53 * @ingroup Elput_Init_Group
54 * @since 1.18
55 */
56EAPI int elput_init(void);
57
58/**
59 * Shutdown the Elput library
60 *
61 * @return The number of times the library has been initialized without being
62 * shutdown. 0 is returned if an error occurs.
63 *
64 * @ingroup Elput_Init_Group
65 * @since 1.18
66 */
67EAPI int elput_shutdown(void);
68
69# endif
70
71# undef EAPI
72# define EAPI
73
74#endif
diff --git a/src/lib/elput/elput.c b/src/lib/elput/elput.c
new file mode 100644
index 0000000000..1b5613fc3a
--- /dev/null
+++ b/src/lib/elput/elput.c
@@ -0,0 +1,55 @@
1#include "elput_private.h"
2
3/* local variables */
4static int _elput_init_count = 0;
5
6/* external variables */
7int _elput_log_dom = -1;
8
9EAPI int
10elput_init(void)
11{
12 if (++_elput_init_count != 1) return _elput_init_count;
13
14 if (!eina_init()) goto eina_err;
15 if (!ecore_init()) goto ecore_err;
16 if (!ecore_event_init()) goto ecore_event_err;
17 if (!eeze_init()) goto eeze_err;
18
19 _elput_log_dom = eina_log_domain_register("elput", ELPUT_DEFAULT_LOG_COLOR);
20 if (!_elput_log_dom)
21 {
22 EINA_LOG_ERR("Could not create logging domain for Elput");
23 goto log_err;
24 }
25
26 return _elput_init_count;
27
28log_err:
29 eeze_shutdown();
30eeze_err:
31 ecore_event_shutdown();
32ecore_event_err:
33 ecore_shutdown();
34ecore_err:
35 eina_shutdown();
36eina_err:
37 return --_elput_init_count;
38}
39
40EAPI int
41elput_shutdown(void)
42{
43 if (_elput_init_count < 1) return 0;
44 if (--_elput_init_count != 0) return _elput_init_count;
45
46 eina_log_domain_unregister(_elput_log_dom);
47 _elput_log_dom = -1;
48
49 eeze_shutdown();
50 ecore_event_shutdown();
51 ecore_shutdown();
52 eina_shutdown();
53
54 return _elput_init_count;
55}
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
new file mode 100644
index 0000000000..62b7395c29
--- /dev/null
+++ b/src/lib/elput/elput_private.h
@@ -0,0 +1,57 @@
1#ifndef _ELPUT_PRIVATE_H
2# define _ELPUT_PRIVATE_H
3
4# ifdef HAVE_CONFIG_H
5# include "config.h"
6# endif
7
8# include "Ecore.h"
9# include "ecore_private.h"
10# include "Ecore_Input.h"
11# include "Eeze.h"
12# include "Eldbus.h"
13# include <Elput.h>
14
15# include <linux/vt.h>
16# include <linux/kd.h>
17# include <linux/major.h>
18# include <linux/input.h>
19# include <libinput.h>
20
21# ifdef HAVE_SYSTEMD
22# include <systemd/sd-login.h>
23# endif
24
25# ifdef ELPUT_DEFAULT_LOG_COLOR
26# undef ELPUT_DEFAULT_LOG_COLOR
27# endif
28# define ELPUT_DEFAULT_LOG_COLOR EINA_COLOR_GREEN
29
30extern int _elput_log_dom;
31
32# ifdef ERR
33# undef ERR
34# endif
35# define ERR(...) EINA_LOG_DOM_ERR(_elput_log_dom, __VA_ARGS__)
36
37# ifdef DBG
38# undef DBG
39# endif
40# define DBG(...) EINA_LOG_DOM_DBG(_elput_log_dom, __VA_ARGS__)
41
42# ifdef INF
43# undef INF
44# endif
45# define INF(...) EINA_LOG_DOM_INFO(_elput_log_dom, __VA_ARGS__)
46
47# ifdef WRN
48# undef WRN
49# endif
50# define WRN(...) EINA_LOG_DOM_WARN(_elput_log_dom, __VA_ARGS__)
51
52# ifdef CRIT
53# undef CRIT
54# endif
55# define CRIT(...) EINA_LOG_DOM_CRIT(_elput_log_dom, __VA_ARGS__)
56
57#endif