e3050dc1a4adf749efc3c6cf378474e34611af9d
[platform/upstream/enlightenment.git] / src / bin / e_devicemgr_conf.c
1 #include "e_devicemgr_private.h"
2
3 #define E_DEVICEMGR_INPUT_DFLT_BACK_KEYCODE 166
4
5 void
6 _e_devicemgr_conf_value_check(E_Devicemgr_Config_Data* dconfig)
7 {
8    if (!dconfig->conf) dconfig->conf = E_NEW(E_Devicemgr_Conf_Edd, 1);
9    EINA_SAFETY_ON_NULL_RETURN(dconfig->conf);
10
11    dconfig->conf->input.back_keycode = E_DEVICEMGR_INPUT_DFLT_BACK_KEYCODE;
12 }
13
14 void
15 e_devicemgr_conf_init(E_Devicemgr_Config_Data *dconfig)
16 {
17    dconfig->conf_edd = E_CONFIG_DD_NEW("Devicemgr_Config", E_Devicemgr_Conf_Edd);
18 #undef T
19 #undef D
20 #define T E_Devicemgr_Conf_Edd
21 #define D dconfig->conf_edd
22    E_CONFIG_VAL(D, T, input.button_remap_enable, CHAR);
23    E_CONFIG_VAL(D, T, input.virtual_key_device_enable, CHAR);
24    E_CONFIG_VAL(D, T, input.virtual_mouse_device_enable, CHAR);
25    E_CONFIG_VAL(D, T, input.back_keycode, INT);
26
27 #undef T
28 #undef D
29    dconfig->conf = e_config_domain_load("module.devicemgr", dconfig->conf_edd);
30
31    if (!dconfig->conf)
32      {
33         WRN("Failed to find module.devicemgr config file.\n");
34      }
35    _e_devicemgr_conf_value_check(dconfig);
36 }
37
38 void
39 e_devicemgr_conf_fini(E_Devicemgr_Config_Data *dconfig)
40 {
41    if (dconfig->conf)
42      {
43         E_FREE(dconfig->conf);
44      }
45    E_CONFIG_DD_FREE(dconfig->conf_edd);
46 }