From: Sung-Jin Park Date: Tue, 5 Dec 2017 00:32:20 +0000 (+0900) Subject: e_input: define/add environment variables to enable choice between two libinput backe... X-Git-Tag: submit/tizen/20171207.025043~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd39a3a7783e741766a443b406aa1a47799694e6;p=platform%2Fupstream%2Fenlightenment.git e_input: define/add environment variables to enable choice between two libinput backends (udev/path) Change-Id: Id6fc157681a4d33f72094b8a48f04efe53a7f527 Signed-off-by: Sung-Jin Park --- diff --git a/src/bin/e_input.c b/src/bin/e_input.c index a0a97859dc..963c6fe3a6 100644 --- a/src/bin/e_input.c +++ b/src/bin/e_input.c @@ -17,6 +17,7 @@ EINTERN int e_input_init(Ecore_Evas *ee) { E_Input_Device *dev; + E_Input_Libinput_Backend backend = E_INPUT_LIBINPUT_BACKEND_UDEV; if (++_e_input_init_count != 1) return _e_input_init_count; @@ -65,7 +66,12 @@ e_input_init(Ecore_Evas *ee) e_input->window = ecore_evas_window_get(ee); e_input_device_window_set(dev, e_input->window); - if (!e_input_device_input_backend_create(dev, "libinput_udev")) + if (getenv("E_INPUT_USE_LIBINPUT_UDEV_BACKEND")) + backend = E_INPUT_LIBINPUT_BACKEND_UDEV; + else if (getenv("E_INPUT_USE_LIBINPUT_PATH_BACKEND")) + backend = E_INPUT_LIBINPUT_BACKEND_PATH; + + if (!e_input_device_input_backend_create(dev, backend)) { EINA_LOG_ERR("Failed to create device\n"); goto device_create_err; diff --git a/src/bin/e_input.h b/src/bin/e_input.h index 6ee85f7617..881e85f98f 100644 --- a/src/bin/e_input.h +++ b/src/bin/e_input.h @@ -24,6 +24,12 @@ typedef enum _E_Input_Seat_Capabilities E_INPUT_SEAT_TOUCH = (1 << 2), } E_Input_Seat_Capabilities; +typedef enum _E_Input_Libinput_Backend +{ + E_INPUT_LIBINPUT_BACKEND_UDEV = 1, + E_INPUT_LIBINPUT_BACKEND_PATH +} E_Input_Libinput_Backend; + struct _E_Input_Event_Input_Device_Add { const char *name; /* descriptive device name */ @@ -74,7 +80,7 @@ EINTERN E_Input_Device *e_input_device_open(void); EINTERN Eina_Bool e_input_device_close(E_Input_Device *dev); EINTERN void e_input_device_keyboard_cached_context_set(struct xkb_context *ctx); EINTERN void e_input_device_keyboard_cached_keymap_set(struct xkb_keymap *map); -EINTERN Eina_Bool e_input_device_input_backend_create(E_Input_Device *dev, const char *backend); +EINTERN Eina_Bool e_input_device_input_backend_create(E_Input_Device *dev, E_Input_Libinput_Backend backend); EINTERN Eina_Bool e_input_device_input_create_libinput_udev(E_Input_Device *dev); EINTERN Eina_Bool e_input_device_input_create_libinput_path(E_Input_Device *dev); EINTERN void e_input_device_window_set(E_Input_Device *dev, unsigned int window); diff --git a/src/bin/e_input_device.c b/src/bin/e_input_device.c index 6eb7f288e3..6d497aa982 100644 --- a/src/bin/e_input_device.c +++ b/src/bin/e_input_device.c @@ -700,17 +700,20 @@ e_input_device_libinput_log_handler(struct libinput *libinput EINA_UNUSED, } EINTERN Eina_Bool -e_input_device_input_backend_create(E_Input_Device *dev, const char *backend) +e_input_device_input_backend_create(E_Input_Device *dev, E_Input_Libinput_Backend backend) { Eina_Bool res = EINA_FALSE; EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE); - EINA_SAFETY_ON_NULL_RETURN_VAL(backend, EINA_FALSE); - if (!strncmp(backend, "libinput_udev", strlen("libinput_udev"))) - res = e_input_device_input_create_libinput_udev(dev); - else if (!strncmp(backend, "libinput_path", strlen("libinput_path"))) - res = e_input_device_input_create_libinput_path(dev); + if (backend == E_INPUT_LIBINPUT_BACKEND_UDEV) + { + res = e_input_device_input_create_libinput_udev(dev); + } + else if (backend == E_INPUT_LIBINPUT_BACKEND_PATH) + { + res = e_input_device_input_create_libinput_path(dev); + } return res; }