Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_evas


Modified Files:
        ecore_evas_x.c 


Log Message:


optimise ecore and ecore_evas. makes e look better in benchmarks... and
well.. it does make it faster for certain situations/scenarios... and well..
in general too.

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_evas/ecore_evas_x.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ecore_evas_x.c      3 May 2005 17:35:50 -0000       1.37
+++ ecore_evas_x.c      28 May 2005 03:57:17 -0000      1.38
@@ -13,6 +13,7 @@
 static int _ecore_evas_fps_debug = 0;
 
 static Ecore_Evas *ecore_evases = NULL;
+static Evas_Hash *ecore_evases_hash = NULL;
 static Ecore_Event_Handler *ecore_evas_event_handlers[16];
 static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
 
@@ -51,24 +52,30 @@
      evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, NULL);
 }
 
+static char *
+_ecore_evas_x_winid_str_get(Ecore_X_Window win)
+{
+   const char *vals = "qWeRtYuIoP5-$&<~";
+   static char id[9];
+   unsigned int val;
+   
+   val = (unsigned int)win;
+   id[0] = vals[(val >> 28) & 0xf];
+   id[1] = vals[(val >> 24) & 0xf];
+   id[2] = vals[(val >> 20) & 0xf];
+   id[3] = vals[(val >> 16) & 0xf];
+   id[4] = vals[(val >> 12) & 0xf];
+   id[5] = vals[(val >>  8) & 0xf];
+   id[6] = vals[(val >>  4) & 0xf];
+   id[7] = vals[(val      ) & 0xf];
+   id[8] = 0;
+   return id;
+}
+
 static Ecore_Evas *
 _ecore_evas_x_match(Ecore_X_Window win)
 {
-   Ecore_Oldlist *l;
-   
-   for (l = (Ecore_Oldlist *)ecore_evases; l; l = l->next)
-     {
-       Ecore_Evas *ee;
-       
-       ee = (Ecore_Evas *)l;
-       if ((ee->engine.x.win == win) || (ee->engine.x.win_container == win))
-         {
-            ecore_evases = _ecore_list_remove(ecore_evases, ee);
-            ecore_evases = _ecore_list_prepend(ecore_evases, ee);
-            return ee;
-         }
-     }
-   return NULL;
+   return evas_hash_find(ecore_evases_hash, _ecore_evas_x_winid_str_get(win));
 }
 
 static void
@@ -664,6 +671,8 @@
    ee->engine.x.mask = 0;
    ee->engine.x.gc = 0;
    ee->engine.x.damages = 0;
+   ecore_evases_hash = evas_hash_del(ecore_evases_hash, 
_ecore_evas_x_winid_str_get(ee->engine.x.win), ee);
+   ecore_evases_hash = evas_hash_del(ecore_evases_hash, 
_ecore_evas_x_winid_str_get(ee->engine.x.win_container), ee);
    ecore_evases = _ecore_list_remove(ecore_evases, ee);
    _ecore_evas_x_shutdown();
    ecore_x_shutdown();
@@ -1064,6 +1073,7 @@
    ecore_x_window_hide(ee->engine.x.win);
    ecore_x_window_reparent(ee->engine.x.win, ee->engine.x.win_root, 0, 0);
    ecore_x_window_del(ee->engine.x.win_container);
+   ecore_evases_hash = evas_hash_del(ecore_evases_hash, 
_ecore_evas_x_winid_str_get(ee->engine.x.win_container), ee);
    if (on)
      ee->engine.x.win_container = 
ecore_x_window_override_new(ee->engine.x.win_root, ee->x, ee->y, ee->w, ee->h);
    else
@@ -1083,6 +1093,7 @@
        ecore_x_window_prop_sticky_set(ee->engine.x.win_container,
                                       ee->prop.sticky);
      }
+   ecore_evases_hash = evas_hash_add(ecore_evases_hash, 
_ecore_evas_x_winid_str_get(ee->engine.x.win_container), ee);
    ecore_x_window_reparent(ee->engine.x.win, ee->engine.x.win_container, 0, 
0);        
    ecore_x_window_show(ee->engine.x.win);
    if (ee->visible) ecore_x_window_show(ee->engine.x.win_container);
@@ -1364,6 +1375,8 @@
    evas_key_lock_add(ee->evas, "Scroll_Lock");
 
    ecore_evases = _ecore_list_prepend(ecore_evases, ee);
+   ecore_evases_hash = evas_hash_add(ecore_evases_hash, 
_ecore_evas_x_winid_str_get(ee->engine.x.win), ee);
+   ecore_evases_hash = evas_hash_add(ecore_evases_hash, 
_ecore_evas_x_winid_str_get(ee->engine.x.win_container), ee);
    return ee;
 #else
    return NULL;
@@ -1556,6 +1569,8 @@
    evas_key_lock_add(ee->evas, "Scroll_Lock");
 
    ecore_evases = _ecore_list_prepend(ecore_evases, ee);
+   ecore_evases_hash = evas_hash_add(ecore_evases_hash, 
_ecore_evas_x_winid_str_get(ee->engine.x.win), ee);
+   ecore_evases_hash = evas_hash_add(ecore_evases_hash, 
_ecore_evas_x_winid_str_get(ee->engine.x.win_container), ee);
    return ee;
 #else
    return NULL;




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to