forked from enlightenment/efl
ecore evas gets func to get dpi and frix x screen size get.
SVN revision: 73341
This commit is contained in:
parent
8f38e5e4e6
commit
1e8520050d
|
@ -804,3 +804,9 @@
|
||||||
* Add event callbacks for Ecore_Imf Input Panel
|
* Add event callbacks for Ecore_Imf Input Panel
|
||||||
* Add functions to retrieve input panel geometry & state from Ecore_Imf.
|
* Add functions to retrieve input panel geometry & state from Ecore_Imf.
|
||||||
|
|
||||||
|
2012-07-05 Carsten Haitzler (The Rasterman)
|
||||||
|
|
||||||
|
* Add ecore_evas_screen_dpi_get()
|
||||||
|
* Fix ecore_evas_screen_geometry_get(0 for x11 to return zone
|
||||||
|
pos/size as it should.
|
||||||
|
|
||||||
|
|
|
@ -1784,6 +1784,7 @@ EAPI void ecore_evas_input_event_unregister(Ecore_Evas *ee);
|
||||||
EAPI void ecore_evas_manual_render(Ecore_Evas *ee);
|
EAPI void ecore_evas_manual_render(Ecore_Evas *ee);
|
||||||
EAPI void ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync);
|
EAPI void ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync);
|
||||||
EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee);
|
EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get geometry of screen associated with this Ecore_Evas.
|
* @brief Get geometry of screen associated with this Ecore_Evas.
|
||||||
*
|
*
|
||||||
|
@ -1797,6 +1798,17 @@ EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee);
|
||||||
*/
|
*/
|
||||||
EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
|
EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the dpi of the screen the Ecore_Evas is primarily on.
|
||||||
|
*
|
||||||
|
* @param ee The Ecore_Evas whose window's to query.
|
||||||
|
* @param xdpi Pointer to integer to store horizontal DPI. May be @c NULL.
|
||||||
|
* @param ydpi Pointer to integer to store vertical DPI. May be @c NULL.
|
||||||
|
*
|
||||||
|
* @since 1.3
|
||||||
|
*/
|
||||||
|
EAPI void ecore_evas_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi);
|
||||||
|
|
||||||
EAPI void ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame);
|
EAPI void ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame);
|
||||||
EAPI Eina_Bool ecore_evas_draw_frame_get(const Ecore_Evas *ee);
|
EAPI Eina_Bool ecore_evas_draw_frame_get(const Ecore_Evas *ee);
|
||||||
|
|
||||||
|
|
|
@ -2293,6 +2293,22 @@ ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int
|
||||||
IFE;
|
IFE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
ecore_evas_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi)
|
||||||
|
{
|
||||||
|
if (xdpi) *xdpi = 0;
|
||||||
|
if (ydpi) *ydpi = 0;
|
||||||
|
if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
|
||||||
|
{
|
||||||
|
ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
|
||||||
|
"ecore_evas_screen_geometry_get");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IFC(ee, fn_screen_dpi_get) (ee, xdpi, ydpi);
|
||||||
|
IFE;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame)
|
ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame)
|
||||||
{
|
{
|
||||||
|
|
|
@ -525,7 +525,8 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
_ecore_evas_buffer_render,
|
_ecore_evas_buffer_render,
|
||||||
NULL // screen_geometry_get
|
NULL, // screen_geometry_get
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -473,7 +473,8 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
NULL, // render
|
NULL, // render
|
||||||
NULL
|
NULL,
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,8 @@ static Ecore_Evas_Engine_Func _ecore_directfb_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
NULL, // render
|
NULL, // render
|
||||||
NULL // screen_geometry_get
|
NULL, // screen_geometry_get
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -693,7 +693,8 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
_ecore_evas_ews_render,
|
_ecore_evas_ews_render,
|
||||||
_ecore_evas_ews_screen_geometry_get
|
_ecore_evas_ews_screen_geometry_get,
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1128,7 +1128,8 @@ static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
NULL, // render
|
NULL, // render
|
||||||
NULL // screen_geometry_get
|
NULL, // screen_geometry_get
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -2013,7 +2014,8 @@ static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
_ecore_evas_extn_socket_render, // render
|
_ecore_evas_extn_socket_render, // render
|
||||||
NULL // screen_geometry_get
|
NULL, // screen_geometry_get
|
||||||
|
NULL, // screen_dpi_get
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -561,7 +561,8 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
NULL, // render
|
NULL, // render
|
||||||
NULL // screen_geometry_get
|
NULL, // screen_geometry_get
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,7 @@ struct _Ecore_Evas_Engine_Func
|
||||||
|
|
||||||
int (*fn_render) (Ecore_Evas *ee);
|
int (*fn_render) (Ecore_Evas *ee);
|
||||||
void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
|
void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
|
||||||
|
void (*fn_screen_dpi_get) (const Ecore_Evas *ee, int *xdpi, int *ydpi);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Ecore_Evas_Engine
|
struct _Ecore_Evas_Engine
|
||||||
|
|
|
@ -405,7 +405,8 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
NULL, // render
|
NULL, // render
|
||||||
_ecore_evas_screen_geometry_get // screen_geometry_get
|
_ecore_evas_screen_geometry_get, // screen_geometry_get
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI Ecore_Evas *
|
EAPI Ecore_Evas *
|
||||||
|
|
|
@ -441,7 +441,8 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
NULL, // render
|
NULL, // render
|
||||||
NULL // screen_geometry_get
|
NULL, // screen_geometry_get
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
|
|
||||||
static Ecore_Evas*
|
static Ecore_Evas*
|
||||||
|
|
|
@ -151,7 +151,8 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
_ecore_evas_wl_render,
|
_ecore_evas_wl_render,
|
||||||
_ecore_evas_wl_screen_geometry_get
|
_ecore_evas_wl_screen_geometry_get,
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
|
|
||||||
/* external variables */
|
/* external variables */
|
||||||
|
|
|
@ -156,7 +156,8 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
|
||||||
NULL, // demand attention set
|
NULL, // demand attention set
|
||||||
NULL, // focus skip set
|
NULL, // focus skip set
|
||||||
_ecore_evas_wl_render,
|
_ecore_evas_wl_render,
|
||||||
_ecore_evas_wl_screen_geometry_get
|
_ecore_evas_wl_screen_geometry_get,
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
|
|
||||||
/* external variables */
|
/* external variables */
|
||||||
|
|
|
@ -1082,7 +1082,8 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
NULL, // render
|
NULL, // render
|
||||||
NULL //screen_geometry_get
|
NULL, //screen_geometry_get
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BUILD_ECORE_EVAS_WIN32 */
|
#endif /* BUILD_ECORE_EVAS_WIN32 */
|
||||||
|
|
|
@ -782,7 +782,8 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func =
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
NULL, // render
|
NULL, // render
|
||||||
NULL // screen_geometry_get
|
NULL, // screen_geometry_get
|
||||||
|
NULL // screen_dpi_get
|
||||||
};
|
};
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
|
|
|
@ -2954,9 +2954,63 @@ _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on)
|
||||||
static void
|
static void
|
||||||
_ecore_evas_x_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
|
_ecore_evas_x_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h)
|
||||||
{
|
{
|
||||||
|
int outnum = 0;
|
||||||
|
int px = 0, py = 0, pw = 0, ph = 0;
|
||||||
|
Ecore_X_Window root;
|
||||||
|
Ecore_X_Randr_Output *out = NULL;
|
||||||
|
Ecore_X_Randr_Crtc crtc;
|
||||||
|
|
||||||
|
root = ecore_x_window_root_get(ee->prop.window);
|
||||||
|
out = ecore_x_randr_window_outputs_get(ee->prop.window, &outnum);
|
||||||
|
if (!out)
|
||||||
|
{
|
||||||
|
norandr:
|
||||||
|
if (out) free(out);
|
||||||
if (x) *x = 0;
|
if (x) *x = 0;
|
||||||
if (y) *y = 0;
|
if (y) *y = 0;
|
||||||
ecore_x_screen_size_get(ecore_x_default_screen_get(), w, h);
|
ecore_x_window_size_get(root, w, h);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
crtc = ecore_x_randr_output_crtc_get(root, out[0]);
|
||||||
|
if (!crtc) goto norandr;
|
||||||
|
ecore_x_randr_crtc_geometry_get(root, crtc, &px, &py, &pw, &ph);
|
||||||
|
if ((pw == 0) || (ph == 0)) goto norandr;
|
||||||
|
if (x) *x = px;
|
||||||
|
if (y) *y = py;
|
||||||
|
if (w) *w = pw;
|
||||||
|
if (h) *h = ph;
|
||||||
|
free(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_evas_x_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi)
|
||||||
|
{
|
||||||
|
int scdpi, xmm = 0, ymm = 0, outnum = 0, w = 0, h = 0;
|
||||||
|
int px = 0, py = 0;
|
||||||
|
Ecore_X_Window root;
|
||||||
|
Ecore_X_Randr_Output *out = NULL;
|
||||||
|
Ecore_X_Randr_Crtc crtc;
|
||||||
|
|
||||||
|
root = ecore_x_window_root_get(ee->prop.window);
|
||||||
|
out = ecore_x_randr_window_outputs_get(ee->prop.window, &outnum);
|
||||||
|
if (!out)
|
||||||
|
{
|
||||||
|
norandr:
|
||||||
|
if (out) free(out);
|
||||||
|
scdpi = ecore_x_dpi_get();
|
||||||
|
if (xdpi) *xdpi = scdpi;
|
||||||
|
if (ydpi) *ydpi = scdpi;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
crtc = ecore_x_randr_output_crtc_get(root, out[0]);
|
||||||
|
if (!crtc) goto norandr;
|
||||||
|
ecore_x_randr_crtc_geometry_get(root, crtc, &px, &py, &w, &h);
|
||||||
|
if ((w == 0) || (h == 0)) goto norandr;
|
||||||
|
ecore_x_randr_output_size_mm_get(root, out[0], &xmm, &ymm);
|
||||||
|
if ((xmm == 0) || (ymm == 0)) goto norandr;
|
||||||
|
if (xdpi) *xdpi = (w * 254) / (xmm * 10); // 25.4mm / inch
|
||||||
|
if (ydpi) *ydpi = (h * 254) / (ymm * 10); // 25.4mm / inch
|
||||||
|
free(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -3036,7 +3090,8 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
|
||||||
_ecore_evas_x_focus_skip_set,
|
_ecore_evas_x_focus_skip_set,
|
||||||
|
|
||||||
NULL, // render
|
NULL, // render
|
||||||
_ecore_evas_x_screen_geometry_get
|
_ecore_evas_x_screen_geometry_get,
|
||||||
|
_ecore_evas_x_screen_dpi_get
|
||||||
};
|
};
|
||||||
#endif /* BUILD_ECORE_EVAS_X11 */
|
#endif /* BUILD_ECORE_EVAS_X11 */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue