[beryl-commits] r1557 - branches/beryl-group-with-tab-plugin

marex at server.beryl-project.org marex at server.beryl-project.org
Tue Dec 5 21:29:03 CET 2006


Author: marex
Date: 2006-12-05 21:28:17 +0100 (Tue, 05 Dec 2006)
New Revision: 1557

Modified:
   branches/beryl-group-with-tab-plugin/group.c
Log:
group-tab-branch: Changed window index from ID's to pointers.. better performence for glow


Modified: branches/beryl-group-with-tab-plugin/group.c
===================================================================
--- branches/beryl-group-with-tab-plugin/group.c	2006-12-05 20:06:01 UTC (rev 1556)
+++ branches/beryl-group-with-tab-plugin/group.c	2006-12-05 20:28:17 UTC (rev 1557)
@@ -187,7 +187,7 @@
  * GroupSelection
  */
 typedef struct _GroupSelection {
-    Window*         windows;
+    CompWindow**    windows;
     int             nWins;
     int             id;
 
@@ -298,14 +298,14 @@
  * groupFindWindowsInRegion
  *
  */
-static Window*
+static CompWindow**
 groupFindWindowsInRegion (CompScreen *s, REGION reg, int *c)
 {
     GROUP_SCREEN(s);
 
     float tolerance = gs->opt[GROUP_SCREEN_OPTION_TOLERANCE].value.i / 10.0f;
 
-    Window *ret = NULL;
+    CompWindow **ret = NULL;
     int count = 0;
     CompWindow *w;
     for (w = s->windows; w; w = w->next)
@@ -318,11 +318,11 @@
             TOLRNC_MAX(reg.extents.y2, (WIN_Y (w) + WIN_HEIGHT (w)), tolerance * WIN_HEIGHT (w)))
         {
             if (count == 0) {
-                ret = calloc (1, sizeof (Window));
-                ret[0] = w->id;
+                ret = calloc (1, sizeof (CompWindow));
+                ret[0] = w;
             } else {
-                ret = realloc (ret, sizeof (Window) * (count+1));
-                ret[count] = w->id;
+                ret = realloc (ret, sizeof (CompWindow) * (count+1));
+                ret[count] = w;
             }
             count++;
         }
@@ -357,9 +357,9 @@
     int steps = gs->opt[GROUP_SCREEN_OPTION_STEPS].value.i;
     for (i = 0; i < gd->groups[index].nWins; i++)
     {
-        CompWindow *cw = findWindowAtDisplay (d, gd->groups[index].windows[i]);
-        if (!cw || cw->id == main->id)
-            continue;
+        CompWindow *cw = gd->groups[index].windows[i];
+		if (cw->id == main->id)
+			continue;
         GROUP_WINDOW (cw);
 
         gw->steps = steps;
@@ -400,9 +400,9 @@
     int steps = gs->opt[GROUP_SCREEN_OPTION_STEPS].value.i;
     for (i = 0; i < gd->groups[index].nWins; i++)
     {
-        CompWindow *cw = findWindowAtDisplay (d, gd->groups[index].windows[i]);
-        if (!cw || cw->id == main->id)
-            continue;
+        CompWindow *cw = gd->groups[index].windows[i];
+		if (cw->id == main->id)
+			continue;
         GROUP_WINDOW (cw);
 
         gw->steps = steps;
@@ -454,15 +454,15 @@
 
     if (gd->groups[index].nWins != 0 && gd->groups[index].windows != NULL)
     {
-        Window *buf = gd->groups[index].windows;
+        CompWindow **buf = gd->groups[index].windows;
         
-        gd->groups[index].windows = (Window*) calloc (gd->groups[index].nWins-1, sizeof (Window));
+        gd->groups[index].windows = (CompWindow**) calloc (gd->groups[index].nWins-1, sizeof (CompWindow*));
 
         int counter = 0;
         int i;
         for (i = 0; i < gd->groups[index].nWins; i++)
         {
-            if (buf[i] == w->id)
+            if (buf[i]->id == w->id)
                 continue;
             gd->groups[index].windows[counter++] = buf[i];
         }
@@ -516,12 +516,9 @@
         int i;
         for (i = 0; i < gd->groups[index].nWins; i++)
         {
-            CompWindow *cw = findWindowAtDisplay (d, gd->groups[index].windows[i]);
-            if (!cw)
-                continue;
+            CompWindow *cw = gd->groups[index].windows[i];
+			GROUP_WINDOW (cw);
 
-            GROUP_WINDOW (cw);
-
             gw->inGroup = FALSE;
         }
         free (gd->groups[index].windows);
@@ -565,8 +562,8 @@
         GroupSelection g;
 
         g.id = groupID;
-        g.windows = (Window*) calloc (1, sizeof (Window));
-        g.windows[0] = w->id;
+        g.windows = (CompWindow**) calloc (1, sizeof (CompWindow*));
+        g.windows[0] = w;
         g.nWins = 1;
         g.topTab = NULL;
         g.tabbed = FALSE;
@@ -587,8 +584,8 @@
     }
     else
     {
-        gd->groups[index].windows = (Window*) realloc (gd->groups[index].windows, sizeof (Window)* (gd->groups[index].nWins+1));
-        gd->groups[index].windows[gd->groups[index].nWins] = w->id;
+        gd->groups[index].windows = (CompWindow**) realloc (gd->groups[index].windows, sizeof (CompWindow*)* (gd->groups[index].nWins+1));
+        gd->groups[index].windows[gd->groups[index].nWins] = w;
         gd->groups[index].nWins++;
 
         gw->groupID = groupID;
@@ -607,14 +604,14 @@
 
     if (gd->tmpSel.nWins > 0 && gd->tmpSel.windows)
     {
-        Window *buf = gd->tmpSel.windows;
-        gd->tmpSel.windows = (Window*) calloc (gd->tmpSel.nWins-1, sizeof (Window));
+        CompWindow **buf = gd->tmpSel.windows;
+        gd->tmpSel.windows = (CompWindow**) calloc (gd->tmpSel.nWins-1, sizeof (CompWindow*));
 
         int counter = 0;
         int i;
         for (i = 0; i < gd->tmpSel.nWins; i++)
         {
-            if (buf[i] == w->id)
+            if (buf[i]->id == w->id)
                 continue;
             gd->tmpSel.windows[counter++] = buf[i];
         }
@@ -633,10 +630,10 @@
 {
     GROUP_DISPLAY (d);
 
-    gd->tmpSel.windows = (Window*) realloc (gd->tmpSel.windows,
-                                                sizeof (Window)* (gd->tmpSel.nWins+1));
+    gd->tmpSel.windows = (CompWindow**) realloc (gd->tmpSel.windows,
+                                                sizeof (CompWindow*) * (gd->tmpSel.nWins+1));
 
-    gd->tmpSel.windows[gd->tmpSel.nWins] = w->id;
+    gd->tmpSel.windows[gd->tmpSel.nWins] = w;
     gd->tmpSel.nWins++;
 }
 
@@ -656,9 +653,7 @@
     int i;
     for (i = 0; i < gd->groups[index].nWins; i++)
     {
-        CompWindow *w = findWindowAtDisplay (d, gd->groups[index].windows[i]);
-        if (!w)
-            continue;
+        CompWindow *w = gd->groups[index].windows[i];
         syncWindowPosition (w);
     }
 }
@@ -693,8 +688,8 @@
     int i;
     for (i = 0; i < gd->groups[index].nWins; i++)
     {
-        CompWindow *w = findWindowAtDisplay (d, gd->groups[index].windows[i]);
-        if (!w || w->id == top->id)
+        CompWindow *w = gd->groups[index].windows[i];
+        if (w->id == top->id)
             continue;
         restackWindowBelow (w, top);
     }
@@ -1018,9 +1013,7 @@
         int i;
         for (i = 0; i < gd->groups[index].nWins; i++)
         {
-             CompWindow *cw = findWindowAtDisplay (d, gd->groups[index].windows[i]);
-             if (!cw)
-                 continue;
+             CompWindow *cw = gd->groups[index].windows[i];
              GROUP_WINDOW (cw);
             
              groupAddWindowToSelection (d, cw);
@@ -1040,16 +1033,14 @@
          if (index == -1)
              return;
 
-         Window *buf = gd->tmpSel.windows;
-         gd->tmpSel.windows = (Window*) calloc (gd->tmpSel.nWins - gd->groups[index].nWins, sizeof (Window));
+         CompWindow **buf = gd->tmpSel.windows;
+         gd->tmpSel.windows = (CompWindow**) calloc (gd->tmpSel.nWins - gd->groups[index].nWins, sizeof (CompWindow*));
 
          int counter = 0;
          int i;
          for (i = 0; i < gd->tmpSel.nWins; i++)
          {
-              CompWindow *cw = findWindowAtDisplay (d, buf[i]);
-              if (!cw)
-                  continue;
+              CompWindow *cw = buf[i];
               GROUP_WINDOW (cw);
             
               if (gw->inGroup && gw->groupID == gd->groups[index].id)
@@ -1172,16 +1163,14 @@
             damageScreenRegion (s, &reg);
 
             int count;
-            Window *ws = groupFindWindowsInRegion (s, reg, &count);
+            CompWindow **ws = groupFindWindowsInRegion (s, reg, &count);
 
             if (ws) {
             // select windows
             int i;
             for (i = 0; i < count; i++)
             {
-                CompWindow *cw = findWindowAtDisplay (d, ws[i]);
-                if (!cw)
-                    continue;
+                CompWindow *cw = ws[i];
 
                 groupSelectWindow(d, cw);
             }
@@ -1224,15 +1213,13 @@
         int i;
         for (i = 0; i < gd->tmpSel.nWins; i++)
         {
-            CompWindow* cw = (CompWindow*) findWindowAtDisplay (d, gd->tmpSel.windows[i]);
-            if (!cw)
-                continue;
+            CompWindow* cw = gd->tmpSel.windows[i];
             GROUP_WINDOW (cw);
 
             groupAddWindowToGroup(d, cw, id);
 
             gw->inSelection = FALSE;
-            addWindowDamage (cw);
+			damageScreen (cw->screen);
         }
 
         // exit selection
@@ -1316,8 +1303,8 @@
         int i;
         for (i = 0; i < gd->groups[index].nWins; i++)
         {
-            CompWindow *cw = findWindowAtDisplay (d, gd->groups[index].windows[i]);
-            if (!cw || cw->id == w->id)
+            CompWindow *cw = gd->groups[index].windows[i];
+            if (cw->id == w->id)
                 continue;
             GROUP_WINDOW (cw);
 
@@ -1382,9 +1369,7 @@
         int i;
         for (i = 0; i < nWins; i++)
         {
-            CompWindow *cw = findWindowAtDisplay (d, gd->groups[index].windows[i]);
-            if (!cw)
-                continue;
+            CompWindow *cw = gd->groups[index].windows[i];
             closeWindow (cw, getCurrentTimeFromDisplay (d));
         }
     }
@@ -1415,9 +1400,7 @@
         int i;
         for (i = 0; i < nWins; i++)
         {
-            CompWindow *cw = findWindowAtDisplay (d, gd->groups[index].windows[i]);
-            if (!cw)
-                continue;
+            CompWindow *cw = gd->groups[index].windows[i];
             minimizeWindow (cw);
         }
     }
@@ -1506,6 +1489,7 @@
                 // close event
                 if (gw->inGroup && !w->pendingUnmaps) {
                     groupDeleteGroupWindow (d, w);
+					damageScreen (w->screen);
                 }
                 break;
             }
@@ -1585,7 +1569,7 @@
             int i;
             for (i = 0; i < gd->groups[index].nWins; i++)
             {
-                CompWindow *cw = findWindowAtDisplay (w->screen->display, gd->groups[index].windows[i]);
+                CompWindow *cw = gd->groups[index].windows[i];
                 if (!cw)
                     continue;
 
@@ -1636,7 +1620,7 @@
             int i;
             for (i = 0; i < gd->groups[index].nWins; i++)
             {
-                CompWindow *cw = findWindowAtDisplay (w->screen->display, gd->groups[index].windows[i]);
+                CompWindow *cw = gd->groups[index].windows[i];
                 if (!cw)
                     continue;
 
@@ -1708,7 +1692,7 @@
     int i;
     for (i = 0; i < gd->groups[index].nWins; i++)
     {
-        CompWindow *cw = findWindowAtDisplay (s->display, gd->groups[index].windows[i]);
+        CompWindow *cw = gd->groups[index].windows[i];
         if(!cw)
             continue;
         GROUP_WINDOW (cw);
@@ -1877,7 +1861,7 @@
     int i;
     for (i = 0; i < group->nWins; i++)
     {
-        CompWindow *cw = findWindowAtDisplay (s->display, group->windows[i]);
+        CompWindow *cw = group->windows[i];
         if (!cw)
             continue;
  
@@ -2113,6 +2097,7 @@
 		glEnableClientState (GL_TEXTURE_COORD_ARRAY);
 		glPopMatrix ();
 	
+		/*
 		Region reg = XCreateRegion ();
 		XRectangle rect;
 		rect.x = x1;
@@ -2123,6 +2108,7 @@
 		XSubtractRegion (reg, w->region, reg);
 
         damageScreenRegion (w->screen, reg);
+		*/
     }
 
     UNWRAP (gs, w->screen, drawWindow);




More information about the commits mailing list