summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-03-24 11:19:31 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-04-13 14:16:17 -0400
commitf8964fcf2e4681ab77e0cf37c96e9994d25b19fd (patch)
tree4a70ed38cc391e045f5e333ee94fdddf7f4cc851
parentc23a61a49caebca1244fad484cae403bf7a0a0fd (diff)
elput: Initial checkin of elput library
The elput library is an efl abstraction for the libinput library which can be used by various other subsystems (ecore_fb, ecore_drm, etc) to handle interfacing with libinput without having to duplicate the code in each subsystem. Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac71
-rw-r--r--pc/elput.pc.in12
-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
8 files changed, 302 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index c2422db..564f332 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -286,6 +286,10 @@ if HAVE_ECORE_BUFFER
286pkgconfig_DATA += pc/ecore-buffer.pc 286pkgconfig_DATA += pc/ecore-buffer.pc
287endif 287endif
288 288
289if HAVE_ELPUT
290pkgconfig_DATA += pc/elput.pc
291endif
292
289# Cmake configs: 293# Cmake configs:
290efl_cmakeconfigdir = $(libdir)/cmake/Efl/ 294efl_cmakeconfigdir = $(libdir)/cmake/Efl/
291efl_cmakeconfig_DATA = \ 295efl_cmakeconfig_DATA = \
diff --git a/configure.ac b/configure.ac
index 44daa45..f34bac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1984,6 +1984,17 @@ AC_ARG_ENABLE([ecore-buffer],
1984 ], 1984 ],
1985 [want_ecore_buffer="no"]) 1985 [want_ecore_buffer="no"])
1986 1986
1987AC_ARG_ENABLE([elput],
1988 [AS_HELP_STRING([--enable-elput],[enable elput library. @<:@default=disabled@:>@])],
1989 [
1990 if test "x${enableval}" = "xyes" ; then
1991 want_elput="yes"
1992 else
1993 want_elput="no"
1994 fi
1995 ],
1996 [want_elput="no"])
1997
1987# Image Loaders 1998# Image Loaders
1988 1999
1989ARG_ENABLE_EVAS_IMAGE_LOADER(BMP, static) 2000ARG_ENABLE_EVAS_IMAGE_LOADER(BMP, static)
@@ -3566,6 +3577,64 @@ EFL_LIB_END_OPTIONAL([Ecore_Drm])
3566#### End of Ecore_Drm 3577#### End of Ecore_Drm
3567 3578
3568 3579
3580#### Elput
3581have_libinput_new="no"
3582EFL_LIB_START_OPTIONAL([Elput], [test "${want_elput}" = "yes"])
3583
3584### Additional options to configure
3585SUID_CFLAGS=-fPIE
3586SUID_LDFLAGS=-pie
3587AC_SUBST([SUID_CFLAGS])
3588AC_SUBST([SUID_LDFLAGS])
3589
3590### Default values
3591
3592### Checks for programs
3593
3594### Checks for libraries
3595EFL_INTERNAL_DEPEND_PKG([ELPUT], [ecore])
3596EFL_INTERNAL_DEPEND_PKG([ELPUT], [ecore-input])
3597EFL_INTERNAL_DEPEND_PKG([ELPUT], [eldbus])
3598EFL_INTERNAL_DEPEND_PKG([ELPUT], [eeze])
3599EFL_INTERNAL_DEPEND_PKG([ELPUT], [eo])
3600EFL_INTERNAL_DEPEND_PKG([ELPUT], [eina])
3601
3602EFL_DEPEND_PKG([ELPUT], [LIBINPUT], [libinput >= 0.6.0 xkbcommon >= 0.3.0])
3603
3604EFL_ADD_LIBS([ELPUT], [-lm])
3605
3606# API change from 0.7 to 0.8. So we define this to support both for now.
3607PKG_CHECK_EXISTS([libinput >= 0.8.0],
3608 [have_libinput_new="yes"],
3609 [have_libinput_new="no"])
3610AC_MSG_CHECKING([Use new libinput API (newer than 0.8.0)])
3611AC_MSG_RESULT([${have_libinput_new}])
3612if test "x${have_libinput_new}" = "xyes";then
3613 AC_DEFINE_UNQUOTED([LIBINPUT_HIGHER_08], [1], [libinput version >= 0.8])
3614fi
3615if test "x${have_libinput_new}" = "xno";then
3616 AC_DEFINE_UNQUOTED([LIBINPUT_HIGHER_08], [0], [libinput version >= 0.8])
3617fi
3618
3619
3620EFL_EVAL_PKGS([ELPUT])
3621
3622### Checks for header files
3623
3624### Checks for types
3625
3626### Checks for structures
3627
3628### Checks for compiler characteristics
3629
3630### Checks for linker characteristics
3631
3632### Checks for library functions
3633
3634EFL_LIB_END_OPTIONAL([Elput])
3635#### End of Ecore_Drm
3636
3637
3569#### Ecore_Audio 3638#### Ecore_Audio
3570 3639
3571AC_ARG_ENABLE([audio], 3640AC_ARG_ENABLE([audio],
@@ -5512,6 +5581,7 @@ pc/elocation.pc
5512pc/elua.pc 5581pc/elua.pc
5513pc/elementary.pc 5582pc/elementary.pc
5514pc/elementary-cxx.pc 5583pc/elementary-cxx.pc
5584pc/elput.pc
5515dbus-services/org.enlightenment.Ethumb.service 5585dbus-services/org.enlightenment.Ethumb.service
5516systemd-services/ethumb.service 5586systemd-services/ethumb.service
5517$po_makefile_in 5587$po_makefile_in
@@ -5680,6 +5750,7 @@ fi
5680echo "Ecore_Audio.....: ${efl_lib_optional_ecore_audio} (${features_ecore_audio})" 5750echo "Ecore_Audio.....: ${efl_lib_optional_ecore_audio} (${features_ecore_audio})"
5681echo "Ecore_Avahi.....: yes (${features_ecore_avahi})" 5751echo "Ecore_Avahi.....: yes (${features_ecore_avahi})"
5682echo "Ecore_Evas......: yes (${features_ecore_evas})" 5752echo "Ecore_Evas......: yes (${features_ecore_evas})"
5753echo "Elput...........: $want_elput"
5683echo "Ector...........: yes" 5754echo "Ector...........: yes"
5684echo "Eeze............: ${efl_lib_optional_eeze} (${features_eeze})" 5755echo "Eeze............: ${efl_lib_optional_eeze} (${features_eeze})"
5685echo "EPhysics........: ${efl_lib_optional_ephysics}" 5756echo "EPhysics........: ${efl_lib_optional_ephysics}"
diff --git a/pc/elput.pc.in b/pc/elput.pc.in
new file mode 100644
index 0000000..c345022
--- /dev/null
+++ b/pc/elput.pc.in
@@ -0,0 +1,12 @@
1prefix=@prefix@
2exec_prefix=@exec_prefix@
3libdir=@libdir@
4includedir=@includedir@
5
6Name: elput
7Description: E core library, libinput module
8Requires.private: @requirements_pc_elput@
9Version: @VERSION@
10Libs: -L${libdir} -lelput
11Libs.private: @requirements_libs_elput@
12Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/elput-@VMAJ@
diff --git a/src/Makefile.am b/src/Makefile.am
index 3aaa2ce..c08d77c 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 0000000..73fe8f9
--- /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 0000000..7c88e4b
--- /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 0000000..1b5613f
--- /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 0000000..62b7395
--- /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