From 76d787b7c9fd43d7842708f9c53640b912b97e94 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Mon, 28 Nov 2016 10:26:20 -0500 Subject: [PATCH] use ecore_evas_screen_dpi_get to get screen dpi under wayland This small patch modifies the conf_theme module to use screen dpi from the compositor canvas (thus getting server screen dpi) for use in scaling. Signed-off-by: Chris Michael --- src/modules/conf_theme/e_int_config_scale.c | 30 +++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/modules/conf_theme/e_int_config_scale.c b/src/modules/conf_theme/e_int_config_scale.c index a200f702d..6ff288d1e 100644 --- a/src/modules/conf_theme/e_int_config_scale.c +++ b/src/modules/conf_theme/e_int_config_scale.c @@ -229,6 +229,18 @@ _basic_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data if (e_comp->comp_type == E_PIXMAP_TYPE_X) dpi = ecore_x_dpi_get(); #endif +#ifdef HAVE_WAYLAND + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + { + int xdpi = 0, ydpi = 0; + + ecore_evas_screen_dpi_get(e_comp->ee, &xdpi, &ydpi); + if (xdpi == 0) xdpi = 75; + if (ydpi == 0) ydpi = 75; + dpi = ((xdpi + ydpi) / 2); + } +#endif + if ((dpi > 0) && (cfdata->base_dpi > 0)) sc = (double)dpi / (double)cfdata->base_dpi; @@ -294,6 +306,7 @@ _adv_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data * Evas_Object *o, *otb, *ow; E_Radio_Group *rg; char buff[256] = {0}; + int dpi = 0; _fill_data(cfdata); if (cfdata->obs) cfdata->obs = eina_list_free(cfdata->obs); @@ -311,9 +324,22 @@ _adv_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data * #ifndef HAVE_WAYLAND_ONLY if (e_comp->comp_type == E_PIXMAP_TYPE_X) - snprintf(buff, sizeof(buff), - _("Base DPI (Currently %i DPI)"), ecore_x_dpi_get()); + dpi = ecore_x_dpi_get(); #endif +#ifdef HAVE_WAYLAND + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + { + int xdpi = 0, ydpi = 0; + + ecore_evas_screen_dpi_get(e_comp->ee, &xdpi, &ydpi); + if (xdpi == 0) xdpi = 75; + if (ydpi == 0) ydpi = 75; + dpi = ((xdpi + ydpi) / 2); + } +#endif + + snprintf(buff, sizeof(buff), _("Base DPI (Currently %i DPI)"), dpi); + ow = e_widget_label_add(evas, buff); cfdata->gui.adv.dpi_lbl = ow; e_widget_list_object_append(o, ow, 1, 1, 0.5);