From b42757c789c551ed9de839189f2861817b8e20bc Mon Sep 17 00:00:00 2001 From: JengHyun Kang Date: Wed, 24 Jan 2018 16:49:26 +0900 Subject: [PATCH] e_input: change calibrations when output is changed Change-Id: I88a2f65bc3bb157ceb0c1ceeb864d543a034ffaa --- src/bin/e_input.c | 23 +++++++++++++++++++++++ src/bin/e_input.h | 1 + src/bin/e_input_device.c | 18 ++++++++++++++++++ src/bin/e_input_evdev.c | 2 +- src/bin/e_input_private.h | 3 +++ 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/bin/e_input.c b/src/bin/e_input.c index 2a6ca8a..fe19eef 100644 --- a/src/bin/e_input.c +++ b/src/bin/e_input.c @@ -13,6 +13,22 @@ E_API int E_EVENT_INPUT_DISABLED = -1; E_API E_Input *e_input = NULL; +static Eina_Bool +_e_input_cb_screen_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + Eina_List *l; + Eina_List *devices; + E_Input_Device *dev_data; + + devices = (Eina_List *)e_input_devices_get(); + + EINA_LIST_FOREACH(devices, l, dev_data) + { + e_input_device_output_changed(dev_data); + } + return ECORE_CALLBACK_PASS_ON; +} + EINTERN const char * e_input_base_dir_get(void) { @@ -154,6 +170,8 @@ e_input_init(Ecore_Evas *ee) e_input->dev = dev; + E_LIST_HANDLER_APPEND(e_input->handlers, E_EVENT_SCREEN_CHANGE, _e_input_cb_screen_change, NULL); + TRACE_INPUT_END(); return _e_input_init_count; @@ -183,6 +201,8 @@ ecore_event_evas_err: EINTERN int e_input_shutdown(void) { + Ecore_Event_Handler *h = NULL; + if (_e_input_init_count < 1) return 0; if (--_e_input_init_count != 0) return _e_input_init_count; @@ -194,6 +214,9 @@ e_input_shutdown(void) E_EVENT_INPUT_ENABLED = -1; E_EVENT_INPUT_DISABLED = -1; + EINA_LIST_FREE(e_input->handlers, h) + ecore_event_handler_del(h); + if (e_input->input_base_dir) eina_stringshare_del(e_input->input_base_dir); e_input_device_close(e_input->dev); diff --git a/src/bin/e_input.h b/src/bin/e_input.h index c3c57b1..39c0562 100644 --- a/src/bin/e_input.h +++ b/src/bin/e_input.h @@ -59,6 +59,7 @@ struct _E_Input Ecore_Window window; E_Input_Device *dev; const char *input_base_dir; + Eina_List *handlers; Eina_Bool use_thread : 1; }; diff --git a/src/bin/e_input_device.c b/src/bin/e_input_device.c index af449d3..a6d645f 100644 --- a/src/bin/e_input_device.c +++ b/src/bin/e_input_device.c @@ -1121,6 +1121,24 @@ err: return EINA_FALSE; } +void +e_input_device_output_changed(E_Input_Device *dev) +{ + E_Input_Seat *seat = NULL; + E_Input_Evdev *edev = NULL; + Eina_List *l = NULL, *l2 = NULL; + + EINA_SAFETY_ON_NULL_RETURN(dev); + EINA_SAFETY_ON_NULL_RETURN(dev->seats); + + EINA_LIST_FOREACH(dev->seats, l, seat) + { + EINA_LIST_FOREACH(e_input_seat_evdev_list_get(seat), l2, edev) + { + _device_calibration_set(edev); + } + } +} E_API const Eina_List * e_input_devices_get(void) diff --git a/src/bin/e_input_evdev.c b/src/bin/e_input_evdev.c index d94ef9b..f2c2430 100644 --- a/src/bin/e_input_evdev.c +++ b/src/bin/e_input_evdev.c @@ -3,7 +3,7 @@ static void _device_modifiers_update(E_Input_Evdev *edev); -static void +void _device_calibration_set(E_Input_Evdev *edev) { E_Output *output; diff --git a/src/bin/e_input_private.h b/src/bin/e_input_private.h index 010ed63..2ba2939 100644 --- a/src/bin/e_input_private.h +++ b/src/bin/e_input_private.h @@ -118,5 +118,8 @@ struct xkb_keymap *_e_input_device_cached_keymap_get(struct xkb_context *ctx, co void _e_input_evdev_device_destroy(E_Input_Evdev *evdev); void _e_input_pointer_motion_post(E_Input_Evdev *edev); +void _device_calibration_set(E_Input_Evdev *edev); +void e_input_device_output_changed(E_Input_Device *dev); + #endif #endif -- 2.7.4