summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/compdisplay.h6
-rw-r--r--include/compiz-core.h106
-rw-r--r--include/compmatch.h52
3 files changed, 58 insertions, 106 deletions
diff --git a/include/compdisplay.h b/include/compdisplay.h
index 7add2e5..11820af 100644
--- a/include/compdisplay.h
+++ b/include/compdisplay.h
@@ -2,6 +2,8 @@
#define _COMPDISPLAY_H
#include <list>
+
+#include <compmatch.h>
#include "wrapable.h"
class CompDisplay;
@@ -25,7 +27,7 @@ class DisplayInterface : public WrapableInterface<CompDisplay> {
const char *, int, int, int, void *);
- WRAPABLE_DEF(void, matchInitExp, CompMatchExp *, const char *);
+ WRAPABLE_DEF(CompMatch::Expression *, matchInitExp, const CompString);
WRAPABLE_DEF(void, matchExpHandlerChanged)
WRAPABLE_DEF(void, matchPropertyChanged, CompWindow *)
@@ -366,7 +368,7 @@ class CompDisplay : public WrapableHandler<DisplayInterface>, public CompObject
const char *, int, int, int, void *)
- WRAPABLE_HND(void, matchInitExp, CompMatchExp *, const char *);
+ WRAPABLE_HND(CompMatch::Expression *, matchInitExp, const CompString);
WRAPABLE_HND(void, matchExpHandlerChanged)
WRAPABLE_HND(void, matchPropertyChanged, CompWindow *)
diff --git a/include/compiz-core.h b/include/compiz-core.h
index b3dd1c6..d80b4a7 100644
--- a/include/compiz-core.h
+++ b/include/compiz-core.h
@@ -86,7 +86,7 @@ typedef struct _CompProgram CompProgram;
typedef struct _CompFunction CompFunction;
typedef struct _CompFunctionData CompFunctionData;
typedef struct _FragmentAttrib FragmentAttrib;
-typedef struct _CompMatch CompMatch;
+class CompMatch;
class CompOutput;
typedef struct _CompWalker CompWalker;
@@ -274,13 +274,7 @@ struct _CompAction {
CompPrivate priv;
};
-typedef union _CompMatchOp CompMatchOp;
-struct _CompMatch {
- CompDisplay *display;
- CompMatchOp *op;
- int nOp;
-};
typedef struct {
CompOptionType type;
@@ -295,7 +289,7 @@ union _CompOptionValue {
char *s;
unsigned short c[4];
CompAction action;
- CompMatch match;
+ CompMatch *match;
CompListValue list;
};
@@ -429,52 +423,7 @@ isActionOption (CompOption *option);
typedef void (*ForEachWindowProc) (CompWindow *window,
void *closure);
-#define MATCH_OP_AND_MASK (1 << 0)
-#define MATCH_OP_NOT_MASK (1 << 1)
-typedef enum {
- CompMatchOpTypeGroup,
- CompMatchOpTypeExp
-} CompMatchOpType;
-
-typedef struct _CompMatchAnyOp {
- CompMatchOpType type;
- int flags;
-} CompMatchAnyOp;
-
-typedef struct _CompMatchGroupOp {
- CompMatchOpType type;
- int flags;
- CompMatchOp *op;
- int nOp;
-} CompMatchGroupOp;
-
-typedef void (*CompMatchExpFiniProc) (CompDisplay *display,
- CompPrivate priv);
-
-typedef Bool (*CompMatchExpEvalProc) (CompDisplay *display,
- CompWindow *window,
- CompPrivate priv);
-
-typedef struct _CompMatchExp {
- CompMatchExpFiniProc fini;
- CompMatchExpEvalProc eval;
- CompPrivate priv;
-} CompMatchExp;
-
-typedef struct _CompMatchExpOp {
- CompMatchOpType type;
- int flags;
- char *value;
- CompMatchExp e;
-} CompMatchExpOp;
-
-union _CompMatchOp {
- CompMatchOpType type;
- CompMatchAnyOp any;
- CompMatchGroupOp group;
- CompMatchExpOp exp;
-};
bool
@@ -896,57 +845,6 @@ matrixGetIdentity (CompTransform *m);
/* match.c */
-void
-matchInit (CompMatch *match);
-
-void
-matchFini (CompMatch *match);
-
-Bool
-matchEqual (CompMatch *m1,
- CompMatch *m2);
-
-Bool
-matchCopy (CompMatch *dst,
- CompMatch *src);
-
-Bool
-matchAddGroup (CompMatch *match,
- int flags,
- CompMatch *group);
-
-Bool
-matchAddExp (CompMatch *match,
- int flags,
- const char *value);
-
-void
-matchAddFromString (CompMatch *match,
- const char *str);
-
-char *
-matchToString (CompMatch *match);
-
-void
-matchUpdate (CompDisplay *display,
- CompMatch *match);
-
-Bool
-matchEval (CompMatch *match,
- CompWindow *window);
-
-void
-matchInitExp (CompDisplay *display,
- CompMatchExp *exp,
- const char *value);
-
-void
-matchExpHandlerChanged (CompDisplay *display);
-
-void
-matchPropertyChanged (CompDisplay *display,
- CompWindow *window);
-
/* metadata.c */
diff --git a/include/compmatch.h b/include/compmatch.h
new file mode 100644
index 0000000..8582b2e
--- /dev/null
+++ b/include/compmatch.h
@@ -0,0 +1,52 @@
+#ifndef _COMPMATCH_H
+#define _COMPMATCH_H
+
+#include <compiz-core.h>
+
+class PrivateMatch;
+class CompWindow;
+class CompDisplay;
+
+class CompMatch {
+ public:
+
+ class Expression {
+ public:
+ virtual bool evaluate (CompWindow *window) = 0;
+ };
+
+ public:
+ CompMatch ();
+ CompMatch (const CompString);
+ CompMatch (const CompMatch &);
+ ~CompMatch ();
+
+ void update (CompDisplay *display);
+ bool evaluate (CompWindow *window);
+
+ CompString toString ();
+
+ CompDisplay *display ();
+
+ CompMatch & operator= (const CompMatch &);
+ CompMatch & operator&= (const CompMatch &);
+ CompMatch & operator|= (const CompMatch &);
+
+ const CompMatch & operator& (const CompMatch &);
+ const CompMatch & operator| (const CompMatch &);
+ const CompMatch & operator! ();
+
+ CompMatch & operator= (const CompString &);
+ CompMatch & operator&= (const CompString &);
+ CompMatch & operator|= (const CompString &);
+
+ const CompMatch & operator& (const CompString &);
+ const CompMatch & operator| (const CompString &);
+
+ bool operator== (const CompMatch &);
+
+ private:
+ PrivateMatch *priv;
+};
+
+#endif \ No newline at end of file