Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h desktops.c ecompmgr.c events.c mod-misc.c 


Log Message:
Composite stuff.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.413
retrieving revision 1.414
diff -u -3 -r1.413 -r1.414
--- E.h 23 Apr 2005 13:35:37 -0000      1.413
+++ E.h 25 Apr 2005 22:07:34 -0000      1.414
@@ -576,6 +576,9 @@
    int                 current_area_x;
    int                 current_area_y;
    long                event_mask;
+#if USE_COMPOSITE
+   Pixmap              pmap;
+#endif
 } Desk;
 
 typedef struct _constraints
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -3 -r1.140 -r1.141
--- desktops.c  23 Apr 2005 07:31:15 -0000      1.140
+++ desktops.c  25 Apr 2005 22:07:36 -0000      1.141
@@ -835,6 +835,9 @@
       return;
 
    BackgroundApply(bg, EoGetWin(d), 1);
+#if USE_COMPOSITE
+   d->pmap = None;
+#endif
    HintsSetRootInfo(EoGetWin(d),
                    BackgroundGetPixmap(bg), BackgroundGetColor(bg));
 }
@@ -1055,6 +1058,9 @@
    EWin               *const *lst;
    int                 n, v, dx, dy;
 
+   if (d->num <= 0)
+      return;
+
    n = -1;
    i = 0;
    while (n < 0 && i < Conf.desks.num)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- ecompmgr.c  22 Apr 2005 07:10:18 -0000      1.22
+++ ecompmgr.c  25 Apr 2005 22:07:37 -0000      1.23
@@ -192,15 +192,20 @@
    XRectangle         *pr;
 
    pr = XFixesFetchRegion(disp, rgn, &nr);
-   if (!pr)
-      return;
+   if (!pr || nr <= 0)
+     {
+       Eprintf(" - region: %s %#lx is empty\n", txt, rgn);
+       goto done;
+     }
 
-   Eprintf("ERegionShow: %s %#lx:\n", txt, rgn);
+   Eprintf(" - region: %s %#lx:\n", txt, rgn);
    for (i = 0; i < nr; i++)
       Eprintf("%4d: %4d+%4d %4dx%4d\n", i, pr[i].x, pr[i].y, pr[i].width,
              pr[i].height);
 
-   XFree(pr);
+ done:
+   if (pr)
+      XFree(pr);
 }
 
 /*
@@ -302,11 +307,6 @@
    XRenderComposite(disp, PictOpSrc, pict, None, cw->picture,
                    0, 0, 0, 0, 0, 0, w, h);
    XRenderFreePicture(disp, pict);
-
-#if 0                          /* FIXME - the screen update seems to be 
delayed? */
-   if (cw->extents != None)
-      ECompMgrDamageMerge(eo->desk, cw->extents, 0);
-#endif
 }
 
 /*
@@ -323,8 +323,20 @@
    XRenderPictFormat  *pictfmt;
    XRenderPictureAttributes pa;
 
+   if (!cw)
+     {
+       ECompMgrWinNew(&d->o);
+       cw = d->o.cmhook;
+       if (!cw)
+          return None;
+     }
+
    if (cw->picture != None)
-      return cw->picture;
+     {
+       if (d->pmap)
+          return cw->picture;
+       XRenderFreePicture(disp, cw->picture);
+     }
 
    fill = False;
    pmap = BackgroundGetPixmap(DeskGetBackground(d->num));
@@ -350,9 +362,12 @@
        XRenderFillRectangle(disp, PictOpSrc, pict, &c, 0, 0, 1, 1);
      }
 
+#if 0                          /* FIXME - Not in window mode? */
    /* New background, all must be repainted */
    ECompMgrDamageAll();
+#endif
 
+   d->pmap = pmap;
    cw->picture = pict;
 
    return pict;
@@ -370,7 +385,7 @@
 
    D1printf("DeskBackgroundPictureFree: Desk %d: pict=%#lx\n", d->num, pict);
 
-   XClearArea(disp, EoGetWin(d), 0, 0, 0, 0, True);
+   XClearArea(disp, EoGetWin(d), 0, 0, 0, 0, False);
    XRenderFreePicture(disp, pict);
 
    cw->picture = None;
@@ -778,6 +793,8 @@
    XFixesTranslateRegion(disp, border, x, y);
 
    D2printf("border_size %#lx: %d %d\n", eo->win, x, y);
+   if (EventDebug(EDBUG_TYPE_COMPMGR3))
+      ERegionShow("borderSize", border);
 
    return border;
 }
@@ -853,7 +870,7 @@
 
    if ((what & (INV_GEOM | INV_SHADOW)) && cw->extents != None)
      {
-#if 0                          /* FIXME - ??? */
+#if 0                          /* FIXME - Not necessary? */
        ECompMgrDamageMerge(cw->extents, 1);
 #else
        XFixesDestroyRegion(dpy, cw->extents);
@@ -913,14 +930,17 @@
           return;
      }
 
+   D1printf("ECompMgrWinMap %#lx\n", eo->win);
+
    cw->a.map_state = IsViewable;
    cw->visible = 1;
 
-   D1printf("ECompMgrWinMap %#lx\n", eo->win);
 #if CAN_DO_USABLE
    cw->damage_bounds.x = cw->damage_bounds.y = 0;
    cw->damage_bounds.width = cw->damage_bounds.height = 0;
 #endif
+   if (cw->extents == None)
+      cw->extents = win_extents(disp, eo);
    ECompMgrDamageMerge(eo->desk, cw->extents, 0);
 }
 
@@ -1081,7 +1101,7 @@
    cw->shadow_height = 0;
 #endif
 
-#if 1
+#if 0                          /* FIXME - Do we need this? */
    if (Conf_compmgr.mode == ECM_MODE_WINDOW)
       ESelectInputAdd(eo->win, StructureNotifyMask);
 #endif
@@ -1089,14 +1109,14 @@
    cw->opacity = 0xdeadbeef;
    ECompMgrWinChangeOpacity(eo, eo->opacity);
 
-#if 1                          /* FIXME - Do we need this? */
+#if 0                          /* FIXME - Do we need this? */
    /* Find new window region */
    cw->extents = win_extents(disp, eo);
 #endif
 
    EventCallbackRegister(eo->win, 0, ECompMgrHandleWindowEvent, eo);
 
-#if 0
+#if 0                          /* FIXME - Not necessary? */
    if (cw->a.map_state == IsViewable)
       ECompMgrWinMap(eo, cw->damage_sequence - 1, False);
 #endif
@@ -1109,7 +1129,8 @@
    XserverRegion       damage = None;
    int                 change_xy, change_wh, change_bw, invalidate;
 
-   D1printf("ECompMgrWinMoveResize %#lx %#lx\n", eo->win, cw->extents);
+   D1printf("ECompMgrWinMoveResize %#lx %#lx %d %d %d %d %d\n",
+           eo->win, cw->extents, x, y, w, h, bw);
 
    /* Invalidate old window region */
 #if CAN_DO_USABLE
@@ -1121,7 +1142,7 @@
           if (cw->extents != None)
              XFixesCopyRegion(disp, damage, cw->extents);
           if (EventDebug(EDBUG_TYPE_COMPMGR3))
-             ERegionShow("ECompMgrWinConfigure old-extents:", damage);
+             ERegionShow("old-extents:", damage);
        }
 
    change_xy = cw->a.x != x || cw->a.y != y;
@@ -1152,26 +1173,35 @@
           cw->extents = win_extents(disp, eo);
      }
 
+#if 0
    if (eo->shown)              /* FIXME - ??? */
      {
        /* Hmmm. Why if not changed? */
        /* Invalidate new window region */
        XFixesUnionRegion(disp, damage, damage, cw->extents);
-       ECompMgrDamageMerge(eo->desk, damage, 1);
      }
+#endif
+
+   if (damage != None)
+      ECompMgrDamageMerge(eo->desk, damage, 1);
 }
 
 static void
 ECompMgrWinConfigure(EObj * eo, XEvent * ev)
 {
    ECmWinInfo         *cw = eo->cmhook;
+   int                 x, y, w, h, bw;
 
    /* Can this change ?!? */
    cw->a.override_redirect = ev->xconfigure.override_redirect;
 
-   ECompMgrWinMoveResize(eo, ev->xconfigure.x, ev->xconfigure.y,
-                        ev->xconfigure.width, ev->xconfigure.height,
-                        ev->xconfigure.border_width);
+   eo->x = x = ev->xconfigure.x;
+   eo->y = y = ev->xconfigure.y;
+   eo->w = w = ev->xconfigure.width;
+   eo->h = h = ev->xconfigure.height;
+   bw = ev->xconfigure.border_width;
+
+   ECompMgrWinMoveResize(eo, x, y, w, h, bw);
 }
 
 static void
@@ -1208,7 +1238,7 @@
 }
 
 void
