Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        ecompmgr.c windowmatch.c windowmatch.h 


Log Message:
Enable window matches on override-redirect windows (for compositing options).

===================================================================
RCS file: /cvs/e/e16/e/src/ecompmgr.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -3 -r1.131 -r1.132
--- ecompmgr.c  19 Nov 2006 21:55:51 -0000      1.131
+++ ecompmgr.c  19 Nov 2006 22:24:59 -0000      1.132
@@ -37,6 +37,7 @@
 #include "hints.h"
 #include "settings.h"
 #include "timers.h"
+#include "windowmatch.h"
 #include "xwin.h"
 
 #include <stdlib.h>
@@ -1475,6 +1476,9 @@
      {
        ESelectInputAdd(eo->win, VisibilityChangeMask);
      }
+
+   if (eo->type != EOBJ_TYPE_EWIN)
+      WindowMatchEobjOps(eo);
 
    cw->opacity = 0xdeadbeef;
    ECompMgrWinSetOpacity(eo, eo->opacity);
===================================================================
RCS file: /cvs/e/e16/e/src/windowmatch.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- windowmatch.c       19 Nov 2006 21:55:52 -0000      1.53
+++ windowmatch.c       19 Nov 2006 22:24:59 -0000      1.54
@@ -68,7 +68,7 @@
 #define MATCH_OP_ICON           2
 #define MATCH_OP_WINOP          3
 
-static int          WindowMatchEwinOpsParse(EWin * ewin, const char *ops);
+static int          WindowMatchEobjOpsParse(EObj * eo, const char *ops);
 
 static Ecore_List  *wm_list = NULL;
 
@@ -421,7 +421,7 @@
        break;
 
      case MATCH_OP_WINOP:
-       if (WindowMatchEwinOpsParse(NULL, args))
+       if (WindowMatchEobjOpsParse(NULL, args))
          {
             Eprintf("WindowMatchDecode: Error (%s): %s\n", args, line);
             err = 1;
@@ -519,7 +519,7 @@
 }
 
 static int
-WindowMatchTest(const EWin * ewin, const WindowMatch * wm)
+WindowMatchEwinTest(const WindowMatch * wm, const EWin * ewin)
 {
    int                 match;
 
@@ -579,6 +579,33 @@
    return match;
 }
 
+#if USE_COMPOSITE
+static int
+WindowMatchEobjTest(const WindowMatch * wm, const EObj * eo)
+{
+   int                 match;
+
+   match = 0;
+
+   switch (wm->match)
+     {
+     case MATCH_TYPE_TITLE:
+       return matchregexp(wm->value, eo->name);
+#if 0
+     case MATCH_TYPE_WM_NAME:
+       return matchregexp(wm->value, eo->icccm.wm_res_name);
+
+     case MATCH_TYPE_WM_CLASS:
+       return matchregexp(wm->value, eo->icccm.wm_res_class);
+#endif
+     }
+
+   if (wm->qual)
+      match = !match;
+   return match;
+}
+#endif
+
 typedef struct
 {
    int                 type;
@@ -591,7 +618,7 @@
    const WindowMatch  *wm = data;
    const wmatch_type_data *wmtd = match;
 
-   return !(wm->op == wmtd->type && WindowMatchTest(wmtd->ewin, wm));
+   return !(wm->op == wmtd->type && WindowMatchEwinTest(wm, wmtd->ewin));
 }
 
 static WindowMatch *
@@ -788,8 +815,40 @@
      }
 }
 
+#if USE_COMPOSITE
+static void
+WindowMatchEobjOpsAction(EObj * eo, int op, const char *args)
+{
+   int                 a;
+
+   switch (op)
+     {
+     default:
+       /* We should not get here */
+       return;
+
+     case EWIN_OP_OPACITY:
+       a = atoi(args);
+       eo->opacity = OpacityFromPercent(OpacityFix(a, 100));
+       break;
+
+     case EWIN_OP_FADE:
+       WINOP_SET_BOOL(eo->fade, args);
+       break;
+
+     case EWIN_OP_SHADOW:
+       WINOP_SET_BOOL(eo->shadow, args);
+       break;
+
+     case EWIN_OP_NO_REDIRECT:
+       WINOP_SET_BOOL(eo->noredir, args);
+       break;
+     }
+}
+#endif
+
 static int
-WindowMatchEwinOpsParse(EWin * ewin, const char *ops)
+WindowMatchEobjOpsParse(EObj * eo, const char *ops)
 {
    int                 err, len;
    const WinOp        *wop;
@@ -822,9 +881,17 @@
             break;
          }
 
-       /* If ewin is NULL, we are validating the configuration */
-       if (ewin)
-          WindowMatchEwinOpsAction(ewin, wop->op, p);
+       /* If eo is NULL, we are validating the configuration */
+       if (!eo)
+          continue;
+#if USE_COMPOSITE
+       if (eo->type == EOBJ_TYPE_EWIN)
+          WindowMatchEwinOpsAction((EWin *) eo, wop->op, p);
+       else
+          WindowMatchEobjOpsAction(eo, wop->op, p);
+#else
+       WindowMatchEwinOpsAction((EWin *) eo, wop->op, p);
+#endif
      }
 
    Efree(ops2);
@@ -839,13 +906,30 @@
 
    ECORE_LIST_FOR_EACH(wm_list, wm)
    {
-      if (wm->op != MATCH_OP_WINOP || !WindowMatchTest(ewin, wm))
+      if (wm->op != MATCH_OP_WINOP || !WindowMatchEwinTest(wm, ewin))
+        continue;
+
+      /* Match found - do the ops */
+      WindowMatchEobjOpsParse(EoObj(ewin), wm->args);
+   }
+}
+
+#if USE_COMPOSITE
+void
+WindowMatchEobjOps(EObj * eo)
+{
+   const WindowMatch  *wm;
+
+   ECORE_LIST_FOR_EACH(wm_list, wm)
+   {
+      if (wm->op != MATCH_OP_WINOP || !WindowMatchEobjTest(wm, eo))
         continue;
 
       /* Match found - do the ops */
-      WindowMatchEwinOpsParse(ewin, wm->args);
+      WindowMatchEobjOpsParse(eo, wm->args);
    }
 }
+#endif
 
 /*
  * Winmatch module
===================================================================
RCS file: /cvs/e/e16/e/src/windowmatch.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- windowmatch.h       19 Nov 2006 21:55:52 -0000      1.1
+++ windowmatch.h       19 Nov 2006 22:24:59 -0000      1.2
@@ -31,4 +31,6 @@
 const char         *WindowMatchEwinIcon(const EWin * ewin);
 void                WindowMatchEwinOps(EWin * ewin);
 
+void                WindowMatchEobjOps(EObj * eo);
+
 #endif /* _WINDOWMATCH_H_ */



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to