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
This commit is contained in:
Mike Blumenkrantz 2016-05-24 16:14:41 -04:00
parent 5f088b026d
commit 7fdcf841f5
6 changed files with 39 additions and 44 deletions

View File

@ -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
*
@ -328,23 +346,6 @@ EAPI void elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh
* Functions that deal with input devices.
*/
/**
* 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
*

View File

@ -1344,14 +1344,6 @@ _evdev_touch_get(Elput_Seat *seat)
return NULL;
}
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)
{

View File

@ -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);
}

View File

@ -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:

View File

@ -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)
{

View File

@ -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);