From 7fdcf841f57de11ea92f4b2d4eeec34c1c5a70e0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 May 2016 16:14:41 -0400 Subject: [PATCH] elput: change some functions and internal flags to enable async input setup this sets attributes on the Elput_Manager struct so that devices created at a later point can then have relevant attributes applied to them --- src/lib/elput/Elput.h | 35 ++++++++++++++++++----------------- src/lib/elput/elput_evdev.c | 8 -------- src/lib/elput/elput_input.c | 10 +++------- src/lib/elput/elput_logind.c | 10 ---------- src/lib/elput/elput_manager.c | 17 +++++++++++++++-- src/lib/elput/elput_private.h | 3 +++ 6 files changed, 39 insertions(+), 44 deletions(-) diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h index 2f31160..77ba406 100644 --- a/src/lib/elput/Elput.h +++ b/src/lib/elput/Elput.h @@ -230,6 +230,24 @@ EAPI Eina_Bool elput_manager_vt_set(Elput_Manager *manager, int vt); */ EAPI const Eina_List *elput_manager_seats_get(Elput_Manager *manager); + +/** + * Set which window to use for this input manager + * + * @brief This function should be used to specify which window to set on the + * input manager. Setting a window on the input manager is done so that + * when we raise events (mouse movement, keyboard key, etc) then + * this window is passed to the event structure as the window which + * the event occured on. + * + * @param manager + * @param window + * + * @ingroup Elput_Manager_Group + * @since 1.18 + */ +EAPI void elput_manager_window_set(Elput_Manager *manager, unsigned int window); + /** * @defgroup Elput_Input_Group Elput input functions * @@ -329,23 +347,6 @@ EAPI void elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh */ /** - * Set which window to use for this input device - * - * @brief This function should be used to specify which window to set on the - * input device. Setting a window on the input device is done so that - * when we raise events (mouse movement, keyboard key, etc) then - * this window is passed to the event structure as the window which - * the event occured on. - * - * @param device - * @param window - * - * @ingroup Elput_Device_Group - * @since 1.18 - */ -EAPI void elput_device_window_set(Elput_Device *device, unsigned int window); - -/** * Set size of output for input device calibration * * @param device diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c index 4537019..5095320 100644 --- a/src/lib/elput/elput_evdev.c +++ b/src/lib/elput/elput_evdev.c @@ -1345,14 +1345,6 @@ _evdev_touch_get(Elput_Seat *seat) } EAPI void -elput_device_window_set(Elput_Device *device, unsigned int window) -{ - EINA_SAFETY_ON_NULL_RETURN(device); - - device->window = window; -} - -EAPI void elput_device_output_size_set(Elput_Device *device, int w, int h) { EINA_SAFETY_ON_NULL_RETURN(device); diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c index 8431c29..45778eb 100644 --- a/src/lib/elput/elput_input.c +++ b/src/lib/elput/elput_input.c @@ -500,12 +500,8 @@ elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh) Elput_Seat *eseat; EINA_SAFETY_ON_NULL_RETURN(manager); + manager->input.pointer_w = maxw; + manager->input.pointer_h = maxh; - EINA_LIST_FOREACH(manager->input.seats, l, eseat) - { - if (!eseat->ptr) continue; - - eseat->ptr->maxw = maxw; - eseat->ptr->maxh = maxh; - } + _elput_input_pointer_max_update(manager); } diff --git a/src/lib/elput/elput_logind.c b/src/lib/elput/elput_logind.c index 8db4a11..475b1c6 100644 --- a/src/lib/elput/elput_logind.c +++ b/src/lib/elput/elput_logind.c @@ -200,16 +200,6 @@ _logind_dbus_setup(Elput_Manager *em) _cb_device_paused, em); eldbus_proxy_signal_handler_add(proxy, "ResumeDevice", _cb_device_resumed, em); - proxy = - eldbus_proxy_get(em->dbus.obj, "org.freedesktop.DBus.Properties"); - if (!proxy) - { - ERR("Could not get dbus proxy"); - goto proxy_err; - } - - eldbus_proxy_unref(proxy); - return EINA_TRUE; proxy_err: diff --git a/src/lib/elput/elput_manager.c b/src/lib/elput/elput_manager.c index 3b127af..0dcc820 100644 --- a/src/lib/elput/elput_manager.c +++ b/src/lib/elput/elput_manager.c @@ -89,6 +89,7 @@ elput_manager_open(Elput_Manager *manager, const char *path, int flags) manager->vt_hdlr = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _cb_key_down, manager); + manager->vt_fd = ret; } } @@ -101,8 +102,11 @@ elput_manager_close(Elput_Manager *manager, int fd) EINA_SAFETY_ON_NULL_RETURN(manager); EINA_SAFETY_ON_NULL_RETURN(manager->interface); - if (manager->vt_hdlr) ecore_event_handler_del(manager->vt_hdlr); - manager->vt_hdlr = NULL; + if (fd == manager->vt_fd) + { + if (manager->vt_hdlr) ecore_event_handler_del(manager->vt_hdlr); + manager->vt_hdlr = NULL; + } if (manager->interface->close) manager->interface->close(manager, fd); @@ -121,6 +125,15 @@ elput_manager_vt_set(Elput_Manager *manager, int vt) return EINA_FALSE; } +EAPI void +elput_manager_window_set(Elput_Manager *manager, unsigned int window) +{ + EINA_SAFETY_ON_NULL_RETURN(manager); + + manager->window = window; + _elput_input_window_update(manager); +} + EAPI const Eina_List * elput_manager_seats_get(Elput_Manager *manager) { diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h index a934bf1..0fc5d6a 100644 --- a/src/lib/elput/elput_private.h +++ b/src/lib/elput/elput_private.h @@ -86,6 +86,7 @@ typedef struct _Elput_Input Ecore_Thread *thread; Eldbus_Pending *current_pending; int pipe; + int pointer_w, pointer_h; Eina_Bool suspended : 1; } Elput_Input; @@ -252,6 +253,8 @@ typedef struct _Elput_Async_Open int flags; } Elput_Async_Open; +void _elput_input_window_update(Elput_Manager *manager); + int _evdev_event_process(struct libinput_event *event); Elput_Device *_evdev_device_create(Elput_Seat *seat, struct libinput_device *device); void _evdev_device_destroy(Elput_Device *edev); -- 2.7.4