-ECompMgrWinDel(EObj * eo, Bool gone, Bool do_fade)
+ECompMgrWinDel(EObj * eo, Bool gone, Bool do_fade __UNUSED__)
 {
    ECmWinInfo         *cw = eo->cmhook;
 
@@ -1216,15 +1246,19 @@
       return;
 
    D1printf("ECompMgrWinDel %#lx\n", eo->win);
-   finish_destroy_win(eo, gone);
-   do_fade = False;
 
-   if (eo->type != EOBJ_TYPE_DESK)
+   if (eo->type == EOBJ_TYPE_DESK)
+     {
+       DeskBackgroundPictureFree((Desk *) eo);
+     }
+   else
      {
        if (Conf_compmgr.mode == ECM_MODE_WINDOW)
           XCompositeUnredirectWindow(disp, eo->win, CompositeRedirectManual);
      }
 
+   finish_destroy_win(eo, gone);
+
    EventCallbackUnregister(eo->win, 0, ECompMgrHandleWindowEvent, eo);
 }
 
@@ -1347,7 +1381,7 @@
      {
        eo = lst[i];
 
-       if (eo->desk != desk)
+       if (!eo->shown || eo->desk != desk)
           continue;
 
        D4printf(" - %#lx desk=%d shown=%d\n", eo->win, eo->desk, eo->shown);
@@ -1378,7 +1412,7 @@
 
        cw = eo->cmhook;
 
-       if (!cw /* || !eo->shown */ )
+       if (!cw)
           continue;
 
        D4printf(" - %#lx desk=%d shown=%d vis=%d dam=%d pict=%#lx\n",
@@ -1423,12 +1457,32 @@
 }
 
 static void
+ERegionSubtractOffset(XserverRegion dst, int dx, int dy, XserverRegion src)
+{
+   Display            *dpy = disp;
+   XserverRegion       reg;
+
+   if (dx == 0 && dy == 0)
+     {
+       reg = src;
+     }
+   else
+     {
+       reg = XFixesCreateRegion(dpy, 0, 0);
+       XFixesCopyRegion(dpy, reg, src);
+       XFixesTranslateRegion(dpy, reg, dx, dy);
+     }
+   XFixesSubtractRegion(dpy, dst, dst, reg);
+   if (reg != src)
+      XFixesDestroyRegion(dpy, reg);
+}
+
+static void
 ECompMgrRepaintObj(Picture pbuf, XserverRegion region, EObj * eo, int mode)
 {
    Display            *dpy = disp;
    ECmWinInfo         *cw;
    Desk               *d = DeskGet(eo->desk);
-   XserverRegion       breg;   /* Border region in screen coordinates */
    int                 x, y;
 
    cw = eo->cmhook;
@@ -1437,20 +1491,19 @@
    ECompMgrWinSetPicts(eo);
 #endif
 
-   D2printf("ECompMgrRepaintObj %d %#lx %d %#lx\n", mode, eo->win, cw->mode,
-           cw->picture);
+   D2printf("ECompMgrRepaintObj mode=%d %#lx %s\n", mode, eo->win, eo->name);
 
    /* Region of shaped window in screen coordinates */
    if (!cw->borderSize)
       cw->borderSize = border_size(eo);
    if (EventDebug(EDBUG_TYPE_COMPMGR3))
-      ERegionShow("Window borderSize", cw->borderSize);
+      ERegionShow("borderSize", cw->borderSize);
 
    /* Region of window in screen coordinates, including shadows */
    if (!cw->extents)
       cw->extents = win_extents(dpy, eo);
    if (EventDebug(EDBUG_TYPE_COMPMGR3))
-      ERegionShow("Window extents", cw->extents);
+      ERegionShow("extents", cw->extents);
 
    x = EoGetX(d);
    y = EoGetY(d);
@@ -1465,24 +1518,13 @@
        switch (cw->mode)
          {
          case WINDOW_SOLID:
-            D2printf("ECompMgrRepaintObj %d %#lx %d %#lx d=%d l=%d: %s\n",
-                     mode, eo->win, cw->mode, cw->picture, eo->desk,
-                     eo->ilayer, eo->name);
+            D2printf(" * solid pict=%#lx d=%d l=%d\n",
+                     cw->picture, eo->desk, eo->ilayer);
             XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, region);
             XRenderComposite(dpy, PictOpSrc, cw->picture, None, pbuf,
                              0, 0, 0, 0, x + cw->rcx, y + cw->rcy, cw->rcw,
                              cw->rch);
-            if (x == 0 && y == 0)
-              {
-                 breg = cw->borderSize;
-              }
-            else
-              {
-                 breg = XFixesCreateRegion(dpy, 0, 0);
-                 XFixesCopyRegion(dpy, breg, cw->borderSize);
-                 XFixesTranslateRegion(disp, breg, x, y);
-              }
-            XFixesSubtractRegion(dpy, region, region, breg);
+            ERegionSubtractOffset(region, x, y, cw->borderSize);
             break;
          }
      }
