ecore-wl2: Add API function to get the DPI of a given output

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-10-13 14:22:06 -04:00
parent 47cd4d4168
commit 24aa08ede7
2 changed files with 29 additions and 0 deletions

View File

@ -711,6 +711,21 @@ EAPI void ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_B
*/
EAPI void ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface *subsurface, int x, int y, int w, int h);
/**
* Return the DPI of a given output
*
* This is a simplistic call to get DPI. It does not account for differing
* DPI in the x and y axes nor does it account for multihead or xinerama and
* xrandr where different parts of the screen may have different DPI etc.
*
* @param output The output to get the DPI of
*
* @return the general screen DPI (dots/pixels per inch).
*
* @ingroup Ecore_Wl2_Output_Group
*/
EAPI int ecore_wl2_output_dpi_get(Ecore_Wl2_Output *output);
/* # ifdef __cplusplus */
/* } */
/* # endif */

View File

@ -94,3 +94,17 @@ _ecore_wl2_output_del(Ecore_Wl2_Output *output)
free(output);
}
EAPI int
ecore_wl2_output_dpi_get(Ecore_Wl2_Output *output)
{
int w, mw;
EINA_SAFETY_ON_NULL_RETURN_VAL(output, 75);
mw = output->mw;
if (mw <= 0) return 75;
w = output->geometry.w;
return (((w * 254) / mw) + 5) / 10;
}