summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_device.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-04-08 10:41:26 -0400
committerStefan Schmidt <s.schmidt@samsung.com>2015-04-10 11:09:50 +0200
commite11be98ed05b695d9dc6f662b1f957eca28c2160 (patch)
tree430758bd1fb1d599e07117bb43efbe234547eb2e /src/lib/ecore_drm/ecore_drm_device.c
parent70e8a002718e137bf85f20c6179fa8932fd12083 (diff)
ecore-drm: Add API function to find an output at given coordinates
Summary: This commit adds an API function that can be used to find an output given an x/y coordinate pair. @feature Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm/ecore_drm_device.c')
-rw-r--r--src/lib/ecore_drm/ecore_drm_device.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c
index 275c9d0d3e..405375239f 100644
--- a/src/lib/ecore_drm/ecore_drm_device.c
+++ b/src/lib/ecore_drm/ecore_drm_device.c
@@ -5,6 +5,10 @@
5#include "ecore_drm_private.h" 5#include "ecore_drm_private.h"
6#include <dlfcn.h> 6#include <dlfcn.h>
7 7
8#define INSIDE(x, y, xx, yy, ww, hh) \
9 (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && \
10 ((x) >= (xx)) && ((y) >= (yy)))
11
8static Eina_List *drm_devices; 12static Eina_List *drm_devices;
9 13
10static void 14static void
@@ -480,3 +484,32 @@ err:
480 } 484 }
481 return EINA_FALSE; 485 return EINA_FALSE;
482} 486}
487
488EAPI Ecore_Drm_Output *
489ecore_drm_device_output_find(Ecore_Drm_Device *dev, int x, int y)
490{
491 Ecore_Drm_Output *output;
492 Eina_List *l;
493
494 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
495
496 EINA_LIST_FOREACH(dev->outputs, l, output)
497 {
498 int ox = 0, oy = 0;
499 int ow = 0, oh = 0;
500
501 if (!output->cloned)
502 {
503 ox = output->x;
504 oy = output->y;
505 }
506
507 ow = output->current_mode->width;
508 oh = output->current_mode->height;
509
510 if (INSIDE(x, y, ox, oy, ow, oh))
511 return output;
512 }
513
514 return NULL;
515}