summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2007-06-01 12:21:31 -0400
committerDavid Reveman <davidr@novell.com>2007-06-01 12:21:31 -0400
commitf933ada81fa0a58911a8cb7d973a392a5ba3a2e9 (patch)
treed405e042bc9b03e2b3fc245c20bb70a5e3f0e932
parent22481bc09476cb0d9271f119eb9e8ef7a10fbc1e (diff)
downloadcompiz-core-doc-f933ada81fa0a58911a8cb7d973a392a5ba3a2e9.tar.gz
compiz-core-doc-f933ada81fa0a58911a8cb7d973a392a5ba3a2e9.tar.bz2
Add CompWalker interface.
-rw-r--r--include/compiz.h22
-rw-r--r--src/screen.c37
2 files changed, 59 insertions, 0 deletions
diff --git a/include/compiz.h b/include/compiz.h
index 2e0808c..76f3f88 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -90,6 +90,7 @@ typedef struct _CompCursor CompCursor;
typedef struct _CompMatch CompMatch;
typedef struct _CompMetadata CompMetadata;
typedef struct _CompOutput CompOutput;
+typedef struct _CompWalker CompWalker;
/* virtual modifiers */
@@ -1228,6 +1229,22 @@ typedef void (*ApplyScreenTransformProc) (CompScreen *screen,
CompOutput *output,
CompTransform *transform);
+typedef void (*WalkerFiniProc) (CompScreen *screen,
+ CompWalker *walker);
+
+typedef CompWindow *(*WalkInitProc) (CompScreen *screen);
+typedef CompWindow *(*WalkStepProc) (CompWindow *window);
+
+struct _CompWalker {
+ WalkerFiniProc fini;
+ CompPrivate priv;
+
+ WalkInitProc first;
+ WalkInitProc last;
+ WalkStepProc next;
+ WalkStepProc prev;
+};
+
/*
window paint flags
@@ -1703,6 +1720,9 @@ typedef void (*WindowAddNotifyProc) (CompWindow *window);
typedef void (*OutputChangeNotifyProc) (CompScreen *screen);
+typedef void (*InitWindowWalkerProc) (CompScreen *screen,
+ CompWalker *walker);
+
#define COMP_SCREEN_DAMAGE_PENDING_MASK (1 << 0)
#define COMP_SCREEN_DAMAGE_REGION_MASK (1 << 1)
#define COMP_SCREEN_DAMAGE_ALL_MASK (1 << 2)
@@ -2015,6 +2035,8 @@ struct _CompScreen {
OutputChangeNotifyProc outputChangeNotify;
+ InitWindowWalkerProc initWindowWalker;
+
CompPrivate *privates;
};
diff --git a/src/screen.c b/src/screen.c
index d3e0d48..a3d39a5 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1359,6 +1359,41 @@ leaveShowDesktopMode (CompScreen *s,
(unsigned char *) &data, 1);
}
+static CompWindow *
+walkFirst (CompScreen *s)
+{
+ return s->windows;
+}
+
+static CompWindow *
+walkLast (CompScreen *s)
+{
+ return s->reverseWindows;
+}
+
+static CompWindow *
+walkNext (CompWindow *w)
+{
+ return w->next;
+}
+
+static CompWindow *
+walkPrev (CompWindow *w)
+{
+ return w->prev;
+}
+
+static void
+initWindowWalker (CompScreen *screen,
+ CompWalker *walker)
+{
+ walker->fini = NULL;
+ walker->first = walkFirst;
+ walker->last = walkLast;
+ walker->next = walkNext;
+ walker->prev = walkPrev;
+}
+
Bool
addScreen (CompDisplay *display,
int screenNum,
@@ -1554,6 +1589,8 @@ addScreen (CompDisplay *display,
s->outputChangeNotify = outputChangeNotify;
+ s->initWindowWalker = initWindowWalker;
+
s->getProcAddress = 0;
if (!XGetWindowAttributes (dpy, s->root, &s->attrib))