e_scale: update scale when output device is created 06/42706/2 accepted/tizen/mobile/20150703.014352 accepted/tizen/tv/20150703.014412 accepted/tizen/wearable/20150703.014452 submit/tizen/20150702.024916
authorMinJeong Kim <minjjj.kim@samsung.com>
Wed, 1 Jul 2015 14:29:14 +0000 (23:29 +0900)
committerGwanglim Lee <gl77.lee@samsung.com>
Thu, 2 Jul 2015 01:14:01 +0000 (18:14 -0700)
 e_scale is updated only at init time and the output of calculation even
have been worthless, because there was no output so ecore_wl_dpi_get()
have returned default value at that time.
 To get correct scale value, enlightenment has to re-calculate when new output
device is created.

Change-Id: I0eb40841d5fb7032984641fb2a8ccbfdde4e6bc6
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
src/bin/e_scale.c
src/bin/e_scale.h
src/modules/wl_drm/e_mod_main.c

index 66f4f0e..cc666cf 100644 (file)
@@ -48,3 +48,22 @@ e_scale_update(void)
    e_hints_scale_update();
 }
 
+EAPI void
+e_scale_manual_update(int dpi)
+{
+   char buf[128];
+
+   e_scale = (double)dpi / (double)e_config->scale.base_dpi;
+
+   if (e_scale > e_config->scale.max) e_scale = e_config->scale.max;
+   else if (e_scale < e_config->scale.min)
+     e_scale = e_config->scale.min;
+
+   elm_config_scale_set(e_scale);
+   elm_config_all_flush();
+   edje_scale_set(e_scale);
+   snprintf(buf, sizeof(buf), "%1.3f", e_scale);
+   e_util_env_set("E_SCALE", buf);
+   e_hints_scale_update();
+}
+
index 6468c33..f10baa7 100644 (file)
@@ -6,6 +6,7 @@
 EINTERN int  e_scale_init(void);
 EINTERN int  e_scale_shutdown(void);
 EAPI void e_scale_update(void);
+EAPI void e_scale_manual_update(int dpi);
 
 extern EAPI double e_scale;
 
index c918bf4..15012b7 100644 (file)
@@ -68,6 +68,12 @@ _e_mod_drm_cb_output(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
                          e->phys_width, e->phys_height, e->refresh,
                          e->subpixel_order, e->transform);
 
+   /* previous calculation of e_scale gave unsuitable value because
+    * there were no sufficient information to calculate dpi.
+    * so it's considerable to re-calculate e_scale with output geometry.
+    */
+   e_scale_manual_update(((e->w * 254 / e->phys_width) + 5) / 10);
+
 end:
    return ECORE_CALLBACK_PASS_ON;
 }