ecore-drm: Add function to return the pointer xy of Ecore_Drm_Device

Summary: This adds a function (ecore_drm_device_pointer_xy_get) to we
can return the mouse position inside ecore_evas_pointer_xy_get calls.
This is going to be used for centering the mouse when E-Wl starts up.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-03-04 11:46:22 -05:00
parent f23acbac81
commit aabf45071c
2 changed files with 43 additions and 0 deletions

View File

@ -312,4 +312,18 @@ EAPI Eina_Stringshare *ecore_drm_output_model_get(Ecore_Drm_Output *output);
*/
EAPI Eina_Stringshare *ecore_drm_output_make_get(Ecore_Drm_Output *output);
/**
* Get the pointer position of Ecore_Drm_Device
*
* This function will give the pointer position of Ecore_Drm_Device
*
* @param dev The Ecore_Drm_Device to get pointer position for
* @param *x The parameter in which output x co-ordinate is stored
* @param *y The parameter in which output y co-ordinate is stored
*
* @ingroup Ecore_Drm_Device_Group
* @since 1.14
*/
EAPI void ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y);
#endif

View File

@ -470,3 +470,32 @@ ecore_drm_device_name_get(Ecore_Drm_Device *dev)
return dev->drm.name;
}
EAPI void
ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y)
{
Ecore_Drm_Seat *seat;
Ecore_Drm_Evdev *edev;
Eina_List *l, *ll;
if (x) *x = 0;
if (y) *y = 0;
/* check for valid device */
if ((!dev) || (dev->drm.fd < 0)) return;
EINA_LIST_FOREACH(dev->seats, l, seat)
{
EINA_LIST_FOREACH(seat->devices, ll, edev)
{
if (!libinput_device_has_capability(edev->device,
LIBINPUT_DEVICE_CAP_POINTER))
continue;
if (x) *x = edev->mouse.dx;
if (y) *y = edev->mouse.dy;
return;
}
}
}