forked from enlightenment/enlightenment
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 <cp.michael@samsung.com>
This commit is contained in:
parent
96d517a6f2
commit
76d787b7c9
|
@ -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)
|
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
||||||
dpi = ecore_x_dpi_get();
|
dpi = ecore_x_dpi_get();
|
||||||
#endif
|
#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))
|
if ((dpi > 0) && (cfdata->base_dpi > 0))
|
||||||
sc = (double)dpi / (double)cfdata->base_dpi;
|
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;
|
Evas_Object *o, *otb, *ow;
|
||||||
E_Radio_Group *rg;
|
E_Radio_Group *rg;
|
||||||
char buff[256] = {0};
|
char buff[256] = {0};
|
||||||
|
int dpi = 0;
|
||||||
|
|
||||||
_fill_data(cfdata);
|
_fill_data(cfdata);
|
||||||
if (cfdata->obs) cfdata->obs = eina_list_free(cfdata->obs);
|
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
|
#ifndef HAVE_WAYLAND_ONLY
|
||||||
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
||||||
snprintf(buff, sizeof(buff),
|
dpi = ecore_x_dpi_get();
|
||||||
_("Base DPI (Currently %i DPI)"), ecore_x_dpi_get());
|
|
||||||
#endif
|
#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);
|
ow = e_widget_label_add(evas, buff);
|
||||||
cfdata->gui.adv.dpi_lbl = ow;
|
cfdata->gui.adv.dpi_lbl = ow;
|
||||||
e_widget_list_object_append(o, ow, 1, 1, 0.5);
|
e_widget_list_object_append(o, ow, 1, 1, 0.5);
|
||||||
|
|
Loading…
Reference in New Issue