Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        ecompmgr.c ecompmgr.h eobj.c x.c 


Log Message:
Composite manager - Invalidate named pixmap on unmap, cleanups,
 experimental override redirect handling modes.

===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- ecompmgr.c  6 Aug 2005 10:31:35 -0000       1.49
+++ ecompmgr.c  7 Aug 2005 10:51:07 -0000       1.50
@@ -71,8 +71,9 @@
 #define INV_SIZE    0x02
 #define INV_OPACITY 0x04
 #define INV_SHADOW  0x08
+#define INV_PIXMAP  0x10
 #define INV_GEOM    (INV_POS | INV_SIZE)
-#define INV_ALL     (INV_POS | INV_SIZE | INV_OPACITY | INV_SHADOW)
+#define INV_ALL     (INV_POS | INV_SIZE | INV_OPACITY | INV_SHADOW | 
INV_PIXMAP)
 
 typedef struct
 {
@@ -123,6 +124,11 @@
 #define ECM_SHADOWS_BLURRED  2 /* use window extents for shadow, blurred */
 #endif
 
+#define ECM_OR_UNMANAGED     0
+#define ECM_OR_ON_MAP        1
+#define ECM_OR_ON_MAPUNMAP   2
+#define ECM_OR_ON_CREATE     3
+
 static struct
 {
    char                enable;
@@ -131,7 +137,11 @@
    int                 mode;
    int                 shadow;
    int                 shadow_radius;
-   int                 override_redirect_opacity;
+   struct
+   {
+      char                mode;
+      int                 opacity;
+   } override_redirect;
 } Conf_compmgr;
 
 /*
@@ -144,7 +154,6 @@
 
 static struct
 {
-   char               *args;
    char                active;
    char                use_pixmap;
    EObj               *eo_first;
@@ -885,7 +894,7 @@
    if (!cw)
       return;
 
-   if ((what & INV_SIZE) && cw->pixmap != None)
+   if ((what & (INV_SIZE | INV_PIXMAP)) && cw->pixmap != None)
      {
        XFreePixmap(dpy, cw->pixmap);
        cw->pixmap = None;
@@ -1013,9 +1022,7 @@
    if (cw->extents != None)
       ECompMgrDamageMergeObject(eo, cw->extents, 0);
 
-#if 0                          /* FIXME - Invalidate stuff? */
-   ECompMgrWinInvalidate(eo, INV_SIZE);
-#endif
+   ECompMgrWinInvalidate(eo, INV_PIXMAP);
 }
 
 static void
@@ -1098,7 +1105,7 @@
 
    if (eo->type == EOBJ_TYPE_EXT)
       eo->opacity =
-        (unsigned int)(Conf_compmgr.override_redirect_opacity << 24);
+        (unsigned int)(Conf_compmgr.override_redirect.opacity << 24);
    if (eo->opacity == 0)
       eo->opacity = 0xFFFFFFFF;
 
@@ -2025,6 +2032,7 @@
 static void
 ECompMgrHandleRootEvent(XEvent * ev, void *prm)
 {
+   Window              xwin;
    EObj               *eo;
 
    D2printf("ECompMgrHandleRootEvent: type=%d\n", ev->type);
@@ -2032,36 +2040,30 @@
    switch (ev->type)
      {
      case CreateNotify:
-#if 0
+       xwin = ev->xcreatewindow.window;
       case_CreateNotify:
-       eo = EobjListStackFind(ev->xcreatewindow.window);
-       if (eo)
-          ECompMgrWinNew(eo);
-#endif
+       if (!Conf_compmgr.override_redirect.mode != ECM_OR_ON_CREATE)
+          break;
+       eo = EobjListStackFind(xwin);
+       if (!eo)
+          EobjRegister(xwin, EOBJ_TYPE_EXT);
        break;
+
      case DestroyNotify:
-       eo = EobjListStackFind(ev->xdestroywindow.window);
+       xwin = ev->xdestroywindow.window;
+      case_DestroyNotify:
+       eo = EobjListStackFind(xwin);
        if (eo && eo->type == EOBJ_TYPE_EXT)
           EobjUnregister(eo);
        break;
 
-#if 0
      case ReparentNotify:
-       if (Conf_compmgr.mode != ECM_MODE_WINDOW)
-         {
-            eo = EobjListStackFind(ev->xreparent.window);
-            if (eo && eo->cmhook)
-               ECompMgrWinUnmap(eo);
-         }
-#if 0
+       xwin = ev->xreparent.window;
        if (ev->xreparent.parent == VRoot.win)
           goto case_CreateNotify;
-       eo = EobjListStackFind(ev->xreparent.window);
-       if (eo)
-          ECompMgrWinDel(eo);
-#endif
+       else
+          goto case_DestroyNotify;
        break;
-#endif
 
      case ConfigureNotify:
        if (ev->xconfigure.window == VRoot.win)
@@ -2080,7 +2082,7 @@
 
      case MapNotify:
        eo = EobjListStackFind(ev->xmap.window);
-       if (!eo)
+       if (!eo && Conf_compmgr.override_redirect.mode)
           eo = EobjRegister(ev->xmap.window, EOBJ_TYPE_EXT);
        if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
          {
@@ -2088,12 +2090,23 @@
             ECompMgrWinMap(eo);
          }
        break;
+
      case UnmapNotify:
        eo = EobjListStackFind(ev->xunmap.window);
        if (eo && eo->type == EOBJ_TYPE_EXT && eo->cmhook)
          {
-            ECompMgrWinUnmap(eo);
-            eo->shown = 0;
+#if 0
+            /* No. Unredirection seems to cause map/unmap => loop */
+            if (Conf_compmgr.override_redirect.mode == ECM_OR_ON_MAPUNMAP)
+              {
+                 EobjUnregister(eo);
+              }
+            else
+#endif
+              {
+                 ECompMgrWinUnmap(eo);
+                 eo->shown = 0;
+              }
          }
        break;
 
@@ -2112,12 +2125,6 @@
      }
 }
 