@@ -1494,9 +1536,8 @@
          {
          case WINDOW_TRANS:
          case WINDOW_ARGB:
-            D2printf("ECompMgrRepaintObj %d %#lx %d %#lx d=%d l=%d: %s\n",
-                     mode, eo->win, cw->mode, cw->picture, eo->desk,
-                     eo->ilayer, eo->name);
+            D2printf(" * trans pict=%#lx d=%d l=%d\n",
+                     cw->picture, eo->desk, eo->ilayer);
             XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, cw->clip);
             ECompMgrCheckAlphaMask(cw);
             XRenderComposite(dpy, PictOpOver, cw->picture, cw->alphaPict, pbuf,
@@ -1515,26 +1556,26 @@
                cw->shadowPict = EPictureCreateSolid(True,
                                                     (double)cw->opacity /
                                                     OPAQUE * 0.3, 0, 0, 0);
-            XFixesSubtractRegion(dpy, cw->clip, cw->clip, cw->borderSize);
+            ERegionSubtractOffset(cw->clip, x, y, cw->borderSize);
             XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, cw->clip);
             XRenderComposite(dpy, PictOpOver,
                              cw->shadowPict ? cw->
                              shadowPict : transBlackPicture, cw->picture, pbuf,
-                             0, 0, 0, 0, cw->a.x + cw->shadow_dx,
-                             cw->a.y + cw->shadow_dy, cw->shadow_width,
+                             0, 0, 0, 0, x + cw->rcx + cw->shadow_dx,
+                             y + cw->rcy + cw->shadow_dy, cw->shadow_width,
                              cw->shadow_height);
             break;
          case ECM_SHADOWS_BLURRED:
-            if (cw->shadow)
-              {
-                 XFixesSubtractRegion(dpy, cw->clip, cw->clip, cw->borderSize);
-                 XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, cw->clip);
-                 XRenderComposite(dpy, PictOpOver, blackPicture, cw->shadow,
-                                  pbuf, 0, 0, 0, 0,
-                                  cw->a.x + cw->shadow_dx,
-                                  cw->a.y + cw->shadow_dy, cw->shadow_width,
-                                  cw->shadow_height);
-              }
+            if (cw->shadow == None)
+               break;
+
+            ERegionSubtractOffset(cw->clip, x, y, cw->borderSize);
+            XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, cw->clip);
+            XRenderComposite(dpy, PictOpOver, blackPicture, cw->shadow,
+                             pbuf, 0, 0, 0, 0,
+                             x + cw->rcx + cw->shadow_dx,
+                             y + cw->rcy + cw->shadow_dy, cw->shadow_width,
+                             cw->shadow_height);
             break;
          }
 #endif
@@ -1559,7 +1600,7 @@
    D2printf("ECompMgrRepaint rootBuffer=%#lx rootPicture=%#lx\n",
            rootBuffer, rootPicture);
    if (EventDebug(EDBUG_TYPE_COMPMGR3))
-      ERegionShow("ECompMgrRepaint", region);
+      ERegionShow("allDamage", region);
 
    if (!rootBuffer)
       rootBuffer = EPictureCreateBuffer(VRoot.win, VRoot.w, VRoot.h,
@@ -1578,28 +1619,15 @@
        eo = ((ECmWinInfo *) (eo->cmhook))->next)
       ECompMgrRepaintObj(pbuf, region, eo, 0);
 
-#if 1                          /* FIXME- New code+?? */
    if (EventDebug(EDBUG_TYPE_COMPMGR2))
-      ERegionShow("ECompMgrRepaint-2", region);
-   {
-      /* Draw desktop background picture */
-      pict = DeskBackgroundPictureGet(d);
-      D1printf("ECompMgrRepaint desk picture=%#lx\n", pict);
-#if 1
-      XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, region);
-      XRenderComposite(dpy, PictOpSrc, pict, None, pbuf,
-                      0, 0, 0, 0, 0, 0, VRoot.w, VRoot.h);
-#endif
-   }
+      ERegionShow("after opaque", region);
 
-#else /* FIXME - ??? */
    /* Repaint background, clipped by damage region and opaque windows */
    pict = DeskBackgroundPictureGet(d);
    D1printf("ECompMgrRepaint desk picture=%#lx\n", pict);
    XFixesSetPictureClipRegion(dpy, pbuf, 0, 0, region);
    XRenderComposite(dpy, PictOpSrc, pict, None, pbuf,
                    0, 0, 0, 0, 0, 0, VRoot.w, VRoot.h);
