aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_libinput/ecore_libinput.c
blob: 3b935898c2c63c93b18400a8fe28aa8187fd3f9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "ecore_libinput_private.h"

static int _ecore_libinput_init_count = 0;

int _ecore_libinput_log_dom = -1;

EAPI int
ecore_libinput_init(void)
{
   if (++_ecore_libinput_init_count != 1) return _ecore_libinput_init_count;

   if (!eina_init()) goto eina_err;

   _ecore_libinput_log_dom =
     eina_log_domain_register("ecore_libinput", ECORE_LIBINPUT_COLOR_DEFAULT);
   if (!_ecore_libinput_log_dom)
     {
        EINA_LOG_ERR("Could not create logging domain");
        goto log_err;
     }

   if (!ecore_event_init())
     {
        ERR("Could not init Ecore_Event");
        goto ecore_event_err;
     }

   if (!eeze_init())
     {
        ERR("Could not init Eeze");
        goto eeze_err;
     }

   return _ecore_libinput_init_count;

eeze_err:
   ecore_event_shutdown();
ecore_event_err:
   eina_log_domain_unregister(_ecore_libinput_log_dom);
   _ecore_libinput_log_dom = -1;
log_err:
   eina_shutdown();
eina_err:
   return --_ecore_libinput_init_count;
}

EAPI int
ecore_libinput_shutdown(void)
{
   if (--_ecore_libinput_init_count != 0) return _ecore_libinput_init_count;

   eeze_shutdown();
   ecore_event_shutdown();

   eina_log_domain_unregister(_ecore_libinput_log_dom);
   _ecore_libinput_log_dom = -1;

   eina_shutdown();
   return _ecore_libinput_init_count;
}