diff options
author | Chris Michael <cp.michael@samsung.com> | 2015-03-04 11:46:22 -0500 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2015-03-04 11:49:44 -0500 |
commit | aabf45071cedba9e4e61d5690fb4537f11590ad2 (patch) | |
tree | 49d7e4166433ebba8a6d88034330644381daed24 /src | |
parent | f23acbac8101d89f55da3775e7118dcbc2cdfe27 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ecore_drm/Ecore_Drm.h | 14 | ||||
-rw-r--r-- | src/lib/ecore_drm/ecore_drm_device.c | 29 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h index ed76983ea1..10928ed092 100644 --- a/src/lib/ecore_drm/Ecore_Drm.h +++ b/src/lib/ecore_drm/Ecore_Drm.h | |||
@@ -312,4 +312,18 @@ EAPI Eina_Stringshare *ecore_drm_output_model_get(Ecore_Drm_Output *output); | |||
312 | */ | 312 | */ |
313 | EAPI Eina_Stringshare *ecore_drm_output_make_get(Ecore_Drm_Output *output); | 313 | EAPI Eina_Stringshare *ecore_drm_output_make_get(Ecore_Drm_Output *output); |
314 | 314 | ||
315 | /** | ||
316 | * Get the pointer position of Ecore_Drm_Device | ||
317 | * | ||
318 | * This function will give the pointer position of Ecore_Drm_Device | ||
319 | * | ||
320 | * @param dev The Ecore_Drm_Device to get pointer position for | ||
321 | * @param *x The parameter in which output x co-ordinate is stored | ||
322 | * @param *y The parameter in which output y co-ordinate is stored | ||
323 | * | ||
324 | * @ingroup Ecore_Drm_Device_Group | ||
325 | * @since 1.14 | ||
326 | */ | ||
327 | EAPI void ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y); | ||
328 | |||
315 | #endif | 329 | #endif |
diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c index 5d0c0bcfe2..89c6b86485 100644 --- a/src/lib/ecore_drm/ecore_drm_device.c +++ b/src/lib/ecore_drm/ecore_drm_device.c | |||
@@ -470,3 +470,32 @@ ecore_drm_device_name_get(Ecore_Drm_Device *dev) | |||
470 | 470 | ||
471 | return dev->drm.name; | 471 | return dev->drm.name; |
472 | } | 472 | } |
473 | |||
474 | EAPI void | ||
475 | ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y) | ||
476 | { | ||
477 | Ecore_Drm_Seat *seat; | ||
478 | Ecore_Drm_Evdev *edev; | ||
479 | Eina_List *l, *ll; | ||
480 | |||
481 | if (x) *x = 0; | ||
482 | if (y) *y = 0; | ||
483 | |||
484 | /* check for valid device */ | ||
485 | if ((!dev) || (dev->drm.fd < 0)) return; | ||
486 | |||
487 | EINA_LIST_FOREACH(dev->seats, l, seat) | ||
488 | { | ||
489 | EINA_LIST_FOREACH(seat->devices, ll, edev) | ||
490 | { | ||
491 | if (!libinput_device_has_capability(edev->device, | ||
492 | LIBINPUT_DEVICE_CAP_POINTER)) | ||
493 | continue; | ||
494 | |||
495 | if (x) *x = edev->mouse.dx; | ||
496 | if (y) *y = edev->mouse.dy; | ||
497 | |||
498 | return; | ||
499 | } | ||
500 | } | ||
501 | } | ||