-#endif /* FIXME - ??? */
 
    /* Paint trans windows and shadows bottom up */
    for (eo = Mode_compmgr.eo_last; eo; eo = ((ECmWinInfo *) 
(eo->cmhook))->prev)
@@ -1638,6 +1666,7 @@
    return;
 }
 
+#if 0                          /* FIXME - Need this? */
 static void
 ECompMgrRootExpose(void *prm __UNUSED__, XEvent * ev)
 {
@@ -1682,6 +1711,7 @@
        n_expose = 0;
      }
 }
+#endif
 
 static void
 ECompMgrDeskChanged(int desk)
@@ -1790,8 +1820,6 @@
 
    EventCallbackRegister(VRoot.win, 0, ECompMgrHandleRootEvent, NULL);
 
-   ECompMgrWinNew(&DeskGet(0)->o);
-
    lst = EobjListStackGet(&num);
    for (i = 0; i < num; i++)
      {
@@ -1912,7 +1940,11 @@
        ECompMgrWinMap(eo);
        break;
      case UnmapNotify:
-       ECompMgrWinUnmap(eo);
+       if (eo->type == EOBJ_TYPE_EXT && eo->cmhook)
+         {
+            ECompMgrWinUnmap(eo);
+            eo->shown = 0;
+         }
        break;
 
      case CirculateNotify:
@@ -1945,9 +1977,11 @@
        break;
      case DestroyNotify:
        eo = EobjListStackFind(ev->xdestroywindow.window);
-       if (eo && eo->cmhook)
-          ECompMgrWinDel(eo, True, True);
-       EobjUnregister(ev->xdestroywindow.window);
+       if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
+         {
+            ECompMgrWinDel(eo, True, True);
+            EobjUnregister(ev->xdestroywindow.window);
+         }
        break;
 
 #if 0
@@ -1976,28 +2010,30 @@
        else
          {
             eo = EobjListStackFind(ev->xconfigure.window);
-            if (eo && eo->cmhook)
-               ECompMgrWinConfigure(eo, ev);
+            if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
+              {
+                 ECompMgrWinConfigure(eo, ev);
+              }
          }
        break;
 
      case MapNotify:
-#if 0                          /* FIXME */
        eo = EobjListStackFind(ev->xmap.window);
        if (!eo)
           eo = EobjRegister(ev->xmap.window, EOBJ_TYPE_EXT);
-       else
-          EobjListStackRaise(eo);      /* FIXME - Use 
Configure/CirculateNotify */
-       if (eo)
-          ECompMgrWinMap(eo);
-#endif
+       if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
+         {
+            eo->shown = 1;
+            ECompMgrWinMap(eo);
+         }
        break;
      case UnmapNotify:
-#if 0                          /* FIXME */
        eo = EobjListStackFind(ev->xunmap.window);
-       if (eo && eo->cmhook)
-          ECompMgrWinUnmap(eo);
-#endif
+       if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
+         {
+            ECompMgrWinUnmap(eo);
+            eo->shown = 0;
+         }
        break;
 
      case CirculateNotify:
@@ -2007,7 +2043,9 @@
        break;
 
      case Expose:
+#if 0                          /* FIXME - Need this? */
        ECompMgrRootExpose(prm, ev);
+#endif
        break;
      }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- events.c    23 Apr 2005 07:31:15 -0000      1.83
+++ events.c    25 Apr 2005 22:07:37 -0000      1.84
@@ -652,6 +652,8 @@
    evq_num = 0;
    count = EventsProcess(&evq_ptr, &evq_num);
 
+   ModulesSignal(ESIGNAL_IDLE, NULL);
+
    if (count > 0)
       XFlush(disp);
 
@@ -664,8 +666,6 @@
        evq_ptr = NULL;
      }
 
-   ModulesSignal(ESIGNAL_IDLE, NULL);
-
    FD_ZERO(&fdset);
    FD_SET(xfd, &fdset);
    if (smfd >= 0)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/mod-misc.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- mod-misc.c  30 Mar 2005 22:51:02 -0000      1.14
+++ mod-misc.c  25 Apr 2005 22:07:37 -0000      1.15
@@ -58,11 +58,11 @@
    &ModAclass,
    &ModBackgrounds,
    &ModButtons,
-   &ModDesktops,
 #if USE_COMPOSITE
    &ModCompMgr,
 #endif
    &ModCursors,
+   &ModDesktops,
    &ModEwins,
    &ModEffects,
    &ModFocus,




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to