-void
-ECompMgrParseArgs(const char *args)
-{
-   Mode_compmgr.args = Estrdup(args);
-}
-
 /*
  * Module functions
  */
@@ -2151,26 +2158,6 @@
    /* FIXME - Hardcode for now. */
    Conf_compmgr.mode = ECM_MODE_WINDOW;
 
-   if (Mode_compmgr.args)
-     {
-       switch (Mode_compmgr.args[0])
-         {
-         case '0':
-            Conf_compmgr.mode = ECM_MODE_OFF;
-            break;
-         case '1':
-            Conf_compmgr.mode = ECM_MODE_ROOT;
-            break;
-         case '2':
-            Conf_compmgr.mode = ECM_MODE_WINDOW;
-            break;
-         case '3':
-            Conf_compmgr.mode = ECM_MODE_AUTO;
-            break;
-         }
-       _EFREE(Mode_compmgr.args);
-     }
-
  done:
    if (Conf_compmgr.mode == ECM_MODE_OFF)
       Conf_compmgr.enable = 0;
@@ -2266,7 +2253,8 @@
    CFG_ITEM_INT(Conf_compmgr, shadow_radius, 12),
    CFG_ITEM_BOOL(Conf_compmgr, resize_fix_enable, 0),
    CFG_ITEM_BOOL(Conf_compmgr, use_name_pixmap, 0),
-   CFG_ITEM_INT(Conf_compmgr, override_redirect_opacity, 240),
+   CFG_ITEM_BOOL(Conf_compmgr, override_redirect.mode, 1),
+   CFG_ITEM_INT(Conf_compmgr, override_redirect.opacity, 240),
 };
 #define N_CFG_ITEMS (sizeof(CompMgrCfgItems)/sizeof(CfgItem))
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ecompmgr.h  5 Jun 2005 15:15:59 -0000       1.15
+++ ecompmgr.h  7 Aug 2005 10:51:07 -0000       1.16
@@ -33,7 +33,6 @@
 
 int                 EVisualIsARGB(Visual * vis);
 
-void                ECompMgrParseArgs(const char *args);
 void                ECompMgrRepaint(void);
 
 void                ECompMgrWinNew(EObj * eo);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/eobj.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- eobj.c      2 Aug 2005 17:06:52 -0000       1.42
+++ eobj.c      7 Aug 2005 10:51:07 -0000       1.43
@@ -246,6 +246,9 @@
    if (!XGetWindowAttributes(disp, win, &attr))
       return NULL;
 
+   if (type == EOBJ_TYPE_EXT && !attr.override_redirect)
+      return NULL;
+
    eo = Ecalloc(1, sizeof(EObj));
    if (!eo)
       return eo;
@@ -260,6 +263,10 @@
        EobjSetLayer(eo, 4);
      }
 #endif
+#if 0
+   Eprintf("EobjRegister: %#lx type=%d or=%d: %s\n", win, type,
+          attr.override_redirect, eo->name);
+#endif
 
    return eo;
 }
@@ -267,6 +274,9 @@
 void
 EobjUnregister(EObj * eo)
 {
+#if 0
+   Eprintf("EobjUnregister: %#lx type=%d: %s\n", eo->win, eo->type, eo->name);
+#endif
    EobjDestroy(eo);
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -3 -r1.102 -r1.103
--- x.c 24 Jul 2005 18:29:50 -0000      1.102
+++ x.c 7 Aug 2005 10:51:07 -0000       1.103
@@ -290,7 +290,7 @@
    XSetWindowAttributes attr;
 
    attr.backing_store = NotUseful;
-   attr.override_redirect = True;
+   attr.override_redirect = False;
    attr.colormap = VRoot.cmap;
    attr.border_pixel = 0;
 /*   attr.background_pixel = 0; */
@@ -319,7 +319,7 @@
    XSetWindowAttributes attr;
 
    attr.backing_store = NotUseful;
-   attr.override_redirect = True;
+   attr.override_redirect = False;
    attr.border_pixel = 0;
    attr.colormap = c_attr->colormap;
 /*   attr.background_pixel = 0; */
@@ -365,7 +365,7 @@
    XSetWindowAttributes attr;
 
    attr.backing_store = NotUseful;
-   attr.override_redirect = True;
+   attr.override_redirect = False;
    attr.colormap = VRoot.cmap;
    attr.border_pixel = 0;
    attr.background_pixel = 0;
@@ -1543,7 +1543,7 @@
 
    if (win_ts == None)
      {
-       attr.override_redirect = 1;
+       attr.override_redirect = False;
        win_ts = XCreateWindow(disp, VRoot.win, -100, -100, 1, 1, 0,
                               CopyFromParent, InputOnly, CopyFromParent,
                               CWOverrideRedirect, &attr);




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to