This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch devs/devilhorns/apos
in repository efl.
View the commit online.
commit db666e93e99d0bada033e458ddfe9428414e5153
Author: Christopher Michael <devilho...@comcast.net>
AuthorDate: Wed Jan 17 08:14:01 2024 -0500
ecore_drm2: Add API to find a display at given coordinates
NB: This also makes a small modification for calibrating displays
which should now properly work based on display rotation
---
src/lib/ecore_drm2/Ecore_Drm2.h | 1 +
src/lib/ecore_drm2/ecore_drm2_device.c | 9 +++++++--
src/lib/ecore_drm2/ecore_drm2_displays.c | 26 ++++++++++++++++++++++++++
src/lib/ecore_drm2/ecore_drm2_private.h | 2 +-
4 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index 9913186f18..21e81eab8d 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -115,6 +115,7 @@ EAPI int ecore_drm2_display_supported_rotations_get(Ecore_Drm2_Display *disp);
EAPI void ecore_drm2_display_relative_mode_set(Ecore_Drm2_Display *disp, Ecore_Drm2_Relative_Mode mode);
EAPI void ecore_drm2_display_relative_to_set(Ecore_Drm2_Display *disp, const char *relative);
EAPI void ecore_drm2_display_dpi_get(Ecore_Drm2_Display *disp, int *xdpi, int *ydpi);
+EAPI Ecore_Drm2_Display *ecore_drm2_display_find(Ecore_Drm2_Device *dev, int x, int y);
# endif
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index 2528336502..dd8cb13a94 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -41,6 +41,7 @@ _ecore_drm2_device_cb_device_change(void *data, int type EINA_UNUSED, void *even
{
Elput_Event_Device_Change *ev;
Ecore_Drm2_Device *dev;
+ int dw, dh;
ev = event;
dev = data;
@@ -55,7 +56,10 @@ _ecore_drm2_device_cb_device_change(void *data, int type EINA_UNUSED, void *even
{
disp = eina_list_data_get(dev->displays);
if (disp)
- ecore_drm2_device_calibrate(dev, disp->w, disp->h);
+ {
+ ecore_drm2_display_info_get(disp, NULL, NULL, &dw, &dh, NULL);
+ ecore_drm2_device_calibrate(dev, dw, dh);
+ }
}
else
{
@@ -65,7 +69,8 @@ _ecore_drm2_device_cb_device_change(void *data, int type EINA_UNUSED, void *even
{
if (eina_streq(disp->name, name))
{
- ecore_drm2_device_calibrate(dev, disp->w, disp->h);
+ ecore_drm2_display_info_get(disp, NULL, NULL, &dw, &dh, NULL);
+ ecore_drm2_device_calibrate(dev, dw, dh);
break;
}
}
diff --git a/src/lib/ecore_drm2/ecore_drm2_displays.c b/src/lib/ecore_drm2/ecore_drm2_displays.c
index 2809a2368e..1e49a26311 100644
--- a/src/lib/ecore_drm2/ecore_drm2_displays.c
+++ b/src/lib/ecore_drm2/ecore_drm2_displays.c
@@ -1,5 +1,9 @@
#include "ecore_drm2_private.h"
+#define INSIDE(x, y, xx, yy, ww, hh) \
+ (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && \
+ ((x) >= (xx)) && ((y) >= (yy)))
+
#define EDID_DESCRIPTOR_ALPHANUMERIC_DATA_STRING 0xfe
#define EDID_DESCRIPTOR_DISPLAY_PRODUCT_NAME 0xfc
#define EDID_DESCRIPTOR_DISPLAY_PRODUCT_SERIAL_NUMBER 0xff
@@ -963,3 +967,25 @@ ecore_drm2_display_dpi_get(Ecore_Drm2_Display *disp, int *xdpi, int *ydpi)
if (ydpi)
*ydpi = ((25.4 * (disp->state.current->mode->height)) / disp->ph);
}
+
+EAPI Ecore_Drm2_Display *
+ecore_drm2_display_find(Ecore_Drm2_Device *dev, int x, int y)
+{
+ Eina_List *l;
+ Ecore_Drm2_Display *disp;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
+
+ EINA_LIST_FOREACH(dev->displays, l, disp)
+ {
+ int ox, oy, ow, oh;
+
+ if (!disp->state.current->enabled) continue;
+
+ ecore_drm2_display_info_get(disp, &ox, &oy, &ow, &oh, NULL);
+ if (INSIDE(x, y, ox, oy, ow, oh))
+ return disp;
+ }
+
+ return NULL;
+}
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 26b654125f..c22180d807 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -240,7 +240,7 @@ struct _Ecore_Drm2_Display_Mode
struct _Ecore_Drm2_Display
{
/* int fd; */
- int x, y, w, h;
+ int x, y;
int pw, ph; // physical dimensions
Eina_Stringshare *name, *make, *model, *serial;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.