add simple dpi get call

SVN revision: 36205
This commit is contained in:
Carsten Haitzler 2008-09-24 10:18:26 +00:00
parent 96ad3331d8
commit 44fc837b6a
2 changed files with 19 additions and 0 deletions

View File

@ -1029,6 +1029,7 @@ EAPI void ecore_x_flush(void);
EAPI void ecore_x_sync(void);
EAPI void ecore_x_killall(Ecore_X_Window root);
EAPI void ecore_x_kill(Ecore_X_Window win);
EAPI int ecore_x_dpi_get(void);
EAPI Ecore_X_Time ecore_x_current_time_get(void);

View File

@ -605,6 +605,24 @@ ecore_x_current_time_get(void)
return _ecore_x_event_last_time;
}
/**
* Return the screen DPI
*
* This is a simplistic call to get DPI. It does not account for differing
* DPI in the x amd y axes nor does it accoutn for multihead or xinerama and
* xrander where different parts of the screen may have differen DPI etc.
*
* @return the general screen DPI (dots/pixels per inch).
*/
EAPI int
ecore_x_dpi_get(void)
{
Screen *s;
s = DefaultScreenOfDisplay(_ecore_x_disp);
return (s->width / (s->mwidth * 254)) / 10;
}
static int
_ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{