make insanely huge icon scale with screen size, this is broken somehow because of...
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 24 Nov 2011 05:07:23 +0000 (05:07 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 24 Nov 2011 05:07:23 +0000 (05:07 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@65562 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/test_tooltip.c

index 8e0bc12..005b89f 100644 (file)
@@ -142,11 +142,23 @@ _tt_item_icon3(void *data   __UNUSED__,
               Evas_Object *tt,
               void *item   __UNUSED__)
 {
+   int w, h, sw, sh;
    Evas_Object *ic = elm_icon_add(tt);
+   
    char buf[PATH_MAX];
    snprintf(buf, sizeof(buf), "%s/images/insanely_huge_test_image.jpg", elm_app_data_dir_get());
    elm_icon_file_set(ic, buf, NULL);
-   elm_icon_scale_set(ic, 0, 0);
+   elm_icon_size_get(ic, &w, &h);
+   elm_win_screen_size_get(tt, NULL, NULL, &sw, &sh);
+   if ((w > sw) || (h > sh))
+     {
+        float sc = 0;
+        if ((float)w / (float)sw >= 0.8)
+          sc = ((float)sw * 0.8) / (float)w;
+        else if ((float)h / (float)sh >= 0.8)
+          sc = ((float)sh * 0.8) / (float)h;
+        if (sc) elm_object_scale_set(ic, sc);
+     }
    return ic;
 }