Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        tooltips.c 


Log Message:
Defer tooltip realization.

===================================================================
RCS file: /cvs/e/e16/e/src/tooltips.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -3 -r1.108 -r1.109
--- tooltips.c  12 Aug 2006 15:40:57 -0000      1.108
+++ tooltips.c  13 Aug 2006 09:24:14 -0000      1.109
@@ -66,19 +66,42 @@
 #define TTWIN win[4]
 #define TTICL iclass[4]
 
+static void
+TooltipRealize(ToolTip * tt)
+{
+   int                 i, wh;
+   EImage             *im;
+   EObj               *eo;
+
+   for (i = 0; i < 5; i++)
+     {
+       if (!tt->iclass[i])
+          continue;
+
+       im = ImageclassGetImage(tt->iclass[i], 0, 0, STATE_NORMAL);
+
+       wh = (i + 1) * 8;
+       eo = EobjWindowCreate(EOBJ_TYPE_MISC, -50, -100, wh, wh, 1, tt->name);
+       EobjChangeOpacity(eo, OpacityFromPercent(Conf.opacity.tooltips));
+       tt->win[i] = eo;
+     }
+   tt->iwin = ECreateWindow(tt->TTWIN->win, 0, 0, 1, 1, 0);
+}
+
 static ToolTip     *
 TooltipCreate(const char *name, ImageClass * ic0, ImageClass * ic1,
              ImageClass * ic2, ImageClass * ic3, ImageClass * ic4,
              TextClass * tclass, int dist, ImageClass * tooltippic)
 {
-   int                 i, wh;
+   int                 i;
    ToolTip            *tt;
-   EObj               *eo;
 
    if (ic0 == NULL || tclass == NULL)
       return NULL;
 
    tt = Ecalloc(1, sizeof(ToolTip));
+   if (!tt)
+      return NULL;
 
    tt->name = Estrdup(name);
    tt->iclass[0] = ic1;
@@ -96,20 +119,8 @@
    tt->dist = dist;
 
    for (i = 0; i < 5; i++)
-     {
-       if (!tt->iclass[i])
-          continue;
-
-       wh = (i + 1) * 8;
-
-       eo = EobjWindowCreate(EOBJ_TYPE_MISC, -50, -100, wh, wh, 1, name);
-       ImageclassIncRefcount(tt->iclass[i]);
-       EobjChangeOpacity(eo, OpacityFromPercent(Conf.opacity.tooltips));
-       tt->win[i] = eo;
-     }
-   tt->iwin = ECreateWindow(tt->TTWIN->win, 0, 0, 1, 1, 0);
-
-   tt->ref_count = 0;
+      if (tt->iclass[i])
+        ImageclassIncRefcount(tt->iclass[i]);
 
    ecore_list_prepend(tt_list, tt);
 
@@ -290,6 +301,13 @@
    if (!tt || Mode.mode != MODE_NONE)
       return;
 
+   if (!tt->TTWIN)
+     {
+       TooltipRealize(tt);
+       if (!tt->TTWIN)
+          return;
+     }
+
    /* if we get an actionclass, look for tooltip action texts */
    h = 0;
    if (ac)
@@ -686,7 +704,7 @@
 {
    int                 i;
 
-   if (!tt || !tt->TTWIN->shown)
+   if (!tt || !tt->TTWIN || !tt->TTWIN->shown)
       return;
 
    for (i = 4; i >= 0; i--)



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to