forked from enlightenment/efl
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>
This commit is contained in:
parent
70e8a00271
commit
e11be98ed0
|
@ -341,6 +341,7 @@ EAPI const char *ecore_drm_device_name_get(Ecore_Drm_Device *dev);
|
|||
* which includes creating dumb buffers to render into
|
||||
*
|
||||
* @param dev The Ecore_Drm_Device to setup for software rendering
|
||||
*
|
||||
* @return EINA_TRUE on success, EINA_FALSE on failure
|
||||
*
|
||||
* @ingroup Ecore_Drm_Device_Group
|
||||
|
@ -348,6 +349,23 @@ EAPI const char *ecore_drm_device_name_get(Ecore_Drm_Device *dev);
|
|||
*/
|
||||
EAPI Eina_Bool ecore_drm_device_software_setup(Ecore_Drm_Device *dev);
|
||||
|
||||
/**
|
||||
* Find an Ecore_Drm_Output at the given coordinates
|
||||
*
|
||||
* This function will loop all the existing outputs in Ecore_Drm_Device and
|
||||
* return an output if one exists that encapsulates the given coordinates.
|
||||
*
|
||||
* @param dev The Ecore_Drm_Device to search
|
||||
* @param x The x coordinate
|
||||
* @param y The y coordinate
|
||||
*
|
||||
* @return An Ecore_Drm_Output if one exists at these coordinates or NULL
|
||||
*
|
||||
* @ingroup Ecore_Drm_Device_Group
|
||||
* @since 1.15
|
||||
*/
|
||||
EAPI Ecore_Drm_Output *ecore_drm_device_output_find(Ecore_Drm_Device *dev, int x, int y);
|
||||
|
||||
/**
|
||||
* Open a tty for use
|
||||
*
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
#include "ecore_drm_private.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
#define INSIDE(x, y, xx, yy, ww, hh) \
|
||||
(((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && \
|
||||
((x) >= (xx)) && ((y) >= (yy)))
|
||||
|
||||
static Eina_List *drm_devices;
|
||||
|
||||
static void
|
||||
|
@ -480,3 +484,32 @@ err:
|
|||
}
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EAPI Ecore_Drm_Output *
|
||||
ecore_drm_device_output_find(Ecore_Drm_Device *dev, int x, int y)
|
||||
{
|
||||
Ecore_Drm_Output *output;
|
||||
Eina_List *l;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
|
||||
|
||||
EINA_LIST_FOREACH(dev->outputs, l, output)
|
||||
{
|
||||
int ox = 0, oy = 0;
|
||||
int ow = 0, oh = 0;
|
||||
|
||||
if (!output->cloned)
|
||||
{
|
||||
ox = output->x;
|
||||
oy = output->y;
|
||||
}
|
||||
|
||||
ow = output->current_mode->width;
|
||||
oh = output->current_mode->height;
|
||||
|
||||
if (INSIDE(x, y, ox, oy, ow, oh))
|
||||
return output;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue