summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-18 04:22:26 +0000
committerracarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-18 04:22:26 +0000
commit1c73601946ee1779c0a7a49373dd7cb6df88e16f (patch)
treedab16d079da0deb046b18eecd47f1e51bb704495
parent348bae4cdd40a155c87ce7be92e8752ffa74a5aa (diff)
downloadmarex-dev-1c73601946ee1779c0a7a49373dd7cb6df88e16f.tar.gz
marex-dev-1c73601946ee1779c0a7a49373dd7cb6df88e16f.tar.bz2
Run indent.sh on beryl-plugins most of the files had such mixed coding styles it was a real pain to work with
git-svn-id: file:///beryl/trunk@1849 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r--beryl-plugins/src/3d.c1501
-rw-r--r--beryl-plugins/src/animation.c11384
-rw-r--r--beryl-plugins/src/annotate.c2055
-rw-r--r--beryl-plugins/src/bench.c1158
-rw-r--r--beryl-plugins/src/blurfx.c9198
-rw-r--r--beryl-plugins/src/clone.c1312
-rw-r--r--beryl-plugins/src/crashhandler.c401
-rw-r--r--beryl-plugins/src/cube.c5227
-rw-r--r--beryl-plugins/src/decoration.c2370
-rw-r--r--beryl-plugins/src/fade.c541
-rw-r--r--beryl-plugins/src/group.c3120
-rw-r--r--beryl-plugins/src/inputzoom.c1536
-rw-r--r--beryl-plugins/src/move.c1391
-rw-r--r--beryl-plugins/src/neg.c1426
-rw-r--r--beryl-plugins/src/place.c2116
-rw-r--r--beryl-plugins/src/plane.c1550
-rw-r--r--beryl-plugins/src/png.c370
-rw-r--r--beryl-plugins/src/put.c3959
-rw-r--r--beryl-plugins/src/resize.c2348
-rw-r--r--beryl-plugins/src/rotate.c4655
-rw-r--r--beryl-plugins/src/scale.c5570
-rw-r--r--beryl-plugins/src/screenshot.c743
-rw-r--r--beryl-plugins/src/settings.c789
-rw-r--r--beryl-plugins/src/showdesktop.c1714
-rw-r--r--beryl-plugins/src/snow.c1396
-rw-r--r--beryl-plugins/src/splash.c1540
-rw-r--r--beryl-plugins/src/state.c1942
-rw-r--r--beryl-plugins/src/svg.c143
-rw-r--r--beryl-plugins/src/switcher.c3730
-rw-r--r--beryl-plugins/src/trailfocus.c1185
-rw-r--r--beryl-plugins/src/water.c3279
-rw-r--r--beryl-plugins/src/wobbly.c6459
-rw-r--r--beryl-plugins/src/zoom.c1659
33 files changed, 44251 insertions, 43516 deletions
diff --git a/beryl-plugins/src/3d.c b/beryl-plugins/src/3d.c
index 9d49006..c99bbd1 100644
--- a/beryl-plugins/src/3d.c
+++ b/beryl-plugins/src/3d.c
@@ -77,75 +77,80 @@ TODO:
static int displayPrivateIndex;
-typedef struct _revertReorder {
- struct _revertReorder *next;
- struct _revertReorder *prev;
+typedef struct _revertReorder
+{
+ struct _revertReorder *next;
+ struct _revertReorder *prev;
- CompWindow *window;
+ CompWindow *window;
- CompWindow *nextWindow;
- CompWindow *prevWindow;
+ CompWindow *nextWindow;
+ CompWindow *prevWindow;
} RevertReorder;
-typedef enum _MultiMonitorMode {
- Automatic,
- Multiscreen,
- Multiple,
- OneBig,
+typedef enum _MultiMonitorMode
+{
+ Automatic,
+ Multiscreen,
+ Multiple,
+ OneBig,
} MultiMonitorMode;
-typedef struct _tdDisplay {
- int screenPrivateIndex;
+typedef struct _tdDisplay
+{
+ int screenPrivateIndex;
} tdDisplay;
-typedef struct _tdScreen {
+typedef struct _tdScreen
+{
- int windowPrivateIndex;
- CompOption opt[TD_SCREEN_OPTION_NUM];
+ int windowPrivateIndex;
+ CompOption opt[TD_SCREEN_OPTION_NUM];
- Bool tdWindowExists;
- //Bool reorder;
+ Bool tdWindowExists;
+ //Bool reorder;
- PreparePaintScreenProc preparePaintScreen;
+ PreparePaintScreenProc preparePaintScreen;
- PaintTransformedScreenProc paintTransformedScreen;
- PaintScreenProc paintScreen;
+ PaintTransformedScreenProc paintTransformedScreen;
+ PaintScreenProc paintScreen;
- DonePaintScreenProc donePaintScreen;
+ DonePaintScreenProc donePaintScreen;
- PaintWindowProc paintWindow;
+ PaintWindowProc paintWindow;
- RevertReorder *revertReorder;
+ RevertReorder *revertReorder;
- float maxZ;
+ float maxZ;
- int currentViewportNum;
- float xMove;
+ int currentViewportNum;
+ float xMove;
- int mmModeAtom;
- MultiMonitorMode currentMmMode;
+ int mmModeAtom;
+ MultiMonitorMode currentMmMode;
- int insideAtom;
- int manualAtom;
- Bool currentDifferentResolutions;
+ int insideAtom;
+ int manualAtom;
+ Bool currentDifferentResolutions;
- int currentScreenNum;
+ int currentScreenNum;
- float mvm[16]; //ModelView Matrix.
- float pm[16]; //Projection Matrix.
- float pmvm[16]; //Projection * ModelView matrix.
+ float mvm[16]; //ModelView Matrix.
+ float pm[16]; //Projection Matrix.
+ float pmvm[16]; //Projection * ModelView matrix.
- Bool reorderWindowPainting;
- int tmpOutput;
+ Bool reorderWindowPainting;
+ int tmpOutput;
} tdScreen;
-typedef struct _tdWindow {
- float z;
- float currentZ;
+typedef struct _tdWindow
+{
+ float z;
+ float currentZ;
} tdWindow;
@@ -173,68 +178,69 @@ typedef struct _tdWindow {
#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
-static Bool windowIs3D(CompWindow * w)
+static Bool
+windowIs3D (CompWindow * w)
{
- if (w->attrib.override_redirect)
- return FALSE;
+ if (w->attrib.override_redirect)
+ return FALSE;
- if (!(w->shaded || w->attrib.map_state == IsViewable))
- return FALSE;
+ if (!(w->shaded || w->attrib.map_state == IsViewable))
+ return FALSE;
- if (w->
- wmType & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))
- return FALSE;
+ if (w->wmType & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))
+ return FALSE;
- if (w->type & (
- CompWindowTypeDialogMask |
- CompWindowTypeModalDialogMask |
- CompWindowTypeUtilMask |
- CompWindowTypeNormalMask ) )
- return TRUE;
+ if (w->type & (CompWindowTypeDialogMask |
+ CompWindowTypeModalDialogMask |
+ CompWindowTypeUtilMask | CompWindowTypeNormalMask))
+ return TRUE;
- return FALSE;
+ return FALSE;
}
-static Bool differentResolutions(CompScreen * s)
+static Bool
+differentResolutions (CompScreen * s)
{
- //This code is taken from cube plugin... thanks for whoever wrote it (davidr i guess).
+ //This code is taken from cube plugin... thanks for whoever wrote it (davidr i guess).
- BoxPtr pBox0, pBox1;
- int i, j, k;
+ BoxPtr pBox0, pBox1;
+ int i, j, k;
- k = 0;
+ k = 0;
- for (i = 0; i < s->nOutputDev; i++) {
- /* dimensions must match first output */
- if (s->outputDev[i].width != s->outputDev[0].width ||
- s->outputDev[i].height != s->outputDev[0].height)
- continue;
+ for (i = 0; i < s->nOutputDev; i++)
+ {
+ /* dimensions must match first output */
+ if (s->outputDev[i].width != s->outputDev[0].width ||
+ s->outputDev[i].height != s->outputDev[0].height)
+ continue;
- pBox0 = &s->outputDev[0].region.extents;
- pBox1 = &s->outputDev[i].region.extents;
+ pBox0 = &s->outputDev[0].region.extents;
+ pBox1 = &s->outputDev[i].region.extents;
- /* top and bottom line must match first output */
- if (pBox0->y1 != pBox1->y1 || pBox0->y2 != pBox1->y2)
- continue;
+ /* top and bottom line must match first output */
+ if (pBox0->y1 != pBox1->y1 || pBox0->y2 != pBox1->y2)
+ continue;
- k++;
+ k++;
- for (j = 0; j < s->nOutputDev; j++) {
- pBox0 = &s->outputDev[j].region.extents;
+ for (j = 0; j < s->nOutputDev; j++)
+ {
+ pBox0 = &s->outputDev[j].region.extents;
- /* must not intersect other output region */
- if (i != j && pBox0->x2 > pBox1->x1
- && pBox0->x1 < pBox1->x2) {
- k--;
- break;
- }
- }
- }
+ /* must not intersect other output region */
+ if (i != j && pBox0->x2 > pBox1->x1 && pBox0->x1 < pBox1->x2)
+ {
+ k--;
+ break;
+ }
+ }
+ }
- if (k != s->nOutputDev)
- return TRUE;
+ if (k != s->nOutputDev)
+ return TRUE;
- return FALSE;
+ return FALSE;
}
#define REAL_POSITION(x, s) ( (x >= 0)? x: x + (s)->hsize * (s)->width )
@@ -257,815 +263,840 @@ static Bool differentResolutions(CompScreen * s)
#define MULTISCREENCUBE_MODE ( (tds->currentMmMode == Automatic && !tds->currentDifferentResolutions) \
|| tds->currentMmMode == Multiscreen )
-static void reorder(CompScreen * screen)
+static void
+reorder (CompScreen * screen)
{
- CompWindow *firstReordered = NULL;
- CompWindow *next;
- CompWindow *w;
-
- TD_SCREEN(screen);
-
- for (w = screen->windows; w && w != firstReordered; w = next) {
- next = w->next;
-
- if (!windowIs3D(w))
- continue;
-
- if (!firstReordered)
- firstReordered = w;
-
- if (tds->revertReorder) {
- tds->revertReorder->next =
- (RevertReorder *)
- malloc(sizeof(RevertReorder));
- tds->revertReorder->next->prev =
- tds->revertReorder;
-
- tds->revertReorder = tds->revertReorder->next;
- }
-
- else {
- tds->revertReorder =
- (RevertReorder *)
- malloc(sizeof(RevertReorder));
- tds->revertReorder->prev = NULL;
- }
-
- tds->revertReorder->next = NULL;
-
- tds->revertReorder->window = w;
- tds->revertReorder->nextWindow = w->next;
- tds->revertReorder->prevWindow = w->prev;
-
- unhookWindowFromScreen(screen, w);
-
- /*This is a faster replacement to insertWindowIntoScreen (screen, w, screen->reverseWindows->id)
- The original function will go through all the windows until it finds screen->reverseWindows->id
- But we already know where that window is, so it's unnecessary to go through all the windows. */
- if (screen->windows) {
- screen->reverseWindows->next = w;
- w->next = NULL;
- w->prev = screen->reverseWindows;
- screen->reverseWindows = w;
- }
-
- else {
- screen->reverseWindows = screen->windows = w;
- w->prev = w->next = NULL;
- }
- }
+ CompWindow *firstReordered = NULL;
+ CompWindow *next;
+ CompWindow *w;
+
+ TD_SCREEN (screen);
+
+ for (w = screen->windows; w && w != firstReordered; w = next)
+ {
+ next = w->next;
+
+ if (!windowIs3D (w))
+ continue;
+
+ if (!firstReordered)
+ firstReordered = w;
+
+ if (tds->revertReorder)
+ {
+ tds->revertReorder->next =
+ (RevertReorder *) malloc (sizeof (RevertReorder));
+ tds->revertReorder->next->prev = tds->revertReorder;
+
+ tds->revertReorder = tds->revertReorder->next;
+ }
+
+ else
+ {
+ tds->revertReorder =
+ (RevertReorder *) malloc (sizeof (RevertReorder));
+ tds->revertReorder->prev = NULL;
+ }
+
+ tds->revertReorder->next = NULL;
+
+ tds->revertReorder->window = w;
+ tds->revertReorder->nextWindow = w->next;
+ tds->revertReorder->prevWindow = w->prev;
+
+ unhookWindowFromScreen (screen, w);
+
+ /*This is a faster replacement to insertWindowIntoScreen (screen, w, screen->reverseWindows->id)
+ The original function will go through all the windows until it finds screen->reverseWindows->id
+ But we already know where that window is, so it's unnecessary to go through all the windows. */
+ if (screen->windows)
+ {
+ screen->reverseWindows->next = w;
+ w->next = NULL;
+ w->prev = screen->reverseWindows;
+ screen->reverseWindows = w;
+ }
+
+ else
+ {
+ screen->reverseWindows = screen->windows = w;
+ w->prev = w->next = NULL;
+ }
+ }
}
-static void revertReorder(CompScreen * screen)
+static void
+revertReorder (CompScreen * screen)
{
- TD_SCREEN(screen);
-
- while (tds->revertReorder) {
- unhookWindowFromScreen(screen, tds->revertReorder->window);
-
- tds->revertReorder->window->next =
- tds->revertReorder->nextWindow;
- tds->revertReorder->window->prev =
- tds->revertReorder->prevWindow;
-
- if (tds->revertReorder->nextWindow)
- tds->revertReorder->nextWindow->prev =
- tds->revertReorder->window;
- else
- screen->reverseWindows =
- tds->revertReorder->window;
-
- if (tds->revertReorder->prevWindow)
- tds->revertReorder->prevWindow->next =
- tds->revertReorder->window;
- else
- screen->windows = tds->revertReorder->window;
-
- if (tds->revertReorder->prev) {
- tds->revertReorder = tds->revertReorder->prev;
-
- free(tds->revertReorder->next);
- tds->revertReorder->next = NULL;
- }
-
- else {
- free(tds->revertReorder);
- tds->revertReorder = NULL;
- }
- }
+ TD_SCREEN (screen);
+
+ while (tds->revertReorder)
+ {
+ unhookWindowFromScreen (screen, tds->revertReorder->window);
+
+ tds->revertReorder->window->next = tds->revertReorder->nextWindow;
+ tds->revertReorder->window->prev = tds->revertReorder->prevWindow;
+
+ if (tds->revertReorder->nextWindow)
+ tds->revertReorder->nextWindow->prev = tds->revertReorder->window;
+ else
+ screen->reverseWindows = tds->revertReorder->window;
+
+ if (tds->revertReorder->prevWindow)
+ tds->revertReorder->prevWindow->next = tds->revertReorder->window;
+ else
+ screen->windows = tds->revertReorder->window;
+
+ if (tds->revertReorder->prev)
+ {
+ tds->revertReorder = tds->revertReorder->prev;
+
+ free (tds->revertReorder->next);
+ tds->revertReorder->next = NULL;
+ }
+
+ else
+ {
+ free (tds->revertReorder);
+ tds->revertReorder = NULL;
+ }
+ }
}
-static void tdPreparePaintScreen(CompScreen * screen, int msSinceLastPaint)
+static void
+tdPreparePaintScreen (CompScreen * screen, int msSinceLastPaint)
{
- tdWindow **lastInViewport;
+ tdWindow **lastInViewport;
- CompWindow *w;
+ CompWindow *w;
- tdWindow *tdw;
+ tdWindow *tdw;
- int i;
+ int i;
- float maxZoom;
+ float maxZoom;
- TD_SCREEN(screen);
+ TD_SCREEN (screen);
- if (tds->currentMmMode !=
- IPCS_GetInt(IPCS_OBJECT(screen), tds->mmModeAtom)
- || tds->currentViewportNum != screen->hsize
- || tds->currentScreenNum != screen->nOutputDev
- || tds->currentDifferentResolutions !=
- differentResolutions(screen)) {
- tds->currentViewportNum = screen->hsize;
- tds->currentMmMode =
- IPCS_GetInt(IPCS_OBJECT(screen), tds->mmModeAtom);
- tds->currentScreenNum = screen->nOutputDev;
- tds->currentDifferentResolutions =
- differentResolutions(screen);
+ if (tds->currentMmMode !=
+ IPCS_GetInt (IPCS_OBJECT (screen), tds->mmModeAtom)
+ || tds->currentViewportNum != screen->hsize
+ || tds->currentScreenNum != screen->nOutputDev
+ || tds->currentDifferentResolutions != differentResolutions (screen))
+ {
+ tds->currentViewportNum = screen->hsize;
+ tds->currentMmMode =
+ IPCS_GetInt (IPCS_OBJECT (screen), tds->mmModeAtom);
+ tds->currentScreenNum = screen->nOutputDev;
+ tds->currentDifferentResolutions = differentResolutions (screen);
- if (MULTISCREENCUBE_MODE)
- tds->currentViewportNum *= tds->currentScreenNum;
+ if (MULTISCREENCUBE_MODE)
+ tds->currentViewportNum *= tds->currentScreenNum;
- if (tds->currentViewportNum > 2
- && (tds->currentMmMode != Multiple
- || screen->nOutputDev == 1)
- && !(MULTISCREENCUBE_MODE
- && tds->currentDifferentResolutions))
- tds->xMove =
- 1.0f /
- (tan
- (PI * (tds->currentViewportNum - 2.0f) /
- (2.0f * tds->currentViewportNum)));
- else
- tds->xMove = 0.0f;
+ if (tds->currentViewportNum > 2
+ && (tds->currentMmMode != Multiple
+ || screen->nOutputDev == 1)
+ && !(MULTISCREENCUBE_MODE && tds->currentDifferentResolutions))
+ tds->xMove =
+ 1.0f /
+ (tan
+ (PI * (tds->currentViewportNum - 2.0f) /
+ (2.0f * tds->currentViewportNum)));
+ else
+ tds->xMove = 0.0f;
- if (MULTISCREENCUBE_MODE)
- tds->currentViewportNum /= tds->currentScreenNum;
- }
+ if (MULTISCREENCUBE_MODE)
+ tds->currentViewportNum /= tds->currentScreenNum;
+ }
- if (!DO_3D(screen->display,screen)) {
- //tds->reorder = TRUE;
+ if (!DO_3D (screen->display, screen))
+ {
+ //tds->reorder = TRUE;
- if (tds->tdWindowExists)
- reorder(screen);
+ if (tds->tdWindowExists)
+ reorder (screen);
- UNWRAP(tds, screen, preparePaintScreen);
- (*screen->preparePaintScreen) (screen, msSinceLastPaint);
- WRAP(tds, screen, preparePaintScreen,
- tdPreparePaintScreen);
+ UNWRAP (tds, screen, preparePaintScreen);
+ (*screen->preparePaintScreen) (screen, msSinceLastPaint);
+ WRAP (tds, screen, preparePaintScreen, tdPreparePaintScreen);
- return;
- }
+ return;
+ }
- compDisplaySetRequestFlagForPlugin(screen->display, "3d",
- "DRAW_ALL_FACES");
+ compDisplaySetRequestFlagForPlugin (screen->display, "3d",
+ "DRAW_ALL_FACES");
- lastInViewport =
- (tdWindow **) malloc(sizeof(tdWindow *) * screen->hsize);
+ lastInViewport =
+ (tdWindow **) malloc (sizeof (tdWindow *) * screen->hsize);
- for (i = 0; i < screen->hsize; i++)
- lastInViewport[i] = NULL;
+ for (i = 0; i < screen->hsize; i++)
+ lastInViewport[i] = NULL;
- tds->maxZ = 0.0f;
+ tds->maxZ = 0.0f;
- for (w = screen->windows; w; w = w->next) {
- if (!windowIs3D(w))
- continue;
+ for (w = screen->windows; w; w = w->next)
+ {
+ if (!windowIs3D (w))
+ continue;
- tdw = GET_TD_WINDOW(w, tds);
- maxZoom = 0.0f;
+ tdw = GET_TD_WINDOW (w, tds);
+ maxZoom = 0.0f;
- for (i = 0; i < screen->hsize; i++) {
- if (IS_IN_VIEWPORT(w, i)) {
- if (lastInViewport[i]
- && lastInViewport[i]->z > maxZoom)
- maxZoom = lastInViewport[i]->z;
+ for (i = 0; i < screen->hsize; i++)
+ {
+ if (IS_IN_VIEWPORT (w, i))
+ {
+ if (lastInViewport[i] && lastInViewport[i]->z > maxZoom)
+ maxZoom = lastInViewport[i]->z;
- lastInViewport[i] = tdw;
- }
- }
+ lastInViewport[i] = tdw;
+ }
+ }
- tdw->z = maxZoom + SPACE;
+ tdw->z = maxZoom + SPACE;
- if (tdw->z > tds->maxZ)
- tds->maxZ = tdw->z;
- }
+ if (tdw->z > tds->maxZ)
+ tds->maxZ = tdw->z;
+ }
- if (tds->maxZ > 0.0f
- && IPCS_GetBool(IPCS_OBJECT(screen), tds->insideAtom)
- && DISABLE_CAPS)
- compDisplaySetRequestFlagForPlugin(screen->display, "3d",
- "NO_CUBE_CAPS");
+ if (tds->maxZ > 0.0f
+ && IPCS_GetBool (IPCS_OBJECT (screen), tds->insideAtom)
+ && DISABLE_CAPS)
+ compDisplaySetRequestFlagForPlugin (screen->display, "3d",
+ "NO_CUBE_CAPS");
- reorder(screen);
+ reorder (screen);
- //tds->reorder = FALSE;
+ //tds->reorder = FALSE;
- free(lastInViewport);
+ free (lastInViewport);
- UNWRAP(tds, screen, preparePaintScreen);
- (*screen->preparePaintScreen) (screen, msSinceLastPaint);
- WRAP(tds, screen, preparePaintScreen, tdPreparePaintScreen);
+ UNWRAP (tds, screen, preparePaintScreen);
+ (*screen->preparePaintScreen) (screen, msSinceLastPaint);
+ WRAP (tds, screen, preparePaintScreen, tdPreparePaintScreen);
}
static Bool
-tdPaintWindow(CompWindow * w,
- const WindowPaintAttrib * attrib,
- Region region, unsigned int mask)
+tdPaintWindow (CompWindow * w,
+ const WindowPaintAttrib * attrib,
+ Region region, unsigned int mask)
{
- Bool status;
- Bool disabledCull = FALSE;
-
- TD_SCREEN(w->screen);
- TD_WINDOW(w);
-
- int output = tds->tmpOutput;
- int width;
-
- if (output < w->screen->nOutputDev && MULTISCREENCUBE_MODE)
- width = w->screen->outputDev[output].width;
- else
- width = w->screen->width;
-
- if (DO_3D(w->screen->display,w->screen) && tds->reorderWindowPainting) {
- //Window painting is done twice, once in reverse mode and one in normal.
- //We should paint it only in the needed mode.
-
- float pntA[4] =
- { w->screen->outputDev[output].region.extents.x1,
- w->screen->outputDev[output].region.extents.y1,
- tdw->currentZ, 1
- };
-
- float pntB[4] =
- { w->screen->outputDev[output].region.extents.x2,
- w->screen->outputDev[output].region.extents.y1,
- tdw->currentZ, 1
- };
-
- float pntC[4] =
- { w->screen->outputDev[output].region.extents.x1 +
- w->screen->outputDev[output].width / 2.0f,
- w->screen->outputDev[output].region.extents.y1 +
- w->screen->outputDev[output].height / 2.0f,
- tdw->currentZ, 1
- };
-
- MULTMV(tds->pmvm, pntA);
- DIVV(pntA);
-
- MULTMV(tds->pmvm, pntB);
- DIVV(pntB);
-
- MULTMV(tds->pmvm, pntC);
- DIVV(pntC);
-
- float vecA[3] =
- { pntC[0] - pntA[0], pntC[1] - pntA[1],
- pntC[2] - pntA[2] };
- float vecB[3] =
- { pntC[0] - pntB[0], pntC[1] - pntB[1],
- pntC[2] - pntB[2] };
-
- float ortho[3] = { vecA[1] * vecB[2] - vecA[2] * vecB[1],
- vecA[2] * vecB[0] - vecA[0] * vecB[2],
- vecA[0] * vecB[1] - vecA[1] * vecB[0]
- };
-
- if (ortho[2] > 0.0f) //The window is reversed, should be painted front to back.
- {
- if (mask & PAINT_WINDOW_BACK_TO_FRONT_MASK)
- return TRUE;
- }
-
- else {
- if (mask & PAINT_WINDOW_FRONT_TO_BACK_MASK)
- return TRUE;
- }
- }
-
- glPushMatrix();
-
- if (tdw->currentZ != 0.0f) {
- if (glIsEnabled(GL_CULL_FACE) && DISABLE_BACKFACE_CULLING) {
- disabledCull = TRUE;
- glDisable(GL_CULL_FACE);
- }
-
- glTranslatef(0.0f, 0.0f, tdw->currentZ);
-
- if (!IS_IN_VIEWPORT(w, 0)) {
- float angle = 360 / tds->currentViewportNum;
-
- glScalef(1.0f, 1.0f, 1.0f / width);
-
- if (RIGHT_VIEWPORT(w) == w->screen->hsize - 1) {
- glTranslatef(-width * tdw->currentZ *
- tds->xMove, 0.0f, 0.0f);
- glRotatef(-angle, 0.0f, 1.0f, 0.0f);
- glTranslatef(-width * tdw->currentZ *
- tds->xMove, 0.0f, 0.0f);
- }
-
- else if (LEFT_VIEWPORT(w) == 1) {
- glTranslatef(width +
- width * tdw->currentZ *
- tds->xMove, 0.0f, 0.0f);
- glRotatef(angle, 0.0f, 1.0f, 0.0f);
- glTranslatef(width * tdw->currentZ *
- tds->xMove - width, 0.0f,
- 0.0f);
- }
- }
-
- if (LEFT_VIEWPORT(w) != RIGHT_VIEWPORT(w)
- || (LEFT_SCREEN(w) != RIGHT_SCREEN(w)
- && MULTISCREENCUBE_MODE)) {
- if (LEFT_VIEWPORT(w) == 0
- && (LEFT_SCREEN(w) == output
- || !MULTISCREENCUBE_MODE))
- glTranslatef(width * tdw->currentZ *
- tds->xMove, 0.0f, 0.0f);
-
- else if (RIGHT_VIEWPORT(w) == 0
- && (RIGHT_SCREEN(w) == output
- || !MULTISCREENCUBE_MODE))
- glTranslatef(-width * tdw->currentZ *
- tds->xMove, 0.0f, 0.0f);
- }
-
- /*glBegin(GL_QUADS);
- glVertex3f(w->serverX, w->serverY, 0.0f);
- glVertex3f(w->serverX, w->serverY, -SPACE/2);
- glVertex3f(w->serverX, w->serverY + w->height, -SPACE/2);
- glVertex3f(w->serverX, w->serverY + w->height, 0.0f);
-
- glVertex3f(w->serverX + w->width, w->serverY, 0.0f);
- glVertex3f(w->serverX + w->width, w->serverY, -SPACE/2);
- glVertex3f(w->serverX + w->width, w->serverY + w->height, -SPACE/2);
- glVertex3f(w->serverX + w->width, w->serverY + w->height, 0.0f);
-
- glVertex3f(w->serverX, w->serverY, 0.0f);
- glVertex3f(w->serverX + w->width, w->serverY, 0.0f);
- glVertex3f(w->serverX + w->width, w->serverY, -SPACE/2);
- glVertex3f(w->serverX, w->serverY, -SPACE/2);
-
- glVertex3f(w->serverX, w->serverY, 0.0f);
- glVertex3f(w->serverX + w->width, w->serverY, 0.0f);
- glVertex3f(w->serverX + w->width, w->serverY, -SPACE/2);
- glVertex3f(w->serverX, w->serverY, -SPACE/2);
-
- glVertex3f(w->serverX, w->serverY + w->height, 0.0f);
- glVertex3f(w->serverX + w->width, w->serverY + w->height, 0.0f);
- glVertex3f(w->serverX + w->width, w->serverY + w->height, -SPACE/2);
- glVertex3f(w->serverX, w->serverY + w->height, -SPACE/2);
- glEnd(); */
- }
-
- UNWRAP(tds, w->screen, paintWindow);
- status = (*w->screen->paintWindow) (w, attrib, region, mask);
- WRAP(tds, w->screen, paintWindow, tdPaintWindow);
-
- if (disabledCull)
- glEnable(GL_CULL_FACE);
-
- glPopMatrix();
-
- return status;
+ Bool status;
+ Bool disabledCull = FALSE;
+
+ TD_SCREEN (w->screen);
+ TD_WINDOW (w);
+
+ int output = tds->tmpOutput;
+ int width;
+
+ if (output < w->screen->nOutputDev && MULTISCREENCUBE_MODE)
+ width = w->screen->outputDev[output].width;
+ else
+ width = w->screen->width;
+
+ if (DO_3D (w->screen->display, w->screen) && tds->reorderWindowPainting)
+ {
+ //Window painting is done twice, once in reverse mode and one in normal.
+ //We should paint it only in the needed mode.
+
+ float pntA[4] = { w->screen->outputDev[output].region.extents.x1,
+ w->screen->outputDev[output].region.extents.y1,
+ tdw->currentZ, 1
+ };
+
+ float pntB[4] = { w->screen->outputDev[output].region.extents.x2,
+ w->screen->outputDev[output].region.extents.y1,
+ tdw->currentZ, 1
+ };
+
+ float pntC[4] =
+ { w->screen->outputDev[output].region.extents.x1 +
+ w->screen->outputDev[output].width / 2.0f,
+ w->screen->outputDev[output].region.extents.y1 +
+ w->screen->outputDev[output].height / 2.0f,
+ tdw->currentZ, 1
+ };
+
+ MULTMV (tds->pmvm, pntA);
+ DIVV (pntA);
+
+ MULTMV (tds->pmvm, pntB);
+ DIVV (pntB);
+
+ MULTMV (tds->pmvm, pntC);
+ DIVV (pntC);
+
+ float vecA[3] = { pntC[0] - pntA[0], pntC[1] - pntA[1],
+ pntC[2] - pntA[2]
+ };
+ float vecB[3] = { pntC[0] - pntB[0], pntC[1] - pntB[1],
+ pntC[2] - pntB[2]
+ };
+
+ float ortho[3] = { vecA[1] * vecB[2] - vecA[2] * vecB[1],
+ vecA[2] * vecB[0] - vecA[0] * vecB[2],
+ vecA[0] * vecB[1] - vecA[1] * vecB[0]
+ };
+
+ if (ortho[2] > 0.0f) //The window is reversed, should be painted front to back.
+ {
+ if (mask & PAINT_WINDOW_BACK_TO_FRONT_MASK)
+ return TRUE;
+ }
+
+ else
+ {
+ if (mask & PAINT_WINDOW_FRONT_TO_BACK_MASK)
+ return TRUE;
+ }
+ }
+
+ glPushMatrix ();
+
+ if (tdw->currentZ != 0.0f)
+ {
+ if (glIsEnabled (GL_CULL_FACE) && DISABLE_BACKFACE_CULLING)
+ {
+ disabledCull = TRUE;
+ glDisable (GL_CULL_FACE);
+ }
+
+ glTranslatef (0.0f, 0.0f, tdw->currentZ);
+
+ if (!IS_IN_VIEWPORT (w, 0))
+ {
+ float angle = 360 / tds->currentViewportNum;
+
+ glScalef (1.0f, 1.0f, 1.0f / width);
+
+ if (RIGHT_VIEWPORT (w) == w->screen->hsize - 1)
+ {
+ glTranslatef (-width * tdw->currentZ *
+ tds->xMove, 0.0f, 0.0f);
+ glRotatef (-angle, 0.0f, 1.0f, 0.0f);
+ glTranslatef (-width * tdw->currentZ *
+ tds->xMove, 0.0f, 0.0f);
+ }
+
+ else if (LEFT_VIEWPORT (w) == 1)
+ {
+ glTranslatef (width +
+ width * tdw->currentZ * tds->xMove, 0.0f, 0.0f);
+ glRotatef (angle, 0.0f, 1.0f, 0.0f);
+ glTranslatef (width * tdw->currentZ *
+ tds->xMove - width, 0.0f, 0.0f);
+ }
+ }
+
+ if (LEFT_VIEWPORT (w) != RIGHT_VIEWPORT (w)
+ || (LEFT_SCREEN (w) != RIGHT_SCREEN (w) && MULTISCREENCUBE_MODE))
+ {
+ if (LEFT_VIEWPORT (w) == 0
+ && (LEFT_SCREEN (w) == output || !MULTISCREENCUBE_MODE))
+ glTranslatef (width * tdw->currentZ * tds->xMove, 0.0f, 0.0f);
+
+ else if (RIGHT_VIEWPORT (w) == 0
+ && (RIGHT_SCREEN (w) == output || !MULTISCREENCUBE_MODE))
+ glTranslatef (-width * tdw->currentZ *
+ tds->xMove, 0.0f, 0.0f);
+ }
+
+ /*glBegin(GL_QUADS);
+ glVertex3f(w->serverX, w->serverY, 0.0f);
+ glVertex3f(w->serverX, w->serverY, -SPACE/2);
+ glVertex3f(w->serverX, w->serverY + w->height, -SPACE/2);
+ glVertex3f(w->serverX, w->serverY + w->height, 0.0f);
+
+ glVertex3f(w->serverX + w->width, w->serverY, 0.0f);
+ glVertex3f(w->serverX + w->width, w->serverY, -SPACE/2);
+ glVertex3f(w->serverX + w->width, w->serverY + w->height, -SPACE/2);
+ glVertex3f(w->serverX + w->width, w->serverY + w->height, 0.0f);
+
+ glVertex3f(w->serverX, w->serverY, 0.0f);
+ glVertex3f(w->serverX + w->width, w->serverY, 0.0f);
+ glVertex3f(w->serverX + w->width, w->serverY, -SPACE/2);
+ glVertex3f(w->serverX, w->serverY, -SPACE/2);
+
+ glVertex3f(w->serverX, w->serverY, 0.0f);
+ glVertex3f(w->serverX + w->width, w->serverY, 0.0f);
+ glVertex3f(w->serverX + w->width, w->serverY, -SPACE/2);
+ glVertex3f(w->serverX, w->serverY, -SPACE/2);
+
+ glVertex3f(w->serverX, w->serverY + w->height, 0.0f);
+ glVertex3f(w->serverX + w->width, w->serverY + w->height, 0.0f);
+ glVertex3f(w->serverX + w->width, w->serverY + w->height, -SPACE/2);
+ glVertex3f(w->serverX, w->serverY + w->height, -SPACE/2);
+ glEnd(); */
+ }
+
+ UNWRAP (tds, w->screen, paintWindow);
+ status = (*w->screen->paintWindow) (w, attrib, region, mask);
+ WRAP (tds, w->screen, paintWindow, tdPaintWindow);
+
+ if (disabledCull)
+ glEnable (GL_CULL_FACE);
+
+ glPopMatrix ();
+
+ return status;
}
static void
-tdPaintTransformedScreen(CompScreen * s,
- const ScreenPaintAttrib * sAttrib,
- Region region, int output, unsigned int mask)
+tdPaintTransformedScreen (CompScreen * s,
+ const ScreenPaintAttrib * sAttrib,
+ Region region, int output, unsigned int mask)
{
- TD_SCREEN(s);
+ TD_SCREEN (s);
- tds->reorderWindowPainting = FALSE;
+ tds->reorderWindowPainting = FALSE;
- tds->tmpOutput = output;
+ tds->tmpOutput = output;
- if (DO_3D(s->display,s)) {
- if (CREATE_MIPMAPS)
- s->display->textureFilter =
- GL_LINEAR_MIPMAP_LINEAR;
+ if (DO_3D (s->display, s))
+ {
+ if (CREATE_MIPMAPS)
+ s->display->textureFilter = GL_LINEAR_MIPMAP_LINEAR;
- /*Front to back should always be done.
- If FTB is already in mask, then the viewport is reversed, and all windows should be reversed.
- If BTF is in mask, the viewport isn't reversed, but some of the windows there might be, so we set FTB in addition to BTF, and check for each window what mode it should use... */
+ /*Front to back should always be done.
+ If FTB is already in mask, then the viewport is reversed, and all windows should be reversed.
+ If BTF is in mask, the viewport isn't reversed, but some of the windows there might be, so we set FTB in addition to BTF, and check for each window what mode it should use... */
- if ((mask & PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK)
- && !IPCS_GetBool(IPCS_OBJECT(s), tds->insideAtom)) {
- tds->reorderWindowPainting = TRUE;
- mask |= PAINT_SCREEN_ORDER_FRONT_TO_BACK_MASK;
+ if ((mask & PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK)
+ && !IPCS_GetBool (IPCS_OBJECT (s), tds->insideAtom))
+ {
+ tds->reorderWindowPainting = TRUE;
+ mask |= PAINT_SCREEN_ORDER_FRONT_TO_BACK_MASK;
- glPushMatrix(); //Get the matrices.
+ glPushMatrix (); //Get the matrices.
- (s->applyScreenTransform) (s, sAttrib, output);
- prepareXCoords(s, output, -sAttrib->zTranslate);
+ (s->applyScreenTransform) (s, sAttrib, output);
+ prepareXCoords (s, output, -sAttrib->zTranslate);
- glGetFloatv(GL_MODELVIEW_MATRIX, tds->mvm);
- glGetFloatv(GL_PROJECTION_MATRIX, tds->pm);
+ glGetFloatv (GL_MODELVIEW_MATRIX, tds->mvm);
+ glGetFloatv (GL_PROJECTION_MATRIX, tds->pm);
- MULTM(tds->pm, tds->mvm, tds->pmvm);
+ MULTM (tds->pm, tds->mvm, tds->pmvm);
- glPopMatrix();
- }
- }
+ glPopMatrix ();
+ }
+ }
- UNWRAP(tds, s, paintTransformedScreen);
- (*s->paintTransformedScreen) (s, sAttrib, region, output, mask);
- WRAP(tds, s, paintTransformedScreen, tdPaintTransformedScreen);
+ UNWRAP (tds, s, paintTransformedScreen);
+ (*s->paintTransformedScreen) (s, sAttrib, region, output, mask);
+ WRAP (tds, s, paintTransformedScreen, tdPaintTransformedScreen);
}
static Bool
-tdPaintScreen(CompScreen * s,
- const ScreenPaintAttrib * sAttrib,
- Region region, int output, unsigned int mask)
+tdPaintScreen (CompScreen * s,
+ const ScreenPaintAttrib * sAttrib,
+ Region region, int output, unsigned int mask)
{
- Bool status;
+ Bool status;
- TD_SCREEN(s);
+ TD_SCREEN (s);
- if ((DO_3D(s->display,s)) || tds->tdWindowExists) {
- mask |= PAINT_SCREEN_TRANSFORMED_MASK;
- mask &= ~PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
- }
+ if ((DO_3D (s->display, s)) || tds->tdWindowExists)
+ {
+ mask |= PAINT_SCREEN_TRANSFORMED_MASK;
+ mask &= ~PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
+ }
- UNWRAP(tds, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, output, mask);
- WRAP(tds, s, paintScreen, tdPaintScreen);
+ UNWRAP (tds, s, paintScreen);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
+ WRAP (tds, s, paintScreen, tdPaintScreen);
- return status;
+ return status;
}
-static void tdDonePaintScreen(CompScreen * s)
+static void
+tdDonePaintScreen (CompScreen * s)
{
- CompWindow *w;
- tdWindow *tdw;
+ CompWindow *w;
+ tdWindow *tdw;
- TD_SCREEN(s);
+ TD_SCREEN (s);
- compDisplayClearRequestFlagForPlugin(s->display, "3d",
- "DRAW_ALL_FACES");
- compDisplayClearRequestFlagForPlugin(s->display, "3d",
- "NO_CUBE_CAPS");
+ compDisplayClearRequestFlagForPlugin (s->display, "3d", "DRAW_ALL_FACES");
+ compDisplayClearRequestFlagForPlugin (s->display, "3d", "NO_CUBE_CAPS");
- if (DO_3D(s->display,s) || tds->tdWindowExists) {
- float aim = 0.0f;
+ if (DO_3D (s->display, s) || tds->tdWindowExists)
+ {
+ float aim = 0.0f;
- damageScreen(s);
+ damageScreen (s);
- tds->tdWindowExists = FALSE;
+ tds->tdWindowExists = FALSE;
- for (w = s->windows; w; w = w->next) {
- tdw =
- GET_TD_WINDOW(w,
- GET_TD_SCREEN(w->screen,
- GET_TD_DISPLAY(w->
- screen->
- display)));
+ for (w = s->windows; w; w = w->next)
+ {
+ tdw =
+ GET_TD_WINDOW (w,
+ GET_TD_SCREEN (w->screen,
+ GET_TD_DISPLAY (w->
+ screen->
+ display)));
- if (DO_3D(s->display,s)) {
- if (IPCS_GetBool
- (IPCS_OBJECT(s), tds->insideAtom))
- aim = tdw->z - tds->maxZ;
+ if (DO_3D (s->display, s))
+ {
+ if (IPCS_GetBool (IPCS_OBJECT (s), tds->insideAtom))
+ aim = tdw->z - tds->maxZ;
- else
- aim = tdw->z;
- }
+ else
+ aim = tdw->z;
+ }
- if (fabs(tdw->currentZ - aim) < SPEED)
- tdw->currentZ = aim;
+ if (fabs (tdw->currentZ - aim) < SPEED)
+ tdw->currentZ = aim;
- else if (tdw->currentZ < aim)
- tdw->currentZ += SPEED;
+ else if (tdw->currentZ < aim)
+ tdw->currentZ += SPEED;
- else if (tdw->currentZ > aim)
- tdw->currentZ -= SPEED;
+ else if (tdw->currentZ > aim)
+ tdw->currentZ -= SPEED;
- if (tdw->currentZ)
- tds->tdWindowExists = TRUE;
- }
- }
+ if (tdw->currentZ)
+ tds->tdWindowExists = TRUE;
+ }
+ }
- revertReorder(s);
+ revertReorder (s);
- UNWRAP(tds, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP(tds, s, donePaintScreen, tdDonePaintScreen);
+ UNWRAP (tds, s, donePaintScreen);
+ (*s->donePaintScreen) (s);
+ WRAP (tds, s, donePaintScreen, tdDonePaintScreen);
}
-static void tdScreenInitOptions(tdScreen * tds)
+static void
+tdScreenInitOptions (tdScreen * tds)
{
- CompOption *o;
-
- o = &tds->opt[TD_SCREEN_OPTION_SPACE];
- o->name = "space";
- o->shortDesc = N_("Space between windows");
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->longDesc = N_("Change the space between the windows.");
- o->type = CompOptionTypeFloat;
- o->value.f = TD_SPACE_DEFAULT;
- o->rest.f.min = TD_SPACE_MIN;
- o->rest.f.max = TD_SPACE_MAX;
- o->rest.f.precision = TD_SPACE_PRECISION;
-
- o = &tds->opt[TD_SCREEN_OPTION_SPEED];
- o->name = "speed";
- o->shortDesc = N_("3D animation speed");
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->longDesc = N_("Change the speed of the 3D animation.");
- o->type = CompOptionTypeFloat;
- o->value.f = TD_SPEED_DEFAULT;
- o->rest.f.min = TD_SPEED_MIN;
- o->rest.f.max = TD_SPEED_MAX;
- o->rest.f.precision = TD_SPEED_PRECISION;
-
- o = &tds->opt[TD_SCREEN_OPTION_CREATE_MIPMAPS];
- o->name = "mipmaps";
- o->shortDesc = N_("create mipmaps");
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->longDesc = N_("Create mipmaps.");
- o->type = CompOptionTypeBool;
- o->value.b = TD_CREATE_MIPMAPS_DEFAULT;
-
- o = &tds->opt[TD_SCREEN_OPTION_DISABLE_BACKFACE_CULLING];
- o->name = "noculling";
- o->shortDesc = N_("Disable Backface Culling");
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->longDesc = N_("Disable Backface Culling.");
- o->type = CompOptionTypeBool;
- o->value.b = TD_DISABLE_BACKFACE_CULLING_DEFAULT;
-
- o = &tds->opt[TD_SCREEN_OPTION_DISABLE_CAPS_IN_INSIDE_CUBE];
- o->name = "nocaps";
- o->shortDesc = N_("Disable caps in inside cube");
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->longDesc = N_("Disable cube caps when inside cube mode is used.");
- o->type = CompOptionTypeBool;
- o->value.b = TD_DISABLE_CAPS_IN_INSIDE_CUBE_DEFAULT;
-
- o = &tds->opt[5];
- o->name = "manual only";
- o->shortDesc = N_("3D only on mouse rotate");
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->longDesc = N_("Initiates 3D only if rotate is mouse driven.");
- o->type = CompOptionTypeBool;
- o->value.b = TD_SCREEN_OPTION_MANUAL_ONLY_DEFAULT;
+ CompOption *o;
+
+ o = &tds->opt[TD_SCREEN_OPTION_SPACE];
+ o->name = "space";
+ o->shortDesc = N_("Space between windows");
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->longDesc = N_("Change the space between the windows.");
+ o->type = CompOptionTypeFloat;
+ o->value.f = TD_SPACE_DEFAULT;
+ o->rest.f.min = TD_SPACE_MIN;
+ o->rest.f.max = TD_SPACE_MAX;
+ o->rest.f.precision = TD_SPACE_PRECISION;
+
+ o = &tds->opt[TD_SCREEN_OPTION_SPEED];
+ o->name = "speed";
+ o->shortDesc = N_("3D animation speed");
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->longDesc = N_("Change the speed of the 3D animation.");
+ o->type = CompOptionTypeFloat;
+ o->value.f = TD_SPEED_DEFAULT;
+ o->rest.f.min = TD_SPEED_MIN;
+ o->rest.f.max = TD_SPEED_MAX;
+ o->rest.f.precision = TD_SPEED_PRECISION;
+
+ o = &tds->opt[TD_SCREEN_OPTION_CREATE_MIPMAPS];
+ o->name = "mipmaps";
+ o->shortDesc = N_("create mipmaps");
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->longDesc = N_("Create mipmaps.");
+ o->type = CompOptionTypeBool;
+ o->value.b = TD_CREATE_MIPMAPS_DEFAULT;
+
+ o = &tds->opt[TD_SCREEN_OPTION_DISABLE_BACKFACE_CULLING];
+ o->name = "noculling";
+ o->shortDesc = N_("Disable Backface Culling");
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->longDesc = N_("Disable Backface Culling.");
+ o->type = CompOptionTypeBool;
+ o->value.b = TD_DISABLE_BACKFACE_CULLING_DEFAULT;
+
+ o = &tds->opt[TD_SCREEN_OPTION_DISABLE_CAPS_IN_INSIDE_CUBE];
+ o->name = "nocaps";
+ o->shortDesc = N_("Disable caps in inside cube");
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->longDesc = N_("Disable cube caps when inside cube mode is used.");
+ o->type = CompOptionTypeBool;
+ o->value.b = TD_DISABLE_CAPS_IN_INSIDE_CUBE_DEFAULT;
+
+ o = &tds->opt[5];
+ o->name = "manual only";
+ o->shortDesc = N_("3D only on mouse rotate");
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->longDesc = N_("Initiates 3D only if rotate is mouse driven.");
+ o->type = CompOptionTypeBool;
+ o->value.b = TD_SCREEN_OPTION_MANUAL_ONLY_DEFAULT;
}
-static CompOption *tdGetScreenOptions(CompScreen * s, int *count)
+static CompOption *
+tdGetScreenOptions (CompScreen * s, int *count)
{
- if (s) {
- TD_SCREEN(s);
+ if (s)
+ {
+ TD_SCREEN (s);
- *count = NUM_OPTIONS(tds);
+ *count = NUM_OPTIONS (tds);
- return tds->opt;
- }
+ return tds->opt;
+ }
- else {
- tdScreen *tds = malloc(sizeof(tdScreen));
+ else
+ {
+ tdScreen *tds = malloc (sizeof (tdScreen));
- tdScreenInitOptions(tds);
- *count = NUM_OPTIONS(tds);
+ tdScreenInitOptions (tds);
+ *count = NUM_OPTIONS (tds);
- return tds->opt;
- }
+ return tds->opt;
+ }
}
static Bool
-tdSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
+tdSetScreenOption (CompScreen * screen, char *name, CompOptionValue * value)
{
- CompOption *o;
- int index;
-
- TD_SCREEN(screen);
-
- o = compFindOption(tds->opt, NUM_OPTIONS(tds), name, &index);
- if (!o)
- return FALSE;
-
- switch (index) {
- case TD_SCREEN_OPTION_SPACE:
- case TD_SCREEN_OPTION_SPEED:
- if (compSetFloatOption(o, value))
- return TRUE;
- break;
-
- case TD_SCREEN_OPTION_CREATE_MIPMAPS:
- if (compSetBoolOption(o, value))
- return TRUE;
- break;
-
- case TD_SCREEN_OPTION_DISABLE_BACKFACE_CULLING:
- case TD_SCREEN_OPTION_DISABLE_CAPS_IN_INSIDE_CUBE:
- if (compSetBoolOption(o, value))
- return TRUE;
- break;
- case TD_SCREEN_OPTION_MANUAL_ONLY:
- if (compSetBoolOption(o,value))
- return TRUE;
- break;
-
-
- default:
- break;
- }
-
- return FALSE;
+ CompOption *o;
+ int index;
+
+ TD_SCREEN (screen);
+
+ o = compFindOption (tds->opt, NUM_OPTIONS (tds), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index)
+ {
+ case TD_SCREEN_OPTION_SPACE:
+ case TD_SCREEN_OPTION_SPEED:
+ if (compSetFloatOption (o, value))
+ return TRUE;
+ break;
+
+ case TD_SCREEN_OPTION_CREATE_MIPMAPS:
+ if (compSetBoolOption (o, value))
+ return TRUE;
+ break;
+
+ case TD_SCREEN_OPTION_DISABLE_BACKFACE_CULLING:
+ case TD_SCREEN_OPTION_DISABLE_CAPS_IN_INSIDE_CUBE:
+ if (compSetBoolOption (o, value))
+ return TRUE;
+ break;
+ case TD_SCREEN_OPTION_MANUAL_ONLY:
+ if (compSetBoolOption (o, value))
+ return TRUE;
+ break;
+
+
+ default:
+ break;
+ }
+
+ return FALSE;
}
-static Bool tdInitDisplay(CompPlugin * p, CompDisplay * d)
+static Bool
+tdInitDisplay (CompPlugin * p, CompDisplay * d)
{
- tdDisplay *tdd;
+ tdDisplay *tdd;
- tdd = malloc(sizeof(tdDisplay));
- if (!tdd)
- return FALSE;
+ tdd = malloc (sizeof (tdDisplay));
+ if (!tdd)
+ return FALSE;
- tdd->screenPrivateIndex = allocateScreenPrivateIndex(d);
- if (tdd->screenPrivateIndex < 0) {
- free(tdd);
- return FALSE;
- }
+ tdd->screenPrivateIndex = allocateScreenPrivateIndex (d);
+ if (tdd->screenPrivateIndex < 0)
+ {
+ free (tdd);
+ return FALSE;
+ }
- d->privates[displayPrivateIndex].ptr = tdd;
+ d->privates[displayPrivateIndex].ptr = tdd;
- return TRUE;
+ return TRUE;
}
-static void tdFiniDisplay(CompPlugin * p, CompDisplay * d)
+static void
+tdFiniDisplay (CompPlugin * p, CompDisplay * d)
{
- TD_DISPLAY(d);
+ TD_DISPLAY (d);
- freeScreenPrivateIndex(d, tdd->screenPrivateIndex);
+ freeScreenPrivateIndex (d, tdd->screenPrivateIndex);
- free(tdd);
+ free (tdd);
}
-static Bool tdInitScreen(CompPlugin * p, CompScreen * s)
+static Bool
+tdInitScreen (CompPlugin * p, CompScreen * s)
{
- TD_DISPLAY(s->display);
+ TD_DISPLAY (s->display);
- tdScreen *tds;
+ tdScreen *tds;
- tds = malloc(sizeof(tdScreen));
- if (!tds)
- return FALSE;
+ tds = malloc (sizeof (tdScreen));
+ if (!tds)
+ return FALSE;
- tds->windowPrivateIndex = allocateWindowPrivateIndex(s);
- if (tds->windowPrivateIndex < 0) {
- free(tds);
- free(tdd);
- return FALSE;
- }
+ tds->windowPrivateIndex = allocateWindowPrivateIndex (s);
+ if (tds->windowPrivateIndex < 0)
+ {
+ free (tds);
+ free (tdd);
+ return FALSE;
+ }
- tdScreenInitOptions(tds);
+ tdScreenInitOptions (tds);
- tds->tdWindowExists = FALSE;
- //tds->reorder = TRUE;
- tds->revertReorder = NULL;
+ tds->tdWindowExists = FALSE;
+ //tds->reorder = TRUE;
+ tds->revertReorder = NULL;
- tds->mmModeAtom = IPCS_GetAtom(IPCS_OBJECT(s), IPCS_INT,
- "MM_MODE", TRUE);
- tds->manualAtom = IPCS_GetAtom(IPCS_OBJECT(s),IPCS_BOOL,"MOUSE_INITIATED_ROTATE",TRUE);
- tds->insideAtom = IPCS_GetAtom(IPCS_OBJECT(s),IPCS_BOOL,"INSIDE",TRUE);
+ tds->mmModeAtom = IPCS_GetAtom (IPCS_OBJECT (s), IPCS_INT,
+ "MM_MODE", TRUE);
+ tds->manualAtom =
+ IPCS_GetAtom (IPCS_OBJECT (s), IPCS_BOOL, "MOUSE_INITIATED_ROTATE",
+ TRUE);
+ tds->insideAtom =
+ IPCS_GetAtom (IPCS_OBJECT (s), IPCS_BOOL, "INSIDE", TRUE);
- tds->currentViewportNum = s->hsize;
- tds->currentMmMode = IPCS_GetInt(IPCS_OBJECT(s), tds->mmModeAtom);
- tds->currentScreenNum = s->nOutputDev;
- tds->currentDifferentResolutions = differentResolutions(s);
+ tds->currentViewportNum = s->hsize;
+ tds->currentMmMode = IPCS_GetInt (IPCS_OBJECT (s), tds->mmModeAtom);
+ tds->currentScreenNum = s->nOutputDev;
+ tds->currentDifferentResolutions = differentResolutions (s);
- if (MULTISCREENCUBE_MODE)
- tds->currentViewportNum *= tds->currentScreenNum;
+ if (MULTISCREENCUBE_MODE)
+ tds->currentViewportNum *= tds->currentScreenNum;
- if (tds->currentViewportNum > 2 && tds->currentMmMode != Multiple)
- tds->xMove =
- 1.0f /
- (tan
- (PI * (tds->currentViewportNum - 2.0f) /
- (2.0f * tds->currentViewportNum)));
- else
- tds->xMove = 0.0f;
+ if (tds->currentViewportNum > 2 && tds->currentMmMode != Multiple)
+ tds->xMove =
+ 1.0f /
+ (tan
+ (PI * (tds->currentViewportNum - 2.0f) /
+ (2.0f * tds->currentViewportNum)));
+ else
+ tds->xMove = 0.0f;
- if (MULTISCREENCUBE_MODE)
- tds->currentViewportNum /= tds->currentScreenNum;
+ if (MULTISCREENCUBE_MODE)
+ tds->currentViewportNum /= tds->currentScreenNum;
- WRAP(tds, s, paintTransformedScreen, tdPaintTransformedScreen);
- WRAP(tds, s, paintWindow, tdPaintWindow);
- WRAP(tds, s, paintScreen, tdPaintScreen);
- WRAP(tds, s, donePaintScreen, tdDonePaintScreen);
- WRAP(tds, s, preparePaintScreen, tdPreparePaintScreen);
+ WRAP (tds, s, paintTransformedScreen, tdPaintTransformedScreen);
+ WRAP (tds, s, paintWindow, tdPaintWindow);
+ WRAP (tds, s, paintScreen, tdPaintScreen);
+ WRAP (tds, s, donePaintScreen, tdDonePaintScreen);
+ WRAP (tds, s, preparePaintScreen, tdPreparePaintScreen);
- s->privates[tdd->screenPrivateIndex].ptr = tds;
+ s->privates[tdd->screenPrivateIndex].ptr = tds;
- return TRUE;
+ return TRUE;
}
-static void tdFiniScreen(CompPlugin * p, CompScreen * s)
+static void
+tdFiniScreen (CompPlugin * p, CompScreen * s)
{
- TD_SCREEN(s);
+ TD_SCREEN (s);
- freeWindowPrivateIndex(s, tds->windowPrivateIndex);
+ freeWindowPrivateIndex (s, tds->windowPrivateIndex);
- UNWRAP(tds, s, paintTransformedScreen);
- UNWRAP(tds, s, paintWindow);
- UNWRAP(tds, s, paintScreen);
- UNWRAP(tds, s, donePaintScreen);
- UNWRAP(tds, s, preparePaintScreen);
+ UNWRAP (tds, s, paintTransformedScreen);
+ UNWRAP (tds, s, paintWindow);
+ UNWRAP (tds, s, paintScreen);
+ UNWRAP (tds, s, donePaintScreen);
+ UNWRAP (tds, s, preparePaintScreen);
- free(tds);
+ free (tds);
}
-static Bool tdInitWindow(CompPlugin * p, CompWindow * w)
+static Bool
+tdInitWindow (CompPlugin * p, CompWindow * w)
{
- tdWindow *tdw;
+ tdWindow *tdw;
- TD_SCREEN(w->screen);
+ TD_SCREEN (w->screen);
- tdw = malloc(sizeof(tdWindow));
- if (!tdw)
- return FALSE;
+ tdw = malloc (sizeof (tdWindow));
+ if (!tdw)
+ return FALSE;
- tdw->z = 0.0f;
- tdw->currentZ = 0.0f;
+ tdw->z = 0.0f;
+ tdw->currentZ = 0.0f;
- w->privates[tds->windowPrivateIndex].ptr = tdw;
+ w->privates[tds->windowPrivateIndex].ptr = tdw;
- return TRUE;
+ return TRUE;
}
-static void tdFiniWindow(CompPlugin * p, CompWindow * w)
+static void
+tdFiniWindow (CompPlugin * p, CompWindow * w)
{
- TD_WINDOW(w);
+ TD_WINDOW (w);
- free(tdw);
+ free (tdw);
}
-static Bool tdInit(CompPlugin * p)
+static Bool
+tdInit (CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex();
- if (displayPrivateIndex < 0)
- return FALSE;
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
+ if (displayPrivateIndex < 0)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-static void tdFini(CompPlugin * p)
+static void
+tdFini (CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex(displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex (displayPrivateIndex);
}
CompPluginDep tdDeps[] = {
- {CompPluginRuleAfter, "decoration"}
- ,
+ {CompPluginRuleAfter, "decoration"}
+ ,
};
static CompPluginVTable tdVTable = {
- "3d",
- N_("A 3D world"),
- N_("Windows live in a 3D world."),
- tdInit,
- tdFini,
- tdInitDisplay,
- tdFiniDisplay,
- tdInitScreen,
- tdFiniScreen,
- tdInitWindow,
- tdFiniWindow,
- /*tdGetDisplayOptions */ 0,
- /*tdSetDisplayOption */ 0,
- tdGetScreenOptions,
- tdSetScreenOption,
- tdDeps,
- sizeof(tdDeps) / sizeof(tdDeps[0]),
- 0,
- 0,
- BERYL_ABI_INFO,
- "beryl-plugins",
- "effects"
+ "3d",
+ N_("A 3D world"),
+ N_("Windows live in a 3D world."),
+ tdInit,
+ tdFini,
+ tdInitDisplay,
+ tdFiniDisplay,
+ tdInitScreen,
+ tdFiniScreen,
+ tdInitWindow,
+ tdFiniWindow,
+ /*tdGetDisplayOptions */ 0,
+ /*tdSetDisplayOption */ 0,
+ tdGetScreenOptions,
+ tdSetScreenOption,
+ tdDeps,
+ sizeof (tdDeps) / sizeof (tdDeps[0]),
+ 0,
+ 0,
+ BERYL_ABI_INFO,
+ "beryl-plugins",
+ "effects"
};
-CompPluginVTable *getCompPluginInfo(void)
+CompPluginVTable *
+getCompPluginInfo (void)
{
- return &tdVTable;
+ return &tdVTable;
}
diff --git a/beryl-plugins/src/animation.c b/beryl-plugins/src/animation.c
index f7e95a9..c5b9525 100644
--- a/beryl-plugins/src/animation.c
+++ b/beryl-plugins/src/animation.c
@@ -59,59 +59,64 @@
#define BORDER_W(w) ((w)->width + (w)->input.left + (w)->input.right)
#define BORDER_H(w) ((w)->height + (w)->input.top + (w)->input.bottom)
-typedef struct _xy_pair {
- float x, y;
+typedef struct _xy_pair
+{
+ float x, y;
} Point, Vector;
-typedef struct _Object {
- Point gridPosition; // position on window in [0,1] range
- Point position; // position on screen
-
- // Texture x, y coordinates will be offset by given amounts
- // for quads that fall after and before this object in x and y directions.
- // Currently only y offset can be used.
- Point offsetTexCoordForQuadBefore;
- Point offsetTexCoordForQuadAfter;
+typedef struct _Object
+{
+ Point gridPosition; // position on window in [0,1] range
+ Point position; // position on screen
+
+ // Texture x, y coordinates will be offset by given amounts
+ // for quads that fall after and before this object in x and y directions.
+ // Currently only y offset can be used.
+ Point offsetTexCoordForQuadBefore;
+ Point offsetTexCoordForQuadAfter;
} Object;
-typedef struct _WaveParam {
- float halfWidth;
- float amp;
- float pos;
+typedef struct _WaveParam
+{
+ float halfWidth;
+ float amp;
+ float pos;
} WaveParam;
-typedef enum {
- WindowEventNone = 0,
- WindowEventMinimize,
- WindowEventUnminimize,
- WindowEventClose,
- WindowEventCreate,
- WindowEventFocus,
- WindowEventShade,
- WindowEventUnshade
+typedef enum
+{
+ WindowEventNone = 0,
+ WindowEventMinimize,
+ WindowEventUnminimize,
+ WindowEventClose,
+ WindowEventCreate,
+ WindowEventFocus,
+ WindowEventShade,
+ WindowEventUnshade
} WindowEvent;
-typedef struct _Model {
- Object *objects;
- int numObjects;
- int gridWidth;
- int gridHeight;
- float remainderSteps;
- Vector scale;
- Point scaleOrigin;
- Bool transformed;
- Point topLeft;
- Point bottomRight;
-
- int magicLampWaveCount;
- WaveParam *magicLampWaves;
- WindowEvent forWindowEvent;
- float topHeight;
- float bottomHeight;
+typedef struct _Model
+{
+ Object *objects;
+ int numObjects;
+ int gridWidth;
+ int gridHeight;
+ float remainderSteps;
+ Vector scale;
+ Point scaleOrigin;
+ Bool transformed;
+ Point topLeft;
+ Point bottomRight;
+
+ int magicLampWaveCount;
+ WaveParam *magicLampWaves;
+ WindowEvent forWindowEvent;
+ float topHeight;
+ float bottomHeight;
} Model;
static void
-modelInitObjects(Model * model, int x, int y, int width, int height);
+modelInitObjects (Model * model, int x, int y, int width, int height);
#define ANIM_MAGIC_LAMP1_GRID_RES_DEFAULT 100
#define ANIM_MAGIC_LAMP1_GRID_RES_MIN 4
@@ -289,48 +294,51 @@ modelInitObjects(Model * model, int x, int y, int width, int height);
#define ANIM_BEAMUP_COLOR_BLUE_DEFAULT 0x7fff
#define ANIM_BEAMUP_COLOR_ALPHA_DEFAULT 0xffff
-typedef enum {
- AnimDirectionDown = 0,
- AnimDirectionUp,
- AnimDirectionLeft,
- AnimDirectionRight,
- AnimDirectionRandom
+typedef enum
+{
+ AnimDirectionDown = 0,
+ AnimDirectionUp,
+ AnimDirectionLeft,
+ AnimDirectionRight,
+ AnimDirectionRandom
} AnimDirection;
static char *animDirectionName[] = {
- N_("Down"),
- N_("Up"),
- N_("Left"),
- N_("Right"),
- N_("Random")
+ N_("Down"),
+ N_("Up"),
+ N_("Left"),
+ N_("Right"),
+ N_("Random")
};
#define ANIM_FIRE_DIRECTION_DEFAULT AnimDirectionDown
-typedef enum {
- PostprocessDisablingNone = 0,
- PostprocessDisablingWindow,
- PostprocessDisablingScreen
+typedef enum
+{
+ PostprocessDisablingNone = 0,
+ PostprocessDisablingWindow,
+ PostprocessDisablingScreen
} PostprocessDisabling;
static char *ppDisablingName[] = {
- N_("No disabling"),
- N_("Animated window"),
- N_("All windows")
+ N_("No disabling"),
+ N_("Animated window"),
+ N_("All windows")
};
-typedef enum {
- ZoomFromCenterOff = 0,
- ZoomFromCenterMin,
- ZoomFromCenterCreate,
- ZoomFromCenterOn
+typedef enum
+{
+ ZoomFromCenterOff = 0,
+ ZoomFromCenterMin,
+ ZoomFromCenterCreate,
+ ZoomFromCenterOn
} ZoomFromCenter;
static char *zoomFromCenterOption[] = {
- N_("Off"),
- N_("Minimize/Unminimize Only"),
- N_("Create/Close Only"),
- N_("On")
+ N_("Off"),
+ N_("Minimize/Unminimize Only"),
+ N_("Create/Close Only"),
+ N_("On")
};
#define ANIM_ZOOM_FROM_CENTER_DEFAULT 0
@@ -339,292 +347,299 @@ static char *zoomFromCenterOption[] = {
// ===================== Particle engine =========================
-typedef struct _Particle {
- float life; // particle life
- float fade; // fade speed
- float width; // particle width
- float height; // particle height
- float w_mod; // particle size modification during life
- float h_mod; // particle size modification during life
- float r; // red value
- float g; // green value
- float b; // blue value
- float a; // alpha value
- float x; // X position
- float y; // Y position
- float z; // Z position
- float xi; // X direction
- float yi; // Y direction
- float zi; // Z direction
- float xg; // X gravity
- float yg; // Y gravity
- float zg; // Z gravity
- float xo; // orginal X position
- float yo; // orginal Y position
- float zo; // orginal Z position
+typedef struct _Particle
+{
+ float life; // particle life
+ float fade; // fade speed
+ float width; // particle width
+ float height; // particle height
+ float w_mod; // particle size modification during life
+ float h_mod; // particle size modification during life
+ float r; // red value
+ float g; // green value
+ float b; // blue value
+ float a; // alpha value
+ float x; // X position
+ float y; // Y position
+ float z; // Z position
+ float xi; // X direction
+ float yi; // Y direction
+ float zi; // Z direction
+ float xg; // X gravity
+ float yg; // Y gravity
+ float zg; // Z gravity
+ float xo; // orginal X position
+ float yo; // orginal Y position
+ float zo; // orginal Z position
} Particle;
-typedef struct _ParticleSystem {
- int numParticles;
- Particle *particles;
- float slowdown;
- GLuint tex;
- Bool active;
- int x, y;
- float darken;
- GLuint blendMode;
+typedef struct _ParticleSystem
+{
+ int numParticles;
+ Particle *particles;
+ float slowdown;
+ GLuint tex;
+ Bool active;
+ int x, y;
+ float darken;
+ GLuint blendMode;
} ParticleSystem;
-static void initParticles(int numParticles, ParticleSystem * ps)
+static void
+initParticles (int numParticles, ParticleSystem * ps)
{
- if (ps->particles)
- free(ps->particles);
- ps->particles = calloc(1, sizeof(Particle) * numParticles);
- ps->tex = 0;
- ps->numParticles = numParticles;
- ps->slowdown = 1;
- ps->active = FALSE;
-
- int i;
- for (i = 0; i < numParticles; i++) {
- ps->particles[i].life = 0.0f;
- }
+ if (ps->particles)
+ free (ps->particles);
+ ps->particles = calloc (1, sizeof (Particle) * numParticles);
+ ps->tex = 0;
+ ps->numParticles = numParticles;
+ ps->slowdown = 1;
+ ps->active = FALSE;
+
+ int i;
+ for (i = 0; i < numParticles; i++)
+ {
+ ps->particles[i].life = 0.0f;
+ }
}
static void
-drawParticles(CompScreen * s, CompWindow * w, ParticleSystem * ps)
+drawParticles (CompScreen * s, CompWindow * w, ParticleSystem * ps)
{
- glPushMatrix();
- if (w)
- glTranslated(WIN_X(w) - ps->x, WIN_Y(w) - ps->y, 0);
- glEnable(GL_BLEND);
- if (ps->tex) {
- glBindTexture(GL_TEXTURE_2D, ps->tex);
- glEnable(GL_TEXTURE_2D);
- }
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- int i;
- Particle *part;
-
- GLfloat *vertices =
- malloc(ps->numParticles * 4 * 3 * sizeof(GLfloat));
- GLfloat *coords =
- malloc(ps->numParticles * 4 * 2 * sizeof(GLfloat));
- GLfloat *colors =
- malloc(ps->numParticles * 4 * 4 * sizeof(GLfloat));
- GLfloat *dcolors = 0;
-
- GLfloat *vert = vertices;
- GLfloat *coord = coords;
- GLfloat *col = colors;
-
- if (ps->darken > 0) {
- dcolors =
- malloc(ps->numParticles * 4 * 4 * sizeof(GLfloat));
- }
-
- GLfloat *dcol = dcolors;
-
- int numActive = 0;
-
- for (i = 0; i < ps->numParticles; i++) {
- part = &ps->particles[i];
- if (part->life > 0.0f) {
- numActive += 4;
-
- float w = part->width / 2;
- float h = part->height / 2;
- w += (w * part->w_mod) * part->life;
- h += (h * part->h_mod) * part->life;
-
- vert[0] = part->x - w;
- vert[1] = part->y - h;
- vert[2] = part->z;
-
- vert[3] = part->x - w;
- vert[4] = part->y + h;
- vert[5] = part->z;
-
- vert[6] = part->x + w;
- vert[7] = part->y + h;
- vert[8] = part->z;
-
- vert[9] = part->x + w;
- vert[10] = part->y - h;
- vert[11] = part->z;
-
- vert += 12;
-
- coord[0] = 0.0;
- coord[1] = 0.0;
-
- coord[2] = 0.0;
- coord[3] = 1.0;
-
- coord[4] = 1.0;
- coord[5] = 1.0;
-
- coord[6] = 1.0;
- coord[7] = 0.0;
-
- coord += 8;
-
- col[0] = part->r;
- col[1] = part->g;
- col[2] = part->b;
- col[3] = part->life * part->a;
- col[4] = part->r;
- col[5] = part->g;
- col[6] = part->b;
- col[7] = part->life * part->a;
- col[8] = part->r;
- col[9] = part->g;
- col[10] = part->b;
- col[11] = part->life * part->a;
- col[12] = part->r;
- col[13] = part->g;
- col[14] = part->b;
- col[15] = part->life * part->a;
-
- col += 16;
-
- if (ps->darken > 0) {
-
- dcol[0] = part->r;
- dcol[1] = part->g;
- dcol[2] = part->b;
- dcol[3] =
- part->life * part->a * ps->darken;
- dcol[4] = part->r;
- dcol[5] = part->g;
- dcol[6] = part->b;
- dcol[7] =
- part->life * part->a * ps->darken;
- dcol[8] = part->r;
- dcol[9] = part->g;
- dcol[10] = part->b;
- dcol[11] =
- part->life * part->a * ps->darken;
- dcol[12] = part->r;
- dcol[13] = part->g;
- dcol[14] = part->b;
- dcol[15] =
- part->life * part->a * ps->darken;
-
- dcol += 16;
- }
- }
- }
-
- glEnableClientState(GL_COLOR_ARRAY);
-
- glTexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), coords);
- glVertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), vertices);
-
- // darken of the background
- if (ps->darken > 0) {
- glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
- glColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), dcolors);
- glDrawArrays(GL_QUADS, 0, numActive);
- }
- // draw particles
- glBlendFunc(GL_SRC_ALPHA, ps->blendMode);
-
- glColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), colors);
-
- glDrawArrays(GL_QUADS, 0, numActive);
-
- glDisableClientState(GL_COLOR_ARRAY);
-
- free(vertices);
- free(coords);
- free(colors);
-
- if (ps->darken > 0) {
- free(dcolors);
- }
-
- glPopMatrix();
- glColor4usv(defaultColor);
- screenTexEnvMode(s, GL_REPLACE);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_BLEND);
+ glPushMatrix ();
+ if (w)
+ glTranslated (WIN_X (w) - ps->x, WIN_Y (w) - ps->y, 0);
+ glEnable (GL_BLEND);
+ if (ps->tex)
+ {
+ glBindTexture (GL_TEXTURE_2D, ps->tex);
+ glEnable (GL_TEXTURE_2D);
+ }
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ int i;
+ Particle *part;
+
+ GLfloat *vertices = malloc (ps->numParticles * 4 * 3 * sizeof (GLfloat));
+ GLfloat *coords = malloc (ps->numParticles * 4 * 2 * sizeof (GLfloat));
+ GLfloat *colors = malloc (ps->numParticles * 4 * 4 * sizeof (GLfloat));
+ GLfloat *dcolors = 0;
+
+ GLfloat *vert = vertices;
+ GLfloat *coord = coords;
+ GLfloat *col = colors;
+
+ if (ps->darken > 0)
+ {
+ dcolors = malloc (ps->numParticles * 4 * 4 * sizeof (GLfloat));
+ }
+
+ GLfloat *dcol = dcolors;
+
+ int numActive = 0;
+
+ for (i = 0; i < ps->numParticles; i++)
+ {
+ part = &ps->particles[i];
+ if (part->life > 0.0f)
+ {
+ numActive += 4;
+
+ float w = part->width / 2;
+ float h = part->height / 2;
+ w += (w * part->w_mod) * part->life;
+ h += (h * part->h_mod) * part->life;
+
+ vert[0] = part->x - w;
+ vert[1] = part->y - h;
+ vert[2] = part->z;
+
+ vert[3] = part->x - w;
+ vert[4] = part->y + h;
+ vert[5] = part->z;
+
+ vert[6] = part->x + w;
+ vert[7] = part->y + h;
+ vert[8] = part->z;
+
+ vert[9] = part->x + w;
+ vert[10] = part->y - h;
+ vert[11] = part->z;
+
+ vert += 12;
+
+ coord[0] = 0.0;
+ coord[1] = 0.0;
+
+ coord[2] = 0.0;
+ coord[3] = 1.0;
+
+ coord[4] = 1.0;
+ coord[5] = 1.0;
+
+ coord[6] = 1.0;
+ coord[7] = 0.0;
+
+ coord += 8;
+
+ col[0] = part->r;
+ col[1] = part->g;
+ col[2] = part->b;
+ col[3] = part->life * part->a;
+ col[4] = part->r;
+ col[5] = part->g;
+ col[6] = part->b;
+ col[7] = part->life * part->a;
+ col[8] = part->r;
+ col[9] = part->g;
+ col[10] = part->b;
+ col[11] = part->life * part->a;
+ col[12] = part->r;
+ col[13] = part->g;
+ col[14] = part->b;
+ col[15] = part->life * part->a;
+
+ col += 16;
+
+ if (ps->darken > 0)
+ {
+
+ dcol[0] = part->r;
+ dcol[1] = part->g;
+ dcol[2] = part->b;
+ dcol[3] = part->life * part->a * ps->darken;
+ dcol[4] = part->r;
+ dcol[5] = part->g;
+ dcol[6] = part->b;
+ dcol[7] = part->life * part->a * ps->darken;
+ dcol[8] = part->r;
+ dcol[9] = part->g;
+ dcol[10] = part->b;
+ dcol[11] = part->life * part->a * ps->darken;
+ dcol[12] = part->r;
+ dcol[13] = part->g;
+ dcol[14] = part->b;
+ dcol[15] = part->life * part->a * ps->darken;
+
+ dcol += 16;
+ }
+ }
+ }
+
+ glEnableClientState (GL_COLOR_ARRAY);
+
+ glTexCoordPointer (2, GL_FLOAT, 2 * sizeof (GLfloat), coords);
+ glVertexPointer (3, GL_FLOAT, 3 * sizeof (GLfloat), vertices);
+
+ // darken of the background
+ if (ps->darken > 0)
+ {
+ glBlendFunc (GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
+ glColorPointer (4, GL_FLOAT, 4 * sizeof (GLfloat), dcolors);
+ glDrawArrays (GL_QUADS, 0, numActive);
+ }
+ // draw particles
+ glBlendFunc (GL_SRC_ALPHA, ps->blendMode);
+
+ glColorPointer (4, GL_FLOAT, 4 * sizeof (GLfloat), colors);
+
+ glDrawArrays (GL_QUADS, 0, numActive);
+
+ glDisableClientState (GL_COLOR_ARRAY);
+
+ free (vertices);
+ free (coords);
+ free (colors);
+
+ if (ps->darken > 0)
+ {
+ free (dcolors);
+ }
+
+ glPopMatrix ();
+ glColor4usv (defaultColor);
+ screenTexEnvMode (s, GL_REPLACE);
+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ glDisable (GL_TEXTURE_2D);
+ glDisable (GL_BLEND);
}
-static void updateParticles(ParticleSystem * ps, float time)
+static void
+updateParticles (ParticleSystem * ps, float time)
{
- int i;
- Particle *part;
- float speed = (time / 50.0);
- float slowdown =
- ps->slowdown * (1 - MAX(0.99, time / 1000.0)) * 1000;
- ps->active = FALSE;
-
- for (i = 0; i < ps->numParticles; i++) {
- part = &ps->particles[i];
- if (part->life > 0.0f) {
- // move particle
- part->x += part->xi / slowdown;
- part->y += part->yi / slowdown;
- part->z += part->zi / slowdown;
-
- // modify speed
- part->xi += part->xg * speed;
- part->yi += part->yg * speed;
- part->zi += part->zg * speed;
-
- // modify life
- part->life -= part->fade * speed;
- ps->active = TRUE;
- }
- }
+ int i;
+ Particle *part;
+ float speed = (time / 50.0);
+ float slowdown = ps->slowdown * (1 - MAX (0.99, time / 1000.0)) * 1000;
+ ps->active = FALSE;
+
+ for (i = 0; i < ps->numParticles; i++)
+ {
+ part = &ps->particles[i];
+ if (part->life > 0.0f)
+ {
+ // move particle
+ part->x += part->xi / slowdown;
+ part->y += part->yi / slowdown;
+ part->z += part->zi / slowdown;
+
+ // modify speed
+ part->xi += part->xg * speed;
+ part->yi += part->yg * speed;
+ part->zi += part->zg * speed;
+
+ // modify life
+ part->life -= part->fade * speed;
+ ps->active = TRUE;
+ }
+ }
}
-static void finiParticles(ParticleSystem * ps)
+static void
+finiParticles (ParticleSystem * ps)
{
- free(ps->particles);
- if (ps->tex)
- glDeleteTextures(1, &ps->tex);
+ free (ps->particles);
+ if (ps->tex)
+ glDeleteTextures (1, &ps->tex);
}
// ===================== END: Particle engine =========================
static char *allEffectName[] = {
- N_("None"),
- N_("Random"),
- N_("Beam Up"),
- N_("Burn"),
- N_("Curved Fold"),
- N_("Dream"),
- N_("Fade"),
- N_("Horizontal Folds"),
- N_("Magic Lamp 1"),
- N_("Magic Lamp 2"),
- N_("Roll Up"),
- N_("Sidekick"),
- N_("Wave"),
- N_("Zoom")
+ N_("None"),
+ N_("Random"),
+ N_("Beam Up"),
+ N_("Burn"),
+ N_("Curved Fold"),
+ N_("Dream"),
+ N_("Fade"),
+ N_("Horizontal Folds"),
+ N_("Magic Lamp 1"),
+ N_("Magic Lamp 2"),
+ N_("Roll Up"),
+ N_("Sidekick"),
+ N_("Wave"),
+ N_("Zoom")
};
-typedef enum {
- AnimEffectNone = 0,
- AnimEffectRandom,
- AnimEffectBeamUp,
- AnimEffectBurn,
- AnimEffectCurvedFold,
- AnimEffectDream,
- AnimEffectFade,
- AnimEffectHorizontalFolds,
- AnimEffectMagicLamp1,
- AnimEffectMagicLamp2,
- AnimEffectRollUp,
- AnimEffectSidekick,
- AnimEffectWave,
- AnimEffectZoom,
- AnimEffectNum
+typedef enum
+{
+ AnimEffectNone = 0,
+ AnimEffectRandom,
+ AnimEffectBeamUp,
+ AnimEffectBurn,
+ AnimEffectCurvedFold,
+ AnimEffectDream,
+ AnimEffectFade,
+ AnimEffectHorizontalFolds,
+ AnimEffectMagicLamp1,
+ AnimEffectMagicLamp2,
+ AnimEffectRollUp,
+ AnimEffectSidekick,
+ AnimEffectWave,
+ AnimEffectZoom,
+ AnimEffectNum
} AnimEffect;
#define ANIM_MINIMIZE_DEFAULT AnimEffectMagicLamp2
@@ -638,150 +653,151 @@ typedef enum {
#define ANIM_UNSHADE_DEFAULT AnimEffectRollUp
static char *minimizeEffectName[] = {
- N_("None"),
- N_("Random"),
- N_("Beam Up"),
- N_("Burn"),
- N_("Curved Fold"),
- N_("Dream"),
- N_("Fade"),
- N_("Horizontal Folds"),
- N_("Magic Lamp 1"),
- N_("Magic Lamp 2"),
- N_("Sidekick"),
- N_("Zoom")
+ N_("None"),
+ N_("Random"),
+ N_("Beam Up"),
+ N_("Burn"),
+ N_("Curved Fold"),
+ N_("Dream"),
+ N_("Fade"),
+ N_("Horizontal Folds"),
+ N_("Magic Lamp 1"),
+ N_("Magic Lamp 2"),
+ N_("Sidekick"),
+ N_("Zoom")
};
static AnimEffect minimizeEffectType[] = {
- AnimEffectNone,
- AnimEffectRandom,
- AnimEffectBeamUp,
- AnimEffectBurn,
- AnimEffectCurvedFold,
- AnimEffectDream,
- AnimEffectFade,
- AnimEffectHorizontalFolds,
- AnimEffectMagicLamp1,
- AnimEffectMagicLamp2,
- AnimEffectSidekick,
- AnimEffectZoom
+ AnimEffectNone,
+ AnimEffectRandom,
+ AnimEffectBeamUp,
+ AnimEffectBurn,
+ AnimEffectCurvedFold,
+ AnimEffectDream,
+ AnimEffectFade,
+ AnimEffectHorizontalFolds,
+ AnimEffectMagicLamp1,
+ AnimEffectMagicLamp2,
+ AnimEffectSidekick,
+ AnimEffectZoom
};
#define NUM_MINIMIZE_EFFECT (sizeof (minimizeEffectType) / sizeof (minimizeEffectType[0]))
static char *closeEffectName[] = {
- N_("None"),
- N_("Random"),
- N_("Beam Up"),
- N_("Burn"),
- N_("Curved Fold"),
- N_("Dream"),
- N_("Fade"),
- N_("Horizontal Folds"),
- N_("Sidekick"),
- N_("Wave"),
- N_("Zoom")
+ N_("None"),
+ N_("Random"),
+ N_("Beam Up"),
+ N_("Burn"),
+ N_("Curved Fold"),
+ N_("Dream"),
+ N_("Fade"),
+ N_("Horizontal Folds"),
+ N_("Sidekick"),
+ N_("Wave"),
+ N_("Zoom")
};
static AnimEffect closeEffectType[] = {
- AnimEffectNone,
- AnimEffectRandom,
- AnimEffectBeamUp,
- AnimEffectBurn,
- AnimEffectCurvedFold,
- AnimEffectDream,
- AnimEffectFade,
- AnimEffectHorizontalFolds,
- AnimEffectSidekick,
- AnimEffectWave,
- AnimEffectZoom
+ AnimEffectNone,
+ AnimEffectRandom,
+ AnimEffectBeamUp,
+ AnimEffectBurn,
+ AnimEffectCurvedFold,
+ AnimEffectDream,
+ AnimEffectFade,
+ AnimEffectHorizontalFolds,
+ AnimEffectSidekick,
+ AnimEffectWave,
+ AnimEffectZoom
};
#define NUM_CLOSE_EFFECT (sizeof (closeEffectType) / sizeof (closeEffectType[0]))
static char *focusEffectName[] = {
- N_("None"),
- N_("Wave")
+ N_("None"),
+ N_("Wave")
};
static AnimEffect focusEffectType[] = {
- AnimEffectNone,
- AnimEffectWave
+ AnimEffectNone,
+ AnimEffectWave
};
#define NUM_FOCUS_EFFECT (sizeof (focusEffectType) / sizeof (focusEffectType[0]))
static char *shadeEffectName[] = {
- N_("None"),
- N_("Random"),
- N_("Curved Fold"),
- N_("Horizontal Folds"),
- N_("Roll Up")
+ N_("None"),
+ N_("Random"),
+ N_("Curved Fold"),
+ N_("Horizontal Folds"),
+ N_("Roll Up")
};
static AnimEffect shadeEffectType[] = {
- AnimEffectNone,
- AnimEffectRandom,
- AnimEffectCurvedFold,
- AnimEffectHorizontalFolds,
- AnimEffectRollUp
+ AnimEffectNone,
+ AnimEffectRandom,
+ AnimEffectCurvedFold,
+ AnimEffectHorizontalFolds,
+ AnimEffectRollUp
};
#define NUM_SHADE_EFFECT (sizeof (shadeEffectType) / sizeof (shadeEffectType[0]))
static char *minimizeDefaultWinType[] = {
- N_("Normal"),
- N_("Dialog"),
- N_("ModalDialog"),
- N_("Utility")
+ N_("Normal"),
+ N_("Dialog"),
+ N_("ModalDialog"),
+ N_("Utility")
};
#define N_MINIMIZE_DEFAULT_WIN_TYPE (sizeof (minimizeDefaultWinType) / sizeof (minimizeDefaultWinType[0]))
static char *close1DefaultWinType[] = {
- N_("Normal"),
- N_("Dialog"),
- N_("ModalDialog"),
- N_("Utility")
+ N_("Normal"),
+ N_("Dialog"),
+ N_("ModalDialog"),
+ N_("Utility")
};
#define N_CLOSE1_DEFAULT_WIN_TYPE (sizeof (close1DefaultWinType) / sizeof (close1DefaultWinType[0]))
static char *close2DefaultWinType[] = {
- N_("Unknown"),
- N_("Menu"),
- N_("PopupMenu"),
- N_("DropdownMenu"),
- N_("Tooltip")
+ N_("Unknown"),
+ N_("Menu"),
+ N_("PopupMenu"),
+ N_("DropdownMenu"),
+ N_("Tooltip")
};
#define N_CLOSE2_DEFAULT_WIN_TYPE (sizeof (close2DefaultWinType) / sizeof (close2DefaultWinType[0]))
static char *focusDefaultWinType[] = {
- N_("Normal"),
- N_("Dialog"),
- N_("ModalDialog"),
- N_("Dnd")
+ N_("Normal"),
+ N_("Dialog"),
+ N_("ModalDialog"),
+ N_("Dnd")
};
#define N_FOCUS_DEFAULT_WIN_TYPE (sizeof (focusDefaultWinType) / sizeof (focusDefaultWinType[0]))
static char *shadeDefaultWinType[] = {
- N_("Normal"),
- N_("Dialog"),
- N_("ModalDialog"),
- N_("Utility")
+ N_("Normal"),
+ N_("Dialog"),
+ N_("ModalDialog"),
+ N_("Utility")
};
#define N_SHADE_DEFAULT_WIN_TYPE (sizeof (shadeDefaultWinType) / sizeof (shadeDefaultWinType[0]))
static int displayPrivateIndex;
-typedef struct _AnimDisplay {
- int screenPrivateIndex;
- Atom wmHintsAtom;
- Atom winIconGeometryAtom;
- HandleEventProc handleEvent;
+typedef struct _AnimDisplay
+{
+ int screenPrivateIndex;
+ Atom wmHintsAtom;
+ Atom winIconGeometryAtom;
+ HandleEventProc handleEvent;
} AnimDisplay;
#define ANIM_SCREEN_OPTION_MINIMIZE_EFFECT 0
@@ -847,83 +863,85 @@ typedef struct _AnimDisplay {
#define ANIM_SCREEN_OPTION_BEAMUP_LIFE 60
#define ANIM_SCREEN_OPTION_NUM 61
-typedef struct _AnimScreen {
- int windowPrivateIndex;
-
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintScreenProc paintScreen;
- PaintWindowProc paintWindow;
- DamageWindowRectProc damageWindowRect;
- AddWindowGeometryProc addWindowGeometry;
- DrawWindowGeometryProc drawWindowGeometry;
-
- WindowResizeNotifyProc windowResizeNotify;
- WindowMoveNotifyProc windowMoveNotify;
- WindowGrabNotifyProc windowGrabNotify;
- WindowUngrabNotifyProc windowUngrabNotify;
-
- CompOption opt[ANIM_SCREEN_OPTION_NUM];
-
- PostprocessDisabling ppDisabling;
-
- ZoomFromCenter zoomFC;
-
- Bool animInProgress;
- AnimEffect minimizeEffect;
- AnimEffect unminimizeEffect;
- AnimEffect create1Effect;
- AnimEffect create2Effect;
- AnimEffect close1Effect;
- AnimEffect close2Effect;
- AnimEffect focusEffect;
- AnimEffect shadeEffect;
- AnimEffect unshadeEffect;
- unsigned int minimizeWMask;
- unsigned int unminimizeWMask;
- unsigned int create1WMask;
- unsigned int create2WMask;
- unsigned int close1WMask;
- unsigned int close2WMask;
- unsigned int focusWMask;
- unsigned int shadeWMask;
- unsigned int unshadeWMask;
+typedef struct _AnimScreen
+{
+ int windowPrivateIndex;
+
+ PreparePaintScreenProc preparePaintScreen;
+ DonePaintScreenProc donePaintScreen;
+ PaintScreenProc paintScreen;
+ PaintWindowProc paintWindow;
+ DamageWindowRectProc damageWindowRect;
+ AddWindowGeometryProc addWindowGeometry;
+ DrawWindowGeometryProc drawWindowGeometry;
+
+ WindowResizeNotifyProc windowResizeNotify;
+ WindowMoveNotifyProc windowMoveNotify;
+ WindowGrabNotifyProc windowGrabNotify;
+ WindowUngrabNotifyProc windowUngrabNotify;
+
+ CompOption opt[ANIM_SCREEN_OPTION_NUM];
+
+ PostprocessDisabling ppDisabling;
+
+ ZoomFromCenter zoomFC;
+
+ Bool animInProgress;
+ AnimEffect minimizeEffect;
+ AnimEffect unminimizeEffect;
+ AnimEffect create1Effect;
+ AnimEffect create2Effect;
+ AnimEffect close1Effect;
+ AnimEffect close2Effect;
+ AnimEffect focusEffect;
+ AnimEffect shadeEffect;
+ AnimEffect unshadeEffect;
+ unsigned int minimizeWMask;
+ unsigned int unminimizeWMask;
+ unsigned int create1WMask;
+ unsigned int create2WMask;
+ unsigned int close1WMask;
+ unsigned int close2WMask;
+ unsigned int focusWMask;
+ unsigned int shadeWMask;
+ unsigned int unshadeWMask;
} AnimScreen;
-typedef struct _AnimWindow {
- Model *model;
- int numPs;
- ParticleSystem *ps;
- unsigned int state;
- unsigned int newState;
+typedef struct _AnimWindow
+{
+ Model *model;
+ int numPs;
+ ParticleSystem *ps;
+ unsigned int state;
+ unsigned int newState;
- Region drawRegion;
- Bool useDrawRegion;
+ Region drawRegion;
+ Bool useDrawRegion;
- XRectangle icon;
- XRectangle origWindowRect;
+ XRectangle icon;
+ XRectangle origWindowRect;
- float numZoomRotations;
- float storedOpacity;
- float timestep; // to be used in updateWindowAttribFunc
+ float numZoomRotations;
+ float storedOpacity;
+ float timestep; // to be used in updateWindowAttribFunc
- Bool animInitialized; //whether the animation effect (not the window) is initialized
- float animTotalTime;
- float animRemainingTime;
- int animOverrideProgressDir; // 0: default dir, 1: forward, 2: backward
+ Bool animInitialized; //whether the animation effect (not the window) is initialized
+ float animTotalTime;
+ float animRemainingTime;
+ int animOverrideProgressDir; // 0: default dir, 1: forward, 2: backward
- Bool nowShaded;
- Bool grabbed;
+ Bool nowShaded;
+ Bool grabbed;
- WindowEvent curWindowEvent;
- AnimEffect curAnimEffect;
+ WindowEvent curWindowEvent;
+ AnimEffect curAnimEffect;
- int unmapCnt;
- int destroyCnt;
+ int unmapCnt;
+ int destroyCnt;
- int animatedAtom;
+ int animatedAtom;
- int animDirection;
+ int animDirection;
} AnimWindow;
#define GET_ANIM_DISPLAY(d) \
@@ -953,421 +971,419 @@ typedef struct _AnimWindow {
-static void modelCalcBounds(Model * model)
+static void
+modelCalcBounds (Model * model)
{
- int i;
-
- model->topLeft.x = MAXSHORT;
- model->topLeft.y = MAXSHORT;
- model->bottomRight.x = MINSHORT;
- model->bottomRight.y = MINSHORT;
-
- for (i = 0; i < model->numObjects; i++) {
- if (model->objects[i].position.x < model->topLeft.x)
- model->topLeft.x = model->objects[i].position.x;
- else if (model->objects[i].position.x >
- model->bottomRight.x)
- model->bottomRight.x =
- model->objects[i].position.x;
-
- if (model->objects[i].position.y < model->topLeft.y)
- model->topLeft.y = model->objects[i].position.y;
- else if (model->objects[i].position.y >
- model->bottomRight.y)
- model->bottomRight.y =
- model->objects[i].position.y;
- }
+ int i;
+
+ model->topLeft.x = MAXSHORT;
+ model->topLeft.y = MAXSHORT;
+ model->bottomRight.x = MINSHORT;
+ model->bottomRight.y = MINSHORT;
+
+ for (i = 0; i < model->numObjects; i++)
+ {
+ if (model->objects[i].position.x < model->topLeft.x)
+ model->topLeft.x = model->objects[i].position.x;
+ else if (model->objects[i].position.x > model->bottomRight.x)
+ model->bottomRight.x = model->objects[i].position.x;
+
+ if (model->objects[i].position.y < model->topLeft.y)
+ model->topLeft.y = model->objects[i].position.y;
+ else if (model->objects[i].position.y > model->bottomRight.y)
+ model->bottomRight.y = model->objects[i].position.y;
+ }
}
// ===================== Effect: Magic Lamp =========================
static void
-fxMagicLamp1InitGrid(AnimScreen * as,
- WindowEvent forWindowEvent,
- int *gridWidth, int *gridHeight)
+fxMagicLamp1InitGrid (AnimScreen * as,
+ WindowEvent forWindowEvent,
+ int *gridWidth, int *gridHeight)
{
- *gridWidth = 2;
- *gridHeight =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_GRID_RES].value.i;
+ *gridWidth = 2;
+ *gridHeight = as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_GRID_RES].value.i;
}
static void
-fxMagicLamp2InitGrid(AnimScreen * as,
- WindowEvent forWindowEvent,
- int *gridWidth, int *gridHeight)
+fxMagicLamp2InitGrid (AnimScreen * as,
+ WindowEvent forWindowEvent,
+ int *gridWidth, int *gridHeight)
{
- *gridWidth = 2;
- *gridHeight =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_GRID_RES].value.i;
+ *gridWidth = 2;
+ *gridHeight = as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_GRID_RES].value.i;
}
-static void fxMagicLampInit(CompScreen * s, CompWindow * w)
+static void
+fxMagicLampInit (CompScreen * s, CompWindow * w)
{
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- Model *model = aw->model;
-
- int screenHeight = s->height;
- Bool minimizeToTop = (screenHeight - aw->icon.y > aw->icon.y);
- int maxWaves;
- float waveAmpMin, waveAmpMax;
-
- if (aw->curAnimEffect == AnimEffectMagicLamp1) {
- maxWaves =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_MAX_WAVES].
- value.i;
- waveAmpMin =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MIN].
- value.f;
- waveAmpMax =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MAX].
- value.f;
- } else {
- maxWaves =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_MAX_WAVES].
- value.i;
- waveAmpMin =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MIN].
- value.f;
- waveAmpMax =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MAX].
- value.f;
- }
- if (waveAmpMax < waveAmpMin)
- waveAmpMax = waveAmpMin;
-
- if (maxWaves > 0) {
- float distance;
- if (minimizeToTop)
- distance = WIN_Y(w) + WIN_H(w) - aw->icon.y;
- else
- distance = aw->icon.y - WIN_Y(w);
-
- // Initialize waves
- model->magicLampWaveCount =
- 1 + (float) maxWaves *distance / screenHeight;
-
- if (!(model->magicLampWaves))
- model->magicLampWaves =
- malloc(model->magicLampWaveCount *
- sizeof(WaveParam));
-
- int ampDirection =
- ((float) rand() / RAND_MAX < 0.5 ? 1 : -1);
- int i;
- float minHalfWidth = 0.22f;
- float maxHalfWidth = 0.38f;
-
- for (i = 0; i < model->magicLampWaveCount; i++) {
- model->magicLampWaves[i].amp =
- ampDirection * (waveAmpMax - waveAmpMin) *
- rand() / RAND_MAX + ampDirection * waveAmpMin;
- model->magicLampWaves[i].halfWidth =
- (float) rand() / RAND_MAX * (maxHalfWidth -
- minHalfWidth) +
- minHalfWidth;
-
- // avoid offset at top and bottom part by added waves
- float availPos =
- 1 - 2 * model->magicLampWaves[i].halfWidth;
- float posInAvailSegment = 0;
- if (i > 0)
- posInAvailSegment =
- (availPos /
- model->magicLampWaveCount) * rand() /
- RAND_MAX;
-
- model->magicLampWaves[i].pos =
- (posInAvailSegment +
- i * availPos / model->magicLampWaveCount +
- model->magicLampWaves[i].halfWidth);
-
- // switch wave direction
- ampDirection *= -1;
- }
- } else
- model->magicLampWaveCount = 0;
+ ANIM_SCREEN (s);
+ ANIM_WINDOW (w);
+
+ Model *model = aw->model;
+
+ int screenHeight = s->height;
+ Bool minimizeToTop = (screenHeight - aw->icon.y > aw->icon.y);
+ int maxWaves;
+ float waveAmpMin, waveAmpMax;
+
+ if (aw->curAnimEffect == AnimEffectMagicLamp1)
+ {
+ maxWaves = as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_MAX_WAVES].value.i;
+ waveAmpMin =
+ as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MIN].value.f;
+ waveAmpMax =
+ as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MAX].value.f;
+ }
+ else
+ {
+ maxWaves = as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_MAX_WAVES].value.i;
+ waveAmpMin =
+ as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MIN].value.f;
+ waveAmpMax =
+ as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MAX].value.f;
+ }
+ if (waveAmpMax < waveAmpMin)
+ waveAmpMax = waveAmpMin;
+
+ if (maxWaves > 0)
+ {
+ float distance;
+ if (minimizeToTop)
+ distance = WIN_Y (w) + WIN_H (w) - aw->icon.y;
+ else
+ distance = aw->icon.y - WIN_Y (w);
+
+ // Initialize waves
+ model->magicLampWaveCount =
+ 1 + (float)maxWaves *distance / screenHeight;
+
+ if (!(model->magicLampWaves))
+ model->magicLampWaves =
+ malloc (model->magicLampWaveCount * sizeof (WaveParam));
+
+ int ampDirection = ((float)rand () / RAND_MAX < 0.5 ? 1 : -1);
+ int i;
+ float minHalfWidth = 0.22f;
+ float maxHalfWidth = 0.38f;
+
+ for (i = 0; i < model->magicLampWaveCount; i++)
+ {
+ model->magicLampWaves[i].amp =
+ ampDirection * (waveAmpMax - waveAmpMin) *
+ rand () / RAND_MAX + ampDirection * waveAmpMin;
+ model->magicLampWaves[i].halfWidth =
+ (float)rand () / RAND_MAX * (maxHalfWidth -
+ minHalfWidth) + minHalfWidth;
+
+ // avoid offset at top and bottom part by added waves
+ float availPos = 1 - 2 * model->magicLampWaves[i].halfWidth;
+ float posInAvailSegment = 0;
+ if (i > 0)
+ posInAvailSegment =
+ (availPos /
+ model->magicLampWaveCount) * rand () / RAND_MAX;
+
+ model->magicLampWaves[i].pos =
+ (posInAvailSegment +
+ i * availPos / model->magicLampWaveCount +
+ model->magicLampWaves[i].halfWidth);
+
+ // switch wave direction
+ ampDirection *= -1;
+ }
+ }
+ else
+ model->magicLampWaveCount = 0;
}
#define sigmoid(fx) (1.0f/(1.0f+exp(-5.0f*2*((fx)-0.5))))
#define sigmoid2(fx, c) (1.0f/(1.0f+exp(-(c)*2*((fx)-0.5))))
static void
-fxMagicLampModelStepObject(CompWindow * w,
- Model * model,
- Object * object,
- float forwardProgress, Bool minimizeToTop)
+fxMagicLampModelStepObject (CompWindow * w,
+ Model * model,
+ Object * object,
+ float forwardProgress, Bool minimizeToTop)
{
- ANIM_WINDOW(w);
-
- float iconCloseEndY;
- float winFarEndY;
- float winVisibleCloseEndY;
-
- if (minimizeToTop) {
- iconCloseEndY = aw->icon.y + aw->icon.height;
- winFarEndY = WIN_Y(w) + WIN_H(w);
- winVisibleCloseEndY = WIN_Y(w);
- if (winVisibleCloseEndY < iconCloseEndY)
- winVisibleCloseEndY = iconCloseEndY;
- } else {
- iconCloseEndY = aw->icon.y;
- winFarEndY = WIN_Y(w);
- winVisibleCloseEndY = WIN_Y(w) + WIN_H(w);
- if (winVisibleCloseEndY > iconCloseEndY)
- winVisibleCloseEndY = iconCloseEndY;
- }
-
- float preShapePhaseEnd = 0.17f;
- float stretchPhaseEnd =
- preShapePhaseEnd + (1 - preShapePhaseEnd) *
- (iconCloseEndY -
- winVisibleCloseEndY) / ((iconCloseEndY - winFarEndY) +
- (iconCloseEndY -
- winVisibleCloseEndY));
- if (stretchPhaseEnd < preShapePhaseEnd + 0.1)
- stretchPhaseEnd = preShapePhaseEnd + 0.1;
-
- float origx = w->attrib.x + (WIN_W(w) * object->gridPosition.x -
- w->output.left) * model->scale.x;
- float origy = w->attrib.y + (WIN_H(w) * object->gridPosition.y -
- w->output.top) * model->scale.y;
-
- float iconShadowLeft =
- ((float) (w->output.left - w->input.left)) * aw->icon.width /
- w->width;
- float iconShadowRight =
- ((float) (w->output.right - w->input.right)) * aw->icon.width /
- w->width;
- float iconx =
- (aw->icon.x - iconShadowLeft) + (aw->icon.width +
- iconShadowLeft +
- iconShadowRight) *
- object->gridPosition.x;
- float icony =
- aw->icon.y + aw->icon.height * object->gridPosition.y;
-
- if (forwardProgress < preShapePhaseEnd) {
- float preShapeProgress =
- forwardProgress / preShapePhaseEnd;
- float fx =
- (iconCloseEndY - object->position.y) / (iconCloseEndY -
- winFarEndY);
- float fy =
- (sigmoid(fx) - sigmoid(0)) / (sigmoid(1) - sigmoid(0));
- int i;
- float targetx = fy * (origx - iconx) + iconx;
- for (i = 0; i < model->magicLampWaveCount; i++) {
- float cosfx =
- (fx -
- model->magicLampWaves[i].pos) /
- model->magicLampWaves[i].halfWidth;
- if (cosfx < -1 || cosfx > 1)
- continue;
- targetx +=
- model->magicLampWaves[i].amp * model->scale.x *
- (cos(cosfx * M_PI) + 1) / 2;
- }
- object->position.x =
- (1 - preShapeProgress) * origx +
- preShapeProgress * targetx;
- object->position.y = origy;
- } else {
- float stretchedPos;
- if (minimizeToTop)
- stretchedPos =
- object->gridPosition.y * origy +
- (1 - object->gridPosition.y) * icony;
- else
- stretchedPos =
- (1 - object->gridPosition.y) * origy +
- object->gridPosition.y * icony;
-
- if (forwardProgress < stretchPhaseEnd) {
- float stretchProgress =
- (forwardProgress - preShapePhaseEnd) /
- (stretchPhaseEnd - preShapePhaseEnd);
-
- object->position.y =
- (1 - stretchProgress) * origy +
- stretchProgress * stretchedPos;
- } else {
- float postStretchProgress =
- (forwardProgress - stretchPhaseEnd) / (1 -
- stretchPhaseEnd);
-
- object->position.y =
- (1 - postStretchProgress) *
- stretchedPos +
- postStretchProgress *
- (stretchedPos + (iconCloseEndY - winFarEndY));
- }
- float fx =
- (iconCloseEndY - object->position.y) / (iconCloseEndY -
- winFarEndY);
- float fy =
- (sigmoid(fx) - sigmoid(0)) / (sigmoid(1) - sigmoid(0));
-
- int i;
- object->position.x = fy * (origx - iconx) + iconx;
- for (i = 0; i < model->magicLampWaveCount; i++) {
- float cosfx =
- (fx -
- model->magicLampWaves[i].pos) /
- model->magicLampWaves[i].halfWidth;
- if (cosfx < -1 || cosfx > 1)
- continue;
- object->position.x +=
- model->magicLampWaves[i].amp * model->scale.x *
- (cos(cosfx * M_PI) + 1) / 2;
- }
- }
+ ANIM_WINDOW (w);
+
+ float iconCloseEndY;
+ float winFarEndY;
+ float winVisibleCloseEndY;
+
+ if (minimizeToTop)
+ {
+ iconCloseEndY = aw->icon.y + aw->icon.height;
+ winFarEndY = WIN_Y (w) + WIN_H (w);
+ winVisibleCloseEndY = WIN_Y (w);
+ if (winVisibleCloseEndY < iconCloseEndY)
+ winVisibleCloseEndY = iconCloseEndY;
+ }
+ else
+ {
+ iconCloseEndY = aw->icon.y;
+ winFarEndY = WIN_Y (w);
+ winVisibleCloseEndY = WIN_Y (w) + WIN_H (w);
+ if (winVisibleCloseEndY > iconCloseEndY)
+ winVisibleCloseEndY = iconCloseEndY;
+ }
+
+ float preShapePhaseEnd = 0.17f;
+ float stretchPhaseEnd =
+ preShapePhaseEnd + (1 - preShapePhaseEnd) *
+ (iconCloseEndY -
+ winVisibleCloseEndY) / ((iconCloseEndY - winFarEndY) +
+ (iconCloseEndY - winVisibleCloseEndY));
+ if (stretchPhaseEnd < preShapePhaseEnd + 0.1)
+ stretchPhaseEnd = preShapePhaseEnd + 0.1;
+
+ float origx = w->attrib.x + (WIN_W (w) * object->gridPosition.x -
+ w->output.left) * model->scale.x;
+ float origy = w->attrib.y + (WIN_H (w) * object->gridPosition.y -
+ w->output.top) * model->scale.y;
+
+ float iconShadowLeft =
+ ((float)(w->output.left - w->input.left)) * aw->icon.width / w->width;
+ float iconShadowRight =
+ ((float)(w->output.right - w->input.right)) * aw->icon.width /
+ w->width;
+ float iconx =
+ (aw->icon.x - iconShadowLeft) + (aw->icon.width +
+ iconShadowLeft +
+ iconShadowRight) *
+ object->gridPosition.x;
+ float icony = aw->icon.y + aw->icon.height * object->gridPosition.y;
+
+ if (forwardProgress < preShapePhaseEnd)
+ {
+ float preShapeProgress = forwardProgress / preShapePhaseEnd;
+ float fx =
+ (iconCloseEndY - object->position.y) / (iconCloseEndY -
+ winFarEndY);
+ float fy = (sigmoid (fx) - sigmoid (0)) / (sigmoid (1) - sigmoid (0));
+ int i;
+ float targetx = fy * (origx - iconx) + iconx;
+ for (i = 0; i < model->magicLampWaveCount; i++)
+ {
+ float cosfx =
+ (fx -
+ model->magicLampWaves[i].pos) /
+ model->magicLampWaves[i].halfWidth;
+ if (cosfx < -1 || cosfx > 1)
+ continue;
+ targetx +=
+ model->magicLampWaves[i].amp * model->scale.x *
+ (cos (cosfx * M_PI) + 1) / 2;
+ }
+ object->position.x =
+ (1 - preShapeProgress) * origx + preShapeProgress * targetx;
+ object->position.y = origy;
+ }
+ else
+ {
+ float stretchedPos;
+ if (minimizeToTop)
+ stretchedPos =
+ object->gridPosition.y * origy +
+ (1 - object->gridPosition.y) * icony;
+ else
+ stretchedPos =
+ (1 - object->gridPosition.y) * origy +
+ object->gridPosition.y * icony;
+
+ if (forwardProgress < stretchPhaseEnd)
+ {
+ float stretchProgress =
+ (forwardProgress - preShapePhaseEnd) /
+ (stretchPhaseEnd - preShapePhaseEnd);
+
+ object->position.y =
+ (1 - stretchProgress) * origy +
+ stretchProgress * stretchedPos;
+ }
+ else
+ {
+ float postStretchProgress =
+ (forwardProgress - stretchPhaseEnd) / (1 - stretchPhaseEnd);
+
+ object->position.y =
+ (1 - postStretchProgress) *
+ stretchedPos +
+ postStretchProgress *
+ (stretchedPos + (iconCloseEndY - winFarEndY));
+ }
+ float fx =
+ (iconCloseEndY - object->position.y) / (iconCloseEndY -
+ winFarEndY);
+ float fy = (sigmoid (fx) - sigmoid (0)) / (sigmoid (1) - sigmoid (0));
+
+ int i;
+ object->position.x = fy * (origx - iconx) + iconx;
+ for (i = 0; i < model->magicLampWaveCount; i++)
+ {
+ float cosfx =
+ (fx -
+ model->magicLampWaves[i].pos) /
+ model->magicLampWaves[i].halfWidth;
+ if (cosfx < -1 || cosfx > 1)
+ continue;
+ object->position.x +=
+ model->magicLampWaves[i].amp * model->scale.x *
+ (cos (cosfx * M_PI) + 1) / 2;
+ }
+ }
}
static void
-fxMagicLampModelStep(CompScreen * s, CompWindow * w, float time)
+fxMagicLampModelStep (CompScreen * s, CompWindow * w, float time)
{
- int i, j, steps;
-
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- Model *model = aw->model;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
-
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
-
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- Bool minimizeToTop = (s->height - aw->icon.y > aw->icon.y);
-
- for (j = 0; j < steps; j++) {
- float forwardProgress =
- 1 - (aw->animRemainingTime - timestep) /
- (aw->animTotalTime - timestep);
- if (aw->curWindowEvent == WindowEventUnminimize)
- forwardProgress = 1 - forwardProgress;
- for (i = 0; i < model->numObjects; i++) {
- fxMagicLampModelStepObject(w, model,
- &model->objects[i],
- forwardProgress,
- minimizeToTop);
- }
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0) {
- aw->animRemainingTime = 0; // avoid sub-zero values
- break;
- }
- }
- modelCalcBounds(model);
+ int i, j, steps;
+
+ ANIM_SCREEN (s);
+ ANIM_WINDOW (w);
+
+ Model *model = aw->model;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ Bool minimizeToTop = (s->height - aw->icon.y > aw->icon.y);
+
+ for (j = 0; j < steps; j++)
+ {
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - timestep) /
+ (aw->animTotalTime - timestep);
+ if (aw->curWindowEvent == WindowEventUnminimize)
+ forwardProgress = 1 - forwardProgress;
+ for (i = 0; i < model->numObjects; i++)
+ {
+ fxMagicLampModelStepObject (w, model,
+ &model->objects[i],
+ forwardProgress, minimizeToTop);
+ }
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ {
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ break;
+ }
+ }
+ modelCalcBounds (model);
}
// ===================== Effect: Dream =========================
-static void fxDreamInit(CompScreen * s, CompWindow * w)
+static void
+fxDreamInit (CompScreen * s, CompWindow * w)
{
- ANIM_WINDOW(w);
- ANIM_SCREEN(s);
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (s);
- // store window opacity
- aw->storedOpacity = w->paint.opacity;
+ // store window opacity
+ aw->storedOpacity = w->paint.opacity;
- aw->timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+ aw->timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
}
static void
-fxDreamModelStepObject(CompWindow * w,
- Model * model, Object * object,
- float forwardProgress)
+fxDreamModelStepObject (CompWindow * w,
+ Model * model, Object * object, float forwardProgress)
{
- float waveAmpMax = MIN(WIN_H(w), WIN_W(w)) * 0.125f;
- float waveWidth = 10.0f;
- float waveSpeed = 7.0f;
-
- float origx = w->attrib.x + (WIN_W(w) * object->gridPosition.x -
- w->output.left) * model->scale.x;
- float origy = w->attrib.y + (WIN_H(w) * object->gridPosition.y -
- w->output.top) * model->scale.y;
-
- object->position.y = origy;
- object->position.x =
- origx +
- forwardProgress * waveAmpMax * model->scale.x *
- sin(object->gridPosition.y * M_PI * waveWidth +
- waveSpeed * forwardProgress);
+ float waveAmpMax = MIN (WIN_H (w), WIN_W (w)) * 0.125f;
+ float waveWidth = 10.0f;
+ float waveSpeed = 7.0f;
+
+ float origx = w->attrib.x + (WIN_W (w) * object->gridPosition.x -
+ w->output.left) * model->scale.x;
+ float origy = w->attrib.y + (WIN_H (w) * object->gridPosition.y -
+ w->output.top) * model->scale.y;
+
+ object->position.y = origy;
+ object->position.x =
+ origx +
+ forwardProgress * waveAmpMax * model->scale.x *
+ sin (object->gridPosition.y * M_PI * waveWidth +
+ waveSpeed * forwardProgress);
}
-static void fxDreamModelStep(CompScreen * s, CompWindow * w, float time)
+static void
+fxDreamModelStep (CompScreen * s, CompWindow * w, float time)
{
- int i, j, steps;
-
- ANIM_WINDOW(w);
- ANIM_SCREEN(s);
-
- Model *model = aw->model;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
- aw->timestep = timestep;
-
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
-
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- for (j = 0; j < steps; j++) {
- float forwardProgress =
- 1 - (aw->animRemainingTime - timestep) /
- (aw->animTotalTime - timestep);
- if (aw->curWindowEvent == WindowEventCreate ||
- aw->curWindowEvent == WindowEventUnminimize)
- forwardProgress = 1 - forwardProgress;
-
- for (i = 0; i < model->numObjects; i++) {
- fxDreamModelStepObject(w,
- model,
- &model->objects[i],
- forwardProgress);
- }
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0) {
- aw->animRemainingTime = 0; // avoid sub-zero values
- break;
- }
- }
- modelCalcBounds(model);
+ int i, j, steps;
+
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (s);
+
+ Model *model = aw->model;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+ aw->timestep = timestep;
+
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ for (j = 0; j < steps; j++)
+ {
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - timestep) /
+ (aw->animTotalTime - timestep);
+ if (aw->curWindowEvent == WindowEventCreate ||
+ aw->curWindowEvent == WindowEventUnminimize)
+ forwardProgress = 1 - forwardProgress;
+
+ for (i = 0; i < model->numObjects; i++)
+ {
+ fxDreamModelStepObject (w,
+ model,
+ &model->objects[i], forwardProgress);
+ }
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ {
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ break;
+ }
+ }
+ modelCalcBounds (model);
}
static void
-fxDreamUpdateWindowAttrib(AnimScreen * as,
- AnimWindow * aw, WindowPaintAttrib * wAttrib)
+fxDreamUpdateWindowAttrib (AnimScreen * as,
+ AnimWindow * aw, WindowPaintAttrib * wAttrib)
{
- float forwardProgress =
- 1 - (aw->animRemainingTime - aw->timestep) /
- (aw->animTotalTime - aw->timestep);
- forwardProgress = MIN(forwardProgress, 1);
- forwardProgress = MAX(forwardProgress, 0);
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - aw->timestep) /
+ (aw->animTotalTime - aw->timestep);
+ forwardProgress = MIN (forwardProgress, 1);
+ forwardProgress = MAX (forwardProgress, 0);
- if (aw->curWindowEvent == WindowEventCreate ||
- aw->curWindowEvent == WindowEventUnminimize)
- forwardProgress = 1 - forwardProgress;
+ if (aw->curWindowEvent == WindowEventCreate ||
+ aw->curWindowEvent == WindowEventUnminimize)
+ forwardProgress = 1 - forwardProgress;
- wAttrib->opacity = aw->storedOpacity * (1 - forwardProgress);
+ wAttrib->opacity = aw->storedOpacity * (1 - forwardProgress);
}
@@ -1375,296 +1391,294 @@ fxDreamUpdateWindowAttrib(AnimScreen * as,
static void
-fxWaveModelStepObject(CompWindow * w,
- Model * model,
- Object * object,
- float forwardProgress,
- float waveAmp, float waveHalfWidth)
+fxWaveModelStepObject (CompWindow * w,
+ Model * model,
+ Object * object,
+ float forwardProgress,
+ float waveAmp, float waveHalfWidth)
{
- float origx = w->attrib.x + (WIN_W(w) * object->gridPosition.x -
- w->output.left) * model->scale.x;
- float origy = w->attrib.y + (WIN_H(w) * object->gridPosition.y -
- w->output.top) * model->scale.y;
-
- float wavePosition =
- WIN_Y(w) - waveHalfWidth +
- forwardProgress * (WIN_H(w) * model->scale.y +
- 2 * waveHalfWidth);
-
- object->position.y = origy;
- object->position.x = origx;
-
- if (fabs(object->position.y - wavePosition) < waveHalfWidth)
- object->position.x +=
- (object->gridPosition.x - 0.5) * waveAmp *
- (cos
- ((object->position.y -
- wavePosition) * M_PI / waveHalfWidth)
- + 1) / 2;
+ float origx = w->attrib.x + (WIN_W (w) * object->gridPosition.x -
+ w->output.left) * model->scale.x;
+ float origy = w->attrib.y + (WIN_H (w) * object->gridPosition.y -
+ w->output.top) * model->scale.y;
+
+ float wavePosition =
+ WIN_Y (w) - waveHalfWidth +
+ forwardProgress * (WIN_H (w) * model->scale.y + 2 * waveHalfWidth);
+
+ object->position.y = origy;
+ object->position.x = origx;
+
+ if (fabs (object->position.y - wavePosition) < waveHalfWidth)
+ object->position.x +=
+ (object->gridPosition.x - 0.5) * waveAmp *
+ (cos
+ ((object->position.y -
+ wavePosition) * M_PI / waveHalfWidth) + 1) / 2;
}
-static void fxWaveModelStep(CompScreen * s, CompWindow * w, float time)
+static void
+fxWaveModelStep (CompScreen * s, CompWindow * w, float time)
{
- int i, j, steps;
-
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- Model *model = aw->model;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
-
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
-
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- for (j = 0; j < steps; j++) {
- float forwardProgress =
- 1 - (aw->animRemainingTime - timestep) /
- (aw->animTotalTime - timestep);
-
- for (i = 0; i < model->numObjects; i++) {
- fxWaveModelStepObject(w,
- model,
- &model->objects[i],
- forwardProgress,
- WIN_H(w) * model->scale.y *
- as->
- opt
- [ANIM_SCREEN_OPTION_FOCUS_WAVE_AMP].
- value.f,
- WIN_H(w) * model->scale.y *
- as->
- opt
- [ANIM_SCREEN_OPTION_FOCUS_WAVE_WIDTH].
- value.f / 2);
- }
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0) {
- aw->animRemainingTime = 0; // avoid sub-zero values
- break;
- }
- }
- modelCalcBounds(model);
+ int i, j, steps;
+
+ ANIM_SCREEN (s);
+ ANIM_WINDOW (w);
+
+ Model *model = aw->model;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ for (j = 0; j < steps; j++)
+ {
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - timestep) /
+ (aw->animTotalTime - timestep);
+
+ for (i = 0; i < model->numObjects; i++)
+ {
+ fxWaveModelStepObject (w,
+ model,
+ &model->objects[i],
+ forwardProgress,
+ WIN_H (w) * model->scale.y *
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_FOCUS_WAVE_AMP].
+ value.f,
+ WIN_H (w) * model->scale.y *
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_FOCUS_WAVE_WIDTH].
+ value.f / 2);
+ }
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ {
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ break;
+ }
+ }
+ modelCalcBounds (model);
}
// ===================== Effect: Zoom and Sidekick =========================
-static void fxSidekickInit(CompScreen * s, CompWindow * w)
+static void
+fxSidekickInit (CompScreen * s, CompWindow * w)
{
- ANIM_WINDOW(w);
- ANIM_SCREEN(s);
-
- // determine number of rotations randomly in [0.75, 1.25] range
- aw->numZoomRotations =
- as->opt[ANIM_SCREEN_OPTION_SIDEKICK_NUM_ROTATIONS].value.f *
- (1.0 + 0.2 * rand() / RAND_MAX - 0.1);
-
- // store window opacity
- aw->storedOpacity = w->paint.opacity;
- aw->timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (s);
+
+ // determine number of rotations randomly in [0.75, 1.25] range
+ aw->numZoomRotations =
+ as->opt[ANIM_SCREEN_OPTION_SIDEKICK_NUM_ROTATIONS].value.f *
+ (1.0 + 0.2 * rand () / RAND_MAX - 0.1);
+
+ // store window opacity
+ aw->storedOpacity = w->paint.opacity;
+ aw->timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
}
-static void fxZoomInit(CompScreen * s, CompWindow * w)
+static void
+fxZoomInit (CompScreen * s, CompWindow * w)
{
- ANIM_WINDOW(w);
- ANIM_SCREEN(s);
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (s);
- // store window opacity
- aw->storedOpacity = w->paint.opacity;
- aw->timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+ // store window opacity
+ aw->storedOpacity = w->paint.opacity;
+ aw->timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
}
-static float fxZoomAnimProgressDir(AnimScreen * as, AnimWindow * aw)
+static float
+fxZoomAnimProgressDir (AnimScreen * as, AnimWindow * aw)
{
- float forwardProgress =
- 1 - (aw->animRemainingTime - aw->timestep) /
- (aw->animTotalTime - aw->timestep);
-
- int animProgressDir = 1;
- if (aw->curWindowEvent == WindowEventUnminimize ||
- aw->curWindowEvent == WindowEventCreate)
- animProgressDir = 2;
-
- if (aw->animOverrideProgressDir != 0)
- animProgressDir = aw->animOverrideProgressDir;
-
- float x = forwardProgress;
-
- if ((animProgressDir == 1 &&
- (aw->curWindowEvent == WindowEventUnminimize ||
- aw->curWindowEvent == WindowEventCreate)) ||
- (animProgressDir == 2 &&
- (aw->curWindowEvent == WindowEventMinimize ||
- aw->curWindowEvent == WindowEventClose)))
- x = 1 - forwardProgress;
-
- float m = 8;
- float minx = 0.9;
- float maxx = 1.3;
-
- forwardProgress =
- (1 -
- ((sigmoid2(minx + (x * (maxx - minx)), m) -
- sigmoid2(minx, m)) / (sigmoid2(maxx, m) - sigmoid2(minx,
- m))));
-
- if (animProgressDir == 1)
- forwardProgress = 1 - forwardProgress;
-
- return forwardProgress;
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - aw->timestep) /
+ (aw->animTotalTime - aw->timestep);
+
+ int animProgressDir = 1;
+ if (aw->curWindowEvent == WindowEventUnminimize ||
+ aw->curWindowEvent == WindowEventCreate)
+ animProgressDir = 2;
+
+ if (aw->animOverrideProgressDir != 0)
+ animProgressDir = aw->animOverrideProgressDir;
+
+ float x = forwardProgress;
+
+ if ((animProgressDir == 1 &&
+ (aw->curWindowEvent == WindowEventUnminimize ||
+ aw->curWindowEvent == WindowEventCreate)) ||
+ (animProgressDir == 2 &&
+ (aw->curWindowEvent == WindowEventMinimize ||
+ aw->curWindowEvent == WindowEventClose)))
+ x = 1 - forwardProgress;
+
+ float m = 8;
+ float minx = 0.9;
+ float maxx = 1.3;
+
+ forwardProgress =
+ (1 -
+ ((sigmoid2 (minx + (x * (maxx - minx)), m) -
+ sigmoid2 (minx, m)) / (sigmoid2 (maxx, m) - sigmoid2 (minx, m))));
+
+ if (animProgressDir == 1)
+ forwardProgress = 1 - forwardProgress;
+
+ return forwardProgress;
}
static void
-fxSidekickModelStepObject(CompWindow * w,
- Model * model,
- Object * object,
- float forwardProgress,
- Point rotateCenter, float sinRot, float cosRot)
+fxSidekickModelStepObject (CompWindow * w,
+ Model * model,
+ Object * object,
+ float forwardProgress,
+ Point rotateCenter, float sinRot, float cosRot)
{
- ANIM_WINDOW(w);
-
- float origx = w->attrib.x + (WIN_W(w) * object->gridPosition.x -
- w->output.left) * model->scale.x;
- float origy = w->attrib.y + (WIN_H(w) * object->gridPosition.y -
- w->output.top) * model->scale.y;
-
- float x =
- (1 - forwardProgress) * origx +
- forwardProgress * (aw->icon.x +
- aw->icon.width * object->gridPosition.x);
- float y =
- (1 - forwardProgress) * origy +
- forwardProgress * (aw->icon.y - 0 +
- aw->icon.height * object->gridPosition.y);
-
- x -= rotateCenter.x;
- y -= rotateCenter.y;
-
- object->position.x = cosRot * x - sinRot * y;
- object->position.y = sinRot * x + cosRot * y;
-
- object->position.x += rotateCenter.x;
- object->position.y += rotateCenter.y;
+ ANIM_WINDOW (w);
+
+ float origx = w->attrib.x + (WIN_W (w) * object->gridPosition.x -
+ w->output.left) * model->scale.x;
+ float origy = w->attrib.y + (WIN_H (w) * object->gridPosition.y -
+ w->output.top) * model->scale.y;
+
+ float x =
+ (1 - forwardProgress) * origx +
+ forwardProgress * (aw->icon.x +
+ aw->icon.width * object->gridPosition.x);
+ float y =
+ (1 - forwardProgress) * origy +
+ forwardProgress * (aw->icon.y - 0 +
+ aw->icon.height * object->gridPosition.y);
+
+ x -= rotateCenter.x;
+ y -= rotateCenter.y;
+
+ object->position.x = cosRot * x - sinRot * y;
+ object->position.y = sinRot * x + cosRot * y;
+
+ object->position.x += rotateCenter.x;
+ object->position.y += rotateCenter.y;
}
static void
-fxZoomModelStepObject(CompWindow * w,
- Model * model, Object * object,
- float forwardProgress)
+fxZoomModelStepObject (CompWindow * w,
+ Model * model, Object * object, float forwardProgress)
{
- ANIM_WINDOW(w);
-
- float origx = w->attrib.x + (WIN_W(w) * object->gridPosition.x -
- w->output.left) * model->scale.x;
- float origy = w->attrib.y + (WIN_H(w) * object->gridPosition.y -
- w->output.top) * model->scale.y;
-
- object->position.x =
- (1 - forwardProgress) * origx +
- forwardProgress * (aw->icon.x +
- aw->icon.width * object->gridPosition.x);
- object->position.y =
- (1 - forwardProgress) * origy +
- forwardProgress * (aw->icon.y - 0 +
- aw->icon.height * object->gridPosition.y);
+ ANIM_WINDOW (w);
+
+ float origx = w->attrib.x + (WIN_W (w) * object->gridPosition.x -
+ w->output.left) * model->scale.x;
+ float origy = w->attrib.y + (WIN_H (w) * object->gridPosition.y -
+ w->output.top) * model->scale.y;
+
+ object->position.x =
+ (1 - forwardProgress) * origx +
+ forwardProgress * (aw->icon.x +
+ aw->icon.width * object->gridPosition.x);
+ object->position.y =
+ (1 - forwardProgress) * origy +
+ forwardProgress * (aw->icon.y - 0 +
+ aw->icon.height * object->gridPosition.y);
}
-static void fxZoomModelStep(CompScreen * s, CompWindow * w, float time)
+static void
+fxZoomModelStep (CompScreen * s, CompWindow * w, float time)
{
- int i, j, steps;
-
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- Model *model = aw->model;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
- aw->timestep = timestep;
-
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
-
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- for (j = 0; j < steps; j++) {
- float forwardProgress = fxZoomAnimProgressDir(as, aw);
- float sinRot = 0;
- float cosRot = 0;
-
- Point rotateCenter = { 0, 0 };
-
- if (aw->curAnimEffect == AnimEffectSidekick) {
- rotateCenter.x =
- (1 - forwardProgress) * (WIN_X(w) +
- WIN_W(w) *
- model->scale.x / 2) +
- forwardProgress * (aw->icon.x +
- aw->icon.width / 2);
- rotateCenter.y =
- (1 - forwardProgress) * (WIN_Y(w) +
- WIN_H(w) *
- model->scale.y / 2) +
- forwardProgress * (aw->icon.y +
- aw->icon.height / 2);
-
- sinRot =
- sin(2 * M_PI * forwardProgress *
- aw->numZoomRotations);
- cosRot =
- cos(2 * M_PI * forwardProgress *
- aw->numZoomRotations);
- }
-
- if (aw->curAnimEffect == AnimEffectSidekick)
- for (i = 0; i < model->numObjects; i++)
- fxSidekickModelStepObject(w, model,
- &model->
- objects[i],
- forwardProgress,
- rotateCenter,
- sinRot, cosRot);
- else
- for (i = 0; i < model->numObjects; i++)
- fxZoomModelStepObject(w, model,
- &model->objects[i],
- forwardProgress);
-
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0) {
- aw->animRemainingTime = 0; // avoid sub-zero values
- break;
- }
- }
- modelCalcBounds(model);
+ int i, j, steps;
+
+ ANIM_SCREEN (s);
+ ANIM_WINDOW (w);
+
+ Model *model = aw->model;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+ aw->timestep = timestep;
+
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ for (j = 0; j < steps; j++)
+ {
+ float forwardProgress = fxZoomAnimProgressDir (as, aw);
+ float sinRot = 0;
+ float cosRot = 0;
+
+ Point rotateCenter = { 0, 0 };
+
+ if (aw->curAnimEffect == AnimEffectSidekick)
+ {
+ rotateCenter.x =
+ (1 - forwardProgress) * (WIN_X (w) +
+ WIN_W (w) *
+ model->scale.x / 2) +
+ forwardProgress * (aw->icon.x + aw->icon.width / 2);
+ rotateCenter.y =
+ (1 - forwardProgress) * (WIN_Y (w) +
+ WIN_H (w) *
+ model->scale.y / 2) +
+ forwardProgress * (aw->icon.y + aw->icon.height / 2);
+
+ sinRot = sin (2 * M_PI * forwardProgress * aw->numZoomRotations);
+ cosRot = cos (2 * M_PI * forwardProgress * aw->numZoomRotations);
+ }
+
+ if (aw->curAnimEffect == AnimEffectSidekick)
+ for (i = 0; i < model->numObjects; i++)
+ fxSidekickModelStepObject (w, model,
+ &model->
+ objects[i],
+ forwardProgress,
+ rotateCenter, sinRot, cosRot);
+ else
+ for (i = 0; i < model->numObjects; i++)
+ fxZoomModelStepObject (w, model,
+ &model->objects[i], forwardProgress);
+
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ {
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ break;
+ }
+ }
+ modelCalcBounds (model);
}
static void
-fxZoomUpdateWindowAttrib(AnimScreen * as,
- AnimWindow * aw, WindowPaintAttrib * wAttrib)
+fxZoomUpdateWindowAttrib (AnimScreen * as,
+ AnimWindow * aw, WindowPaintAttrib * wAttrib)
{
- if (aw->model->scale.x < 1.0 && // if Scale plugin in progress
- aw->curWindowEvent == WindowEventUnminimize) // and if unminimizing
- return; // then allow Fade to take over opacity
- float forwardProgress = fxZoomAnimProgressDir(as, aw);
- forwardProgress = MIN(forwardProgress, 1);
- forwardProgress = MAX(forwardProgress, 0);
-
- wAttrib->opacity =
- aw->storedOpacity * pow(1 - forwardProgress, 0.75);
+ if (aw->model->scale.x < 1.0 && // if Scale plugin in progress
+ aw->curWindowEvent == WindowEventUnminimize) // and if unminimizing
+ return; // then allow Fade to take over opacity
+ float forwardProgress = fxZoomAnimProgressDir (as, aw);
+ forwardProgress = MIN (forwardProgress, 1);
+ forwardProgress = MAX (forwardProgress, 0);
+
+ wAttrib->opacity = aw->storedOpacity * pow (1 - forwardProgress, 0.75);
}
@@ -1672,123 +1686,129 @@ fxZoomUpdateWindowAttrib(AnimScreen * as,
static void
-fxCurvedFoldModelStepObject(CompWindow * w,
- Model * model,
- Object * object,
- float forwardProgress, float curveMaxAmp)
+fxCurvedFoldModelStepObject (CompWindow * w,
+ Model * model,
+ Object * object,
+ float forwardProgress, float curveMaxAmp)
{
- ANIM_WINDOW(w);
-
- float origx = w->attrib.x + (WIN_W(w) * object->gridPosition.x -
- w->output.left) * model->scale.x;
- float origy = w->attrib.y + (WIN_H(w) * object->gridPosition.y -
- w->output.top) * model->scale.y;
-
- if (aw->curWindowEvent == WindowEventShade ||
- aw->curWindowEvent == WindowEventUnshade) {
- // Execute shade mode
-
- // find position in window contents
- // (window contents correspond to 0.0-1.0 range)
- float relPosInWinContents =
- (object->gridPosition.y * WIN_H(w) -
- model->topHeight) / w->height;
- float relDistToCenter = fabs(relPosInWinContents - 0.5);
-
- if (object->gridPosition.y == 0) {
- object->position.x = origx;
- object->position.y = WIN_Y(w);
- } else if (object->gridPosition.y == 1) {
- object->position.x = origx;
- object->position.y =
- (1 - forwardProgress) *
- origy +
- forwardProgress *
- (WIN_Y(w) + model->topHeight +
- model->bottomHeight);
- } else {
- object->position.x =
- origx + sin(forwardProgress * M_PI / 2) *
- (0.5 -
- object->gridPosition.x) * 2 * model->scale.x *
- (curveMaxAmp -
- curveMaxAmp * 4 * relDistToCenter *
- relDistToCenter);
- object->position.y =
- (1 - forwardProgress) * origy +
- forwardProgress * (WIN_Y(w) +
- model->topHeight);
- }
- } else { // Execute normal mode
-
- // find position within window borders
- // (border contents correspond to 0.0-1.0 range)
- float relPosInWinBorders =
- (object->gridPosition.y * WIN_H(w) -
- (w->output.top - w->input.top)) / BORDER_H(w);
- float relDistToCenter = fabs(relPosInWinBorders - 0.5);
-
- // prevent top & bottom shadows from extending too much
- if (relDistToCenter > 0.5)
- relDistToCenter = 0.5;
-
- object->position.x =
- origx + sin(forwardProgress * M_PI / 2) *
- (0.5 - object->gridPosition.x) * 2 * model->scale.x *
- (curveMaxAmp -
- curveMaxAmp * 4 * relDistToCenter * relDistToCenter);
- object->position.y =
- (1 - forwardProgress) * origy +
- forwardProgress * BORDER_Y(w);
- }
+ ANIM_WINDOW (w);
+
+ float origx = w->attrib.x + (WIN_W (w) * object->gridPosition.x -
+ w->output.left) * model->scale.x;
+ float origy = w->attrib.y + (WIN_H (w) * object->gridPosition.y -
+ w->output.top) * model->scale.y;
+
+ if (aw->curWindowEvent == WindowEventShade ||
+ aw->curWindowEvent == WindowEventUnshade)
+ {
+ // Execute shade mode
+
+ // find position in window contents
+ // (window contents correspond to 0.0-1.0 range)
+ float relPosInWinContents =
+ (object->gridPosition.y * WIN_H (w) -
+ model->topHeight) / w->height;
+ float relDistToCenter = fabs (relPosInWinContents - 0.5);
+
+ if (object->gridPosition.y == 0)
+ {
+ object->position.x = origx;
+ object->position.y = WIN_Y (w);
+ }
+ else if (object->gridPosition.y == 1)
+ {
+ object->position.x = origx;
+ object->position.y =
+ (1 - forwardProgress) *
+ origy +
+ forwardProgress *
+ (WIN_Y (w) + model->topHeight + model->bottomHeight);
+ }
+ else
+ {
+ object->position.x =
+ origx + sin (forwardProgress * M_PI / 2) *
+ (0.5 -
+ object->gridPosition.x) * 2 * model->scale.x *
+ (curveMaxAmp -
+ curveMaxAmp * 4 * relDistToCenter * relDistToCenter);
+ object->position.y =
+ (1 - forwardProgress) * origy +
+ forwardProgress * (WIN_Y (w) + model->topHeight);
+ }
+ }
+ else
+ { // Execute normal mode
+
+ // find position within window borders
+ // (border contents correspond to 0.0-1.0 range)
+ float relPosInWinBorders =
+ (object->gridPosition.y * WIN_H (w) -
+ (w->output.top - w->input.top)) / BORDER_H (w);
+ float relDistToCenter = fabs (relPosInWinBorders - 0.5);
+
+ // prevent top & bottom shadows from extending too much
+ if (relDistToCenter > 0.5)
+ relDistToCenter = 0.5;
+
+ object->position.x =
+ origx + sin (forwardProgress * M_PI / 2) *
+ (0.5 - object->gridPosition.x) * 2 * model->scale.x *
+ (curveMaxAmp -
+ curveMaxAmp * 4 * relDistToCenter * relDistToCenter);
+ object->position.y =
+ (1 - forwardProgress) * origy + forwardProgress * BORDER_Y (w);
+ }
}
static void
-fxCurvedFoldModelStep(CompScreen * s, CompWindow * w, float time)
+fxCurvedFoldModelStep (CompScreen * s, CompWindow * w, float time)
{
- int i, j, steps;
-
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- Model *model = aw->model;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
-
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
-
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- for (j = 0; j < steps; j++) {
- float forwardProgress =
- 1 - (aw->animRemainingTime - timestep) /
- (aw->animTotalTime - timestep);
- if (aw->curWindowEvent == WindowEventCreate ||
- aw->curWindowEvent == WindowEventUnminimize ||
- aw->curWindowEvent == WindowEventUnshade)
- forwardProgress = 1 - forwardProgress;
-
- for (i = 0; i < model->numObjects; i++)
- fxCurvedFoldModelStepObject(w, model,
- &model->objects[i],
- forwardProgress,
- as->
- opt
- [ANIM_SCREEN_OPTION_CURVED_FOLD_AMP].
- value.f * WIN_W(w));
-
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0) {
- aw->animRemainingTime = 0; // avoid sub-zero values
- break;
- }
- }
- modelCalcBounds(model);
+ int i, j, steps;
+
+ ANIM_SCREEN (s);
+ ANIM_WINDOW (w);
+
+ Model *model = aw->model;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ for (j = 0; j < steps; j++)
+ {
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - timestep) /
+ (aw->animTotalTime - timestep);
+ if (aw->curWindowEvent == WindowEventCreate ||
+ aw->curWindowEvent == WindowEventUnminimize ||
+ aw->curWindowEvent == WindowEventUnshade)
+ forwardProgress = 1 - forwardProgress;
+
+ for (i = 0; i < model->numObjects; i++)
+ fxCurvedFoldModelStepObject (w, model,
+ &model->objects[i],
+ forwardProgress,
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_CURVED_FOLD_AMP].
+ value.f * WIN_W (w));
+
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ {
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ break;
+ }
+ }
+ modelCalcBounds (model);
}
@@ -1796,132 +1816,135 @@ fxCurvedFoldModelStep(CompScreen * s, CompWindow * w, float time)
static void
-fxHorizontalFoldsInitGrid(AnimScreen * as,
- WindowEvent forWindowEvent,
- int *gridWidth, int *gridHeight)
+fxHorizontalFoldsInitGrid (AnimScreen * as,
+ WindowEvent forWindowEvent,
+ int *gridWidth, int *gridHeight)
{
- *gridWidth = 2;
- if (forWindowEvent == WindowEventShade ||
- forWindowEvent == WindowEventUnshade)
- *gridHeight =
- 3 + 2 *
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS].
- value.i;
- else
- *gridHeight =
- 1 + 2 *
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS].
- value.i;
+ *gridWidth = 2;
+ if (forWindowEvent == WindowEventShade ||
+ forWindowEvent == WindowEventUnshade)
+ *gridHeight =
+ 3 + 2 *
+ as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS].value.i;
+ else
+ *gridHeight =
+ 1 + 2 *
+ as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS].value.i;
}
static void
-fxHorizontalFoldsModelStepObject(CompWindow * w,
- Model * model,
- Object * object,
- float forwardProgress,
- float curveMaxAmp, int rowNo)
+fxHorizontalFoldsModelStepObject (CompWindow * w,
+ Model * model,
+ Object * object,
+ float forwardProgress,
+ float curveMaxAmp, int rowNo)
{
- ANIM_WINDOW(w);
-
- float origx = w->attrib.x + (WIN_W(w) * object->gridPosition.x -
- w->output.left) * model->scale.x;
- float origy = w->attrib.y + (WIN_H(w) * object->gridPosition.y -
- w->output.top) * model->scale.y;
-
- if (aw->curWindowEvent == WindowEventShade ||
- aw->curWindowEvent == WindowEventUnshade) {
- // Execute shade mode
-
- float relDistToFoldCenter = (rowNo % 2 == 1 ? 0.5 : 0);
-
- if (object->gridPosition.y == 0) {
- object->position.x = origx;
- object->position.y = WIN_Y(w);
- } else if (object->gridPosition.y == 1) {
- object->position.x = origx;
- object->position.y =
- (1 - forwardProgress) * origy +
- forwardProgress *
- (WIN_Y(w) + model->topHeight +
- model->bottomHeight);
- } else {
- object->position.x =
- origx + sin(forwardProgress * M_PI / 2) *
- (0.5 -
- object->gridPosition.x) * 2 * model->scale.x *
- (curveMaxAmp -
- curveMaxAmp * 4 * relDistToFoldCenter *
- relDistToFoldCenter);
- object->position.y =
- (1 - forwardProgress) * origy +
- forwardProgress * (WIN_Y(w) +
- model->topHeight);
- }
- } else { // Execute normal mode
-
- float relDistToFoldCenter;
- relDistToFoldCenter = (rowNo % 2 == 0 ? 0.5 : 0);
-
- object->position.x =
- origx + sin(forwardProgress * M_PI / 2) *
- (0.5 - object->gridPosition.x) * 2 * model->scale.x *
- (curveMaxAmp - curveMaxAmp * 4 *
- relDistToFoldCenter * relDistToFoldCenter);
- object->position.y =
- (1 - forwardProgress) * origy +
- forwardProgress * BORDER_Y(w);
- }
+ ANIM_WINDOW (w);
+
+ float origx = w->attrib.x + (WIN_W (w) * object->gridPosition.x -
+ w->output.left) * model->scale.x;
+ float origy = w->attrib.y + (WIN_H (w) * object->gridPosition.y -
+ w->output.top) * model->scale.y;
+
+ if (aw->curWindowEvent == WindowEventShade ||
+ aw->curWindowEvent == WindowEventUnshade)
+ {
+ // Execute shade mode
+
+ float relDistToFoldCenter = (rowNo % 2 == 1 ? 0.5 : 0);
+
+ if (object->gridPosition.y == 0)
+ {
+ object->position.x = origx;
+ object->position.y = WIN_Y (w);
+ }
+ else if (object->gridPosition.y == 1)
+ {
+ object->position.x = origx;
+ object->position.y =
+ (1 - forwardProgress) * origy +
+ forwardProgress *
+ (WIN_Y (w) + model->topHeight + model->bottomHeight);
+ }
+ else
+ {
+ object->position.x =
+ origx + sin (forwardProgress * M_PI / 2) *
+ (0.5 -
+ object->gridPosition.x) * 2 * model->scale.x *
+ (curveMaxAmp -
+ curveMaxAmp * 4 * relDistToFoldCenter * relDistToFoldCenter);
+ object->position.y =
+ (1 - forwardProgress) * origy +
+ forwardProgress * (WIN_Y (w) + model->topHeight);
+ }
+ }
+ else
+ { // Execute normal mode
+
+ float relDistToFoldCenter;
+ relDistToFoldCenter = (rowNo % 2 == 0 ? 0.5 : 0);
+
+ object->position.x =
+ origx + sin (forwardProgress * M_PI / 2) *
+ (0.5 - object->gridPosition.x) * 2 * model->scale.x *
+ (curveMaxAmp - curveMaxAmp * 4 *
+ relDistToFoldCenter * relDistToFoldCenter);
+ object->position.y =
+ (1 - forwardProgress) * origy + forwardProgress * BORDER_Y (w);
+ }
}
static void
-fxHorizontalFoldsModelStep(CompScreen * s, CompWindow * w, float time)
+fxHorizontalFoldsModelStep (CompScreen * s, CompWindow * w, float time)
{
- int i, j, steps;
-
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- Model *model = aw->model;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
-
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- for (j = 0; j < steps; j++) {
- float forwardProgress =
- 1 - (aw->animRemainingTime - timestep) /
- (aw->animTotalTime - timestep);
- if (aw->curWindowEvent == WindowEventCreate ||
- aw->curWindowEvent == WindowEventUnminimize ||
- aw->curWindowEvent == WindowEventUnshade)
- forwardProgress = 1 - forwardProgress;
-
- for (i = 0; i < model->numObjects; i++)
- fxHorizontalFoldsModelStepObject(w, model,
- &model->
- objects[i],
- forwardProgress,
- as->
- opt
- [ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_AMP].
- value.f *
- WIN_W(w),
- i /
- model->gridWidth);
-
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0) {
- aw->animRemainingTime = 0; // avoid sub-zero values
- break;
- }
- }
- modelCalcBounds(model);
+ int i, j, steps;
+
+ ANIM_SCREEN (s);
+ ANIM_WINDOW (w);
+
+ Model *model = aw->model;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ for (j = 0; j < steps; j++)
+ {
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - timestep) /
+ (aw->animTotalTime - timestep);
+ if (aw->curWindowEvent == WindowEventCreate ||
+ aw->curWindowEvent == WindowEventUnminimize ||
+ aw->curWindowEvent == WindowEventUnshade)
+ forwardProgress = 1 - forwardProgress;
+
+ for (i = 0; i < model->numObjects; i++)
+ fxHorizontalFoldsModelStepObject (w, model,
+ &model->
+ objects[i],
+ forwardProgress,
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_AMP].
+ value.f *
+ WIN_W (w),
+ i / model->gridWidth);
+
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ {
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ break;
+ }
+ }
+ modelCalcBounds (model);
}
@@ -1930,4617 +1953,4534 @@ fxHorizontalFoldsModelStep(CompScreen * s, CompWindow * w, float time)
static void
-fxRollUpInitGrid(AnimScreen * as,
- WindowEvent forWindowEvent, int *gridWidth,
- int *gridHeight)
+fxRollUpInitGrid (AnimScreen * as,
+ WindowEvent forWindowEvent, int *gridWidth, int *gridHeight)
{
- *gridWidth = 2;
- if (forWindowEvent == WindowEventShade ||
- forWindowEvent == WindowEventUnshade)
- *gridHeight = 4;
- else
- *gridHeight = 2;
+ *gridWidth = 2;
+ if (forWindowEvent == WindowEventShade ||
+ forWindowEvent == WindowEventUnshade)
+ *gridHeight = 4;
+ else
+ *gridHeight = 2;
}
static void
-fxRollUpModelStepObject(CompWindow * w,
- Model * model,
- Object * object,
- float forwardProgress, Bool fixedInterior)
+fxRollUpModelStepObject (CompWindow * w,
+ Model * model,
+ Object * object,
+ float forwardProgress, Bool fixedInterior)
{
- ANIM_WINDOW(w);
-
- float origx = WIN_X(w) + WIN_W(w) * object->gridPosition.x;
-
- if (aw->curWindowEvent == WindowEventShade ||
- aw->curWindowEvent == WindowEventUnshade) {
- // Execute shade mode
-
- // find position in window contents
- // (window contents correspond to 0.0-1.0 range)
- float relPosInWinContents =
- (object->gridPosition.y * WIN_H(w) -
- model->topHeight) / w->height;
-
- if (object->gridPosition.y == 0) {
- object->position.x = origx;
- object->position.y = WIN_Y(w);
- } else if (object->gridPosition.y == 1) {
- object->position.x = origx;
- object->position.y =
- (1 - forwardProgress) *
- (WIN_Y(w) +
- WIN_H(w) * object->gridPosition.y) +
- forwardProgress * (WIN_Y(w) +
- model->topHeight +
- model->bottomHeight);
- } else {
- object->position.x = origx;
-
- if (relPosInWinContents > forwardProgress) {
- object->position.y =
- (1 - forwardProgress) *
- (WIN_Y(w) +
- WIN_H(w) * object->gridPosition.y) +
- forwardProgress * (WIN_Y(w) +
- model->topHeight);
-
- if (fixedInterior)
- object->
- offsetTexCoordForQuadBefore.y =
- -forwardProgress * w->height;
- } else {
- object->position.y =
- WIN_Y(w) + model->topHeight;
- if (!fixedInterior)
- object->offsetTexCoordForQuadAfter.
- y =
- (forwardProgress -
- relPosInWinContents) *
- w->height;
- }
- }
- }
- /*else Doesn't work yet
- { // Execute normal mode
-
- // find position within window borders
- // (border contents correspond to 0.0-1.0 range)
- //float relPosInWinBorders =
- // (object->gridPosition.y * WIN_H (w) - (w->output.top - w->input.top)) /
- // BORDER_H (w);
-
- object->position.x = origx;
-
- if (object->gridPosition.y > forwardProgress)
- {
- object->position.y =
- (1 - forwardProgress) *
- (WIN_Y (w) + WIN_H (w) * object->gridPosition.y) +
- forwardProgress *
- WIN_Y (w);
- //printf("1 obj.position.y: %.2f, relPosInWinContents: %.2f, forwardProgress: %.2f\n",
- // object->position.y, relPosInWinContents, forwardProgress);
- }
- else
- {
- object->position.y = WIN_Y (w);
- object->offsetTexCoordForQuadAfter.y =
- (forwardProgress - object->gridPosition.y) * WIN_H (w);
- //printf("2 obj.position.y: %.2f, relPosInWinContents: %.2f, forwardProgress: %.2f\n",
- // object->position.y, relPosInWinContents, forwardProgress);
- }
- } */
+ ANIM_WINDOW (w);
+
+ float origx = WIN_X (w) + WIN_W (w) * object->gridPosition.x;
+
+ if (aw->curWindowEvent == WindowEventShade ||
+ aw->curWindowEvent == WindowEventUnshade)
+ {
+ // Execute shade mode
+
+ // find position in window contents
+ // (window contents correspond to 0.0-1.0 range)
+ float relPosInWinContents =
+ (object->gridPosition.y * WIN_H (w) -
+ model->topHeight) / w->height;
+
+ if (object->gridPosition.y == 0)
+ {
+ object->position.x = origx;
+ object->position.y = WIN_Y (w);
+ }
+ else if (object->gridPosition.y == 1)
+ {
+ object->position.x = origx;
+ object->position.y =
+ (1 - forwardProgress) *
+ (WIN_Y (w) +
+ WIN_H (w) * object->gridPosition.y) +
+ forwardProgress * (WIN_Y (w) +
+ model->topHeight + model->bottomHeight);
+ }
+ else
+ {
+ object->position.x = origx;
+
+ if (relPosInWinContents > forwardProgress)
+ {
+ object->position.y =
+ (1 - forwardProgress) *
+ (WIN_Y (w) +
+ WIN_H (w) * object->gridPosition.y) +
+ forwardProgress * (WIN_Y (w) + model->topHeight);
+
+ if (fixedInterior)
+ object->
+ offsetTexCoordForQuadBefore.y =
+ -forwardProgress * w->height;
+ }
+ else
+ {
+ object->position.y = WIN_Y (w) + model->topHeight;
+ if (!fixedInterior)
+ object->offsetTexCoordForQuadAfter.
+ y =
+ (forwardProgress - relPosInWinContents) * w->height;
+ }
+ }
+ }
+ /*else Doesn't work yet
+ { // Execute normal mode
+
+ // find position within window borders
+ // (border contents correspond to 0.0-1.0 range)
+ //float relPosInWinBorders =
+ // (object->gridPosition.y * WIN_H (w) - (w->output.top - w->input.top)) /
+ // BORDER_H (w);
+
+ object->position.x = origx;
+
+ if (object->gridPosition.y > forwardProgress)
+ {
+ object->position.y =
+ (1 - forwardProgress) *
+ (WIN_Y (w) + WIN_H (w) * object->gridPosition.y) +
+ forwardProgress *
+ WIN_Y (w);
+ //printf("1 obj.position.y: %.2f, relPosInWinContents: %.2f, forwardProgress: %.2f\n",
+ // object->position.y, relPosInWinContents, forwardProgress);
+ }
+ else
+ {
+ object->position.y = WIN_Y (w);
+ object->offsetTexCoordForQuadAfter.y =
+ (forwardProgress - object->gridPosition.y) * WIN_H (w);
+ //printf("2 obj.position.y: %.2f, relPosInWinContents: %.2f, forwardProgress: %.2f\n",
+ // object->position.y, relPosInWinContents, forwardProgress);
+ }
+ } */
}
-static void fxRollUpModelStep(CompScreen * s, CompWindow * w, float time)
+static void
+fxRollUpModelStep (CompScreen * s, CompWindow * w, float time)
{
- int i, j, steps;
-
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- Model *model = aw->model;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
-
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- for (j = 0; j < steps; j++) {
- float forwardProgress =
- 1 - (aw->animRemainingTime - timestep) /
- (aw->animTotalTime - timestep);
- if (aw->curWindowEvent == WindowEventCreate ||
- aw->curWindowEvent == WindowEventUnminimize ||
- aw->curWindowEvent == WindowEventUnshade)
- forwardProgress = 1 - forwardProgress;
-
- for (i = 0; i < model->numObjects; i++)
- fxRollUpModelStepObject(w, model,
- &model->objects[i],
- forwardProgress,
- as->
- opt
- [ANIM_SCREEN_OPTION_ROLLUP_FIXED_INTERIOR].
- value.b);
-
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0) {
- aw->animRemainingTime = 0; // avoid sub-zero values
- break;
- }
- }
- modelCalcBounds(model);
+ int i, j, steps;
+
+ ANIM_SCREEN (s);
+ ANIM_WINDOW (w);
+
+ Model *model = aw->model;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ for (j = 0; j < steps; j++)
+ {
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - timestep) /
+ (aw->animTotalTime - timestep);
+ if (aw->curWindowEvent == WindowEventCreate ||
+ aw->curWindowEvent == WindowEventUnminimize ||
+ aw->curWindowEvent == WindowEventUnshade)
+ forwardProgress = 1 - forwardProgress;
+
+ for (i = 0; i < model->numObjects; i++)
+ fxRollUpModelStepObject (w, model,
+ &model->objects[i],
+ forwardProgress,
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_ROLLUP_FIXED_INTERIOR].
+ value.b);
+
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ {
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ break;
+ }
+ }
+ modelCalcBounds (model);
}
// ===================== Effect: Fade =========================
-static void fxFadeInit(CompScreen * s, CompWindow * w)
+static void
+fxFadeInit (CompScreen * s, CompWindow * w)
{
- ANIM_WINDOW(w);
- ANIM_SCREEN(s);
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (s);
- // store window opacity
- aw->storedOpacity = w->paint.opacity;
+ // store window opacity
+ aw->storedOpacity = w->paint.opacity;
- aw->timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+ aw->timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
}
-static void fxFadeModelStep(CompScreen * s, CompWindow * w, float time)
+static void
+fxFadeModelStep (CompScreen * s, CompWindow * w, float time)
{
- int j, steps;
-
- ANIM_WINDOW(w);
- ANIM_SCREEN(s);
-
- Model *model = aw->model;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
- aw->timestep = timestep;
-
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
-
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- for (j = 0; j < steps; j++) {
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0) {
- aw->animRemainingTime = 0; // avoid sub-zero values
- break;
- }
- }
+ int j, steps;
+
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (s);
+
+ Model *model = aw->model;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+ aw->timestep = timestep;
+
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ for (j = 0; j < steps; j++)
+ {
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ {
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ break;
+ }
+ }
}
static void
-fxFadeUpdateWindowAttrib(AnimScreen * as,
- AnimWindow * aw, WindowPaintAttrib * wAttrib)
+fxFadeUpdateWindowAttrib (AnimScreen * as,
+ AnimWindow * aw, WindowPaintAttrib * wAttrib)
{
- float forwardProgress =
- 1 - (aw->animRemainingTime - aw->timestep) /
- (aw->animTotalTime - aw->timestep);
- forwardProgress = MIN(forwardProgress, 1);
- forwardProgress = MAX(forwardProgress, 0);
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - aw->timestep) /
+ (aw->animTotalTime - aw->timestep);
+ forwardProgress = MIN (forwardProgress, 1);
+ forwardProgress = MAX (forwardProgress, 0);
- if (aw->curWindowEvent == WindowEventCreate ||
- aw->curWindowEvent == WindowEventUnminimize)
- forwardProgress = 1 - forwardProgress;
+ if (aw->curWindowEvent == WindowEventCreate ||
+ aw->curWindowEvent == WindowEventUnminimize)
+ forwardProgress = 1 - forwardProgress;
- wAttrib->opacity = aw->storedOpacity * (1 - forwardProgress);
+ wAttrib->opacity = aw->storedOpacity * (1 - forwardProgress);
}
// ===================== Effect: Burn =========================
-static void fxBurnInit(CompScreen * s, CompWindow * w)
+static void
+fxBurnInit (CompScreen * s, CompWindow * w)
{
- ANIM_WINDOW(w);
- ANIM_SCREEN(s);
-
- modelInitObjects(aw->model,
- WIN_X(w), WIN_Y(w), WIN_W(w), WIN_H(w));
- if (!aw->numPs) {
- aw->ps = calloc(1, 2 * sizeof(ParticleSystem));
- aw->numPs = 2;
- }
- initParticles(as->opt[ANIM_SCREEN_OPTION_FIRE_PARTICLES].value.i /
- 10, &aw->ps[0]);
- initParticles(as->opt[ANIM_SCREEN_OPTION_FIRE_PARTICLES].value.i,
- &aw->ps[1]);
- aw->ps[1].slowdown =
- as->opt[ANIM_SCREEN_OPTION_FIRE_SLOWDOWN].value.f;
- aw->ps[1].darken = 0.5;
- aw->ps[1].blendMode = GL_ONE;
-
- aw->ps[0].slowdown =
- as->opt[ANIM_SCREEN_OPTION_FIRE_SLOWDOWN].value.f / 2.0;
- aw->ps[0].darken = 0.0;
- aw->ps[0].blendMode = GL_ONE_MINUS_SRC_ALPHA;
-
- if (!aw->ps[0].tex)
- glGenTextures(1, &aw->ps[0].tex);
- glBindTexture(GL_TEXTURE_2D, aw->ps[0].tex);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, fireTex);
- glBindTexture(GL_TEXTURE_2D, 0);
-
- if (!aw->ps[1].tex)
- glGenTextures(1, &aw->ps[1].tex);
- glBindTexture(GL_TEXTURE_2D, aw->ps[1].tex);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, fireTex);
- glBindTexture(GL_TEXTURE_2D, 0);
-
- int i;
-
- for (i = 0; i < LIST_SIZE(animDirectionName); i++) {
- if (strcmp
- (as->opt[ANIM_SCREEN_OPTION_FIRE_DIRECTION].value.s,
- animDirectionName[i]) == 0) {
- aw->animDirection = i;
- }
- }
-
- if (aw->animDirection == AnimDirectionRandom) {
- aw->animDirection = rand() % 4;
- }
- if (as->opt[ANIM_SCREEN_OPTION_FIRE_CONSTANT_SPEED].value.b) {
- aw->animTotalTime *= WIN_H(w) / 500.0;
- aw->animRemainingTime *= WIN_H(w) / 500.0;
- }
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (s);
+
+ modelInitObjects (aw->model, WIN_X (w), WIN_Y (w), WIN_W (w), WIN_H (w));
+ if (!aw->numPs)
+ {
+ aw->ps = calloc (1, 2 * sizeof (ParticleSystem));
+ aw->numPs = 2;
+ }
+ initParticles (as->opt[ANIM_SCREEN_OPTION_FIRE_PARTICLES].value.i /
+ 10, &aw->ps[0]);
+ initParticles (as->opt[ANIM_SCREEN_OPTION_FIRE_PARTICLES].value.i,
+ &aw->ps[1]);
+ aw->ps[1].slowdown = as->opt[ANIM_SCREEN_OPTION_FIRE_SLOWDOWN].value.f;
+ aw->ps[1].darken = 0.5;
+ aw->ps[1].blendMode = GL_ONE;
+
+ aw->ps[0].slowdown =
+ as->opt[ANIM_SCREEN_OPTION_FIRE_SLOWDOWN].value.f / 2.0;
+ aw->ps[0].darken = 0.0;
+ aw->ps[0].blendMode = GL_ONE_MINUS_SRC_ALPHA;
+
+ if (!aw->ps[0].tex)
+ glGenTextures (1, &aw->ps[0].tex);
+ glBindTexture (GL_TEXTURE_2D, aw->ps[0].tex);
+
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, fireTex);
+ glBindTexture (GL_TEXTURE_2D, 0);
+
+ if (!aw->ps[1].tex)
+ glGenTextures (1, &aw->ps[1].tex);
+ glBindTexture (GL_TEXTURE_2D, aw->ps[1].tex);
+
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, fireTex);
+ glBindTexture (GL_TEXTURE_2D, 0);
+
+ int i;
+
+ for (i = 0; i < LIST_SIZE (animDirectionName); i++)
+ {
+ if (strcmp
+ (as->opt[ANIM_SCREEN_OPTION_FIRE_DIRECTION].value.s,
+ animDirectionName[i]) == 0)
+ {
+ aw->animDirection = i;
+ }
+ }
+
+ if (aw->animDirection == AnimDirectionRandom)
+ {
+ aw->animDirection = rand () % 4;
+ }
+ if (as->opt[ANIM_SCREEN_OPTION_FIRE_CONSTANT_SPEED].value.b)
+ {
+ aw->animTotalTime *= WIN_H (w) / 500.0;
+ aw->animRemainingTime *= WIN_H (w) / 500.0;
+ }
}
static void
-fxBurnGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
- int width, int height, float size, float time)
+fxBurnGenNewFire (CompScreen * s, ParticleSystem * ps, int x, int y,
+ int width, int height, float size, float time)
{
- ANIM_SCREEN(s);
-
- float max_new =
- ps->numParticles * (time / 50) * (1.05 -
- as->
- opt
- [ANIM_SCREEN_OPTION_FIRE_LIFE].
- value.f);
- int i;
- Particle *part;
- float rVal;
-
- for (i = 0; i < ps->numParticles && max_new > 0; i++) {
- part = &ps->particles[i];
- if (part->life <= 0.0f) {
- // give gt new life
- rVal = (float) (random() & 0xff) / 255.0;
- part->life = 1.0f;
- part->fade = (rVal * (1 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)) + (0.2f * (1.01 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)); // Random Fade Value
-
- // set size
- part->width =
- as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f;
- part->height =
- as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f *
- 1.5;
- rVal = (float) (random() & 0xff) / 255.0;
- part->w_mod = size * rVal;
- part->h_mod = size * rVal;
-
- // choose random position
- rVal = (float) (random() & 0xff) / 255.0;
- part->x = x + ((width > 1) ? (rVal * width) : 0);
- rVal = (float) (random() & 0xff) / 255.0;
- part->y = y + ((height > 1) ? (rVal * height) : 0);
- part->z = 0.0;
- part->xo = part->x;
- part->yo = part->y;
- part->zo = part->z;
-
- // set speed and direction
- rVal = (float) (random() & 0xff) / 255.0;
- part->xi = ((rVal * 20.0) - 10.0f);
- rVal = (float) (random() & 0xff) / 255.0;
- part->yi = ((rVal * 20.0) - 15.0f);
- part->zi = 0.0f;
- rVal = (float) (random() & 0xff) / 255.0;
-
- if (as->opt[ANIM_SCREEN_OPTION_FIRE_MYSTICAL].
- value.b) {
- // Random colors! (aka Mystical Fire)
- rVal = (float) (random() & 0xff) / 255.0;
- part->r = rVal;
- rVal = (float) (random() & 0xff) / 255.0;
- part->g = rVal;
- rVal = (float) (random() & 0xff) / 255.0;
- part->b = rVal;
- } else {
- // set color ABAB as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.f
- part->r =
- (float) as->
- opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
- value.c[0] / 0xffff -
- (rVal / 1.7 *
- (float) as->
- opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
- value.c[0] / 0xffff);
- part->g =
- (float) as->
- opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
- value.c[1] / 0xffff -
- (rVal / 1.7 *
- (float) as->
- opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
- value.c[1] / 0xffff);
- part->b =
- (float) as->
- opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
- value.c[2] / 0xffff -
- (rVal / 1.7 *
- (float) as->
- opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
- value.c[2] / 0xffff);
- }
- // set transparancy
- part->a =
- (float) as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
- value.c[3] / 0xffff;
-
- // set gravity
- part->xg = (part->x < part->xo) ? 1.0 : -1.0;
- part->yg = -3.0f;
- part->zg = 0.0f;
-
- ps->active = TRUE;
- max_new -= 1;
- } else {
- part->xg = (part->x < part->xo) ? 1.0 : -1.0;
- }
- }
+ ANIM_SCREEN (s);
+
+ float max_new =
+ ps->numParticles * (time / 50) * (1.05 -
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_FIRE_LIFE].
+ value.f);
+ int i;
+ Particle *part;
+ float rVal;
+
+ for (i = 0; i < ps->numParticles && max_new > 0; i++)
+ {
+ part = &ps->particles[i];
+ if (part->life <= 0.0f)
+ {
+ // give gt new life
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->life = 1.0f;
+ part->fade = (rVal * (1 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)) + (0.2f * (1.01 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)); // Random Fade Value
+
+ // set size
+ part->width = as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f;
+ part->height =
+ as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f * 1.5;
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->w_mod = size * rVal;
+ part->h_mod = size * rVal;
+
+ // choose random position
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->x = x + ((width > 1) ? (rVal * width) : 0);
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->y = y + ((height > 1) ? (rVal * height) : 0);
+ part->z = 0.0;
+ part->xo = part->x;
+ part->yo = part->y;
+ part->zo = part->z;
+
+ // set speed and direction
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->xi = ((rVal * 20.0) - 10.0f);
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->yi = ((rVal * 20.0) - 15.0f);
+ part->zi = 0.0f;
+ rVal = (float)(random () & 0xff) / 255.0;
+
+ if (as->opt[ANIM_SCREEN_OPTION_FIRE_MYSTICAL].value.b)
+ {
+ // Random colors! (aka Mystical Fire)
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->r = rVal;
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->g = rVal;
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->b = rVal;
+ }
+ else
+ {
+ // set color ABAB as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.f
+ part->r =
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
+ value.c[0] / 0xffff -
+ (rVal / 1.7 *
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[0] / 0xffff);
+ part->g =
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
+ value.c[1] / 0xffff -
+ (rVal / 1.7 *
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[1] / 0xffff);
+ part->b =
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
+ value.c[2] / 0xffff -
+ (rVal / 1.7 *
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[2] / 0xffff);
+ }
+ // set transparancy
+ part->a =
+ (float)as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].
+ value.c[3] / 0xffff;
+
+ // set gravity
+ part->xg = (part->x < part->xo) ? 1.0 : -1.0;
+ part->yg = -3.0f;
+ part->zg = 0.0f;
+
+ ps->active = TRUE;
+ max_new -= 1;
+ }
+ else
+ {
+ part->xg = (part->x < part->xo) ? 1.0 : -1.0;
+ }
+ }
}
static void
-fxBurnGenNewSmoke(CompScreen * s, ParticleSystem * ps, int x, int y,
- int width, int height, float size, float time)
+fxBurnGenNewSmoke (CompScreen * s, ParticleSystem * ps, int x, int y,
+ int width, int height, float size, float time)
{
- ANIM_SCREEN(s);
-
- float max_new =
- ps->numParticles * (time / 50) * (1.05 -
- as->
- opt
- [ANIM_SCREEN_OPTION_FIRE_LIFE].
- value.f);
- int i;
- Particle *part;
- float rVal;
-
- for (i = 0; i < ps->numParticles && max_new > 0; i++) {
- part = &ps->particles[i];
- if (part->life <= 0.0f) {
- // give gt new life
- rVal = (float) (random() & 0xff) / 255.0;
- part->life = 1.0f;
- part->fade = (rVal * (1 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)) + (0.2f * (1.01 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)); // Random Fade Value
-
- // set size
- part->width =
- as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f *
- size * 5;
- part->height =
- as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f *
- size * 5;
- rVal = (float) (random() & 0xff) / 255.0;
- part->w_mod = -0.8;
- part->h_mod = -0.8;
-
- // choose random position
- rVal = (float) (random() & 0xff) / 255.0;
- part->x = x + ((width > 1) ? (rVal * width) : 0);
- rVal = (float) (random() & 0xff) / 255.0;
- part->y = y + ((height > 1) ? (rVal * height) : 0);
- part->z = 0.0;
- part->xo = part->x;
- part->yo = part->y;
- part->zo = part->z;
-
- // set speed and direction
- rVal = (float) (random() & 0xff) / 255.0;
- part->xi = ((rVal * 20.0) - 10.0f);
- rVal = (float) (random() & 0xff) / 255.0;
- part->yi = (rVal + 0.2) * -size;
- part->zi = 0.0f;
-
- // set color
- rVal = (float) (random() & 0xff) / 255.0;
- part->r = rVal / 4.0;
- part->g = rVal / 4.0;
- part->b = rVal / 4.0;
- rVal = (float) (random() & 0xff) / 255.0;
- part->a = 0.5 + (rVal / 2.0);
-
- // set gravity
- part->xg = (part->x < part->xo) ? size : -size;
- part->yg = -size;
- part->zg = 0.0f;
-
- ps->active = TRUE;
- max_new -= 1;
- } else {
- part->xg = (part->x < part->xo) ? size : -size;
- }
- }
+ ANIM_SCREEN (s);
+
+ float max_new =
+ ps->numParticles * (time / 50) * (1.05 -
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_FIRE_LIFE].
+ value.f);
+ int i;
+ Particle *part;
+ float rVal;
+
+ for (i = 0; i < ps->numParticles && max_new > 0; i++)
+ {
+ part = &ps->particles[i];
+ if (part->life <= 0.0f)
+ {
+ // give gt new life
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->life = 1.0f;
+ part->fade = (rVal * (1 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)) + (0.2f * (1.01 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)); // Random Fade Value
+
+ // set size
+ part->width =
+ as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f * size * 5;
+ part->height =
+ as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f * size * 5;
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->w_mod = -0.8;
+ part->h_mod = -0.8;
+
+ // choose random position
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->x = x + ((width > 1) ? (rVal * width) : 0);
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->y = y + ((height > 1) ? (rVal * height) : 0);
+ part->z = 0.0;
+ part->xo = part->x;
+ part->yo = part->y;
+ part->zo = part->z;
+
+ // set speed and direction
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->xi = ((rVal * 20.0) - 10.0f);
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->yi = (rVal + 0.2) * -size;
+ part->zi = 0.0f;
+
+ // set color
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->r = rVal / 4.0;
+ part->g = rVal / 4.0;
+ part->b = rVal / 4.0;
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->a = 0.5 + (rVal / 2.0);
+
+ // set gravity
+ part->xg = (part->x < part->xo) ? size : -size;
+ part->yg = -size;
+ part->zg = 0.0f;
+
+ ps->active = TRUE;
+ max_new -= 1;
+ }
+ else
+ {
+ part->xg = (part->x < part->xo) ? size : -size;
+ }
+ }
}
-static void fxBurnModelStep(CompScreen * s, CompWindow * w, float time)
+static void
+fxBurnModelStep (CompScreen * s, CompWindow * w, float time)
{
- int steps;
-
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- Model *model = aw->model;
-
- Bool smoke = as->opt[ANIM_SCREEN_OPTION_FIRE_SMOKE].value.b;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP_INTENSE].
- value.i);
- float old = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
- float stepSize;
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0)
- aw->animRemainingTime = 0; // avoid sub-zero values
- float new = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
-
- stepSize = new - old;
-
- if (aw->curWindowEvent == WindowEventCreate ||
- aw->curWindowEvent == WindowEventUnminimize ||
- aw->curWindowEvent == WindowEventUnshade) {
- old = 1 - old;
- new = 1 - new;
- }
-
- if (!aw->drawRegion)
- aw->drawRegion = XCreateRegion();
- if (aw->animRemainingTime > 0) {
- XRectangle rect;
- switch (aw->animDirection) {
- case AnimDirectionUp:
- rect.x = 0;
- rect.y = 0;
- rect.width = WIN_W(w);
- rect.height = WIN_H(w) - (old * WIN_H(w));
- break;
- case AnimDirectionRight:
- rect.x = (old * WIN_W(w));
- rect.y = 0;
- rect.width = WIN_W(w) - (old * WIN_W(w));
- rect.height = WIN_H(w);
- break;
- case AnimDirectionLeft:
- rect.x = 0;
- rect.y = 0;
- rect.width = WIN_W(w) - (old * WIN_W(w));
- rect.height = WIN_H(w);
- break;
- case AnimDirectionDown:
- default:
- rect.x = 0;
- rect.y = (old * WIN_H(w));
- rect.width = WIN_W(w);
- rect.height = WIN_H(w) - (old * WIN_H(w));
- break;
- }
- XUnionRectWithRegion(&rect, getEmptyRegion(),
- aw->drawRegion);
- } else {
- XUnionRegion(getEmptyRegion(), getEmptyRegion(),
- aw->drawRegion);
- }
- if (new != 0)
- aw->useDrawRegion = TRUE;
- else
- aw->useDrawRegion = FALSE;
-
- if (aw->animRemainingTime > 0) {
- switch (aw->animDirection) {
- case AnimDirectionUp:
- if (smoke)
- fxBurnGenNewSmoke(s, &aw->ps[0], WIN_X(w),
- WIN_Y(w) +
- ((1 - old) * WIN_H(w)),
- WIN_W(w), 1,
- WIN_W(w) / 40.0, time);
- fxBurnGenNewFire(s, &aw->ps[1], WIN_X(w),
- WIN_Y(w) + ((1 - old) * WIN_H(w)),
- WIN_W(w), (stepSize) * WIN_H(w),
- WIN_W(w) / 40.0, time);
- break;
- case AnimDirectionLeft:
- if (smoke)
- fxBurnGenNewSmoke(s, &aw->ps[0],
- WIN_X(w) +
- ((1 - old) * WIN_W(w)),
- WIN_Y(w),
- (stepSize) * WIN_W(w),
- WIN_H(w),
- WIN_H(w) / 40.0, time);
- fxBurnGenNewFire(s, &aw->ps[1],
- WIN_X(w) + ((1 - old) * WIN_W(w)),
- WIN_Y(w), (stepSize) * WIN_W(w),
- WIN_H(w), WIN_H(w) / 40.0, time);
- break;
- case AnimDirectionRight:
- if (smoke)
- fxBurnGenNewSmoke(s, &aw->ps[0],
- WIN_X(w) +
- (old * WIN_W(w)),
- WIN_Y(w),
- (stepSize) * WIN_W(w),
- WIN_H(w),
- WIN_H(w) / 40.0, time);
- fxBurnGenNewFire(s, &aw->ps[1],
- WIN_X(w) + (old * WIN_W(w)),
- WIN_Y(w), (stepSize) * WIN_W(w),
- WIN_H(w), WIN_H(w) / 40.0, time);
- break;
- case AnimDirectionDown:
- default:
- if (smoke)
- fxBurnGenNewSmoke(s, &aw->ps[0], WIN_X(w),
- WIN_Y(w) +
- (old * WIN_H(w)),
- WIN_W(w), 1,
- WIN_W(w) / 40.0, time);
- fxBurnGenNewFire(s, &aw->ps[1], WIN_X(w),
- WIN_Y(w) + (old * WIN_H(w)),
- WIN_W(w), (stepSize) * WIN_H(w),
- WIN_W(w) / 40.0, time);
- break;
- }
-
- }
- if (aw->animRemainingTime <= 0 && aw->numPs
- && (aw->ps[0].active || aw->ps[1].active))
- aw->animRemainingTime = timestep;
-
- if (!aw->numPs) {
- if (aw->ps) {
- finiParticles(aw->ps);
- free(aw->ps);
- aw->ps = NULL;
- }
- return; // FIXME - is this correct behaviour?
- }
-
- int i;
- Particle *part;
- for (i = 0;
- i < aw->ps[0].numParticles && aw->animRemainingTime > 0
- && smoke; i++) {
- part = &aw->ps[0].particles[i];
- part->xg =
- (part->x <
- part->xo) ? WIN_W(w) / 40.0 : -WIN_W(w) / 40.0;
- }
- aw->ps[0].x = WIN_X(w);
- aw->ps[0].y = WIN_Y(w);
-
- for (i = 0;
- i < aw->ps[1].numParticles && aw->animRemainingTime > 0;
- i++) {
- part = &aw->ps[1].particles[i];
- part->xg = (part->x < part->xo) ? 1.0 : -1.0;
- }
- aw->ps[1].x = WIN_X(w);
- aw->ps[1].y = WIN_Y(w);
-
- modelCalcBounds(model);
+ int steps;
+
+ ANIM_SCREEN (s);
+ ANIM_WINDOW (w);
+
+ Model *model = aw->model;
+
+ Bool smoke = as->opt[ANIM_SCREEN_OPTION_FIRE_SMOKE].value.b;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP_INTENSE].value.i);
+ float old = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
+ float stepSize;
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ float new = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
+
+ stepSize = new - old;
+
+ if (aw->curWindowEvent == WindowEventCreate ||
+ aw->curWindowEvent == WindowEventUnminimize ||
+ aw->curWindowEvent == WindowEventUnshade)
+ {
+ old = 1 - old;
+ new = 1 - new;
+ }
+
+ if (!aw->drawRegion)
+ aw->drawRegion = XCreateRegion ();
+ if (aw->animRemainingTime > 0)
+ {
+ XRectangle rect;
+ switch (aw->animDirection)
+ {
+ case AnimDirectionUp:
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = WIN_W (w);
+ rect.height = WIN_H (w) - (old * WIN_H (w));
+ break;
+ case AnimDirectionRight:
+ rect.x = (old * WIN_W (w));
+ rect.y = 0;
+ rect.width = WIN_W (w) - (old * WIN_W (w));
+ rect.height = WIN_H (w);
+ break;
+ case AnimDirectionLeft:
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = WIN_W (w) - (old * WIN_W (w));
+ rect.height = WIN_H (w);
+ break;
+ case AnimDirectionDown:
+ default:
+ rect.x = 0;
+ rect.y = (old * WIN_H (w));
+ rect.width = WIN_W (w);
+ rect.height = WIN_H (w) - (old * WIN_H (w));
+ break;
+ }
+ XUnionRectWithRegion (&rect, getEmptyRegion (), aw->drawRegion);
+ }
+ else
+ {
+ XUnionRegion (getEmptyRegion (), getEmptyRegion (), aw->drawRegion);
+ }
+ if (new != 0)
+ aw->useDrawRegion = TRUE;
+ else
+ aw->useDrawRegion = FALSE;
+
+ if (aw->animRemainingTime > 0)
+ {
+ switch (aw->animDirection)
+ {
+ case AnimDirectionUp:
+ if (smoke)
+ fxBurnGenNewSmoke (s, &aw->ps[0], WIN_X (w),
+ WIN_Y (w) +
+ ((1 - old) * WIN_H (w)),
+ WIN_W (w), 1, WIN_W (w) / 40.0, time);
+ fxBurnGenNewFire (s, &aw->ps[1], WIN_X (w),
+ WIN_Y (w) + ((1 - old) * WIN_H (w)),
+ WIN_W (w), (stepSize) * WIN_H (w),
+ WIN_W (w) / 40.0, time);
+ break;
+ case AnimDirectionLeft:
+ if (smoke)
+ fxBurnGenNewSmoke (s, &aw->ps[0],
+ WIN_X (w) +
+ ((1 - old) * WIN_W (w)),
+ WIN_Y (w),
+ (stepSize) * WIN_W (w),
+ WIN_H (w), WIN_H (w) / 40.0, time);
+ fxBurnGenNewFire (s, &aw->ps[1],
+ WIN_X (w) + ((1 - old) * WIN_W (w)),
+ WIN_Y (w), (stepSize) * WIN_W (w),
+ WIN_H (w), WIN_H (w) / 40.0, time);
+ break;
+ case AnimDirectionRight:
+ if (smoke)
+ fxBurnGenNewSmoke (s, &aw->ps[0],
+ WIN_X (w) +
+ (old * WIN_W (w)),
+ WIN_Y (w),
+ (stepSize) * WIN_W (w),
+ WIN_H (w), WIN_H (w) / 40.0, time);
+ fxBurnGenNewFire (s, &aw->ps[1],
+ WIN_X (w) + (old * WIN_W (w)),
+ WIN_Y (w), (stepSize) * WIN_W (w),
+ WIN_H (w), WIN_H (w) / 40.0, time);
+ break;
+ case AnimDirectionDown:
+ default:
+ if (smoke)
+ fxBurnGenNewSmoke (s, &aw->ps[0], WIN_X (w),
+ WIN_Y (w) +
+ (old * WIN_H (w)),
+ WIN_W (w), 1, WIN_W (w) / 40.0, time);
+ fxBurnGenNewFire (s, &aw->ps[1], WIN_X (w),
+ WIN_Y (w) + (old * WIN_H (w)),
+ WIN_W (w), (stepSize) * WIN_H (w),
+ WIN_W (w) / 40.0, time);
+ break;
+ }
+
+ }
+ if (aw->animRemainingTime <= 0 && aw->numPs
+ && (aw->ps[0].active || aw->ps[1].active))
+ aw->animRemainingTime = timestep;
+
+ if (!aw->numPs)
+ {
+ if (aw->ps)
+ {
+ finiParticles (aw->ps);
+ free (aw->ps);
+ aw->ps = NULL;
+ }
+ return; // FIXME - is this correct behaviour?
+ }
+
+ int i;
+ Particle *part;
+ for (i = 0;
+ i < aw->ps[0].numParticles && aw->animRemainingTime > 0
+ && smoke; i++)
+ {
+ part = &aw->ps[0].particles[i];
+ part->xg =
+ (part->x < part->xo) ? WIN_W (w) / 40.0 : -WIN_W (w) / 40.0;
+ }
+ aw->ps[0].x = WIN_X (w);
+ aw->ps[0].y = WIN_Y (w);
+
+ for (i = 0; i < aw->ps[1].numParticles && aw->animRemainingTime > 0; i++)
+ {
+ part = &aw->ps[1].particles[i];
+ part->xg = (part->x < part->xo) ? 1.0 : -1.0;
+ }
+ aw->ps[1].x = WIN_X (w);
+ aw->ps[1].y = WIN_Y (w);
+
+ modelCalcBounds (model);
}
// ===================== Effect: Beam Up =========================
-static void fxBeamUpInit(CompScreen * s, CompWindow * w)
+static void
+fxBeamUpInit (CompScreen * s, CompWindow * w)
{
- int particles = WIN_W(w);
- fxFadeInit(s, w);
- ANIM_WINDOW(w);
- ANIM_SCREEN(s);
- if (!aw->numPs) {
- aw->ps = calloc(1, 2 * sizeof(ParticleSystem));
- aw->numPs = 2;
- }
- initParticles(particles / 10, &aw->ps[0]);
- initParticles(particles, &aw->ps[1]);
- aw->ps[1].slowdown =
- as->opt[ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN].value.f;
- aw->ps[1].darken = 0.5;
- aw->ps[1].blendMode = GL_ONE;
-
- aw->ps[0].slowdown =
- as->opt[ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN].value.f / 2.0;
- aw->ps[0].darken = 0.0;
- aw->ps[0].blendMode = GL_ONE_MINUS_SRC_ALPHA;
-
- if (!aw->ps[0].tex)
- glGenTextures(1, &aw->ps[0].tex);
- glBindTexture(GL_TEXTURE_2D, aw->ps[0].tex);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, fireTex);
- glBindTexture(GL_TEXTURE_2D, 0);
-
- if (!aw->ps[1].tex)
- glGenTextures(1, &aw->ps[1].tex);
- glBindTexture(GL_TEXTURE_2D, aw->ps[1].tex);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, fireTex);
- glBindTexture(GL_TEXTURE_2D, 0);
+ int particles = WIN_W (w);
+ fxFadeInit (s, w);
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (s);
+ if (!aw->numPs)
+ {
+ aw->ps = calloc (1, 2 * sizeof (ParticleSystem));
+ aw->numPs = 2;
+ }
+ initParticles (particles / 10, &aw->ps[0]);
+ initParticles (particles, &aw->ps[1]);
+ aw->ps[1].slowdown = as->opt[ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN].value.f;
+ aw->ps[1].darken = 0.5;
+ aw->ps[1].blendMode = GL_ONE;
+
+ aw->ps[0].slowdown =
+ as->opt[ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN].value.f / 2.0;
+ aw->ps[0].darken = 0.0;
+ aw->ps[0].blendMode = GL_ONE_MINUS_SRC_ALPHA;
+
+ if (!aw->ps[0].tex)
+ glGenTextures (1, &aw->ps[0].tex);
+ glBindTexture (GL_TEXTURE_2D, aw->ps[0].tex);
+
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, fireTex);
+ glBindTexture (GL_TEXTURE_2D, 0);
+
+ if (!aw->ps[1].tex)
+ glGenTextures (1, &aw->ps[1].tex);
+ glBindTexture (GL_TEXTURE_2D, aw->ps[1].tex);
+
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, fireTex);
+ glBindTexture (GL_TEXTURE_2D, 0);
}
static void
-fxBeamUpGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
- int width, int height, float size, float time)
+fxBeamUpGenNewFire (CompScreen * s, ParticleSystem * ps, int x, int y,
+ int width, int height, float size, float time)
{
- ANIM_SCREEN(s);
-
- ps->numParticles =
- width / as->opt[ANIM_SCREEN_OPTION_BEAMUP_SPACING].value.i;
- float max_new =
- ps->numParticles * (time / 50) * (1.05 -
- as->
- opt
- [ANIM_SCREEN_OPTION_BEAMUP_LIFE].
- value.f);
- int i;
- Particle *part;
- float rVal;
- for (i = 0; i < ps->numParticles && max_new > 0; i++) {
- part = &ps->particles[i];
- if (part->life <= 0.0f) {
- // give gt new life
- rVal = (float) (random() & 0xff) / 255.0;
- part->life = 1.0f;
- part->fade = (rVal * (1 - as->opt[ANIM_SCREEN_OPTION_BEAMUP_LIFE].value.f)) + (0.2f * (1.01 - as->opt[ANIM_SCREEN_OPTION_BEAMUP_LIFE].value.f)); // Random Fade Value
-
- // set size
- part->width =
- 2.5 *
- as->opt[ANIM_SCREEN_OPTION_BEAMUP_SIZE].value.
- f;
- part->height = height;
- part->w_mod = size * 0.2;
- part->h_mod = size * 0.02;
-
- // choose random x position
- rVal = (float) (random() & 0xff) / 255.0;
- part->x = x + ((width > 1) ? (rVal * width) : 0);
- part->y = y;
- part->z = 0.0;
- part->xo = part->x;
- part->yo = part->y;
- part->zo = part->z;
-
- // set speed and direction
- part->xi = 0.0f;
- part->yi = 0.0f;
- part->zi = 0.0f;
-
- // set color ABAB as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.f
- part->r =
- (float) as->
- opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
- c[0] / 0xffff -
- (rVal / 1.7 *
- (float) as->
- opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
- c[0] / 0xffff);
- part->g =
- (float) as->
- opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
- c[1] / 0xffff -
- (rVal / 1.7 *
- (float) as->
- opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
- c[1] / 0xffff);
- part->b =
- (float) as->
- opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
- c[2] / 0xffff -
- (rVal / 1.7 *
- (float) as->
- opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
- c[2] / 0xffff);;
- part->a =
- (float) as->
- opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
- c[3] / 0xffff;
-
- // set gravity
- part->xg = 0.0f;
- part->yg = 0.0f;
- part->zg = 0.0f;
-
- ps->active = TRUE;
- max_new -= 1;
- } else {
- part->xg = (part->x < part->xo) ? 1.0 : -1.0;
- }
- }
+ ANIM_SCREEN (s);
+
+ ps->numParticles =
+ width / as->opt[ANIM_SCREEN_OPTION_BEAMUP_SPACING].value.i;
+ float max_new =
+ ps->numParticles * (time / 50) * (1.05 -
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_BEAMUP_LIFE].
+ value.f);
+ int i;
+ Particle *part;
+ float rVal;
+ for (i = 0; i < ps->numParticles && max_new > 0; i++)
+ {
+ part = &ps->particles[i];
+ if (part->life <= 0.0f)
+ {
+ // give gt new life
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->life = 1.0f;
+ part->fade = (rVal * (1 - as->opt[ANIM_SCREEN_OPTION_BEAMUP_LIFE].value.f)) + (0.2f * (1.01 - as->opt[ANIM_SCREEN_OPTION_BEAMUP_LIFE].value.f)); // Random Fade Value
+
+ // set size
+ part->width =
+ 2.5 * as->opt[ANIM_SCREEN_OPTION_BEAMUP_SIZE].value.f;
+ part->height = height;
+ part->w_mod = size * 0.2;
+ part->h_mod = size * 0.02;
+
+ // choose random x position
+ rVal = (float)(random () & 0xff) / 255.0;
+ part->x = x + ((width > 1) ? (rVal * width) : 0);
+ part->y = y;
+ part->z = 0.0;
+ part->xo = part->x;
+ part->yo = part->y;
+ part->zo = part->z;
+
+ // set speed and direction
+ part->xi = 0.0f;
+ part->yi = 0.0f;
+ part->zi = 0.0f;
+
+ // set color ABAB as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.f
+ part->r =
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
+ c[0] / 0xffff -
+ (rVal / 1.7 *
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[0] / 0xffff);
+ part->g =
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
+ c[1] / 0xffff -
+ (rVal / 1.7 *
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[1] / 0xffff);
+ part->b =
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.
+ c[2] / 0xffff -
+ (rVal / 1.7 *
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[2] / 0xffff);;
+ part->a =
+ (float)as->
+ opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[3] / 0xffff;
+
+ // set gravity
+ part->xg = 0.0f;
+ part->yg = 0.0f;
+ part->zg = 0.0f;
+
+ ps->active = TRUE;
+ max_new -= 1;
+ }
+ else
+ {
+ part->xg = (part->x < part->xo) ? 1.0 : -1.0;
+ }
+ }
}
-static void fxBeamUpModelStep(CompScreen * s, CompWindow * w, float time)
+static void
+fxBeamUpModelStep (CompScreen * s, CompWindow * w, float time)
{
- int steps;
- int creating = 0;
-
- fxFadeModelStep(s, w, time);
-
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- Model *model = aw->model;
-
- float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP_INTENSE].
- value.i);
- float old = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
- float stepSize;
- model->remainderSteps += time / timestep;
- steps = floor(model->remainderSteps);
- model->remainderSteps -= steps;
- if (!steps && aw->animRemainingTime < aw->animTotalTime)
- return;
- steps = MAX(1, steps);
-
- aw->animRemainingTime -= timestep;
- if (aw->animRemainingTime <= 0)
- aw->animRemainingTime = 0; // avoid sub-zero values
- float new = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
-
- stepSize = new - old;
-
- if (aw->curWindowEvent == WindowEventCreate ||
- aw->curWindowEvent == WindowEventUnminimize ||
- aw->curWindowEvent == WindowEventUnshade) {
- old = 1 - old;
- new = 1 - new;
- creating = 1;
- }
-
- if (!aw->drawRegion)
- aw->drawRegion = XCreateRegion();
- if (aw->animRemainingTime > 0) {
- XRectangle rect;
- rect.x = ((old / 2) * WIN_W(w));
- rect.width = WIN_W(w) - (old * WIN_W(w));
- rect.y = ((old / 2) * WIN_H(w));
- rect.height = WIN_H(w) - (old * WIN_H(w));
- XUnionRectWithRegion(&rect, getEmptyRegion(),
- aw->drawRegion);
- } else {
- XUnionRegion(getEmptyRegion(), getEmptyRegion(),
- aw->drawRegion);
- }
- if (new != 0)
- aw->useDrawRegion = TRUE;
- else
- aw->useDrawRegion = FALSE;
-
- if (aw->animRemainingTime > 0) {
- fxBeamUpGenNewFire(s, &aw->ps[1], WIN_X(w),
- WIN_Y(w) + (WIN_H(w) / 2), WIN_W(w),
- creating ? WIN_H(w) -
- (old / 2 * WIN_H(w)) : (WIN_H(w) -
- (old *
- WIN_H(w))),
- WIN_W(w) / 40.0, time);
-
- }
- if (aw->animRemainingTime <= 0 && aw->numPs
- && (aw->ps[0].active || aw->ps[1].active))
- aw->animRemainingTime = timestep;
-
- if (!aw->numPs) {
- if (aw->ps) {
- finiParticles(aw->ps);
- free(aw->ps);
- aw->ps = NULL;
- }
- return; // FIXME - is this correct behaviour?
- }
-
- int i;
- Particle *part;
- aw->ps[0].x = WIN_X(w);
- aw->ps[0].y = WIN_Y(w);
-
- for (i = 0;
- i < aw->ps[1].numParticles && aw->animRemainingTime > 0;
- i++) {
- part = &aw->ps[1].particles[i];
- part->xg = (part->x < part->xo) ? 1.0 : -1.0;
- }
- aw->ps[1].x = WIN_X(w);
- aw->ps[1].y = WIN_Y(w);
-
- modelCalcBounds(model);
+ int steps;
+ int creating = 0;
+
+ fxFadeModelStep (s, w, time);
+
+ ANIM_SCREEN (s);
+ ANIM_WINDOW (w);
+
+ Model *model = aw->model;
+
+ float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
+ as->opt[ANIM_SCREEN_OPTION_TIME_STEP_INTENSE].value.i);
+ float old = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
+ float stepSize;
+ model->remainderSteps += time / timestep;
+ steps = floor (model->remainderSteps);
+ model->remainderSteps -= steps;
+ if (!steps && aw->animRemainingTime < aw->animTotalTime)
+ return;
+ steps = MAX (1, steps);
+
+ aw->animRemainingTime -= timestep;
+ if (aw->animRemainingTime <= 0)
+ aw->animRemainingTime = 0; // avoid sub-zero values
+ float new = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
+
+ stepSize = new - old;
+
+ if (aw->curWindowEvent == WindowEventCreate ||
+ aw->curWindowEvent == WindowEventUnminimize ||
+ aw->curWindowEvent == WindowEventUnshade)
+ {
+ old = 1 - old;
+ new = 1 - new;
+ creating = 1;
+ }
+
+ if (!aw->drawRegion)
+ aw->drawRegion = XCreateRegion ();
+ if (aw->animRemainingTime > 0)
+ {
+ XRectangle rect;
+ rect.x = ((old / 2) * WIN_W (w));
+ rect.width = WIN_W (w) - (old * WIN_W (w));
+ rect.y = ((old / 2) * WIN_H (w));
+ rect.height = WIN_H (w) - (old * WIN_H (w));
+ XUnionRectWithRegion (&rect, getEmptyRegion (), aw->drawRegion);
+ }
+ else
+ {
+ XUnionRegion (getEmptyRegion (), getEmptyRegion (), aw->drawRegion);
+ }
+ if (new != 0)
+ aw->useDrawRegion = TRUE;
+ else
+ aw->useDrawRegion = FALSE;
+
+ if (aw->animRemainingTime > 0)
+ {
+ fxBeamUpGenNewFire (s, &aw->ps[1], WIN_X (w),
+ WIN_Y (w) + (WIN_H (w) / 2), WIN_W (w),
+ creating ? WIN_H (w) -
+ (old / 2 * WIN_H (w)) : (WIN_H (w) -
+ (old *
+ WIN_H (w))),
+ WIN_W (w) / 40.0, time);
+
+ }
+ if (aw->animRemainingTime <= 0 && aw->numPs
+ && (aw->ps[0].active || aw->ps[1].active))
+ aw->animRemainingTime = timestep;
+
+ if (!aw->numPs)
+ {
+ if (aw->ps)
+ {
+ finiParticles (aw->ps);
+ free (aw->ps);
+ aw->ps = NULL;
+ }
+ return; // FIXME - is this correct behaviour?
+ }
+
+ int i;
+ Particle *part;
+ aw->ps[0].x = WIN_X (w);
+ aw->ps[0].y = WIN_Y (w);
+
+ for (i = 0; i < aw->ps[1].numParticles && aw->animRemainingTime > 0; i++)
+ {
+ part = &aw->ps[1].particles[i];
+ part->xg = (part->x < part->xo) ? 1.0 : -1.0;
+ }
+ aw->ps[1].x = WIN_X (w);
+ aw->ps[1].y = WIN_Y (w);
+
+ modelCalcBounds (model);
}
static void
-fxBeamupUpdateWindowAttrib(AnimScreen * as,
- AnimWindow * aw, WindowPaintAttrib * wAttrib)
+fxBeamupUpdateWindowAttrib (AnimScreen * as,
+ AnimWindow * aw, WindowPaintAttrib * wAttrib)
{
- float forwardProgress =
- 1 - (aw->animRemainingTime - aw->timestep) /
- (aw->animTotalTime - aw->timestep);
- forwardProgress = MIN(forwardProgress, 1);
- forwardProgress = MAX(forwardProgress, 0);
-
- if (aw->curWindowEvent == WindowEventCreate ||
- aw->curWindowEvent == WindowEventUnminimize) {
- forwardProgress = forwardProgress * forwardProgress;
- forwardProgress = forwardProgress * forwardProgress;
- forwardProgress = 1 - forwardProgress;
- }
-
- wAttrib->opacity = aw->storedOpacity * (1 - forwardProgress);
+ float forwardProgress =
+ 1 - (aw->animRemainingTime - aw->timestep) /
+ (aw->animTotalTime - aw->timestep);
+ forwardProgress = MIN (forwardProgress, 1);
+ forwardProgress = MAX (forwardProgress, 0);
+
+ if (aw->curWindowEvent == WindowEventCreate ||
+ aw->curWindowEvent == WindowEventUnminimize)
+ {
+ forwardProgress = forwardProgress * forwardProgress;
+ forwardProgress = forwardProgress * forwardProgress;
+ forwardProgress = 1 - forwardProgress;
+ }
+
+ wAttrib->opacity = aw->storedOpacity * (1 - forwardProgress);
}
// ===================== End of Effects =========================
-typedef struct _AnimEffectProperties {
- void (*updateWindowAttribFunc) (AnimScreen *, AnimWindow *,
- WindowPaintAttrib *);
- void (*preDrawGeometryFunc) (AnimWindow *);
- void (*postDrawGeometryFunc) (AnimWindow *);
- void (*modelStepFunc) (CompScreen *, CompWindow *, float time);
- void (*initFunc) (CompScreen *, CompWindow *);
- void (*initGridFunc) (AnimScreen *, WindowEvent, int *, int *);
+typedef struct _AnimEffectProperties
+{
+ void (*updateWindowAttribFunc) (AnimScreen *, AnimWindow *,
+ WindowPaintAttrib *);
+ void (*preDrawGeometryFunc) (AnimWindow *);
+ void (*postDrawGeometryFunc) (AnimWindow *);
+ void (*modelStepFunc) (CompScreen *, CompWindow *, float time);
+ void (*initFunc) (CompScreen *, CompWindow *);
+ void (*initGridFunc) (AnimScreen *, WindowEvent, int *, int *);
} AnimEffectProperties;
AnimEffectProperties animEffectProperties[AnimEffectNum] = {
- // AnimEffectNone
- {0, 0, 0, 0, 0, 0},
- // AnimEffectRandom
- {0, 0, 0, 0, 0, 0},
- // AnimEffectBeamUp
- {fxBeamupUpdateWindowAttrib, 0, 0, fxBeamUpModelStep, fxBeamUpInit,
- 0},
- // AnimEffectBurn
- {0, 0, 0, fxBurnModelStep, fxBurnInit, 0},
- // AnimEffectCurvedFold
- {0, 0, 0, fxCurvedFoldModelStep, 0, fxMagicLamp1InitGrid},
- // AnimEffectDream
- {fxDreamUpdateWindowAttrib, 0, 0, fxDreamModelStep, fxDreamInit,
- fxMagicLamp1InitGrid},
- // AnimEffectFade
- {fxFadeUpdateWindowAttrib, 0, 0, fxFadeModelStep, fxFadeInit, 0},
- // AnimEffectHorizontalFolds
- {0, 0, 0, fxHorizontalFoldsModelStep, 0,
- fxHorizontalFoldsInitGrid},
- // AnimEffectMagicLamp1
- {0, 0, 0, fxMagicLampModelStep, fxMagicLampInit,
- fxMagicLamp1InitGrid},
- // AnimEffectMagicLamp2
- {0, 0, 0, fxMagicLampModelStep, fxMagicLampInit,
- fxMagicLamp2InitGrid},
- // AnimEffectRollUp
- {0, 0, 0, fxRollUpModelStep, 0, fxRollUpInitGrid},
- // AnimEffectSidekick
- {fxZoomUpdateWindowAttrib, 0, 0, fxZoomModelStep, fxSidekickInit,
- 0},
- // AnimEffectWave
- {0, 0, 0, fxWaveModelStep, 0, fxMagicLamp1InitGrid},
- // AnimEffectZoom
- {fxZoomUpdateWindowAttrib, 0, 0, fxZoomModelStep, fxZoomInit, 0}
+ // AnimEffectNone
+ {0, 0, 0, 0, 0, 0},
+ // AnimEffectRandom
+ {0, 0, 0, 0, 0, 0},
+ // AnimEffectBeamUp
+ {fxBeamupUpdateWindowAttrib, 0, 0, fxBeamUpModelStep, fxBeamUpInit,
+ 0},
+ // AnimEffectBurn
+ {0, 0, 0, fxBurnModelStep, fxBurnInit, 0},
+ // AnimEffectCurvedFold
+ {0, 0, 0, fxCurvedFoldModelStep, 0, fxMagicLamp1InitGrid},
+ // AnimEffectDream
+ {fxDreamUpdateWindowAttrib, 0, 0, fxDreamModelStep, fxDreamInit,
+ fxMagicLamp1InitGrid},
+ // AnimEffectFade
+ {fxFadeUpdateWindowAttrib, 0, 0, fxFadeModelStep, fxFadeInit, 0},
+ // AnimEffectHorizontalFolds
+ {0, 0, 0, fxHorizontalFoldsModelStep, 0,
+ fxHorizontalFoldsInitGrid},
+ // AnimEffectMagicLamp1
+ {0, 0, 0, fxMagicLampModelStep, fxMagicLampInit,
+ fxMagicLamp1InitGrid},
+ // AnimEffectMagicLamp2
+ {0, 0, 0, fxMagicLampModelStep, fxMagicLampInit,
+ fxMagicLamp2InitGrid},
+ // AnimEffectRollUp
+ {0, 0, 0, fxRollUpModelStep, 0, fxRollUpInitGrid},
+ // AnimEffectSidekick
+ {fxZoomUpdateWindowAttrib, 0, 0, fxZoomModelStep, fxSidekickInit,
+ 0},
+ // AnimEffectWave
+ {0, 0, 0, fxWaveModelStep, 0, fxMagicLamp1InitGrid},
+ // AnimEffectZoom
+ {fxZoomUpdateWindowAttrib, 0, 0, fxZoomModelStep, fxZoomInit, 0}
};
-static Bool getMousePointerXY(CompScreen * s, short *x, short *y)
+static Bool
+getMousePointerXY (CompScreen * s, short *x, short *y)
{
- Window w1, w2;
- int xp, yp, xj, yj;
- unsigned int m;
- if (XQueryPointer
- (s->display->display, s->root, &w1, &w2, &xj, &yj, &xp, &yp,
- &m)) {
- *x = xp;
- *y = yp;
- return TRUE;
- }
- return FALSE;
+ Window w1, w2;
+ int xp, yp, xj, yj;
+ unsigned int m;
+ if (XQueryPointer
+ (s->display->display, s->root, &w1, &w2, &xj, &yj, &xp, &yp, &m))
+ {
+ *x = xp;
+ *y = yp;
+ return TRUE;
+ }
+ return FALSE;
}
-static int animGetWindowState(CompWindow * w)
+static int
+animGetWindowState (CompWindow * w)
{
- Atom actual;
- int result, format;
- unsigned long n, left;
- unsigned char *data;
+ Atom actual;
+ int result, format;
+ unsigned long n, left;
+ unsigned char *data;
- result = XGetWindowProperty(w->screen->display->display, w->id,
- w->screen->display->wmStateAtom, 0L,
- 1L, FALSE,
- w->screen->display->wmStateAtom,
- &actual, &format, &n, &left, &data);
+ result = XGetWindowProperty (w->screen->display->display, w->id,
+ w->screen->display->wmStateAtom, 0L,
+ 1L, FALSE,
+ w->screen->display->wmStateAtom,
+ &actual, &format, &n, &left, &data);
- if (result == Success && n && data) {
- int state;
+ if (result == Success && n && data)
+ {
+ int state;
- memcpy(&state, data, sizeof(int));
- XFree((void *) data);
+ memcpy (&state, data, sizeof (int));
+ XFree ((void *)data);
- return state;
- }
+ return state;
+ }
- return WithdrawnState;
+ return WithdrawnState;
}
static Bool
-animSetScreenOption(CompScreen * screen, char *name,
- CompOptionValue * value)
+animSetScreenOption (CompScreen * screen, char *name, CompOptionValue * value)
{
- CompOption *o;
- int index;
-
- ANIM_SCREEN(screen);
-
- o = compFindOption(as->opt, NUM_OPTIONS(as), name, &index);
- if (!o)
- return FALSE;
-
- switch (index) {
- case ANIM_SCREEN_OPTION_SIDEKICK_NUM_ROTATIONS:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < 4; i++) {
- if (strcmp(o->value.s, zoomFromCenterOption[i])
- == 0) {
- as->zoomFC = i;
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_TIME_STEP:
- if (compSetIntOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_TIME_STEP_INTENSE:
- if (compSetIntOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_DISABLE_PP_FX:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < 3; i++) {
- if (strcmp(o->value.s, ppDisablingName[i])
- == 0) {
- as->ppDisabling = i;
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_MAGIC_LAMP1_GRID_RES:
- if (compSetIntOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_MAGIC_LAMP1_MAX_WAVES:
- if (compSetIntOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MIN:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MAX:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_MAGIC_LAMP2_GRID_RES:
- if (compSetIntOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_MAGIC_LAMP2_MAX_WAVES:
- if (compSetIntOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MIN:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MAX:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FOCUS_WAVE_WIDTH:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FOCUS_WAVE_AMP:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_CURVED_FOLD_AMP:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_AMP:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS:
- if (compSetIntOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_ROLLUP_FIXED_INTERIOR:
- if (compSetBoolOption(o, value))
- return TRUE;
- break;
- case ANIM_SCREEN_OPTION_ALL_RANDOM:
- if (compSetBoolOption(o, value))
- return TRUE;
- break;
- case ANIM_SCREEN_OPTION_MINIMIZE_EFFECT:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < NUM_MINIMIZE_EFFECT; i++) {
- if (strcmp
- (o->value.s,
- minimizeEffectName[i]) == 0) {
- as->minimizeEffect =
- minimizeEffectType[i];
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_UNMINIMIZE_EFFECT:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < NUM_MINIMIZE_EFFECT; i++) {
- if (strcmp
- (o->value.s,
- minimizeEffectName[i]) == 0) {
- as->unminimizeEffect =
- minimizeEffectType[i];
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_CLOSE1_EFFECT:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < NUM_CLOSE_EFFECT; i++) {
- if (strcmp(o->value.s, closeEffectName[i])
- == 0) {
- as->close1Effect =
- closeEffectType[i];
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_CLOSE2_EFFECT:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < NUM_CLOSE_EFFECT; i++) {
- if (strcmp(o->value.s, closeEffectName[i])
- == 0) {
- as->close2Effect =
- closeEffectType[i];
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_CREATE1_EFFECT:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < NUM_CLOSE_EFFECT; i++) {
- if (strcmp(o->value.s, closeEffectName[i])
- == 0) {
- as->create1Effect =
- closeEffectType[i];
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_CREATE2_EFFECT:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < NUM_CLOSE_EFFECT; i++) {
- if (strcmp(o->value.s, closeEffectName[i])
- == 0) {
- as->create2Effect =
- closeEffectType[i];
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_FOCUS_EFFECT:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < NUM_FOCUS_EFFECT; i++) {
- if (strcmp(o->value.s, focusEffectName[i])
- == 0) {
- as->focusEffect =
- focusEffectType[i];
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_SHADE_EFFECT:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < NUM_SHADE_EFFECT; i++) {
- if (strcmp(o->value.s, shadeEffectName[i])
- == 0) {
- as->shadeEffect =
- shadeEffectType[i];
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_UNSHADE_EFFECT:
- if (compSetStringOption(o, value)) {
- int i;
-
- for (i = 0; i < NUM_SHADE_EFFECT; i++) {
- if (strcmp(o->value.s, shadeEffectName[i])
- == 0) {
- as->unshadeEffect =
- shadeEffectType[i];
- return TRUE;
- }
- }
- }
- break;
- case ANIM_SCREEN_OPTION_MINIMIZE_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- as->minimizeWMask =
- compWindowTypeMaskFromStringList(&o->value);
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_UNMINIMIZE_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- as->unminimizeWMask =
- compWindowTypeMaskFromStringList(&o->value);
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_CLOSE1_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- as->close1WMask =
- compWindowTypeMaskFromStringList(&o->value);
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_CLOSE2_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- as->close2WMask =
- compWindowTypeMaskFromStringList(&o->value);
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_CREATE1_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- as->create1WMask =
- compWindowTypeMaskFromStringList(&o->value);
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_CREATE2_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- as->create2WMask =
- compWindowTypeMaskFromStringList(&o->value);
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FOCUS_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- as->focusWMask =
- compWindowTypeMaskFromStringList(&o->value);
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_SHADE_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- as->shadeWMask =
- compWindowTypeMaskFromStringList(&o->value);
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_UNSHADE_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- as->unshadeWMask =
- compWindowTypeMaskFromStringList(&o->value);
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_MINIMIZE_DURATION:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_UNMINIMIZE_DURATION:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_CLOSE1_DURATION:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_CLOSE2_DURATION:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_CREATE1_DURATION:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_CREATE2_DURATION:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FOCUS_DURATION:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_SHADE_DURATION:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_UNSHADE_DURATION:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FIRE_PARTICLES:
- if (compSetIntOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FIRE_SIZE:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FIRE_SLOWDOWN:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FIRE_LIFE:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FIRE_COLOR:
- if (compSetColorOption(o, value)) {
- return TRUE;
- }
- case ANIM_SCREEN_OPTION_FIRE_DIRECTION:
- if (compSetStringOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_FIRE_CONSTANT_SPEED:
- if (compSetBoolOption(o, value))
- return TRUE;
- break;
- case ANIM_SCREEN_OPTION_FIRE_SMOKE:
- if (compSetBoolOption(o, value))
- return TRUE;
- break;
- case ANIM_SCREEN_OPTION_FIRE_MYSTICAL:
- if (compSetBoolOption(o, value))
- return TRUE;
- break;
- case ANIM_SCREEN_OPTION_BEAMUP_SIZE:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_BEAMUP_SPACING:
- if (compSetIntOption(o, value)) {
- return TRUE;
- }
- case ANIM_SCREEN_OPTION_BEAMUP_COLOR:
- if (compSetColorOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- case ANIM_SCREEN_OPTION_BEAMUP_LIFE:
- if (compSetFloatOption(o, value)) {
- return TRUE;
- }
- break;
- default:
- break;
- }
-
- return FALSE;
+ CompOption *o;
+ int index;
+
+ ANIM_SCREEN (screen);
+
+ o = compFindOption (as->opt, NUM_OPTIONS (as), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index)
+ {
+ case ANIM_SCREEN_OPTION_SIDEKICK_NUM_ROTATIONS:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < 4; i++)
+ {
+ if (strcmp (o->value.s, zoomFromCenterOption[i]) == 0)
+ {
+ as->zoomFC = i;
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_TIME_STEP:
+ if (compSetIntOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_TIME_STEP_INTENSE:
+ if (compSetIntOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_DISABLE_PP_FX:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < 3; i++)
+ {
+ if (strcmp (o->value.s, ppDisablingName[i]) == 0)
+ {
+ as->ppDisabling = i;
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MAGIC_LAMP1_GRID_RES:
+ if (compSetIntOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MAGIC_LAMP1_MAX_WAVES:
+ if (compSetIntOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MIN:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MAX:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MAGIC_LAMP2_GRID_RES:
+ if (compSetIntOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MAGIC_LAMP2_MAX_WAVES:
+ if (compSetIntOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MIN:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MAX:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FOCUS_WAVE_WIDTH:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FOCUS_WAVE_AMP:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CURVED_FOLD_AMP:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_AMP:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS:
+ if (compSetIntOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_ROLLUP_FIXED_INTERIOR:
+ if (compSetBoolOption (o, value))
+ return TRUE;
+ break;
+ case ANIM_SCREEN_OPTION_ALL_RANDOM:
+ if (compSetBoolOption (o, value))
+ return TRUE;
+ break;
+ case ANIM_SCREEN_OPTION_MINIMIZE_EFFECT:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < NUM_MINIMIZE_EFFECT; i++)
+ {
+ if (strcmp (o->value.s, minimizeEffectName[i]) == 0)
+ {
+ as->minimizeEffect = minimizeEffectType[i];
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_UNMINIMIZE_EFFECT:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < NUM_MINIMIZE_EFFECT; i++)
+ {
+ if (strcmp (o->value.s, minimizeEffectName[i]) == 0)
+ {
+ as->unminimizeEffect = minimizeEffectType[i];
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CLOSE1_EFFECT:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < NUM_CLOSE_EFFECT; i++)
+ {
+ if (strcmp (o->value.s, closeEffectName[i]) == 0)
+ {
+ as->close1Effect = closeEffectType[i];
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CLOSE2_EFFECT:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < NUM_CLOSE_EFFECT; i++)
+ {
+ if (strcmp (o->value.s, closeEffectName[i]) == 0)
+ {
+ as->close2Effect = closeEffectType[i];
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CREATE1_EFFECT:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < NUM_CLOSE_EFFECT; i++)
+ {
+ if (strcmp (o->value.s, closeEffectName[i]) == 0)
+ {
+ as->create1Effect = closeEffectType[i];
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CREATE2_EFFECT:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < NUM_CLOSE_EFFECT; i++)
+ {
+ if (strcmp (o->value.s, closeEffectName[i]) == 0)
+ {
+ as->create2Effect = closeEffectType[i];
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FOCUS_EFFECT:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < NUM_FOCUS_EFFECT; i++)
+ {
+ if (strcmp (o->value.s, focusEffectName[i]) == 0)
+ {
+ as->focusEffect = focusEffectType[i];
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_SHADE_EFFECT:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < NUM_SHADE_EFFECT; i++)
+ {
+ if (strcmp (o->value.s, shadeEffectName[i]) == 0)
+ {
+ as->shadeEffect = shadeEffectType[i];
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_UNSHADE_EFFECT:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+
+ for (i = 0; i < NUM_SHADE_EFFECT; i++)
+ {
+ if (strcmp (o->value.s, shadeEffectName[i]) == 0)
+ {
+ as->unshadeEffect = shadeEffectType[i];
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MINIMIZE_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ as->minimizeWMask = compWindowTypeMaskFromStringList (&o->value);
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_UNMINIMIZE_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ as->unminimizeWMask =
+ compWindowTypeMaskFromStringList (&o->value);
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CLOSE1_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ as->close1WMask = compWindowTypeMaskFromStringList (&o->value);
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CLOSE2_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ as->close2WMask = compWindowTypeMaskFromStringList (&o->value);
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CREATE1_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ as->create1WMask = compWindowTypeMaskFromStringList (&o->value);
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CREATE2_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ as->create2WMask = compWindowTypeMaskFromStringList (&o->value);
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FOCUS_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ as->focusWMask = compWindowTypeMaskFromStringList (&o->value);
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_SHADE_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ as->shadeWMask = compWindowTypeMaskFromStringList (&o->value);
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_UNSHADE_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ as->unshadeWMask = compWindowTypeMaskFromStringList (&o->value);
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MINIMIZE_DURATION:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_UNMINIMIZE_DURATION:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CLOSE1_DURATION:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CLOSE2_DURATION:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CREATE1_DURATION:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CREATE2_DURATION:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FOCUS_DURATION:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_SHADE_DURATION:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_UNSHADE_DURATION:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FIRE_PARTICLES:
+ if (compSetIntOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FIRE_SIZE:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FIRE_SLOWDOWN:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FIRE_LIFE:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FIRE_COLOR:
+ if (compSetColorOption (o, value))
+ {
+ return TRUE;
+ }
+ case ANIM_SCREEN_OPTION_FIRE_DIRECTION:
+ if (compSetStringOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FIRE_CONSTANT_SPEED:
+ if (compSetBoolOption (o, value))
+ return TRUE;
+ break;
+ case ANIM_SCREEN_OPTION_FIRE_SMOKE:
+ if (compSetBoolOption (o, value))
+ return TRUE;
+ break;
+ case ANIM_SCREEN_OPTION_FIRE_MYSTICAL:
+ if (compSetBoolOption (o, value))
+ return TRUE;
+ break;
+ case ANIM_SCREEN_OPTION_BEAMUP_SIZE:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_BEAMUP_SPACING:
+ if (compSetIntOption (o, value))
+ {
+ return TRUE;
+ }
+ case ANIM_SCREEN_OPTION_BEAMUP_COLOR:
+ if (compSetColorOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ case ANIM_SCREEN_OPTION_BEAMUP_LIFE:
+ if (compSetFloatOption (o, value))
+ {
+ return TRUE;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return FALSE;
}
-static void animScreenInitOptions(AnimScreen * as)
+static void
+animScreenInitOptions (AnimScreen * as)
{
- CompOption *o;
- int i;
-
- o = &as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM];
- o->name = "all_random";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Random Animations For All Events");
- o->longDesc =
- N_
- ("All effects get to be chosen randomly, ignoring the selected effect. If None is selected for an event, that event won't be animated.");
- o->type = CompOptionTypeBool;
- o->value.b = ANIM_ALL_RANDOM_DEFAULT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_ROLLUP_FIXED_INTERIOR];
- o->name = "rollup_fixed_interior";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Rollup Fixed Interior");
- o->longDesc = N_("Fixed window interior during Rollup effect");
- o->type = CompOptionTypeBool;
- o->value.b = ANIM_ROLLUP_FIXED_INTERIOR_DEFAULT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS];
- o->name = "horizontal_folds_num_folds";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Horizontal Folds Number of Folds");
- o->longDesc = N_("Horizontal Folds number of complete folds");
- o->type = CompOptionTypeInt;
- o->value.i = ANIM_HORIZONTAL_FOLDS_NUM_FOLDS_DEFAULT;
- o->rest.i.min = ANIM_HORIZONTAL_FOLDS_NUM_FOLDS_MIN;
- o->rest.i.max = ANIM_HORIZONTAL_FOLDS_NUM_FOLDS_MAX;
-
- o = &as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_AMP];
- o->name = "horizontal_folds_amp";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Horizontal Folds Amplitude");
- o->longDesc =
- N_
- ("Horizontal folds amplitude relative to window width. Negative values fold outward.");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_HORIZONTAL_FOLDS_AMP_DEFAULT;
- o->rest.f.min = ANIM_HORIZONTAL_FOLDS_AMP_MIN;
- o->rest.f.max = ANIM_HORIZONTAL_FOLDS_AMP_MAX;
- o->rest.f.precision = ANIM_HORIZONTAL_FOLDS_AMP_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_CURVED_FOLD_AMP];
- o->name = "curved_fold_amp";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Curved Fold Amplitude");
- o->longDesc =
- N_
- ("Curved fold amplitude relative to window width. Negative values fold outward.");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_CURVED_FOLD_AMP_DEFAULT;
- o->rest.f.min = ANIM_CURVED_FOLD_AMP_MIN;
- o->rest.f.max = ANIM_CURVED_FOLD_AMP_MAX;
- o->rest.f.precision = ANIM_CURVED_FOLD_AMP_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER];
- o->name = "zoom_from_center";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc =
- N_("Zoom From Center");
- o->longDesc =
- N_("Zoom from center when playing Zoom and Sidekick effects");
- o->type = CompOptionTypeString;
- o->value.s = strdup(zoomFromCenterOption[ANIM_ZOOM_FROM_CENTER_DEFAULT]);
- o->rest.s.string = zoomFromCenterOption;
- o->rest.s.nString = 4;
-
- o = &as->opt[ANIM_SCREEN_OPTION_TIME_STEP];
- o->name = "time_step";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Animation Time Step");
- o->longDesc = N_("Animation time step in milliseconds");
- o->type = CompOptionTypeInt;
- o->value.i = ANIM_TIME_STEP_DEFAULT;
- o->rest.i.min = ANIM_TIME_STEP_MIN;
- o->rest.i.max = ANIM_TIME_STEP_MAX;
-
- o = &as->opt[ANIM_SCREEN_OPTION_TIME_STEP_INTENSE];
- o->name = "time_step_intense";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Animation Time Step For Intense Effects");
- o->longDesc =
- N_
- ("Animation time step in milliseconds for intense effects like Burn");
- o->type = CompOptionTypeInt;
- o->value.i = ANIM_TIME_STEP_INTENSE_DEFAULT;
- o->rest.i.min = ANIM_TIME_STEP_INTENSE_MIN;
- o->rest.i.max = ANIM_TIME_STEP_INTENSE_MAX;
-
- o = &as->opt[ANIM_SCREEN_OPTION_DISABLE_PP_FX];
- o->name = "disable_pp_fx";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc =
- N_("Disable Postprocessing Effects During Animation");
- o->longDesc = N_("Disables Blur during animation");
- o->type = CompOptionTypeString;
- o->value.s = strdup(ppDisablingName[ANIM_DISABLE_PP_FX_DEFAULT]);
- o->rest.s.string = ppDisablingName;
- o->rest.s.nString = 3;
-
- o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_GRID_RES];
- o->name = "magic_lamp1_grid_res";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Magic Lamp 1 Grid Y Resolution");
- o->longDesc =
- N_
- ("Vertex Grid Resolution (2-200) for Magic Lamp 1 (Y dimension only)");
- o->type = CompOptionTypeInt;
- o->value.i = ANIM_MAGIC_LAMP1_GRID_RES_DEFAULT;
- o->rest.i.min = ANIM_MAGIC_LAMP1_GRID_RES_MIN;
- o->rest.i.max = ANIM_MAGIC_LAMP1_GRID_RES_MAX;
-
- o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_MAX_WAVES];
- o->name = "magic_lamp1_max_waves";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Magic Lamp 1 Max Waves");
- o->longDesc = N_("Maximum number of waves for Magic Lamp 1");
- o->type = CompOptionTypeInt;
- o->value.i = ANIM_MAGIC_LAMP1_MAX_WAVES_DEFAULT;
- o->rest.i.min = ANIM_MAGIC_LAMP1_MAX_WAVES_MIN;
- o->rest.i.max = ANIM_MAGIC_LAMP1_MAX_WAVES_MAX;
-
- o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MIN];
- o->name = "magic_lamp1_wave_amp_min";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Magic Lamp 1 Wave Min Amplitude");
- o->longDesc =
- N_
- ("Magic Lamp 1 waves will have random amplitudes between min and max");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_MAGIC_LAMP1_WAVE_AMP_MIN_DEFAULT;
- o->rest.f.min = ANIM_MAGIC_LAMP1_WAVE_AMP_MIN_MIN;
- o->rest.f.max = ANIM_MAGIC_LAMP1_WAVE_AMP_MIN_MAX;
- o->rest.f.precision = ANIM_MAGIC_LAMP1_WAVE_AMP_MIN_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MAX];
- o->name = "magic_lamp1_wave_amp_max";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Magic Lamp 1 Wave Max Amplitude");
- o->longDesc =
- N_
- ("Magic Lamp 1 waves will have random amplitudes between min and max");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_MAGIC_LAMP1_WAVE_AMP_MAX_DEFAULT;
- o->rest.f.min = ANIM_MAGIC_LAMP1_WAVE_AMP_MAX_MIN;
- o->rest.f.max = ANIM_MAGIC_LAMP1_WAVE_AMP_MAX_MAX;
- o->rest.f.precision = ANIM_MAGIC_LAMP1_WAVE_AMP_MAX_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_GRID_RES];
- o->name = "magic_lamp2_grid_res";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Magic Lamp 2 Grid Y Resolution");
- o->longDesc =
- N_
- ("Vertex Grid Resolution (2-200) for Magic Lamp 2 (Y dimension only)");
- o->type = CompOptionTypeInt;
- o->value.i = ANIM_MAGIC_LAMP2_GRID_RES_DEFAULT;
- o->rest.i.min = ANIM_MAGIC_LAMP2_GRID_RES_MIN;
- o->rest.i.max = ANIM_MAGIC_LAMP2_GRID_RES_MAX;
-
- o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_MAX_WAVES];
- o->name = "magic_lamp2_max_waves";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Magic Lamp 2 Max Waves");
- o->longDesc = N_("Maximum number of waves for Magic Lamp 2");
- o->type = CompOptionTypeInt;
- o->value.i = ANIM_MAGIC_LAMP2_MAX_WAVES_DEFAULT;
- o->rest.i.min = ANIM_MAGIC_LAMP2_MAX_WAVES_MIN;
- o->rest.i.max = ANIM_MAGIC_LAMP2_MAX_WAVES_MAX;
-
- o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MIN];
- o->name = "magic_lamp2_wave_amp_min";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Magic Lamp 2 Wave Min Amplitude");
- o->longDesc =
- N_
- ("Magic Lamp 2 waves will have random amplitudes between min and max");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_MAGIC_LAMP2_WAVE_AMP_MIN_DEFAULT;
- o->rest.f.min = ANIM_MAGIC_LAMP2_WAVE_AMP_MIN_MIN;
- o->rest.f.max = ANIM_MAGIC_LAMP2_WAVE_AMP_MIN_MAX;
- o->rest.f.precision = ANIM_MAGIC_LAMP2_WAVE_AMP_MIN_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MAX];
- o->name = "magic_lamp2_wave_amp_max";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Magic Lamp 2 Wave Max Amplitude");
- o->longDesc =
- N_
- ("Magic Lamp 2 waves will have random amplitudes between min and max");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_MAGIC_LAMP2_WAVE_AMP_MAX_DEFAULT;
- o->rest.f.min = ANIM_MAGIC_LAMP2_WAVE_AMP_MAX_MIN;
- o->rest.f.max = ANIM_MAGIC_LAMP2_WAVE_AMP_MAX_MAX;
- o->rest.f.precision = ANIM_MAGIC_LAMP2_WAVE_AMP_MAX_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_WAVE_WIDTH];
- o->name = "focus_wave_width";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Focus Wave Width");
- o->longDesc = N_("Focus wave width relative to window height");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_FOCUS_WAVE_WIDTH_DEFAULT;
- o->rest.f.min = ANIM_FOCUS_WAVE_WIDTH_MIN;
- o->rest.f.max = ANIM_FOCUS_WAVE_WIDTH_MAX;
- o->rest.f.precision = ANIM_FOCUS_WAVE_WIDTH_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_WAVE_AMP];
- o->name = "focus_wave_amp";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Focus Wave Amplitude");
- o->longDesc = N_("Focus wave amplitude relative to window height");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_FOCUS_WAVE_AMP_DEFAULT;
- o->rest.f.min = ANIM_FOCUS_WAVE_AMP_MIN;
- o->rest.f.max = ANIM_FOCUS_WAVE_AMP_MAX;
- o->rest.f.precision = ANIM_FOCUS_WAVE_AMP_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_SIDEKICK_NUM_ROTATIONS];
- o->name = "sidekick_num_rotations";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Sidekick Number of Rotations");
- o->longDesc =
- N_("Sidekick number of rotations (with +/-10% randomness)");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_SIDEKICK_NUM_ROTATIONS_DEFAULT;
- o->rest.f.min = ANIM_SIDEKICK_NUM_ROTATIONS_MIN;
- o->rest.f.max = ANIM_SIDEKICK_NUM_ROTATIONS_MAX;
- o->rest.f.precision = ANIM_SIDEKICK_NUM_ROTATIONS_PRECISION;
-
- // Minimize
-
- o = &as->opt[ANIM_SCREEN_OPTION_MINIMIZE_EFFECT];
- o->name = "minimize_effect";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Minimize Effect");
- o->longDesc = N_("Minimize Window Effect");
- o->type = CompOptionTypeString;
- o->value.s = strdup(allEffectName[ANIM_MINIMIZE_DEFAULT]);
- o->rest.s.string = minimizeEffectName;
- o->rest.s.nString = NUM_MINIMIZE_EFFECT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_MINIMIZE_WINDOW_TYPE];
- o->name = "minimize_window_types";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Minimize Window Types");
- o->longDesc =
- N_
- ("Window types that should animate with this effect when minimized");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_MINIMIZE_DEFAULT_WIN_TYPE;
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * N_MINIMIZE_DEFAULT_WIN_TYPE);
- for (i = 0; i < N_MINIMIZE_DEFAULT_WIN_TYPE; i++)
- o->value.list.value[i].s =
- strdup(minimizeDefaultWinType[i]);
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- as->minimizeWMask = compWindowTypeMaskFromStringList(&o->value);
-
- o = &as->opt[ANIM_SCREEN_OPTION_MINIMIZE_DURATION];
- o->name = "minimize_duration";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Minimize Animation Duration");
- o->longDesc = N_("Minimize animation duration in seconds");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_MINIMIZE_DURATION_DEFAULT;
- o->rest.f.min = ANIM_MINIMIZE_DURATION_MIN;
- o->rest.f.max = ANIM_MINIMIZE_DURATION_MAX;
- o->rest.f.precision = ANIM_MINIMIZE_DURATION_PRECISION;
-
- // Unminimize
-
- o = &as->opt[ANIM_SCREEN_OPTION_UNMINIMIZE_EFFECT];
- o->name = "unminimize_effect";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Unminimize Effect");
- o->longDesc = N_("Unminimize Window Effect");
- o->type = CompOptionTypeString;
- o->value.s = strdup(allEffectName[ANIM_UNMINIMIZE_DEFAULT]);
- o->rest.s.string = minimizeEffectName;
- o->rest.s.nString = NUM_MINIMIZE_EFFECT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_UNMINIMIZE_WINDOW_TYPE];
- o->name = "unminimize_window_types";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Unminimize Window Types");
- o->longDesc =
- N_
- ("Window types that should animate with this effect when unminimized");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_MINIMIZE_DEFAULT_WIN_TYPE;
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * N_MINIMIZE_DEFAULT_WIN_TYPE);
- for (i = 0; i < N_MINIMIZE_DEFAULT_WIN_TYPE; i++)
- o->value.list.value[i].s =
- strdup(minimizeDefaultWinType[i]);
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- as->unminimizeWMask = compWindowTypeMaskFromStringList(&o->value);
-
- o = &as->opt[ANIM_SCREEN_OPTION_UNMINIMIZE_DURATION];
- o->name = "unminimize_duration";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Unminimize Animation Duration");
- o->longDesc = N_("Unminimize animation duration in seconds");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_UNMINIMIZE_DURATION_DEFAULT;
- o->rest.f.min = ANIM_UNMINIMIZE_DURATION_MIN;
- o->rest.f.max = ANIM_UNMINIMIZE_DURATION_MAX;
- o->rest.f.precision = ANIM_UNMINIMIZE_DURATION_PRECISION;
-
- // Close 1
-
- o = &as->opt[ANIM_SCREEN_OPTION_CLOSE1_EFFECT];
- o->name = "close1_effect";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Close Effect 1");
- o->longDesc = N_("Close Window Effect 1");
- o->type = CompOptionTypeString;
- o->value.s = strdup(allEffectName[ANIM_CLOSE1_DEFAULT]);
- o->rest.s.string = closeEffectName;
- o->rest.s.nString = NUM_CLOSE_EFFECT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_CLOSE1_WINDOW_TYPE];
- o->name = "close1_window_types";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Close Window Types 1");
- o->longDesc =
- N_
- ("Window types that should animate with this effect when closed");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_CLOSE1_DEFAULT_WIN_TYPE;
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * N_CLOSE1_DEFAULT_WIN_TYPE);
- for (i = 0; i < N_CLOSE1_DEFAULT_WIN_TYPE; i++)
- o->value.list.value[i].s = strdup(close1DefaultWinType[i]);
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- as->close1WMask = compWindowTypeMaskFromStringList(&o->value);
-
- o = &as->opt[ANIM_SCREEN_OPTION_CLOSE1_DURATION];
- o->name = "close1_duration";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Close Animation Duration 1");
- o->longDesc =
- N_("Animation duration in seconds for close effect 1");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_CLOSE1_DURATION_DEFAULT;
- o->rest.f.min = ANIM_CLOSE1_DURATION_MIN;
- o->rest.f.max = ANIM_CLOSE1_DURATION_MAX;
- o->rest.f.precision = ANIM_CLOSE1_DURATION_PRECISION;
-
- // Close 2
-
- o = &as->opt[ANIM_SCREEN_OPTION_CLOSE2_EFFECT];
- o->name = "close2_effect";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Close Effect 2");
- o->longDesc = N_("Close Window Effect 2");
- o->type = CompOptionTypeString;
- o->value.s = strdup(allEffectName[ANIM_CLOSE2_DEFAULT]);
- o->rest.s.string = closeEffectName;
- o->rest.s.nString = NUM_CLOSE_EFFECT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_CLOSE2_WINDOW_TYPE];
- o->name = "close2_window_types";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Close Window Types 2");
- o->longDesc =
- N_
- ("Window types that should animate with this effect when closed");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_CLOSE2_DEFAULT_WIN_TYPE;
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * N_CLOSE2_DEFAULT_WIN_TYPE);
- for (i = 0; i < N_CLOSE2_DEFAULT_WIN_TYPE; i++)
- o->value.list.value[i].s = strdup(close2DefaultWinType[i]);
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- as->close2WMask = compWindowTypeMaskFromStringList(&o->value);
-
- o = &as->opt[ANIM_SCREEN_OPTION_CLOSE2_DURATION];
- o->name = "close2_duration";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Close Animation Duration 2");
- o->longDesc =
- N_("Animation duration in seconds for close effect 2");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_CLOSE2_DURATION_DEFAULT;
- o->rest.f.min = ANIM_CLOSE2_DURATION_MIN;
- o->rest.f.max = ANIM_CLOSE2_DURATION_MAX;
- o->rest.f.precision = ANIM_CLOSE2_DURATION_PRECISION;
-
- // Create 1
-
- o = &as->opt[ANIM_SCREEN_OPTION_CREATE1_EFFECT];
- o->name = "create1_effect";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Create Effect 1");
- o->longDesc = N_("Create Window Effect 1");
- o->type = CompOptionTypeString;
- o->value.s = strdup(allEffectName[ANIM_CREATE1_DEFAULT]);
- o->rest.s.string = closeEffectName;
- o->rest.s.nString = NUM_CLOSE_EFFECT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_CREATE1_WINDOW_TYPE];
- o->name = "create1_window_types";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Create Window Types 1");
- o->longDesc =
- N_
- ("Window types that should animate with this effect when created");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_CLOSE1_DEFAULT_WIN_TYPE;
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * N_CLOSE1_DEFAULT_WIN_TYPE);
- for (i = 0; i < N_CLOSE1_DEFAULT_WIN_TYPE; i++)
- o->value.list.value[i].s = strdup(close1DefaultWinType[i]);
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- as->create1WMask = compWindowTypeMaskFromStringList(&o->value);
-
- o = &as->opt[ANIM_SCREEN_OPTION_CREATE1_DURATION];
- o->name = "create1_duration";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Create Animation Duration 1");
- o->longDesc =
- N_("Animation duration in seconds for create effect 1");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_CREATE1_DURATION_DEFAULT;
- o->rest.f.min = ANIM_CREATE1_DURATION_MIN;
- o->rest.f.max = ANIM_CREATE1_DURATION_MAX;
- o->rest.f.precision = ANIM_CREATE1_DURATION_PRECISION;
-
- // Create 2
-
- o = &as->opt[ANIM_SCREEN_OPTION_CREATE2_EFFECT];
- o->name = "create2_effect";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Create Effect 2");
- o->longDesc = N_("Create Window Effect 2");
- o->type = CompOptionTypeString;
- o->value.s = strdup(allEffectName[ANIM_CREATE2_DEFAULT]);
- o->rest.s.string = closeEffectName;
- o->rest.s.nString = NUM_CLOSE_EFFECT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_CREATE2_WINDOW_TYPE];
- o->name = "create2_window_types";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Create Window Types 2");
- o->longDesc =
- N_
- ("Window types that should animate with this effect when created");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_CLOSE2_DEFAULT_WIN_TYPE;
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * N_CLOSE2_DEFAULT_WIN_TYPE);
- for (i = 0; i < N_CLOSE2_DEFAULT_WIN_TYPE; i++)
- o->value.list.value[i].s = strdup(close2DefaultWinType[i]);
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- as->create2WMask = compWindowTypeMaskFromStringList(&o->value);
-
- o = &as->opt[ANIM_SCREEN_OPTION_CREATE2_DURATION];
- o->name = "create2_duration";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Create Animation Duration 2");
- o->longDesc =
- N_("Animation duration in seconds for create effect 2");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_CREATE2_DURATION_DEFAULT;
- o->rest.f.min = ANIM_CREATE2_DURATION_MIN;
- o->rest.f.max = ANIM_CREATE2_DURATION_MAX;
- o->rest.f.precision = ANIM_CREATE2_DURATION_PRECISION;
-
- // Focus
-
- o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_EFFECT];
- o->name = "focus_effect";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Focus Effect");
- o->longDesc = N_("Focus Window Effect");
- o->type = CompOptionTypeString;
- o->value.s = strdup(allEffectName[ANIM_FOCUS_DEFAULT]);
- o->rest.s.string = focusEffectName;
- o->rest.s.nString = NUM_FOCUS_EFFECT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_WINDOW_TYPE];
- o->name = "focus_window_types";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Focus Window Types");
- o->longDesc =
- N_
- ("Window types that should animate with this effect when focused");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_FOCUS_DEFAULT_WIN_TYPE;
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * N_FOCUS_DEFAULT_WIN_TYPE);
- for (i = 0; i < N_FOCUS_DEFAULT_WIN_TYPE; i++)
- o->value.list.value[i].s = strdup(focusDefaultWinType[i]);
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- as->focusWMask = compWindowTypeMaskFromStringList(&o->value);
-
- o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_DURATION];
- o->name = "focus_duration";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Focus Animation Duration");
- o->longDesc = N_("Focus animation duration in seconds");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_FOCUS_DURATION_DEFAULT;
- o->rest.f.min = ANIM_FOCUS_DURATION_MIN;
- o->rest.f.max = ANIM_FOCUS_DURATION_MAX;
- o->rest.f.precision = ANIM_FOCUS_DURATION_PRECISION;
-
- // Shade
-
- o = &as->opt[ANIM_SCREEN_OPTION_SHADE_EFFECT];
- o->name = "shade_effect";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Shade Effect");
- o->longDesc = N_("Shade Window Effect");
- o->type = CompOptionTypeString;
- o->value.s = strdup(allEffectName[ANIM_SHADE_DEFAULT]);
- o->rest.s.string = shadeEffectName;
- o->rest.s.nString = NUM_SHADE_EFFECT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_SHADE_WINDOW_TYPE];
- o->name = "shade_window_types";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Shade Window Types");
- o->longDesc =
- N_
- ("Window types that should animate with this effect when shaded");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_SHADE_DEFAULT_WIN_TYPE;
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * N_SHADE_DEFAULT_WIN_TYPE);
- for (i = 0; i < N_SHADE_DEFAULT_WIN_TYPE; i++)
- o->value.list.value[i].s = strdup(shadeDefaultWinType[i]);
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- as->shadeWMask = compWindowTypeMaskFromStringList(&o->value);
-
- o = &as->opt[ANIM_SCREEN_OPTION_SHADE_DURATION];
- o->name = "shade_duration";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Shade Animation Duration");
- o->longDesc = N_("Shade animation duration in seconds");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_SHADE_DURATION_DEFAULT;
- o->rest.f.min = ANIM_SHADE_DURATION_MIN;
- o->rest.f.max = ANIM_SHADE_DURATION_MAX;
- o->rest.f.precision = ANIM_SHADE_DURATION_PRECISION;
-
- // Unshade
-
- o = &as->opt[ANIM_SCREEN_OPTION_UNSHADE_EFFECT];
- o->name = "unshade_effect";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Unshade Effect");
- o->longDesc = N_("Unshade Window Effect");
- o->type = CompOptionTypeString;
- o->value.s = strdup(allEffectName[ANIM_UNSHADE_DEFAULT]);
- o->rest.s.string = shadeEffectName;
- o->rest.s.nString = NUM_SHADE_EFFECT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_UNSHADE_WINDOW_TYPE];
- o->name = "unshade_window_types";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Unshade Window Types");
- o->longDesc =
- N_
- ("Window types that should animate with this effect when unshaded");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_SHADE_DEFAULT_WIN_TYPE;
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * N_SHADE_DEFAULT_WIN_TYPE);
- for (i = 0; i < N_SHADE_DEFAULT_WIN_TYPE; i++)
- o->value.list.value[i].s = strdup(shadeDefaultWinType[i]);
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- as->unshadeWMask = compWindowTypeMaskFromStringList(&o->value);
-
- o = &as->opt[ANIM_SCREEN_OPTION_UNSHADE_DURATION];
- o->name = "unshade_duration";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Unshade Animation Duration");
- o->longDesc = N_("Unshade animation duration in seconds");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_UNSHADE_DURATION_DEFAULT;
- o->rest.f.min = ANIM_UNSHADE_DURATION_MIN;
- o->rest.f.max = ANIM_UNSHADE_DURATION_MAX;
- o->rest.f.precision = ANIM_UNSHADE_DURATION_PRECISION;
-
-
- o = &as->opt[ANIM_SCREEN_OPTION_FIRE_PARTICLES];
- o->name = "fire_particles";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Number Of Fire Particles");
- o->longDesc = N_("Number of fire particles");
- o->type = CompOptionTypeInt;
- o->value.i = ANIM_FIRE_PARTICLES_DEFAULT;
- o->rest.i.min = ANIM_FIRE_PARTICLES_MIN;
- o->rest.i.max = ANIM_FIRE_PARTICLES_MAX;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE];
- o->name = "fire_size";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Fire Particle Size");
- o->longDesc = N_("Fire particle size");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_FIRE_SIZE_DEFAULT;
- o->rest.f.min = ANIM_FIRE_SIZE_MIN;
- o->rest.f.max = ANIM_FIRE_SIZE_MAX;
- o->rest.f.precision = ANIM_FIRE_SIZE_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FIRE_SLOWDOWN];
- o->name = "fire_slowdown";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Fire Particle Slowdown");
- o->longDesc = N_("Fire particle slowdown");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_FIRE_SLOWDOWN_DEFAULT;
- o->rest.f.min = ANIM_FIRE_SLOWDOWN_MIN;
- o->rest.f.max = ANIM_FIRE_SLOWDOWN_MAX;
- o->rest.f.precision = ANIM_FIRE_SLOWDOWN_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE];
- o->name = "fire_life";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Fire Particle Life");
- o->longDesc = N_("Fire particle life");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_FIRE_LIFE_DEFAULT;
- o->rest.f.min = ANIM_FIRE_LIFE_MIN;
- o->rest.f.max = ANIM_FIRE_LIFE_MAX;
- o->rest.f.precision = ANIM_FIRE_LIFE_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR];
- o->name = "fire_color";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Fire Particle Color");
- o->longDesc = N_("Fire Particle Color");
- o->type = CompOptionTypeColor;
- o->value.c[0] = ANIM_FIRE_COLOR_RED_DEFAULT;
- o->value.c[1] = ANIM_FIRE_COLOR_GREEN_DEFAULT;
- o->value.c[2] = ANIM_FIRE_COLOR_BLUE_DEFAULT;
- o->value.c[3] = ANIM_FIRE_COLOR_ALPHA_DEFAULT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FIRE_DIRECTION];
- o->name = "fire_direction";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Fire direction");
- o->longDesc = N_("Fire direction");
- o->type = CompOptionTypeString;
- o->value.s =
- strdup(animDirectionName[ANIM_FIRE_DIRECTION_DEFAULT]);
- o->rest.s.string = animDirectionName;
- o->rest.s.nString = LIST_SIZE(animDirectionName);
-
- o = &as->opt[ANIM_SCREEN_OPTION_FIRE_CONSTANT_SPEED];
- o->name = "fire_constant_speed";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Fire constant speed");
- o->longDesc =
- N_("Make fire effect duration be dependent of window height");
- o->type = CompOptionTypeBool;
- o->value.b = ANIM_FIRE_CONSTANT_SPEED_DEFAULT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FIRE_SMOKE];
- o->name = "fire_smoke";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Fire smoke");
- o->longDesc = N_("Fire Smoke");
- o->type = CompOptionTypeBool;
- o->value.b = ANIM_FIRE_SMOKE_DEFAULT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_FIRE_MYSTICAL];
- o->name = "fire_mystical";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Randomly Colored Fire");
- o->longDesc =
- N_
- ("Have random colors for the fire effect, also known as Mystical Fire");
- o->type = CompOptionTypeBool;
- o->value.b = ANIM_FIRE_MYSTICAL_DEFAULT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_SIZE];
- o->name = "beam_size";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Beam Width");
- o->longDesc = N_("Beam Width");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_BEAMUP_SIZE_DEFAULT;
- o->rest.f.min = ANIM_BEAMUP_SIZE_MIN;
- o->rest.f.max = ANIM_BEAMUP_SIZE_MAX;
- o->rest.f.precision = ANIM_BEAMUP_SIZE_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_SPACING];
- o->name = "beam_spacing";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Beam spacing");
- o->longDesc = N_("Spacing between beams");
- o->type = CompOptionTypeInt;
- o->value.i = ANIM_BEAMUP_SPACING_DEFAULT;
- o->rest.i.min = ANIM_BEAMUP_SPACING_MIN;
- o->rest.i.max = ANIM_BEAMUP_SPACING_MAX;
-
- o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR];
- o->name = "beam_color";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Beam Color");
- o->longDesc = N_("Beam Color");
- o->type = CompOptionTypeColor;
- o->value.c[0] = ANIM_BEAMUP_COLOR_RED_DEFAULT;
- o->value.c[1] = ANIM_BEAMUP_COLOR_GREEN_DEFAULT;
- o->value.c[2] = ANIM_BEAMUP_COLOR_BLUE_DEFAULT;
- o->value.c[3] = ANIM_BEAMUP_COLOR_ALPHA_DEFAULT;
-
- o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN];
- o->name = "beam_slowdown";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Beam Slowdown");
- o->longDesc = N_("Beam slowdown");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_BEAMUP_SLOWDOWN_DEFAULT;
- o->rest.f.min = ANIM_BEAMUP_SLOWDOWN_MIN;
- o->rest.f.max = ANIM_BEAMUP_SLOWDOWN_MAX;
- o->rest.f.precision = ANIM_BEAMUP_SLOWDOWN_PRECISION;
-
- o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_LIFE];
- o->name = "beam_life";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Beam Life");
- o->longDesc = N_("Beam life");
- o->type = CompOptionTypeFloat;
- o->value.f = ANIM_BEAMUP_LIFE_DEFAULT;
- o->rest.f.min = ANIM_BEAMUP_LIFE_MIN;
- o->rest.f.max = ANIM_BEAMUP_LIFE_MAX;
- o->rest.f.precision = ANIM_BEAMUP_LIFE_PRECISION;
+ CompOption *o;
+ int i;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM];
+ o->name = "all_random";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Random Animations For All Events");
+ o->longDesc =
+ N_
+ ("All effects get to be chosen randomly, ignoring the selected effect. If None is selected for an event, that event won't be animated.");
+ o->type = CompOptionTypeBool;
+ o->value.b = ANIM_ALL_RANDOM_DEFAULT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_ROLLUP_FIXED_INTERIOR];
+ o->name = "rollup_fixed_interior";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Rollup Fixed Interior");
+ o->longDesc = N_("Fixed window interior during Rollup effect");
+ o->type = CompOptionTypeBool;
+ o->value.b = ANIM_ROLLUP_FIXED_INTERIOR_DEFAULT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS];
+ o->name = "horizontal_folds_num_folds";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Horizontal Folds Number of Folds");
+ o->longDesc = N_("Horizontal Folds number of complete folds");
+ o->type = CompOptionTypeInt;
+ o->value.i = ANIM_HORIZONTAL_FOLDS_NUM_FOLDS_DEFAULT;
+ o->rest.i.min = ANIM_HORIZONTAL_FOLDS_NUM_FOLDS_MIN;
+ o->rest.i.max = ANIM_HORIZONTAL_FOLDS_NUM_FOLDS_MAX;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_AMP];
+ o->name = "horizontal_folds_amp";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Horizontal Folds Amplitude");
+ o->longDesc =
+ N_
+ ("Horizontal folds amplitude relative to window width. Negative values fold outward.");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_HORIZONTAL_FOLDS_AMP_DEFAULT;
+ o->rest.f.min = ANIM_HORIZONTAL_FOLDS_AMP_MIN;
+ o->rest.f.max = ANIM_HORIZONTAL_FOLDS_AMP_MAX;
+ o->rest.f.precision = ANIM_HORIZONTAL_FOLDS_AMP_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CURVED_FOLD_AMP];
+ o->name = "curved_fold_amp";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Curved Fold Amplitude");
+ o->longDesc =
+ N_
+ ("Curved fold amplitude relative to window width. Negative values fold outward.");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_CURVED_FOLD_AMP_DEFAULT;
+ o->rest.f.min = ANIM_CURVED_FOLD_AMP_MIN;
+ o->rest.f.max = ANIM_CURVED_FOLD_AMP_MAX;
+ o->rest.f.precision = ANIM_CURVED_FOLD_AMP_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER];
+ o->name = "zoom_from_center";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Zoom From Center");
+ o->longDesc =
+ N_("Zoom from center when playing Zoom and Sidekick effects");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (zoomFromCenterOption[ANIM_ZOOM_FROM_CENTER_DEFAULT]);
+ o->rest.s.string = zoomFromCenterOption;
+ o->rest.s.nString = 4;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_TIME_STEP];
+ o->name = "time_step";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Animation Time Step");
+ o->longDesc = N_("Animation time step in milliseconds");
+ o->type = CompOptionTypeInt;
+ o->value.i = ANIM_TIME_STEP_DEFAULT;
+ o->rest.i.min = ANIM_TIME_STEP_MIN;
+ o->rest.i.max = ANIM_TIME_STEP_MAX;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_TIME_STEP_INTENSE];
+ o->name = "time_step_intense";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Animation Time Step For Intense Effects");
+ o->longDesc =
+ N_
+ ("Animation time step in milliseconds for intense effects like Burn");
+ o->type = CompOptionTypeInt;
+ o->value.i = ANIM_TIME_STEP_INTENSE_DEFAULT;
+ o->rest.i.min = ANIM_TIME_STEP_INTENSE_MIN;
+ o->rest.i.max = ANIM_TIME_STEP_INTENSE_MAX;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_DISABLE_PP_FX];
+ o->name = "disable_pp_fx";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Disable Postprocessing Effects During Animation");
+ o->longDesc = N_("Disables Blur during animation");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (ppDisablingName[ANIM_DISABLE_PP_FX_DEFAULT]);
+ o->rest.s.string = ppDisablingName;
+ o->rest.s.nString = 3;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_GRID_RES];
+ o->name = "magic_lamp1_grid_res";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Magic Lamp 1 Grid Y Resolution");
+ o->longDesc =
+ N_
+ ("Vertex Grid Resolution (2-200) for Magic Lamp 1 (Y dimension only)");
+ o->type = CompOptionTypeInt;
+ o->value.i = ANIM_MAGIC_LAMP1_GRID_RES_DEFAULT;
+ o->rest.i.min = ANIM_MAGIC_LAMP1_GRID_RES_MIN;
+ o->rest.i.max = ANIM_MAGIC_LAMP1_GRID_RES_MAX;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_MAX_WAVES];
+ o->name = "magic_lamp1_max_waves";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Magic Lamp 1 Max Waves");
+ o->longDesc = N_("Maximum number of waves for Magic Lamp 1");
+ o->type = CompOptionTypeInt;
+ o->value.i = ANIM_MAGIC_LAMP1_MAX_WAVES_DEFAULT;
+ o->rest.i.min = ANIM_MAGIC_LAMP1_MAX_WAVES_MIN;
+ o->rest.i.max = ANIM_MAGIC_LAMP1_MAX_WAVES_MAX;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MIN];
+ o->name = "magic_lamp1_wave_amp_min";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Magic Lamp 1 Wave Min Amplitude");
+ o->longDesc =
+ N_
+ ("Magic Lamp 1 waves will have random amplitudes between min and max");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_MAGIC_LAMP1_WAVE_AMP_MIN_DEFAULT;
+ o->rest.f.min = ANIM_MAGIC_LAMP1_WAVE_AMP_MIN_MIN;
+ o->rest.f.max = ANIM_MAGIC_LAMP1_WAVE_AMP_MIN_MAX;
+ o->rest.f.precision = ANIM_MAGIC_LAMP1_WAVE_AMP_MIN_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP1_WAVE_AMP_MAX];
+ o->name = "magic_lamp1_wave_amp_max";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Magic Lamp 1 Wave Max Amplitude");
+ o->longDesc =
+ N_
+ ("Magic Lamp 1 waves will have random amplitudes between min and max");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_MAGIC_LAMP1_WAVE_AMP_MAX_DEFAULT;
+ o->rest.f.min = ANIM_MAGIC_LAMP1_WAVE_AMP_MAX_MIN;
+ o->rest.f.max = ANIM_MAGIC_LAMP1_WAVE_AMP_MAX_MAX;
+ o->rest.f.precision = ANIM_MAGIC_LAMP1_WAVE_AMP_MAX_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_GRID_RES];
+ o->name = "magic_lamp2_grid_res";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Magic Lamp 2 Grid Y Resolution");
+ o->longDesc =
+ N_
+ ("Vertex Grid Resolution (2-200) for Magic Lamp 2 (Y dimension only)");
+ o->type = CompOptionTypeInt;
+ o->value.i = ANIM_MAGIC_LAMP2_GRID_RES_DEFAULT;
+ o->rest.i.min = ANIM_MAGIC_LAMP2_GRID_RES_MIN;
+ o->rest.i.max = ANIM_MAGIC_LAMP2_GRID_RES_MAX;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_MAX_WAVES];
+ o->name = "magic_lamp2_max_waves";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Magic Lamp 2 Max Waves");
+ o->longDesc = N_("Maximum number of waves for Magic Lamp 2");
+ o->type = CompOptionTypeInt;
+ o->value.i = ANIM_MAGIC_LAMP2_MAX_WAVES_DEFAULT;
+ o->rest.i.min = ANIM_MAGIC_LAMP2_MAX_WAVES_MIN;
+ o->rest.i.max = ANIM_MAGIC_LAMP2_MAX_WAVES_MAX;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MIN];
+ o->name = "magic_lamp2_wave_amp_min";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Magic Lamp 2 Wave Min Amplitude");
+ o->longDesc =
+ N_
+ ("Magic Lamp 2 waves will have random amplitudes between min and max");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_MAGIC_LAMP2_WAVE_AMP_MIN_DEFAULT;
+ o->rest.f.min = ANIM_MAGIC_LAMP2_WAVE_AMP_MIN_MIN;
+ o->rest.f.max = ANIM_MAGIC_LAMP2_WAVE_AMP_MIN_MAX;
+ o->rest.f.precision = ANIM_MAGIC_LAMP2_WAVE_AMP_MIN_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP2_WAVE_AMP_MAX];
+ o->name = "magic_lamp2_wave_amp_max";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Magic Lamp 2 Wave Max Amplitude");
+ o->longDesc =
+ N_
+ ("Magic Lamp 2 waves will have random amplitudes between min and max");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_MAGIC_LAMP2_WAVE_AMP_MAX_DEFAULT;
+ o->rest.f.min = ANIM_MAGIC_LAMP2_WAVE_AMP_MAX_MIN;
+ o->rest.f.max = ANIM_MAGIC_LAMP2_WAVE_AMP_MAX_MAX;
+ o->rest.f.precision = ANIM_MAGIC_LAMP2_WAVE_AMP_MAX_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_WAVE_WIDTH];
+ o->name = "focus_wave_width";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Focus Wave Width");
+ o->longDesc = N_("Focus wave width relative to window height");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_FOCUS_WAVE_WIDTH_DEFAULT;
+ o->rest.f.min = ANIM_FOCUS_WAVE_WIDTH_MIN;
+ o->rest.f.max = ANIM_FOCUS_WAVE_WIDTH_MAX;
+ o->rest.f.precision = ANIM_FOCUS_WAVE_WIDTH_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_WAVE_AMP];
+ o->name = "focus_wave_amp";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Focus Wave Amplitude");
+ o->longDesc = N_("Focus wave amplitude relative to window height");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_FOCUS_WAVE_AMP_DEFAULT;
+ o->rest.f.min = ANIM_FOCUS_WAVE_AMP_MIN;
+ o->rest.f.max = ANIM_FOCUS_WAVE_AMP_MAX;
+ o->rest.f.precision = ANIM_FOCUS_WAVE_AMP_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_SIDEKICK_NUM_ROTATIONS];
+ o->name = "sidekick_num_rotations";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Sidekick Number of Rotations");
+ o->longDesc = N_("Sidekick number of rotations (with +/-10% randomness)");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_SIDEKICK_NUM_ROTATIONS_DEFAULT;
+ o->rest.f.min = ANIM_SIDEKICK_NUM_ROTATIONS_MIN;
+ o->rest.f.max = ANIM_SIDEKICK_NUM_ROTATIONS_MAX;
+ o->rest.f.precision = ANIM_SIDEKICK_NUM_ROTATIONS_PRECISION;
+
+ // Minimize
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MINIMIZE_EFFECT];
+ o->name = "minimize_effect";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Minimize Effect");
+ o->longDesc = N_("Minimize Window Effect");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (allEffectName[ANIM_MINIMIZE_DEFAULT]);
+ o->rest.s.string = minimizeEffectName;
+ o->rest.s.nString = NUM_MINIMIZE_EFFECT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MINIMIZE_WINDOW_TYPE];
+ o->name = "minimize_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Minimize Window Types");
+ o->longDesc =
+ N_
+ ("Window types that should animate with this effect when minimized");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_MINIMIZE_DEFAULT_WIN_TYPE;
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * N_MINIMIZE_DEFAULT_WIN_TYPE);
+ for (i = 0; i < N_MINIMIZE_DEFAULT_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup (minimizeDefaultWinType[i]);
+ o->rest.s.string = (char **)windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ as->minimizeWMask = compWindowTypeMaskFromStringList (&o->value);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_MINIMIZE_DURATION];
+ o->name = "minimize_duration";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Minimize Animation Duration");
+ o->longDesc = N_("Minimize animation duration in seconds");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_MINIMIZE_DURATION_DEFAULT;
+ o->rest.f.min = ANIM_MINIMIZE_DURATION_MIN;
+ o->rest.f.max = ANIM_MINIMIZE_DURATION_MAX;
+ o->rest.f.precision = ANIM_MINIMIZE_DURATION_PRECISION;
+
+ // Unminimize
+
+ o = &as->opt[ANIM_SCREEN_OPTION_UNMINIMIZE_EFFECT];
+ o->name = "unminimize_effect";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Unminimize Effect");
+ o->longDesc = N_("Unminimize Window Effect");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (allEffectName[ANIM_UNMINIMIZE_DEFAULT]);
+ o->rest.s.string = minimizeEffectName;
+ o->rest.s.nString = NUM_MINIMIZE_EFFECT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_UNMINIMIZE_WINDOW_TYPE];
+ o->name = "unminimize_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Unminimize Window Types");
+ o->longDesc =
+ N_
+ ("Window types that should animate with this effect when unminimized");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_MINIMIZE_DEFAULT_WIN_TYPE;
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * N_MINIMIZE_DEFAULT_WIN_TYPE);
+ for (i = 0; i < N_MINIMIZE_DEFAULT_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup (minimizeDefaultWinType[i]);
+ o->rest.s.string = (char **)windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ as->unminimizeWMask = compWindowTypeMaskFromStringList (&o->value);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_UNMINIMIZE_DURATION];
+ o->name = "unminimize_duration";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Unminimize Animation Duration");
+ o->longDesc = N_("Unminimize animation duration in seconds");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_UNMINIMIZE_DURATION_DEFAULT;
+ o->rest.f.min = ANIM_UNMINIMIZE_DURATION_MIN;
+ o->rest.f.max = ANIM_UNMINIMIZE_DURATION_MAX;
+ o->rest.f.precision = ANIM_UNMINIMIZE_DURATION_PRECISION;
+
+ // Close 1
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CLOSE1_EFFECT];
+ o->name = "close1_effect";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Close Effect 1");
+ o->longDesc = N_("Close Window Effect 1");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (allEffectName[ANIM_CLOSE1_DEFAULT]);
+ o->rest.s.string = closeEffectName;
+ o->rest.s.nString = NUM_CLOSE_EFFECT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CLOSE1_WINDOW_TYPE];
+ o->name = "close1_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Close Window Types 1");
+ o->longDesc =
+ N_("Window types that should animate with this effect when closed");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_CLOSE1_DEFAULT_WIN_TYPE;
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * N_CLOSE1_DEFAULT_WIN_TYPE);
+ for (i = 0; i < N_CLOSE1_DEFAULT_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup (close1DefaultWinType[i]);
+ o->rest.s.string = (char **)windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ as->close1WMask = compWindowTypeMaskFromStringList (&o->value);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CLOSE1_DURATION];
+ o->name = "close1_duration";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Close Animation Duration 1");
+ o->longDesc = N_("Animation duration in seconds for close effect 1");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_CLOSE1_DURATION_DEFAULT;
+ o->rest.f.min = ANIM_CLOSE1_DURATION_MIN;
+ o->rest.f.max = ANIM_CLOSE1_DURATION_MAX;
+ o->rest.f.precision = ANIM_CLOSE1_DURATION_PRECISION;
+
+ // Close 2
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CLOSE2_EFFECT];
+ o->name = "close2_effect";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Close Effect 2");
+ o->longDesc = N_("Close Window Effect 2");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (allEffectName[ANIM_CLOSE2_DEFAULT]);
+ o->rest.s.string = closeEffectName;
+ o->rest.s.nString = NUM_CLOSE_EFFECT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CLOSE2_WINDOW_TYPE];
+ o->name = "close2_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Close Window Types 2");
+ o->longDesc =
+ N_("Window types that should animate with this effect when closed");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_CLOSE2_DEFAULT_WIN_TYPE;
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * N_CLOSE2_DEFAULT_WIN_TYPE);
+ for (i = 0; i < N_CLOSE2_DEFAULT_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup (close2DefaultWinType[i]);
+ o->rest.s.string = (char **)windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ as->close2WMask = compWindowTypeMaskFromStringList (&o->value);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CLOSE2_DURATION];
+ o->name = "close2_duration";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Close Animation Duration 2");
+ o->longDesc = N_("Animation duration in seconds for close effect 2");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_CLOSE2_DURATION_DEFAULT;
+ o->rest.f.min = ANIM_CLOSE2_DURATION_MIN;
+ o->rest.f.max = ANIM_CLOSE2_DURATION_MAX;
+ o->rest.f.precision = ANIM_CLOSE2_DURATION_PRECISION;
+
+ // Create 1
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CREATE1_EFFECT];
+ o->name = "create1_effect";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Create Effect 1");
+ o->longDesc = N_("Create Window Effect 1");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (allEffectName[ANIM_CREATE1_DEFAULT]);
+ o->rest.s.string = closeEffectName;
+ o->rest.s.nString = NUM_CLOSE_EFFECT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CREATE1_WINDOW_TYPE];
+ o->name = "create1_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Create Window Types 1");
+ o->longDesc =
+ N_("Window types that should animate with this effect when created");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_CLOSE1_DEFAULT_WIN_TYPE;
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * N_CLOSE1_DEFAULT_WIN_TYPE);
+ for (i = 0; i < N_CLOSE1_DEFAULT_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup (close1DefaultWinType[i]);
+ o->rest.s.string = (char **)windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ as->create1WMask = compWindowTypeMaskFromStringList (&o->value);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CREATE1_DURATION];
+ o->name = "create1_duration";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Create Animation Duration 1");
+ o->longDesc = N_("Animation duration in seconds for create effect 1");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_CREATE1_DURATION_DEFAULT;
+ o->rest.f.min = ANIM_CREATE1_DURATION_MIN;
+ o->rest.f.max = ANIM_CREATE1_DURATION_MAX;
+ o->rest.f.precision = ANIM_CREATE1_DURATION_PRECISION;
+
+ // Create 2
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CREATE2_EFFECT];
+ o->name = "create2_effect";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Create Effect 2");
+ o->longDesc = N_("Create Window Effect 2");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (allEffectName[ANIM_CREATE2_DEFAULT]);
+ o->rest.s.string = closeEffectName;
+ o->rest.s.nString = NUM_CLOSE_EFFECT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CREATE2_WINDOW_TYPE];
+ o->name = "create2_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Create Window Types 2");
+ o->longDesc =
+ N_("Window types that should animate with this effect when created");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_CLOSE2_DEFAULT_WIN_TYPE;
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * N_CLOSE2_DEFAULT_WIN_TYPE);
+ for (i = 0; i < N_CLOSE2_DEFAULT_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup (close2DefaultWinType[i]);
+ o->rest.s.string = (char **)windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ as->create2WMask = compWindowTypeMaskFromStringList (&o->value);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_CREATE2_DURATION];
+ o->name = "create2_duration";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Create Animation Duration 2");
+ o->longDesc = N_("Animation duration in seconds for create effect 2");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_CREATE2_DURATION_DEFAULT;
+ o->rest.f.min = ANIM_CREATE2_DURATION_MIN;
+ o->rest.f.max = ANIM_CREATE2_DURATION_MAX;
+ o->rest.f.precision = ANIM_CREATE2_DURATION_PRECISION;
+
+ // Focus
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_EFFECT];
+ o->name = "focus_effect";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Focus Effect");
+ o->longDesc = N_("Focus Window Effect");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (allEffectName[ANIM_FOCUS_DEFAULT]);
+ o->rest.s.string = focusEffectName;
+ o->rest.s.nString = NUM_FOCUS_EFFECT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_WINDOW_TYPE];
+ o->name = "focus_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Focus Window Types");
+ o->longDesc =
+ N_("Window types that should animate with this effect when focused");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_FOCUS_DEFAULT_WIN_TYPE;
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * N_FOCUS_DEFAULT_WIN_TYPE);
+ for (i = 0; i < N_FOCUS_DEFAULT_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup (focusDefaultWinType[i]);
+ o->rest.s.string = (char **)windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ as->focusWMask = compWindowTypeMaskFromStringList (&o->value);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FOCUS_DURATION];
+ o->name = "focus_duration";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Focus Animation Duration");
+ o->longDesc = N_("Focus animation duration in seconds");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_FOCUS_DURATION_DEFAULT;
+ o->rest.f.min = ANIM_FOCUS_DURATION_MIN;
+ o->rest.f.max = ANIM_FOCUS_DURATION_MAX;
+ o->rest.f.precision = ANIM_FOCUS_DURATION_PRECISION;
+
+ // Shade
+
+ o = &as->opt[ANIM_SCREEN_OPTION_SHADE_EFFECT];
+ o->name = "shade_effect";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Shade Effect");
+ o->longDesc = N_("Shade Window Effect");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (allEffectName[ANIM_SHADE_DEFAULT]);
+ o->rest.s.string = shadeEffectName;
+ o->rest.s.nString = NUM_SHADE_EFFECT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_SHADE_WINDOW_TYPE];
+ o->name = "shade_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Shade Window Types");
+ o->longDesc =
+ N_("Window types that should animate with this effect when shaded");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_SHADE_DEFAULT_WIN_TYPE;
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * N_SHADE_DEFAULT_WIN_TYPE);
+ for (i = 0; i < N_SHADE_DEFAULT_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup (shadeDefaultWinType[i]);
+ o->rest.s.string = (char **)windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ as->shadeWMask = compWindowTypeMaskFromStringList (&o->value);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_SHADE_DURATION];
+ o->name = "shade_duration";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Shade Animation Duration");
+ o->longDesc = N_("Shade animation duration in seconds");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_SHADE_DURATION_DEFAULT;
+ o->rest.f.min = ANIM_SHADE_DURATION_MIN;
+ o->rest.f.max = ANIM_SHADE_DURATION_MAX;
+ o->rest.f.precision = ANIM_SHADE_DURATION_PRECISION;
+
+ // Unshade
+
+ o = &as->opt[ANIM_SCREEN_OPTION_UNSHADE_EFFECT];
+ o->name = "unshade_effect";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Unshade Effect");
+ o->longDesc = N_("Unshade Window Effect");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (allEffectName[ANIM_UNSHADE_DEFAULT]);
+ o->rest.s.string = shadeEffectName;
+ o->rest.s.nString = NUM_SHADE_EFFECT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_UNSHADE_WINDOW_TYPE];
+ o->name = "unshade_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Unshade Window Types");
+ o->longDesc =
+ N_("Window types that should animate with this effect when unshaded");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_SHADE_DEFAULT_WIN_TYPE;
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * N_SHADE_DEFAULT_WIN_TYPE);
+ for (i = 0; i < N_SHADE_DEFAULT_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup (shadeDefaultWinType[i]);
+ o->rest.s.string = (char **)windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ as->unshadeWMask = compWindowTypeMaskFromStringList (&o->value);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_UNSHADE_DURATION];
+ o->name = "unshade_duration";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Unshade Animation Duration");
+ o->longDesc = N_("Unshade animation duration in seconds");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_UNSHADE_DURATION_DEFAULT;
+ o->rest.f.min = ANIM_UNSHADE_DURATION_MIN;
+ o->rest.f.max = ANIM_UNSHADE_DURATION_MAX;
+ o->rest.f.precision = ANIM_UNSHADE_DURATION_PRECISION;
+
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FIRE_PARTICLES];
+ o->name = "fire_particles";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Number Of Fire Particles");
+ o->longDesc = N_("Number of fire particles");
+ o->type = CompOptionTypeInt;
+ o->value.i = ANIM_FIRE_PARTICLES_DEFAULT;
+ o->rest.i.min = ANIM_FIRE_PARTICLES_MIN;
+ o->rest.i.max = ANIM_FIRE_PARTICLES_MAX;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE];
+ o->name = "fire_size";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Fire Particle Size");
+ o->longDesc = N_("Fire particle size");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_FIRE_SIZE_DEFAULT;
+ o->rest.f.min = ANIM_FIRE_SIZE_MIN;
+ o->rest.f.max = ANIM_FIRE_SIZE_MAX;
+ o->rest.f.precision = ANIM_FIRE_SIZE_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FIRE_SLOWDOWN];
+ o->name = "fire_slowdown";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Fire Particle Slowdown");
+ o->longDesc = N_("Fire particle slowdown");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_FIRE_SLOWDOWN_DEFAULT;
+ o->rest.f.min = ANIM_FIRE_SLOWDOWN_MIN;
+ o->rest.f.max = ANIM_FIRE_SLOWDOWN_MAX;
+ o->rest.f.precision = ANIM_FIRE_SLOWDOWN_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE];
+ o->name = "fire_life";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Fire Particle Life");
+ o->longDesc = N_("Fire particle life");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_FIRE_LIFE_DEFAULT;
+ o->rest.f.min = ANIM_FIRE_LIFE_MIN;
+ o->rest.f.max = ANIM_FIRE_LIFE_MAX;
+ o->rest.f.precision = ANIM_FIRE_LIFE_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR];
+ o->name = "fire_color";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Fire Particle Color");
+ o->longDesc = N_("Fire Particle Color");
+ o->type = CompOptionTypeColor;
+ o->value.c[0] = ANIM_FIRE_COLOR_RED_DEFAULT;
+ o->value.c[1] = ANIM_FIRE_COLOR_GREEN_DEFAULT;
+ o->value.c[2] = ANIM_FIRE_COLOR_BLUE_DEFAULT;
+ o->value.c[3] = ANIM_FIRE_COLOR_ALPHA_DEFAULT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FIRE_DIRECTION];
+ o->name = "fire_direction";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Fire direction");
+ o->longDesc = N_("Fire direction");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (animDirectionName[ANIM_FIRE_DIRECTION_DEFAULT]);
+ o->rest.s.string = animDirectionName;
+ o->rest.s.nString = LIST_SIZE (animDirectionName);
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FIRE_CONSTANT_SPEED];
+ o->name = "fire_constant_speed";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Fire constant speed");
+ o->longDesc =
+ N_("Make fire effect duration be dependent of window height");
+ o->type = CompOptionTypeBool;
+ o->value.b = ANIM_FIRE_CONSTANT_SPEED_DEFAULT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FIRE_SMOKE];
+ o->name = "fire_smoke";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Fire smoke");
+ o->longDesc = N_("Fire Smoke");
+ o->type = CompOptionTypeBool;
+ o->value.b = ANIM_FIRE_SMOKE_DEFAULT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_FIRE_MYSTICAL];
+ o->name = "fire_mystical";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Randomly Colored Fire");
+ o->longDesc =
+ N_
+ ("Have random colors for the fire effect, also known as Mystical Fire");
+ o->type = CompOptionTypeBool;
+ o->value.b = ANIM_FIRE_MYSTICAL_DEFAULT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_SIZE];
+ o->name = "beam_size";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Beam Width");
+ o->longDesc = N_("Beam Width");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_BEAMUP_SIZE_DEFAULT;
+ o->rest.f.min = ANIM_BEAMUP_SIZE_MIN;
+ o->rest.f.max = ANIM_BEAMUP_SIZE_MAX;
+ o->rest.f.precision = ANIM_BEAMUP_SIZE_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_SPACING];
+ o->name = "beam_spacing";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Beam spacing");
+ o->longDesc = N_("Spacing between beams");
+ o->type = CompOptionTypeInt;
+ o->value.i = ANIM_BEAMUP_SPACING_DEFAULT;
+ o->rest.i.min = ANIM_BEAMUP_SPACING_MIN;
+ o->rest.i.max = ANIM_BEAMUP_SPACING_MAX;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR];
+ o->name = "beam_color";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Beam Color");
+ o->longDesc = N_("Beam Color");
+ o->type = CompOptionTypeColor;
+ o->value.c[0] = ANIM_BEAMUP_COLOR_RED_DEFAULT;
+ o->value.c[1] = ANIM_BEAMUP_COLOR_GREEN_DEFAULT;
+ o->value.c[2] = ANIM_BEAMUP_COLOR_BLUE_DEFAULT;
+ o->value.c[3] = ANIM_BEAMUP_COLOR_ALPHA_DEFAULT;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN];
+ o->name = "beam_slowdown";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Beam Slowdown");
+ o->longDesc = N_("Beam slowdown");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_BEAMUP_SLOWDOWN_DEFAULT;
+ o->rest.f.min = ANIM_BEAMUP_SLOWDOWN_MIN;
+ o->rest.f.max = ANIM_BEAMUP_SLOWDOWN_MAX;
+ o->rest.f.precision = ANIM_BEAMUP_SLOWDOWN_PRECISION;
+
+ o = &as->opt[ANIM_SCREEN_OPTION_BEAMUP_LIFE];
+ o->name = "beam_life";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Beam Life");
+ o->longDesc = N_("Beam life");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANIM_BEAMUP_LIFE_DEFAULT;
+ o->rest.f.min = ANIM_BEAMUP_LIFE_MIN;
+ o->rest.f.max = ANIM_BEAMUP_LIFE_MAX;
+ o->rest.f.precision = ANIM_BEAMUP_LIFE_PRECISION;
}
-static CompOption *animGetScreenOptions(CompScreen * screen, int *count)
+static CompOption *
+animGetScreenOptions (CompScreen * screen, int *count)
{
- if (screen) {
- ANIM_SCREEN(screen);
-
- *count = NUM_OPTIONS(as);
- return as->opt;
- } else {
- AnimScreen *as = malloc(sizeof(AnimScreen));
- animScreenInitOptions(as);
- *count = NUM_OPTIONS(as);
- return as->opt;
- }
+ if (screen)
+ {
+ ANIM_SCREEN (screen);
+
+ *count = NUM_OPTIONS (as);
+ return as->opt;
+ }
+ else
+ {
+ AnimScreen *as = malloc (sizeof (AnimScreen));
+ animScreenInitOptions (as);
+ *count = NUM_OPTIONS (as);
+ return as->opt;
+ }
}
static void
-objectInit(Object * object,
- float positionX, float positionY,
- float gridPositionX, float gridPositionY)
+objectInit (Object * object,
+ float positionX, float positionY,
+ float gridPositionX, float gridPositionY)
{
- object->gridPosition.x = gridPositionX;
- object->gridPosition.y = gridPositionY;
+ object->gridPosition.x = gridPositionX;
+ object->gridPosition.y = gridPositionY;
- object->position.x = positionX;
- object->position.y = positionY;
+ object->position.x = positionX;
+ object->position.y = positionY;
- object->offsetTexCoordForQuadBefore.x = 0;
- object->offsetTexCoordForQuadBefore.y = 0;
- object->offsetTexCoordForQuadAfter.x = 0;
- object->offsetTexCoordForQuadAfter.y = 0;
+ object->offsetTexCoordForQuadBefore.x = 0;
+ object->offsetTexCoordForQuadBefore.y = 0;
+ object->offsetTexCoordForQuadAfter.x = 0;
+ object->offsetTexCoordForQuadAfter.y = 0;
}
static void
-modelInitObjects(Model * model, int x, int y, int width, int height)
+modelInitObjects (Model * model, int x, int y, int width, int height)
{
- int gridX, gridY;
- int nGridCellsX, nGridCellsY;
- float x0, y0;
-
- x0 = model->scaleOrigin.x;
- y0 = model->scaleOrigin.y;
-
- // number of grid cells in x direction
- nGridCellsX = model->gridWidth - 1;
-
- if (model->forWindowEvent == WindowEventShade ||
- model->forWindowEvent == WindowEventUnshade) {
- // number of grid cells in y direction
- nGridCellsY = model->gridHeight - 3; // One allocated for top, one for bottom
-
- float winContentsHeight =
- height - model->topHeight - model->bottomHeight;
-
- //Top
- float objectY = y + (0 - y0) * model->scale.y + y0;
-
- for (gridX = 0; gridX < model->gridWidth; gridX++) {
- objectInit(&model->objects[gridX],
- x + ((gridX * width / nGridCellsX) -
- x0) * model->scale.x + x0, objectY,
- (float) gridX / nGridCellsX, 0);
- }
-
- // Window contents
- for (gridY = 1; gridY < model->gridHeight - 1; gridY++) {
- float inWinY =
- (gridY - 1) * winContentsHeight / nGridCellsY +
- model->topHeight;
- float gridPosY = inWinY / height;
- objectY = y + (inWinY - y0) * model->scale.y + y0;
-
- for (gridX = 0; gridX < model->gridWidth; gridX++) {
- objectInit(&model->
- objects[gridY *
- model->gridWidth +
- gridX],
- x +
- ((gridX * width / nGridCellsX) -
- x0) * model->scale.x + x0,
- objectY,
- (float) gridX / nGridCellsX,
- gridPosY);
- }
- }
-
- // Bottom (gridY is model->gridHeight-1 now)
- objectY = y + (height - y0) * model->scale.y + y0;
-
- for (gridX = 0; gridX < model->gridWidth; gridX++) {
- objectInit(&model->
- objects[gridY * model->gridWidth +
- gridX],
- x + ((gridX * width / nGridCellsX) -
- x0) * model->scale.x + x0, objectY,
- (float) gridX / nGridCellsX, 1);
- }
- } else {
- // number of grid cells in y direction
- nGridCellsY = model->gridHeight - 1;
-
- int i = 0;
- for (gridY = 0; gridY < model->gridHeight; gridY++) {
- float objectY =
- y + ((gridY * height / nGridCellsY) -
- y0) * model->scale.y + y0;
- for (gridX = 0; gridX < model->gridWidth; gridX++) {
- objectInit(&model->objects[i],
- x +
- ((gridX * width / nGridCellsX) -
- x0) * model->scale.x + x0,
- objectY,
- (float) gridX / nGridCellsX,
- (float) gridY / nGridCellsY);
- i++;
- }
- }
- }
+ int gridX, gridY;
+ int nGridCellsX, nGridCellsY;
+ float x0, y0;
+
+ x0 = model->scaleOrigin.x;
+ y0 = model->scaleOrigin.y;
+
+ // number of grid cells in x direction
+ nGridCellsX = model->gridWidth - 1;
+
+ if (model->forWindowEvent == WindowEventShade ||
+ model->forWindowEvent == WindowEventUnshade)
+ {
+ // number of grid cells in y direction
+ nGridCellsY = model->gridHeight - 3; // One allocated for top, one for bottom
+
+ float winContentsHeight =
+ height - model->topHeight - model->bottomHeight;
+
+ //Top
+ float objectY = y + (0 - y0) * model->scale.y + y0;
+
+ for (gridX = 0; gridX < model->gridWidth; gridX++)
+ {
+ objectInit (&model->objects[gridX],
+ x + ((gridX * width / nGridCellsX) -
+ x0) * model->scale.x + x0, objectY,
+ (float)gridX / nGridCellsX, 0);
+ }
+
+ // Window contents
+ for (gridY = 1; gridY < model->gridHeight - 1; gridY++)
+ {
+ float inWinY =
+ (gridY - 1) * winContentsHeight / nGridCellsY +
+ model->topHeight;
+ float gridPosY = inWinY / height;
+ objectY = y + (inWinY - y0) * model->scale.y + y0;
+
+ for (gridX = 0; gridX < model->gridWidth; gridX++)
+ {
+ objectInit (&model->
+ objects[gridY *
+ model->gridWidth +
+ gridX],
+ x +
+ ((gridX * width / nGridCellsX) -
+ x0) * model->scale.x + x0,
+ objectY, (float)gridX / nGridCellsX, gridPosY);
+ }
+ }
+
+ // Bottom (gridY is model->gridHeight-1 now)
+ objectY = y + (height - y0) * model->scale.y + y0;
+
+ for (gridX = 0; gridX < model->gridWidth; gridX++)
+ {
+ objectInit (&model->
+ objects[gridY * model->gridWidth +
+ gridX],
+ x + ((gridX * width / nGridCellsX) -
+ x0) * model->scale.x + x0, objectY,
+ (float)gridX / nGridCellsX, 1);
+ }
+ }
+ else
+ {
+ // number of grid cells in y direction
+ nGridCellsY = model->gridHeight - 1;
+
+ int i = 0;
+ for (gridY = 0; gridY < model->gridHeight; gridY++)
+ {
+ float objectY =
+ y + ((gridY * height / nGridCellsY) -
+ y0) * model->scale.y + y0;
+ for (gridX = 0; gridX < model->gridWidth; gridX++)
+ {
+ objectInit (&model->objects[i],
+ x +
+ ((gridX * width / nGridCellsX) -
+ x0) * model->scale.x + x0,
+ objectY,
+ (float)gridX / nGridCellsX,
+ (float)gridY / nGridCellsY);
+ i++;
+ }
+ }
+ }
}
-static void modelMove(Model * model, float tx, float ty)
+static void
+modelMove (Model * model, float tx, float ty)
{
- int i;
+ int i;
- for (i = 0; i < model->numObjects; i++) {
- model->objects[i].position.x += tx;
- model->objects[i].position.y += ty;
- }
+ for (i = 0; i < model->numObjects; i++)
+ {
+ model->objects[i].position.x += tx;
+ model->objects[i].position.y += ty;
+ }
}
-static Model *createModel(CompWindow * w,
- WindowEvent forWindowEvent,
- AnimEffect forAnimEffect, int gridWidth,
- int gridHeight)
+static Model *
+createModel (CompWindow * w,
+ WindowEvent forWindowEvent,
+ AnimEffect forAnimEffect, int gridWidth, int gridHeight)
{
- int x = WIN_X(w);
- int y = WIN_Y(w);
- int width = WIN_W(w);
- int height = WIN_H(w);
-
- Model *model;
-
- model = malloc(sizeof(Model));
- if (!model) {
- fprintf(stderr, "Animation: couldn't allocate model!\n");
- return 0;
- }
- model->magicLampWaveCount = 0;
- model->magicLampWaves = NULL;
-
- model->gridWidth = gridWidth;
- model->gridHeight = gridHeight;
- model->numObjects = gridWidth * gridHeight;
- model->objects = malloc(sizeof(Object) * model->numObjects);
- if (!model->objects) {
- fprintf(stderr, "Animation: couldn't allocate objects!\n");
- free(model);
- return 0;
- }
- // For shading
- model->forWindowEvent = forWindowEvent;
- model->topHeight = w->output.top;
- model->bottomHeight = w->output.bottom;
-
- model->remainderSteps = 0;
-
- model->scale.x = 1.0f;
- model->scale.y = 1.0f;
-
- model->scaleOrigin.x = 0.0f;
- model->scaleOrigin.y = 0.0f;
-
- model->transformed = FALSE;
- modelInitObjects(model, x, y, width, height);
-
- modelCalcBounds(model);
-
- return model;
+ int x = WIN_X (w);
+ int y = WIN_Y (w);
+ int width = WIN_W (w);
+ int height = WIN_H (w);
+
+ Model *model;
+
+ model = malloc (sizeof (Model));
+ if (!model)
+ {
+ fprintf (stderr, "Animation: couldn't allocate model!\n");
+ return 0;
+ }
+ model->magicLampWaveCount = 0;
+ model->magicLampWaves = NULL;
+
+ model->gridWidth = gridWidth;
+ model->gridHeight = gridHeight;
+ model->numObjects = gridWidth * gridHeight;
+ model->objects = malloc (sizeof (Object) * model->numObjects);
+ if (!model->objects)
+ {
+ fprintf (stderr, "Animation: couldn't allocate objects!\n");
+ free (model);
+ return 0;
+ }
+ // For shading
+ model->forWindowEvent = forWindowEvent;
+ model->topHeight = w->output.top;
+ model->bottomHeight = w->output.bottom;
+
+ model->remainderSteps = 0;
+
+ model->scale.x = 1.0f;
+ model->scale.y = 1.0f;
+
+ model->scaleOrigin.x = 0.0f;
+ model->scaleOrigin.y = 0.0f;
+
+ model->transformed = FALSE;
+ modelInitObjects (model, x, y, width, height);
+
+ modelCalcBounds (model);
+
+ return model;
}
static Bool
-animEnsureModel(CompWindow * w,
- WindowEvent forWindowEvent, AnimEffect forAnimEffect)
+animEnsureModel (CompWindow * w,
+ WindowEvent forWindowEvent, AnimEffect forAnimEffect)
{
- ANIM_WINDOW(w);
- ANIM_SCREEN(w->screen);
-
- int gridWidth = 2;
- int gridHeight = 2;
-
- if (animEffectProperties[forAnimEffect].initGridFunc)
- animEffectProperties[forAnimEffect].initGridFunc(as,
- forWindowEvent,
- &gridWidth,
- &gridHeight);
-
- Bool isShadeUnshadeEvent =
- (forWindowEvent == WindowEventShade ||
- forWindowEvent == WindowEventUnshade);
-
- Bool wasShadeUnshadeEvent = aw->model &&
- (aw->model->forWindowEvent == WindowEventShade ||
- aw->model->forWindowEvent == WindowEventUnshade);
-
- if (!aw->model ||
- gridWidth != aw->model->gridWidth ||
- gridHeight != aw->model->gridHeight ||
- (isShadeUnshadeEvent != wasShadeUnshadeEvent)) {
- if (aw->model) {
- if (aw->model->magicLampWaves)
- free(aw->model->magicLampWaves);
- free(aw->model->objects);
- free(aw->model);
- }
- aw->model = createModel(w,
- forWindowEvent, forAnimEffect,
- gridWidth, gridHeight);
- if (!aw->model)
- return FALSE;
- }
-
- return TRUE;
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (w->screen);
+
+ int gridWidth = 2;
+ int gridHeight = 2;
+
+ if (animEffectProperties[forAnimEffect].initGridFunc)
+ animEffectProperties[forAnimEffect].initGridFunc (as,
+ forWindowEvent,
+ &gridWidth,
+ &gridHeight);
+
+ Bool isShadeUnshadeEvent =
+ (forWindowEvent == WindowEventShade ||
+ forWindowEvent == WindowEventUnshade);
+
+ Bool wasShadeUnshadeEvent = aw->model &&
+ (aw->model->forWindowEvent == WindowEventShade ||
+ aw->model->forWindowEvent == WindowEventUnshade);
+
+ if (!aw->model ||
+ gridWidth != aw->model->gridWidth ||
+ gridHeight != aw->model->gridHeight ||
+ (isShadeUnshadeEvent != wasShadeUnshadeEvent))
+ {
+ if (aw->model)
+ {
+ if (aw->model->magicLampWaves)
+ free (aw->model->magicLampWaves);
+ free (aw->model->objects);
+ free (aw->model);
+ }
+ aw->model = createModel (w,
+ forWindowEvent, forAnimEffect,
+ gridWidth, gridHeight);
+ if (!aw->model)
+ return FALSE;
+ }
+
+ return TRUE;
}
-static void postAnimationCleanup(CompWindow * w, Bool resetAnimation)
+static void
+postAnimationCleanup (CompWindow * w, Bool resetAnimation)
{
- ANIM_WINDOW(w);
- ANIM_SCREEN(w->screen);
-
- IPCS_SetBool(IPCS_OBJECT(w), aw->animatedAtom, FALSE);
-
- if (resetAnimation) {
- aw->curWindowEvent = WindowEventNone;
- aw->curAnimEffect = AnimEffectNone;
- aw->animOverrideProgressDir = 0;
-
- if (as->ppDisabling == PostprocessDisablingWindow)
- IPCS_SetBoolN(IPCS_OBJECT(w), "DISABLE_BLUR",
- FALSE);
- if (!(as->animInProgress)
- && as->ppDisabling == PostprocessDisablingScreen)
- IPCS_SetBoolN(IPCS_OBJECT(w->screen),
- "DISABLE_BLUR", FALSE);
- if (aw->model) {
- if (aw->model->magicLampWaves)
- free(aw->model->magicLampWaves);
- aw->model->magicLampWaves = 0;
- }
- }
-
- aw->state = aw->newState;
-
- if (aw->drawRegion)
- XDestroyRegion(aw->drawRegion);
- aw->drawRegion = NULL;
- aw->useDrawRegion = FALSE;
-
- if (aw->numPs) {
- int i = 0;
- for (i = 0; i < aw->numPs; i++) {
- free(aw->ps[i].particles);
- if (aw->ps[i].tex)
- glDeleteTextures(1, &aw->ps[i].tex);
- }
- free(aw->ps);
- aw->ps = NULL;
- aw->numPs = 0;
- }
-
- aw->animInitialized = FALSE;
-
- //if (aw->unmapCnt || aw->destroyCnt)
- // releaseWindow (w);
- while (aw->unmapCnt) {
- unmapWindow(w);
- aw->unmapCnt--;
- }
- while (aw->destroyCnt) {
- destroyWindow(w);
- aw->destroyCnt--;
- }
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (w->screen);
+
+ IPCS_SetBool (IPCS_OBJECT (w), aw->animatedAtom, FALSE);
+
+ if (resetAnimation)
+ {
+ aw->curWindowEvent = WindowEventNone;
+ aw->curAnimEffect = AnimEffectNone;
+ aw->animOverrideProgressDir = 0;
+
+ if (as->ppDisabling == PostprocessDisablingWindow)
+ IPCS_SetBoolN (IPCS_OBJECT (w), "DISABLE_BLUR", FALSE);
+ if (!(as->animInProgress)
+ && as->ppDisabling == PostprocessDisablingScreen)
+ IPCS_SetBoolN (IPCS_OBJECT (w->screen), "DISABLE_BLUR", FALSE);
+ if (aw->model)
+ {
+ if (aw->model->magicLampWaves)
+ free (aw->model->magicLampWaves);
+ aw->model->magicLampWaves = 0;
+ }
+ }
+
+ aw->state = aw->newState;
+
+ if (aw->drawRegion)
+ XDestroyRegion (aw->drawRegion);
+ aw->drawRegion = NULL;
+ aw->useDrawRegion = FALSE;
+
+ if (aw->numPs)
+ {
+ int i = 0;
+ for (i = 0; i < aw->numPs; i++)
+ {
+ free (aw->ps[i].particles);
+ if (aw->ps[i].tex)
+ glDeleteTextures (1, &aw->ps[i].tex);
+ }
+ free (aw->ps);
+ aw->ps = NULL;
+ aw->numPs = 0;
+ }
+
+ aw->animInitialized = FALSE;
+
+ //if (aw->unmapCnt || aw->destroyCnt)
+ // releaseWindow (w);
+ while (aw->unmapCnt)
+ {
+ unmapWindow (w);
+ aw->unmapCnt--;
+ }
+ while (aw->destroyCnt)
+ {
+ destroyWindow (w);
+ aw->destroyCnt--;
+ }
}
-static void animPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
+static void
+animPreparePaintScreen (CompScreen * s, int msSinceLastPaint)
{
- CompWindow *w;
-
- ANIM_SCREEN(s);
-
- if (as->animInProgress) {
- AnimWindow *aw;
- BoxRec box;
- Point topLeft, bottomRight;
-
- if (as->ppDisabling == PostprocessDisablingScreen)
- IPCS_SetBoolN(IPCS_OBJECT(s), "DISABLE_BLUR",
- TRUE);
- else
- IPCS_SetBoolN(IPCS_OBJECT(s), "DISABLE_BLUR",
- FALSE);
-
- as->animInProgress = FALSE;
- for (w = s->windows; w; w = w->next) {
- aw = GET_ANIM_WINDOW(w, as);
- if (aw->numPs) {
- int i = 0;
- for (i = 0; i < aw->numPs; i++) {
- if (aw->ps[i].active) {
- updateParticles(&aw->ps[i],
- msSinceLastPaint);
- as->animInProgress = TRUE;
- }
- }
- }
-
- if (aw->animRemainingTime > 0) {
- if (as->ppDisabling ==
- PostprocessDisablingWindow)
- IPCS_SetBoolN(IPCS_OBJECT(w),
- "DISABLE_BLUR",
- TRUE);
- else
- IPCS_SetBoolN(IPCS_OBJECT(w),
- "DISABLE_BLUR",
- FALSE);
-
- if (aw->model) {
- topLeft = aw->model->topLeft;
- bottomRight =
- aw->model->bottomRight;
-
- // If just starting, call fx init func.
- if (!aw->animInitialized &&
- animEffectProperties[aw->
- curAnimEffect].
- initFunc)
- animEffectProperties[aw->
- curAnimEffect].
- initFunc(s, w);
- aw->animInitialized = TRUE;
-
- // Call fx step func.
- if (animEffectProperties
- [aw->curAnimEffect].
- modelStepFunc) {
- animEffectProperties[aw->
- curAnimEffect].
- modelStepFunc(s, w,
- msSinceLastPaint);
- }
- if (aw->animRemainingTime <= 0) {
- // Animation done
- postAnimationCleanup(w,
- TRUE);
- }
-
- if (!
- (s->
- damageMask &
- COMP_SCREEN_DAMAGE_ALL_MASK))
- {
- if (aw->animRemainingTime >
- 0) {
- if (aw->model->
- topLeft.x <
- topLeft.x)
- topLeft.x =
- aw->
- model->
- topLeft.
- x;
- if (aw->model->
- topLeft.y <
- topLeft.y)
- topLeft.y =
- aw->
- model->
- topLeft.
- y;
- if (aw->model->
- bottomRight.x >
- bottomRight.x)
- bottomRight.
- x =
- aw->
- model->
- bottomRight.
- x;
- if (aw->model->
- bottomRight.y >
- bottomRight.y)
- bottomRight.
- y =
- aw->
- model->
- bottomRight.
- y;
- } else
- addWindowDamage(w);
-
- box.x1 = topLeft.x;
- box.y1 = topLeft.y;
- box.x2 =
- bottomRight.x + 0.5f;
- box.y2 =
- bottomRight.y + 0.5f;
-
- box.x1 -=
- w->attrib.x +
- w->attrib.border_width;
- box.y1 -=
- w->attrib.y +
- w->attrib.border_width;
- box.x2 -=
- w->attrib.x +
- w->attrib.border_width;
- box.y2 -=
- w->attrib.y +
- w->attrib.border_width;
-
- addWindowDamageRect(w,
- &box);
- }
- }
- as->animInProgress |=
- (aw->animRemainingTime > 0);
- }
-
- if (aw->animRemainingTime <= 0) {
- if (aw->curAnimEffect != AnimEffectNone ||
- aw->unmapCnt > 0 || aw->destroyCnt > 0)
- postAnimationCleanup(w, TRUE);
- aw->curWindowEvent = WindowEventNone;
- aw->curAnimEffect = AnimEffectNone;
- }
- }
- }
-
- UNWRAP(as, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, msSinceLastPaint);
- WRAP(as, s, preparePaintScreen, animPreparePaintScreen);
+ CompWindow *w;
+
+ ANIM_SCREEN (s);
+
+ if (as->animInProgress)
+ {
+ AnimWindow *aw;
+ BoxRec box;
+ Point topLeft, bottomRight;
+
+ if (as->ppDisabling == PostprocessDisablingScreen)
+ IPCS_SetBoolN (IPCS_OBJECT (s), "DISABLE_BLUR", TRUE);
+ else
+ IPCS_SetBoolN (IPCS_OBJECT (s), "DISABLE_BLUR", FALSE);
+
+ as->animInProgress = FALSE;
+ for (w = s->windows; w; w = w->next)
+ {
+ aw = GET_ANIM_WINDOW (w, as);
+ if (aw->numPs)
+ {
+ int i = 0;
+ for (i = 0; i < aw->numPs; i++)
+ {
+ if (aw->ps[i].active)
+ {
+ updateParticles (&aw->ps[i], msSinceLastPaint);
+ as->animInProgress = TRUE;
+ }
+ }
+ }
+
+ if (aw->animRemainingTime > 0)
+ {
+ if (as->ppDisabling == PostprocessDisablingWindow)
+ IPCS_SetBoolN (IPCS_OBJECT (w), "DISABLE_BLUR", TRUE);
+ else
+ IPCS_SetBoolN (IPCS_OBJECT (w), "DISABLE_BLUR", FALSE);
+
+ if (aw->model)
+ {
+ topLeft = aw->model->topLeft;
+ bottomRight = aw->model->bottomRight;
+
+ // If just starting, call fx init func.
+ if (!aw->animInitialized &&
+ animEffectProperties[aw->curAnimEffect].initFunc)
+ animEffectProperties[aw->
+ curAnimEffect].initFunc (s, w);
+ aw->animInitialized = TRUE;
+
+ // Call fx step func.
+ if (animEffectProperties[aw->curAnimEffect].modelStepFunc)
+ {
+ animEffectProperties[aw->
+ curAnimEffect].
+ modelStepFunc (s, w, msSinceLastPaint);
+ }
+ if (aw->animRemainingTime <= 0)
+ {
+ // Animation done
+ postAnimationCleanup (w, TRUE);
+ }
+
+ if (!(s->damageMask & COMP_SCREEN_DAMAGE_ALL_MASK))
+ {
+ if (aw->animRemainingTime > 0)
+ {
+ if (aw->model->topLeft.x < topLeft.x)
+ topLeft.x = aw->model->topLeft.x;
+ if (aw->model->topLeft.y < topLeft.y)
+ topLeft.y = aw->model->topLeft.y;
+ if (aw->model->bottomRight.x > bottomRight.x)
+ bottomRight.x = aw->model->bottomRight.x;
+ if (aw->model->bottomRight.y > bottomRight.y)
+ bottomRight.y = aw->model->bottomRight.y;
+ }
+ else
+ addWindowDamage (w);
+
+ box.x1 = topLeft.x;
+ box.y1 = topLeft.y;
+ box.x2 = bottomRight.x + 0.5f;
+ box.y2 = bottomRight.y + 0.5f;
+
+ box.x1 -= w->attrib.x + w->attrib.border_width;
+ box.y1 -= w->attrib.y + w->attrib.border_width;
+ box.x2 -= w->attrib.x + w->attrib.border_width;
+ box.y2 -= w->attrib.y + w->attrib.border_width;
+
+ addWindowDamageRect (w, &box);
+ }
+ }
+ as->animInProgress |= (aw->animRemainingTime > 0);
+ }
+
+ if (aw->animRemainingTime <= 0)
+ {
+ if (aw->curAnimEffect != AnimEffectNone ||
+ aw->unmapCnt > 0 || aw->destroyCnt > 0)
+ postAnimationCleanup (w, TRUE);
+ aw->curWindowEvent = WindowEventNone;
+ aw->curAnimEffect = AnimEffectNone;
+ }
+ }
+ }
+
+ UNWRAP (as, s, preparePaintScreen);
+ (*s->preparePaintScreen) (s, msSinceLastPaint);
+ WRAP (as, s, preparePaintScreen, animPreparePaintScreen);
}
-static void animDonePaintScreen(CompScreen * s)
+static void
+animDonePaintScreen (CompScreen * s)
{
- ANIM_SCREEN(s);
+ ANIM_SCREEN (s);
- if (as->animInProgress)
- damageScreen(s);
+ if (as->animInProgress)
+ damageScreen (s);
- if (!(as->animInProgress) &&
- as->ppDisabling == PostprocessDisablingScreen)
- IPCS_SetBoolN(IPCS_OBJECT(s), "DISABLE_BLUR", FALSE);
+ if (!(as->animInProgress) &&
+ as->ppDisabling == PostprocessDisablingScreen)
+ IPCS_SetBoolN (IPCS_OBJECT (s), "DISABLE_BLUR", FALSE);
- UNWRAP(as, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP(as, s, donePaintScreen, animDonePaintScreen);
+ UNWRAP (as, s, donePaintScreen);
+ (*s->donePaintScreen) (s);
+ WRAP (as, s, donePaintScreen, animDonePaintScreen);
}
static void
-animAddWindowGeometry(CompWindow * w,
- CompMatrix * matrix,
- int nMatrix, Region region, Region clip)
+animAddWindowGeometry (CompWindow * w,
+ CompMatrix * matrix,
+ int nMatrix, Region region, Region clip)
{
- ANIM_WINDOW(w);
- ANIM_SCREEN(w->screen);
-
- // if model is lost during animation (e.g. when plugin just reloaded)
- if (aw->animRemainingTime > 0 && !aw->model) {
- aw->animRemainingTime = 0;
- postAnimationCleanup(w, TRUE);
- }
- // if window is being animated
- if (aw->animRemainingTime > 0 && aw->model) {
- BoxPtr pClip;
- int nClip;
- int nVertices, nIndices;
- GLushort *i;
- GLfloat *v;
- int x1, y1, x2, y2;
- float width, height;
- float winContentsY, winContentsHeight;
- float deformedX, deformedY;
- int nVertX, nVertY, wx, wy;
- int vSize, it;
- float gridW, gridH, x, y;
- Bool rect = TRUE;
- Bool useTextureQ = FALSE;
- Model *model = aw->model;
- Region awRegion = NULL;
-
- // Use Q texture coordinate to avoid jagged-looking quads
- // http://www.r3.nu/~cass/qcoord/
- if (aw->curAnimEffect != AnimEffectZoom &&
- aw->curAnimEffect != AnimEffectSidekick)
- useTextureQ = TRUE;
-
- if (aw->useDrawRegion) {
- awRegion = XCreateRegion();
- XOffsetRegion(aw->drawRegion, WIN_X(w), WIN_Y(w));
- XIntersectRegion(region, aw->drawRegion, awRegion);
- XOffsetRegion(aw->drawRegion, -WIN_X(w),
- -WIN_Y(w));
- nClip = awRegion->numRects;
- pClip = awRegion->rects;
- } else {
- nClip = region->numRects;
- pClip = region->rects;
- }
-
- if (nClip == 0) // nothing to do
- {
- if (awRegion)
- XDestroyRegion(awRegion);
- return;
- }
-
- for (it = 0; it < nMatrix; it++) {
- if (matrix[it].xy != 0.0f || matrix[it].yx != 0.0f) {
- rect = FALSE;
- break;
- }
- }
-
- // window coordinates and size
- wx = WIN_X(w);
- wy = WIN_Y(w);
- width = WIN_W(w);
- height = WIN_H(w);
-
- // to be used if event is shade/unshade
- winContentsY = w->attrib.y;
- winContentsHeight = w->height;
-
- w->texUnits = nMatrix;
-
- if (w->vCount == 0) {
- // reset
- w->indexCount = 0;
- w->texCoordSize = 4;
- }
- vSize = 2 + w->texUnits * w->texCoordSize;
-
- nVertices = w->vCount;
- nIndices = w->indexCount;
-
- v = w->vertices + (nVertices * vSize);
- i = w->indices + nIndices;
-
- // For each clip passed to this function
- for (; nClip--; pClip++) {
- x1 = pClip->x1;
- y1 = pClip->y1;
- x2 = pClip->x2;
- y2 = pClip->y2;
-
- // printf(" x1: %d, y1: %d, x2: %d, y2: %d\n", x1, y1, x2, y2);
-
- gridW = (float) width / (model->gridWidth - 1);
-
- if (aw->curWindowEvent == WindowEventShade ||
- aw->curWindowEvent == WindowEventUnshade) {
- if (y1 < w->attrib.y) // if at top part
- {
- gridH = model->topHeight;
- } else if (y2 > w->attrib.y + w->height) // if at bottom
- {
- gridH = model->bottomHeight;
- } else // in window contents (only in Y coords)
- {
- float winContentsHeight =
- height - model->topHeight -
- model->bottomHeight;
- gridH =
- winContentsHeight /
- (model->gridHeight - 3);
- }
- } else
- gridH =
- (float) height / (model->gridHeight -
- 1);
-
- // nVertX, nVertY: number of vertices for this clip in x and y dimensions
- // + 2 to avoid running short of vertices in some cases
- nVertX = ceil((x2 - x1) / gridW) + 2;
- nVertY = ( gridH ? ceil((y2 - y1) / gridH) : 0 ) + 2;
-
- // Allocate 4 indices for each quad
- int newIndexSize =
- nIndices + ((nVertX - 1) * (nVertY - 1) * 4);
- if (newIndexSize > w->indexSize) {
- if (!moreWindowIndices(w, newIndexSize))
- return;
-
- i = w->indices + nIndices;
- }
- // Assign quad vertices to indices
- int jx, jy;
- for (jy = 0; jy < nVertY - 1; jy++) {
- for (jx = 0; jx < nVertX - 1; jx++) {
- *i++ =
- nVertices + nVertX * (2 * jy +
- 1) + jx;
- *i++ =
- nVertices + nVertX * (2 * jy +
- 1) + jx +
- 1;
- *i++ =
- nVertices + nVertX * 2 * jy +
- jx + 1;
- *i++ =
- nVertices + nVertX * 2 * jy +
- jx;
-
- nIndices += 4;
- }
- }
-
- // Allocate vertices
- int newVertexSize =
- (nVertices +
- nVertX * (2 * nVertY - 2)) * vSize;
- if (newVertexSize > w->vertexSize) {
- if (!moreWindowVertices(w, newVertexSize))
- return;
-
- v = w->vertices + (nVertices * vSize);
- }
-
- float rowTexCoordQ = 1;
- float prevRowCellWidth = 0; // this initial value won't be used
- float rowCellWidth = 0;
-
- // For each vertex
- for (jy = 0, y = y1; jy < nVertY; jy++) {
- if (y > y2)
- y = y2;
-
- // Do calculations for y here to avoid repeating
- // them unnecessarily in the x loop
-
- float topiyFloat;
- Bool applyOffsets = TRUE;
- if (aw->curWindowEvent == WindowEventShade
- || aw->curWindowEvent ==
- WindowEventUnshade) {
- if (y1 < w->attrib.y) // if at top part
- {
- topiyFloat =
- (y -
- WIN_Y(w)) /
- model->topHeight;
- topiyFloat = MIN(topiyFloat, 0.999); // avoid 1.0
- applyOffsets = FALSE;
- } else if (y2 > w->attrib.y + w->height) // if at bottom
- {
- topiyFloat = (model->gridHeight - 2) +
- ( model->bottomHeight ? (y - winContentsY - winContentsHeight)
- / model->bottomHeight : 0);
- applyOffsets = FALSE;
- } else // in window contents (only in Y coords)
- {
- topiyFloat =
- (model->gridHeight -
- 3) * (y -
- winContentsY) /
- winContentsHeight + 1;
- }
- } else {
- topiyFloat =
- (model->gridHeight - 1) * (y -
- wy)
- / height;
- }
- // topiy should be at most (model->gridHeight - 2)
- int topiy = (int) (topiyFloat + 1e-4);
-
- if (topiy == model->gridHeight - 1)
- topiy--;
- int bottomiy = topiy + 1;
- float iny = topiyFloat - topiy;
-
- // End of calculations for y
-
- for (jx = 0, x = x1; jx < nVertX; jx++) {
- if (x > x2)
- x = x2;
-
- // find containing grid cell (leftix rightix) x (topiy bottomiy)
- float leftixFloat =
- (model->gridWidth - 1) * (x -
- wx) /
- width;
- int leftix =
- (int) (leftixFloat + 1e-4);
-
- if (leftix == model->gridWidth - 1)
- leftix--;
- int rightix = leftix + 1;
-
- // Objects that are at top, bottom, left, right corners of quad
- Object *objToTopLeft =
- &(model->
- objects[topiy *
- model->gridWidth +
- leftix]);
- Object *objToTopRight =
- &(model->
- objects[topiy *
- model->gridWidth +
- rightix]);
- Object *objToBottomLeft =
- &(model->
- objects[bottomiy *
- model->gridWidth +
- leftix]);
- Object *objToBottomRight =
- &(model->
- objects[bottomiy *
- model->gridWidth +
- rightix]);
-
- // find position in cell by taking remainder of flooring
- float inx = leftixFloat - leftix;
-
- // Interpolate to find deformed coordinates
-
- float hor1x =
- (1 -
- inx) *
- objToTopLeft->position.x +
- inx *
- objToTopRight->position.x;
- float hor1y =
- (1 -
- inx) *
- objToTopLeft->position.y +
- inx *
- objToTopRight->position.y;
- float hor2x =
- (1 -
- inx) *
- objToBottomLeft->position.x +
- inx *
- objToBottomRight->position.x;
- float hor2y =
- (1 -
- inx) *
- objToBottomLeft->position.y +
- inx *
- objToBottomRight->position.y;
-
- deformedX =
- (1 - iny) * hor1x +
- iny * hor2x;
- deformedY =
- (1 - iny) * hor1y +
- iny * hor2y;
-
- if (useTextureQ) {
- if (jx == 1)
- rowCellWidth =
- deformedX -
- v[-2];
-
- if (jy > 0 && jx == 1) // do only once per row for all rows except row 0
- {
- rowTexCoordQ =
- (rowCellWidth /
- prevRowCellWidth);
-
- v[-3] = rowTexCoordQ; // update first column
- v[-6] *= rowTexCoordQ; // (since we didn't know rowTexCoordQ before)
- v[-5] *=
- rowTexCoordQ;
- }
- }
- if (rect) {
- for (it = 0; it < nMatrix;
- it++) {
- float offsetY = 0;
- if (applyOffsets
- && y < y2)
- offsetY =
- objToTopLeft->
- offsetTexCoordForQuadAfter.
- y;
-
- *v++ =
- COMP_TEX_COORD_X
- (&matrix[it],
- x);
- *v++ =
- COMP_TEX_COORD_Y
- (&matrix[it],
- y + offsetY);
- *v++ = 0;
- if (useTextureQ) {
- *v++ = rowTexCoordQ; // Q texture coordinate
-
- if (0 < jy
- && jy <
- nVertY
- - 1) {
- // copy first 3 texture coords to duplicate row
- memcpy
- (v
- -
- 4
- +
- nVertX
- *
- vSize,
- v
- -
- 4,
- 3
- *
- sizeof
- (GLfloat));
- *(v - 1 + nVertX * vSize) = 1; // Q texture coordinate
- }
- if (applyOffsets && /*0 < jy && */
- objToTopLeft->
- offsetTexCoordForQuadBefore.
- y !=
- 0) {
- // After copying to next row, update texture y coord
- // by following object's offset
- offsetY
- =
- objToTopLeft->
- offsetTexCoordForQuadBefore.
- y;
- v[-3] = COMP_TEX_COORD_Y(&matrix[it], y + offsetY);
- }
- if (jx > 0) // since column 0 is updated when jx == 1
- {
- v[-4] *= rowTexCoordQ;
- v[-3] *= rowTexCoordQ;
- }
- } else {
- *v++ = 1;
-
- if (0 < jy
- && jy <
- nVertY
- - 1) {
- // copy first 3 texture coords to duplicate row
- memcpy
- (v
- -
- 4
- +
- nVertX
- *
- vSize,
- v
- -
- 4,
- 3
- *
- sizeof
- (GLfloat));
-
- *(v - 1 + nVertX * vSize) = 1; // Q texture coordinate
- }
- if (applyOffsets && objToTopLeft->offsetTexCoordForQuadBefore.y != 0) {
- // After copying to next row, update texture y coord
- // by following object's offset
- offsetY
- =
- objToTopLeft->
- offsetTexCoordForQuadBefore.
- y;
- v[-3] = COMP_TEX_COORD_Y(&matrix[it], y + offsetY);
- }
- }
- }
- } else {
- for (it = 0; it < nMatrix;
- it++) {
- float offsetY = 0;
- if (applyOffsets
- && y < y2)
- offsetY =
- objToTopLeft->
- offsetTexCoordForQuadAfter.
- y;
-
- *v++ =
- COMP_TEX_COORD_XY
- (&matrix[it],
- x,
- y + offsetY);
- *v++ =
- COMP_TEX_COORD_YX
- (&matrix[it],
- x,
- y + offsetY);
- *v++ = 0;
- if (useTextureQ) {
- *v++ = rowTexCoordQ; // Q texture coordinate
-
- if (0 < jy
- && jy <
- nVertY
- - 1) {
- // copy first 3 texture coords to duplicate row
- memcpy
- (v
- -
- 4
- +
- nVertX
- *
- vSize,
- v
- -
- 4,
- 3
- *
- sizeof
- (GLfloat));
- *(v - 1 + nVertX * vSize) = 1; // Q texture coordinate
- }
- if (applyOffsets && objToTopLeft->offsetTexCoordForQuadBefore.y != 0) {
- // After copying to next row, update texture y coord
- // by following object's offset
- offsetY
- =
- objToTopLeft->
- offsetTexCoordForQuadBefore.
- y;
- v[-4] = COMP_TEX_COORD_XY(&matrix[it], x, y + offsetY);
- v[-3] = COMP_TEX_COORD_YX(&matrix[it], x, y + offsetY);
- }
- if (jx > 0) // column t should be updated when jx is t+1
- {
- v[-4] *= rowTexCoordQ;
- v[-3] *= rowTexCoordQ;
- }
- } else {
- *v++ = 1;
-
- if (0 < jy
- && jy <
- nVertY
- - 1) {
- // copy first 3 texture coords to duplicate row
- memcpy
- (v
- -
- 4
- +
- nVertX
- *
- vSize,
- v
- -
- 4,
- 3
- *
- sizeof
- (GLfloat));
- *(v - 1 + nVertX * vSize) = 1; // Q texture coordinate
- }
- if (applyOffsets && objToTopLeft->offsetTexCoordForQuadBefore.y != 0) {
- // After copying to next row, update texture y coord
- // by following object's offset
- offsetY
- =
- objToTopLeft->
- offsetTexCoordForQuadBefore.
- y;
- v[-4] = COMP_TEX_COORD_XY(&matrix[it], x, y + offsetY);
- v[-3] = COMP_TEX_COORD_YX(&matrix[it], x, y + offsetY);
- }
- }
- }
- }
- *v++ = deformedX;
- *v++ = deformedY;
-
- if (0 < jy && jy < nVertY - 1)
- memcpy(v - 2 +
- nVertX * vSize,
- v - 2,
- 2 *
- sizeof(GLfloat));
-
- nVertices++;
-
- // increment x properly (so that coordinates fall on grid intersections)
- x = rightix * gridW + wx;
- }
- if (useTextureQ)
- prevRowCellWidth = rowCellWidth;
-
- if (0 < jy && jy < nVertY - 1) {
- v += nVertX * vSize; // skip the duplicate row
- nVertices += nVertX;
- }
- // increment y properly (so that coordinates fall on grid intersections)
- if (aw->curWindowEvent == WindowEventShade
- || aw->curWindowEvent ==
- WindowEventUnshade) {
- y += gridH;
- } else {
- y = bottomiy * gridH + wy;
- }
- }
- }
- w->vCount = nVertices;
- w->indexCount = nIndices;
- if (awRegion) {
- XDestroyRegion(awRegion);
- awRegion = NULL;
- }
- } else {
- UNWRAP(as, w->screen, addWindowGeometry);
- (*w->screen->addWindowGeometry) (w, matrix, nMatrix,
- region, clip);
- WRAP(as, w->screen, addWindowGeometry,
- animAddWindowGeometry);
- }
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (w->screen);
+
+ // if model is lost during animation (e.g. when plugin just reloaded)
+ if (aw->animRemainingTime > 0 && !aw->model)
+ {
+ aw->animRemainingTime = 0;
+ postAnimationCleanup (w, TRUE);
+ }
+ // if window is being animated
+ if (aw->animRemainingTime > 0 && aw->model)
+ {
+ BoxPtr pClip;
+ int nClip;
+ int nVertices, nIndices;
+ GLushort *i;
+ GLfloat *v;
+ int x1, y1, x2, y2;
+ float width, height;
+ float winContentsY, winContentsHeight;
+ float deformedX, deformedY;
+ int nVertX, nVertY, wx, wy;
+ int vSize, it;
+ float gridW, gridH, x, y;
+ Bool rect = TRUE;
+ Bool useTextureQ = FALSE;
+ Model *model = aw->model;
+ Region awRegion = NULL;
+
+ // Use Q texture coordinate to avoid jagged-looking quads
+ // http://www.r3.nu/~cass/qcoord/
+ if (aw->curAnimEffect != AnimEffectZoom &&
+ aw->curAnimEffect != AnimEffectSidekick)
+ useTextureQ = TRUE;
+
+ if (aw->useDrawRegion)
+ {
+ awRegion = XCreateRegion ();
+ XOffsetRegion (aw->drawRegion, WIN_X (w), WIN_Y (w));
+ XIntersectRegion (region, aw->drawRegion, awRegion);
+ XOffsetRegion (aw->drawRegion, -WIN_X (w), -WIN_Y (w));
+ nClip = awRegion->numRects;
+ pClip = awRegion->rects;
+ }
+ else
+ {
+ nClip = region->numRects;
+ pClip = region->rects;
+ }
+
+ if (nClip == 0) // nothing to do
+ {
+ if (awRegion)
+ XDestroyRegion (awRegion);
+ return;
+ }
+
+ for (it = 0; it < nMatrix; it++)
+ {
+ if (matrix[it].xy != 0.0f || matrix[it].yx != 0.0f)
+ {
+ rect = FALSE;
+ break;
+ }
+ }
+
+ // window coordinates and size
+ wx = WIN_X (w);
+ wy = WIN_Y (w);
+ width = WIN_W (w);
+ height = WIN_H (w);
+
+ // to be used if event is shade/unshade
+ winContentsY = w->attrib.y;
+ winContentsHeight = w->height;
+
+ w->texUnits = nMatrix;
+
+ if (w->vCount == 0)
+ {
+ // reset
+ w->indexCount = 0;
+ w->texCoordSize = 4;
+ }
+ vSize = 2 + w->texUnits * w->texCoordSize;
+
+ nVertices = w->vCount;
+ nIndices = w->indexCount;
+
+ v = w->vertices + (nVertices * vSize);
+ i = w->indices + nIndices;
+
+ // For each clip passed to this function
+ for (; nClip--; pClip++)
+ {
+ x1 = pClip->x1;
+ y1 = pClip->y1;
+ x2 = pClip->x2;
+ y2 = pClip->y2;
+
+ // printf(" x1: %d, y1: %d, x2: %d, y2: %d\n", x1, y1, x2, y2);
+
+ gridW = (float)width / (model->gridWidth - 1);
+
+ if (aw->curWindowEvent == WindowEventShade ||
+ aw->curWindowEvent == WindowEventUnshade)
+ {
+ if (y1 < w->attrib.y) // if at top part
+ {
+ gridH = model->topHeight;
+ }
+ else if (y2 > w->attrib.y + w->height) // if at bottom
+ {
+ gridH = model->bottomHeight;
+ }
+ else // in window contents (only in Y coords)
+ {
+ float winContentsHeight =
+ height - model->topHeight - model->bottomHeight;
+ gridH = winContentsHeight / (model->gridHeight - 3);
+ }
+ }
+ else
+ gridH = (float)height / (model->gridHeight - 1);
+
+ // nVertX, nVertY: number of vertices for this clip in x and y dimensions
+ // + 2 to avoid running short of vertices in some cases
+ nVertX = ceil ((x2 - x1) / gridW) + 2;
+ nVertY = (gridH ? ceil ((y2 - y1) / gridH) : 0) + 2;
+
+ // Allocate 4 indices for each quad
+ int newIndexSize = nIndices + ((nVertX - 1) * (nVertY - 1) * 4);
+ if (newIndexSize > w->indexSize)
+ {
+ if (!moreWindowIndices (w, newIndexSize))
+ return;
+
+ i = w->indices + nIndices;
+ }
+ // Assign quad vertices to indices
+ int jx, jy;
+ for (jy = 0; jy < nVertY - 1; jy++)
+ {
+ for (jx = 0; jx < nVertX - 1; jx++)
+ {
+ *i++ = nVertices + nVertX * (2 * jy + 1) + jx;
+ *i++ = nVertices + nVertX * (2 * jy + 1) + jx + 1;
+ *i++ = nVertices + nVertX * 2 * jy + jx + 1;
+ *i++ = nVertices + nVertX * 2 * jy + jx;
+
+ nIndices += 4;
+ }
+ }
+
+ // Allocate vertices
+ int newVertexSize =
+ (nVertices + nVertX * (2 * nVertY - 2)) * vSize;
+ if (newVertexSize > w->vertexSize)
+ {
+ if (!moreWindowVertices (w, newVertexSize))
+ return;
+
+ v = w->vertices + (nVertices * vSize);
+ }
+
+ float rowTexCoordQ = 1;
+ float prevRowCellWidth = 0; // this initial value won't be used
+ float rowCellWidth = 0;
+
+ // For each vertex
+ for (jy = 0, y = y1; jy < nVertY; jy++)
+ {
+ if (y > y2)
+ y = y2;
+
+ // Do calculations for y here to avoid repeating
+ // them unnecessarily in the x loop
+
+ float topiyFloat;
+ Bool applyOffsets = TRUE;
+ if (aw->curWindowEvent == WindowEventShade
+ || aw->curWindowEvent == WindowEventUnshade)
+ {
+ if (y1 < w->attrib.y) // if at top part
+ {
+ topiyFloat = (y - WIN_Y (w)) / model->topHeight;
+ topiyFloat = MIN (topiyFloat, 0.999); // avoid 1.0
+ applyOffsets = FALSE;
+ }
+ else if (y2 > w->attrib.y + w->height) // if at bottom
+ {
+ topiyFloat = (model->gridHeight - 2) +
+ (model->
+ bottomHeight ? (y - winContentsY -
+ winContentsHeight) /
+ model->bottomHeight : 0);
+ applyOffsets = FALSE;
+ }
+ else // in window contents (only in Y coords)
+ {
+ topiyFloat =
+ (model->gridHeight -
+ 3) * (y - winContentsY) / winContentsHeight + 1;
+ }
+ }
+ else
+ {
+ topiyFloat = (model->gridHeight - 1) * (y - wy) / height;
+ }
+ // topiy should be at most (model->gridHeight - 2)
+ int topiy = (int)(topiyFloat + 1e-4);
+
+ if (topiy == model->gridHeight - 1)
+ topiy--;
+ int bottomiy = topiy + 1;
+ float iny = topiyFloat - topiy;
+
+ // End of calculations for y
+
+ for (jx = 0, x = x1; jx < nVertX; jx++)
+ {
+ if (x > x2)
+ x = x2;
+
+ // find containing grid cell (leftix rightix) x (topiy bottomiy)
+ float leftixFloat =
+ (model->gridWidth - 1) * (x - wx) / width;
+ int leftix = (int)(leftixFloat + 1e-4);
+
+ if (leftix == model->gridWidth - 1)
+ leftix--;
+ int rightix = leftix + 1;
+
+ // Objects that are at top, bottom, left, right corners of quad
+ Object *objToTopLeft =
+ &(model->objects[topiy * model->gridWidth + leftix]);
+ Object *objToTopRight =
+ &(model->objects[topiy * model->gridWidth + rightix]);
+ Object *objToBottomLeft =
+ &(model->
+ objects[bottomiy * model->gridWidth + leftix]);
+ Object *objToBottomRight =
+ &(model->
+ objects[bottomiy * model->gridWidth + rightix]);
+
+ // find position in cell by taking remainder of flooring
+ float inx = leftixFloat - leftix;
+
+ // Interpolate to find deformed coordinates
+
+ float hor1x =
+ (1 -
+ inx) *
+ objToTopLeft->position.x +
+ inx * objToTopRight->position.x;
+ float hor1y =
+ (1 -
+ inx) *
+ objToTopLeft->position.y +
+ inx * objToTopRight->position.y;
+ float hor2x =
+ (1 -
+ inx) *
+ objToBottomLeft->position.x +
+ inx * objToBottomRight->position.x;
+ float hor2y =
+ (1 -
+ inx) *
+ objToBottomLeft->position.y +
+ inx * objToBottomRight->position.y;
+
+ deformedX = (1 - iny) * hor1x + iny * hor2x;
+ deformedY = (1 - iny) * hor1y + iny * hor2y;
+
+ if (useTextureQ)
+ {
+ if (jx == 1)
+ rowCellWidth = deformedX - v[-2];
+
+ if (jy > 0 && jx == 1) // do only once per row for all rows except row 0
+ {
+ rowTexCoordQ = (rowCellWidth / prevRowCellWidth);
+
+ v[-3] = rowTexCoordQ; // update first column
+ v[-6] *= rowTexCoordQ; // (since we didn't know rowTexCoordQ before)
+ v[-5] *= rowTexCoordQ;
+ }
+ }
+ if (rect)
+ {
+ for (it = 0; it < nMatrix; it++)
+ {
+ float offsetY = 0;
+ if (applyOffsets && y < y2)
+ offsetY =
+ objToTopLeft->
+ offsetTexCoordForQuadAfter.y;
+
+ *v++ = COMP_TEX_COORD_X (&matrix[it], x);
+ *v++ =
+ COMP_TEX_COORD_Y (&matrix[it], y + offsetY);
+ *v++ = 0;
+ if (useTextureQ)
+ {
+ *v++ = rowTexCoordQ; // Q texture coordinate
+
+ if (0 < jy && jy < nVertY - 1)
+ {
+ // copy first 3 texture coords to duplicate row
+ memcpy
+ (v
+ -
+ 4
+ +
+ nVertX
+ *
+ vSize, v - 4, 3 * sizeof (GLfloat));
+ *(v - 1 + nVertX * vSize) = 1; // Q texture coordinate
+ }
+ if (applyOffsets && /*0 < jy && */
+ objToTopLeft->
+ offsetTexCoordForQuadBefore.y != 0)
+ {
+ // After copying to next row, update texture y coord
+ // by following object's offset
+ offsetY
+ =
+ objToTopLeft->
+ offsetTexCoordForQuadBefore.y;
+ v[-3] =
+ COMP_TEX_COORD_Y (&matrix[it],
+ y + offsetY);
+ }
+ if (jx > 0) // since column 0 is updated when jx == 1
+ {
+ v[-4] *= rowTexCoordQ;
+ v[-3] *= rowTexCoordQ;
+ }
+ }
+ else
+ {
+ *v++ = 1;
+
+ if (0 < jy && jy < nVertY - 1)
+ {
+ // copy first 3 texture coords to duplicate row
+ memcpy
+ (v
+ -
+ 4
+ +
+ nVertX
+ *
+ vSize, v - 4, 3 * sizeof (GLfloat));
+
+ *(v - 1 + nVertX * vSize) = 1; // Q texture coordinate
+ }
+ if (applyOffsets
+ && objToTopLeft->
+ offsetTexCoordForQuadBefore.y != 0)
+ {
+ // After copying to next row, update texture y coord
+ // by following object's offset
+ offsetY
+ =
+ objToTopLeft->
+ offsetTexCoordForQuadBefore.y;
+ v[-3] =
+ COMP_TEX_COORD_Y (&matrix[it],
+ y + offsetY);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (it = 0; it < nMatrix; it++)
+ {
+ float offsetY = 0;
+ if (applyOffsets && y < y2)
+ offsetY =
+ objToTopLeft->
+ offsetTexCoordForQuadAfter.y;
+
+ *v++ =
+ COMP_TEX_COORD_XY
+ (&matrix[it], x, y + offsetY);
+ *v++ =
+ COMP_TEX_COORD_YX
+ (&matrix[it], x, y + offsetY);
+ *v++ = 0;
+ if (useTextureQ)
+ {
+ *v++ = rowTexCoordQ; // Q texture coordinate
+
+ if (0 < jy && jy < nVertY - 1)
+ {
+ // copy first 3 texture coords to duplicate row
+ memcpy
+ (v
+ -
+ 4
+ +
+ nVertX
+ *
+ vSize, v - 4, 3 * sizeof (GLfloat));
+ *(v - 1 + nVertX * vSize) = 1; // Q texture coordinate
+ }
+ if (applyOffsets
+ && objToTopLeft->
+ offsetTexCoordForQuadBefore.y != 0)
+ {
+ // After copying to next row, update texture y coord
+ // by following object's offset
+ offsetY
+ =
+ objToTopLeft->
+ offsetTexCoordForQuadBefore.y;
+ v[-4] =
+ COMP_TEX_COORD_XY (&matrix[it], x,
+ y + offsetY);
+ v[-3] =
+ COMP_TEX_COORD_YX (&matrix[it], x,
+ y + offsetY);
+ }
+ if (jx > 0) // column t should be updated when jx is t+1
+ {
+ v[-4] *= rowTexCoordQ;
+ v[-3] *= rowTexCoordQ;
+ }
+ }
+ else
+ {
+ *v++ = 1;
+
+ if (0 < jy && jy < nVertY - 1)
+ {
+ // copy first 3 texture coords to duplicate row
+ memcpy
+ (v
+ -
+ 4
+ +
+ nVertX
+ *
+ vSize, v - 4, 3 * sizeof (GLfloat));
+ *(v - 1 + nVertX * vSize) = 1; // Q texture coordinate
+ }
+ if (applyOffsets
+ && objToTopLeft->
+ offsetTexCoordForQuadBefore.y != 0)
+ {
+ // After copying to next row, update texture y coord
+ // by following object's offset
+ offsetY
+ =
+ objToTopLeft->
+ offsetTexCoordForQuadBefore.y;
+ v[-4] =
+ COMP_TEX_COORD_XY (&matrix[it], x,
+ y + offsetY);
+ v[-3] =
+ COMP_TEX_COORD_YX (&matrix[it], x,
+ y + offsetY);
+ }
+ }
+ }
+ }
+ *v++ = deformedX;
+ *v++ = deformedY;
+
+ if (0 < jy && jy < nVertY - 1)
+ memcpy (v - 2 +
+ nVertX * vSize, v - 2, 2 * sizeof (GLfloat));
+
+ nVertices++;
+
+ // increment x properly (so that coordinates fall on grid intersections)
+ x = rightix * gridW + wx;
+ }
+ if (useTextureQ)
+ prevRowCellWidth = rowCellWidth;
+
+ if (0 < jy && jy < nVertY - 1)
+ {
+ v += nVertX * vSize; // skip the duplicate row
+ nVertices += nVertX;
+ }
+ // increment y properly (so that coordinates fall on grid intersections)
+ if (aw->curWindowEvent == WindowEventShade
+ || aw->curWindowEvent == WindowEventUnshade)
+ {
+ y += gridH;
+ }
+ else
+ {
+ y = bottomiy * gridH + wy;
+ }
+ }
+ }
+ w->vCount = nVertices;
+ w->indexCount = nIndices;
+ if (awRegion)
+ {
+ XDestroyRegion (awRegion);
+ awRegion = NULL;
+ }
+ }
+ else
+ {
+ UNWRAP (as, w->screen, addWindowGeometry);
+ (*w->screen->addWindowGeometry) (w, matrix, nMatrix, region, clip);
+ WRAP (as, w->screen, addWindowGeometry, animAddWindowGeometry);
+ }
}
-static void animDrawWindowGeometry(CompWindow * w)
+static void
+animDrawWindowGeometry (CompWindow * w)
{
- ANIM_WINDOW(w);
-
- if (aw->animRemainingTime > 0) {
- int texUnit = w->texUnits;
- int currentTexUnit = 0;
- int stride = 2 + texUnit * w->texCoordSize;
- GLfloat *vertices = w->vertices + (stride - 2);
-
- stride *= sizeof(GLfloat);
-
- //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
-
- glVertexPointer(2, GL_FLOAT, stride, vertices);
-
- while (texUnit--) {
- if (texUnit != currentTexUnit) {
- w->screen->
- clientActiveTexture(GL_TEXTURE0_ARB +
- texUnit);
- glEnableClientState
- (GL_TEXTURE_COORD_ARRAY);
- currentTexUnit = texUnit;
- }
- vertices -= w->texCoordSize;
- glTexCoordPointer(w->texCoordSize, GL_FLOAT,
- stride, vertices);
- }
-
- glDrawElements(GL_QUADS, w->indexCount, GL_UNSIGNED_SHORT,
- w->indices);
-
- // disable all texture coordinate arrays except 0
- texUnit = w->texUnits;
- if (texUnit > 1) {
- while (--texUnit) {
- (*w->screen->
- clientActiveTexture) (GL_TEXTURE0_ARB +
- texUnit);
- glDisableClientState
- (GL_TEXTURE_COORD_ARRAY);
- }
-
- (*w->screen->
- clientActiveTexture) (GL_TEXTURE0_ARB);
- }
- } else {
- ANIM_SCREEN(w->screen);
-
- UNWRAP(as, w->screen, drawWindowGeometry);
- (*w->screen->drawWindowGeometry) (w);
- WRAP(as, w->screen, drawWindowGeometry,
- animDrawWindowGeometry);
- }
+ ANIM_WINDOW (w);
+
+ if (aw->animRemainingTime > 0)
+ {
+ int texUnit = w->texUnits;
+ int currentTexUnit = 0;
+ int stride = 2 + texUnit * w->texCoordSize;
+ GLfloat *vertices = w->vertices + (stride - 2);
+
+ stride *= sizeof (GLfloat);
+
+ //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
+
+ glVertexPointer (2, GL_FLOAT, stride, vertices);
+
+ while (texUnit--)
+ {
+ if (texUnit != currentTexUnit)
+ {
+ w->screen->clientActiveTexture (GL_TEXTURE0_ARB + texUnit);
+ glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+ currentTexUnit = texUnit;
+ }
+ vertices -= w->texCoordSize;
+ glTexCoordPointer (w->texCoordSize, GL_FLOAT, stride, vertices);
+ }
+
+ glDrawElements (GL_QUADS, w->indexCount, GL_UNSIGNED_SHORT,
+ w->indices);
+
+ // disable all texture coordinate arrays except 0
+ texUnit = w->texUnits;
+ if (texUnit > 1)
+ {
+ while (--texUnit)
+ {
+ (*w->screen->clientActiveTexture) (GL_TEXTURE0_ARB + texUnit);
+ glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+ }
+
+ (*w->screen->clientActiveTexture) (GL_TEXTURE0_ARB);
+ }
+ }
+ else
+ {
+ ANIM_SCREEN (w->screen);
+
+ UNWRAP (as, w->screen, drawWindowGeometry);
+ (*w->screen->drawWindowGeometry) (w);
+ WRAP (as, w->screen, drawWindowGeometry, animDrawWindowGeometry);
+ }
}
static Bool
-animPaintWindow(CompWindow * w,
- const WindowPaintAttrib * attrib,
- Region region, unsigned int mask)
+animPaintWindow (CompWindow * w,
+ const WindowPaintAttrib * attrib,
+ Region region, unsigned int mask)
{
- Bool status;
-
- ANIM_SCREEN(w->screen);
- ANIM_WINDOW(w);
-
- if (aw->animRemainingTime > 0) {
- w->indexCount = 0;
-
- WindowPaintAttrib wAttrib = *attrib;
-
- if (mask & PAINT_WINDOW_SOLID_MASK)
- return FALSE;
-
- mask |= PAINT_WINDOW_TRANSFORMED_MASK;
-
- wAttrib.xScale = 1.0f;
- wAttrib.yScale = 1.0f;
-
- if (animEffectProperties[aw->curAnimEffect].
- updateWindowAttribFunc)
- animEffectProperties[aw->curAnimEffect].
- updateWindowAttribFunc(as, aw, &wAttrib);
-
- UNWRAP(as, w->screen, paintWindow);
- status =
- (*w->screen->paintWindow) (w, &wAttrib, region, mask);
- WRAP(as, w->screen, paintWindow, animPaintWindow);
-
- if (aw->numPs) {
- int i = 0;
- for (i = 0; i < aw->numPs; i++) {
- if (aw->ps[i].active
- && !WINDOW_INVISIBLE(w)) {
- drawParticles(w->screen, w,
- &aw->ps[i]);
- }
- }
- }
- } else {
- UNWRAP(as, w->screen, paintWindow);
- status =
- (*w->screen->paintWindow) (w, attrib, region, mask);
- WRAP(as, w->screen, paintWindow, animPaintWindow);
- }
-
- return status;
+ Bool status;
+
+ ANIM_SCREEN (w->screen);
+ ANIM_WINDOW (w);
+
+ if (aw->animRemainingTime > 0)
+ {
+ w->indexCount = 0;
+
+ WindowPaintAttrib wAttrib = *attrib;
+
+ if (mask & PAINT_WINDOW_SOLID_MASK)
+ return FALSE;
+
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+
+ wAttrib.xScale = 1.0f;
+ wAttrib.yScale = 1.0f;
+
+ if (animEffectProperties[aw->curAnimEffect].updateWindowAttribFunc)
+ animEffectProperties[aw->curAnimEffect].
+ updateWindowAttribFunc (as, aw, &wAttrib);
+
+ UNWRAP (as, w->screen, paintWindow);
+ status = (*w->screen->paintWindow) (w, &wAttrib, region, mask);
+ WRAP (as, w->screen, paintWindow, animPaintWindow);
+
+ if (aw->numPs)
+ {
+ int i = 0;
+ for (i = 0; i < aw->numPs; i++)
+ {
+ if (aw->ps[i].active && !WINDOW_INVISIBLE (w))
+ {
+ drawParticles (w->screen, w, &aw->ps[i]);
+ }
+ }
+ }
+ }
+ else
+ {
+ UNWRAP (as, w->screen, paintWindow);
+ status = (*w->screen->paintWindow) (w, attrib, region, mask);
+ WRAP (as, w->screen, paintWindow, animPaintWindow);
+ }
+
+ return status;
}
-static Bool animGetWindowIconGeometry(CompWindow * w, XRectangle * rect)
+static Bool
+animGetWindowIconGeometry (CompWindow * w, XRectangle * rect)
{
- Atom actual;
- int result, format;
- unsigned long n, left;
- unsigned char *data;
+ Atom actual;
+ int result, format;
+ unsigned long n, left;
+ unsigned char *data;
- ANIM_DISPLAY(w->screen->display);
+ ANIM_DISPLAY (w->screen->display);
- result = XGetWindowProperty(w->screen->display->display, w->id,
- ad->winIconGeometryAtom,
- 0L, 4L, FALSE, XA_CARDINAL, &actual,
- &format, &n, &left, &data);
+ result = XGetWindowProperty (w->screen->display->display, w->id,
+ ad->winIconGeometryAtom,
+ 0L, 4L, FALSE, XA_CARDINAL, &actual,
+ &format, &n, &left, &data);
- if (result == Success && n && data) {
- if (n == 4) {
- unsigned long *geometry = (unsigned long *) data;
+ if (result == Success && n && data)
+ {
+ if (n == 4)
+ {
+ unsigned long *geometry = (unsigned long *)data;
- rect->x = geometry[0];
- rect->y = geometry[1];
- rect->width = geometry[2];
- rect->height = geometry[3];
+ rect->x = geometry[0];
+ rect->y = geometry[1];
+ rect->width = geometry[2];
+ rect->height = geometry[3];
- XFree(data);
+ XFree (data);
- return TRUE;
- }
+ return TRUE;
+ }
- XFree(data);
- }
+ XFree (data);
+ }
- return FALSE;
+ return FALSE;
}
-static void animHandleEvent(CompDisplay * d, XEvent * event)
+static void
+animHandleEvent (CompDisplay * d, XEvent * event)
{
- Window activeWindow = 0;
- CompWindow *w;
-
- ANIM_DISPLAY(d);
-
- switch (event->type) {
- case PropertyNotify:
- if (event->xproperty.atom == d->winActiveAtom)
- activeWindow = d->activeWindow;
- break;
- case MapNotify:
- w = findWindowAtDisplay(d, event->xmap.window);
- if (w) {
- ANIM_WINDOW(w);
-
- if (aw->animRemainingTime > 0) {
- aw->state = aw->newState;
- }
- while (aw->unmapCnt) {
- unmapWindow(w);
- aw->unmapCnt--;
- }
- }
- break;
- case DestroyNotify:
- w = findWindowAtDisplay(d, event->xunmap.window);
- if (w) {
- ANIM_WINDOW(w);
- aw->destroyCnt++;
- w->destroyRefCnt++;
- addWindowDamage(w);
- }
- break;
- case UnmapNotify:
- w = findWindowAtDisplay(d, event->xunmap.window);
- if (w) {
- ANIM_SCREEN(w->screen);
-
- if (w->pendingUnmaps && onCurrentDesktop(w)) // Normal -> Iconic
- {
- ANIM_WINDOW(w);
- if (w->shaded) {
- // SHADE event!
-
- //printf("SHADE event! %X\n", (unsigned)aw);
-
- aw->nowShaded = TRUE;
-
- if (as->shadeEffect
- && (as->shadeWMask & w->
- type)) {
- IPCS_SetBool(IPCS_OBJECT
- (w),
- aw->
- animatedAtom,
- TRUE);
- Bool startingNew = TRUE;
- if (aw->curWindowEvent !=
- WindowEventNone) {
- if (aw->
- curWindowEvent
- !=
- WindowEventUnshade)
- postAnimationCleanup
- (w,
- TRUE);
- else {
- // Play the unshade effect backwards from where it left
- aw->animRemainingTime = aw->animTotalTime - aw->animRemainingTime;
-
- // avoid window remains
- if (aw->
- animRemainingTime
- <= 0)
- aw->animRemainingTime = 1;
-
- startingNew
- =
- FALSE;
- if (aw->
- animOverrideProgressDir
- == 0)
- aw->animOverrideProgressDir = 2;
- else if
- (aw->
- animOverrideProgressDir
- == 1)
- aw->animOverrideProgressDir = 0;
- }
- }
-
- as->animInProgress = TRUE;
- aw->curWindowEvent =
- WindowEventShade;
-
- if (startingNew) {
- if (as->
- shadeEffect ==
- AnimEffectRandom
- || as->
- opt
- [ANIM_SCREEN_OPTION_ALL_RANDOM].
- value.b)
- aw->curAnimEffect = // choose a random effect
- shadeEffectType
- [(int)
- ((NUM_SHADE_EFFECT - 2) * (double) rand() / RAND_MAX) + 2];
- else
- aw->curAnimEffect = as->shadeEffect;
-
- aw->animTotalTime =
- as->
- opt
- [ANIM_SCREEN_OPTION_SHADE_DURATION].
- value.f * 1000;
- aw->animRemainingTime = aw->animTotalTime;
- }
- if (!animEnsureModel
- (w, WindowEventShade,
- aw->curAnimEffect)) {
- postAnimationCleanup
- (w, TRUE);
- }
-
- aw->unmapCnt++;
- w->unmapRefCnt++;
-
- addWindowDamage(w);
- }
- } else if (!w->invisible
- && as->minimizeEffect
- && (as->minimizeWMask & w->
- type)) {
- // MINIMIZE event!
-
- //printf("MINIMIZE event! %X\n", (unsigned)aw);
-
- IPCS_SetBool(IPCS_OBJECT(w),
- aw->animatedAtom,
- TRUE);
- Bool startingNew = TRUE;
- if (aw->curWindowEvent !=
- WindowEventNone) {
- if (aw->curWindowEvent !=
- WindowEventUnminimize)
- postAnimationCleanup
- (w, TRUE);
- else {
- // Play the unminimize effect backwards from where it left
- aw->animRemainingTime = aw->animTotalTime - aw->animRemainingTime;
-
- // avoid window remains
- if (aw->
- animRemainingTime
- == 0)
- aw->animRemainingTime = 1;
-
- startingNew =
- FALSE;
- if (aw->
- animOverrideProgressDir
- == 0)
- aw->animOverrideProgressDir = 2;
- else if (aw->
- animOverrideProgressDir
- == 1)
- aw->animOverrideProgressDir = 0;
- }
- }
-
- aw->newState = IconicState;
- as->animInProgress = TRUE;
- aw->curWindowEvent =
- WindowEventMinimize;
-
- if (startingNew) {
- if (as->minimizeEffect ==
- AnimEffectRandom
- || as->
- opt
- [ANIM_SCREEN_OPTION_ALL_RANDOM].
- value.b)
- aw->curAnimEffect = // choose a random effect
- minimizeEffectType
- [(int)
- ((NUM_MINIMIZE_EFFECT - 2) * (double) rand() / RAND_MAX) + 2];
- else
- aw->curAnimEffect =
- as->
- minimizeEffect;
-
- aw->animTotalTime =
- as->
- opt
- [ANIM_SCREEN_OPTION_MINIMIZE_DURATION].
- value.f * 1000;
- aw->animRemainingTime =
- aw->animTotalTime;
- }
- if (!animEnsureModel
- (w, WindowEventMinimize,
- aw->curAnimEffect)) {
- postAnimationCleanup(w,
- TRUE);
- } else {
- if (!animGetWindowIconGeometry(w, &aw->icon)) {
- // minimize to bottom-center if there is no window list
- aw->icon.x =
- w->screen->
- width / 2;
- aw->icon.y =
- w->screen->
- height;
- aw->icon.width =
- 100;
- aw->icon.height =
- 20;
- }
- if ((aw->curAnimEffect ==
- AnimEffectZoom
- || aw->
- curAnimEffect ==
- AnimEffectSidekick)
- &&
- (as->zoomFC == ZoomFromCenterOn ||
- as->zoomFC == ZoomFromCenterMin)
- ) {
- aw->icon.x =
- WIN_X(w) +
- WIN_W(w) / 2 -
- aw->icon.
- width / 2;
- aw->icon.y =
- WIN_Y(w) +
- WIN_H(w) / 2 -
- aw->icon.
- height / 2;
- }
-
- aw->unmapCnt++;
- w->unmapRefCnt++;
-
- addWindowDamage(w);
- }
- }
- } else // X -> Withdrawn
- {
- ANIM_WINDOW(w);
-
- AnimEffect windowsCloseEffect =
- AnimEffectNone;
- int whichClose = 1; // either 1 or 2
-
- if (as->close1Effect
- && (as->close1WMask & w->type))
- windowsCloseEffect =
- as->close1Effect;
- else if (as->close2Effect
- && (as->close2WMask & w->type)) {
- windowsCloseEffect =
- as->close2Effect;
- whichClose = 2;
- }
- // CLOSE event!
-
- if (windowsCloseEffect) {
- IPCS_SetBool(IPCS_OBJECT(w),
- aw->animatedAtom,
- TRUE);
- int tmpSteps = 0;
-
- //printf("CLOSE event! %X\n", (unsigned)aw);
-
- Bool startingNew = TRUE;
-
- if (aw->animRemainingTime > 0 &&
- aw->curWindowEvent !=
- WindowEventCreate) {
- tmpSteps =
- aw->animRemainingTime;
- aw->animRemainingTime = 0;
- }
- if (aw->curWindowEvent !=
- WindowEventNone) {
- if (aw->curWindowEvent ==
- WindowEventCreate) {
- // Play the create effect backward from where it left
- aw->animRemainingTime = aw->animTotalTime - aw->animRemainingTime;
-
- // avoid window remains
- if (aw->
- animRemainingTime
- <= 0)
- aw->animRemainingTime = 1;
-
- startingNew =
- FALSE;
- if (aw->
- animOverrideProgressDir
- == 0)
- aw->animOverrideProgressDir = 2;
- else if (aw->
- animOverrideProgressDir
- == 1)
- aw->animOverrideProgressDir = 0;
- } else if (aw->
- curWindowEvent
- ==
- WindowEventClose)
- {
- if (aw->
- animOverrideProgressDir
- == 2) {
- aw->animRemainingTime = tmpSteps;
- startingNew
- =
- FALSE;
- }
- } else {
- postAnimationCleanup
- (w, TRUE);
- }
- }
-
- aw->state = NormalState;
- aw->newState = WithdrawnState;
- as->animInProgress = TRUE;
- aw->curWindowEvent =
- WindowEventClose;
-
- if (startingNew) {
- if (windowsCloseEffect ==
- AnimEffectRandom
- || as->
- opt
- [ANIM_SCREEN_OPTION_ALL_RANDOM].
- value.b)
- aw->curAnimEffect = // choose a random effect
- closeEffectType
- [(int)
- ((NUM_CLOSE_EFFECT - 2) * (double) rand() / RAND_MAX) + 2];
- else
- aw->curAnimEffect =
- windowsCloseEffect;
-
- aw->animTotalTime =
- as->opt[whichClose ==
- 1 ?
- ANIM_SCREEN_OPTION_CLOSE1_DURATION
- :
- ANIM_SCREEN_OPTION_CLOSE2_DURATION].
- value.f * 1000;
- aw->animRemainingTime =
- aw->animTotalTime;
- }
- if (!animEnsureModel
- (w, WindowEventClose,
- aw->curAnimEffect)) {
- postAnimationCleanup(w,
- TRUE);
- } else
- if (getMousePointerXY
- (w->screen, &aw->icon.x,
- &aw->icon.y)) {
- aw->icon.width =
- FAKE_ICON_SIZE;
- aw->icon.height =
- FAKE_ICON_SIZE;
- aw->icon.x -=
- FAKE_ICON_SIZE / 2;
- aw->icon.y -=
- FAKE_ICON_SIZE / 2;
- if ((aw->curAnimEffect ==
- AnimEffectZoom
- || aw->
- curAnimEffect ==
- AnimEffectSidekick)
- &&
- (as->zoomFC == ZoomFromCenterOn ||
- as->zoomFC == ZoomFromCenterCreate)
- ) {
- aw->icon.x =
- WIN_X(w) +
- WIN_W(w) / 2 -
- aw->icon.
- width / 2;
- aw->icon.y =
- WIN_Y(w) +
- WIN_H(w) / 2 -
- aw->icon.
- height / 2;
- }
-
- aw->unmapCnt++;
- w->unmapRefCnt++;
-
- addWindowDamage(w);
- }
- } else
- if ((as->create1Effect
- && (as->create1WMask & w->type))
- || (as->create2Effect
- && (as->create2WMask & w->
- type))) {
- // stop the current animation and prevent it from rewinding
-
- if (aw->animRemainingTime > 0 &&
- aw->curWindowEvent !=
- WindowEventCreate) {
- aw->animRemainingTime = 0;
- }
- if ((aw->curWindowEvent !=
- WindowEventNone)
- && (aw->curWindowEvent !=
- WindowEventClose)) {
- postAnimationCleanup(w,
- TRUE);
- }
- // set some properties to make sure this window will use the
- // correct create effect the next time it's "created"
-
- aw->state = NormalState;
- aw->newState = WithdrawnState;
- as->animInProgress = TRUE;
- aw->curWindowEvent =
- WindowEventClose;
-
- aw->unmapCnt++;
- w->unmapRefCnt++;
-
- addWindowDamage(w);
- }
- }
- }
- break;
- default:
- break;
- }
-
- UNWRAP(ad, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP(ad, d, handleEvent, animHandleEvent);
-
- switch (event->type) {
- case PropertyNotify:
- if (event->xproperty.atom == d->winActiveAtom) {
- if (d->activeWindow != activeWindow) {
- w = findWindowAtDisplay(d,
- d->activeWindow);
- if (w) {
- ANIM_WINDOW(w);
- ANIM_SCREEN(w->screen);
-
- if (aw->curWindowEvent !=
- WindowEventNone)
- return;
-
- if ((as->focusWMask & w->type)
- && as->focusEffect &&
- // On unminimization, focus event is fired first.
- // When this happens and minimize is in progress,
- // don't prevent rewinding of minimize when unminimize is fired
- // right after this focus event.
- aw->curWindowEvent !=
- WindowEventMinimize
- && animEnsureModel(w,
- WindowEventFocus,
- as->
- focusEffect))
- {
- // FOCUS event!
-
- //printf("FOCUS event! %X\n", (unsigned)aw);
-
- IPCS_SetBool(IPCS_OBJECT
- (w),
- aw->
- animatedAtom,
- TRUE);
- if (aw->curWindowEvent !=
- WindowEventNone) {
- postAnimationCleanup
- (w, TRUE);
- }
-
- as->animInProgress = TRUE;
- aw->curWindowEvent =
- WindowEventFocus;
- aw->curAnimEffect =
- as->focusEffect;
- aw->animTotalTime =
- as->
- opt
- [ANIM_SCREEN_OPTION_FOCUS_DURATION].
- value.f * 1000;
- aw->animRemainingTime =
- aw->animTotalTime;
-
- damageScreen(w->screen);
- }
- }
- }
- }
-
- default:
- break;
- }
+ Window activeWindow = 0;
+ CompWindow *w;
+
+ ANIM_DISPLAY (d);
+
+ switch (event->type)
+ {
+ case PropertyNotify:
+ if (event->xproperty.atom == d->winActiveAtom)
+ activeWindow = d->activeWindow;
+ break;
+ case MapNotify:
+ w = findWindowAtDisplay (d, event->xmap.window);
+ if (w)
+ {
+ ANIM_WINDOW (w);
+
+ if (aw->animRemainingTime > 0)
+ {
+ aw->state = aw->newState;
+ }
+ while (aw->unmapCnt)
+ {
+ unmapWindow (w);
+ aw->unmapCnt--;
+ }
+ }
+ break;
+ case DestroyNotify:
+ w = findWindowAtDisplay (d, event->xunmap.window);
+ if (w)
+ {
+ ANIM_WINDOW (w);
+ aw->destroyCnt++;
+ w->destroyRefCnt++;
+ addWindowDamage (w);
+ }
+ break;
+ case UnmapNotify:
+ w = findWindowAtDisplay (d, event->xunmap.window);
+ if (w)
+ {
+ ANIM_SCREEN (w->screen);
+
+ if (w->pendingUnmaps && onCurrentDesktop (w)) // Normal -> Iconic
+ {
+ ANIM_WINDOW (w);
+ if (w->shaded)
+ {
+ // SHADE event!
+
+ //printf("SHADE event! %X\n", (unsigned)aw);
+
+ aw->nowShaded = TRUE;
+
+ if (as->shadeEffect && (as->shadeWMask & w->type))
+ {
+ IPCS_SetBool (IPCS_OBJECT
+ (w), aw->animatedAtom, TRUE);
+ Bool startingNew = TRUE;
+ if (aw->curWindowEvent != WindowEventNone)
+ {
+ if (aw->curWindowEvent != WindowEventUnshade)
+ postAnimationCleanup (w, TRUE);
+ else
+ {
+ // Play the unshade effect backwards from where it left
+ aw->animRemainingTime =
+ aw->animTotalTime - aw->animRemainingTime;
+
+ // avoid window remains
+ if (aw->animRemainingTime <= 0)
+ aw->animRemainingTime = 1;
+
+ startingNew = FALSE;
+ if (aw->animOverrideProgressDir == 0)
+ aw->animOverrideProgressDir = 2;
+ else if (aw->animOverrideProgressDir == 1)
+ aw->animOverrideProgressDir = 0;
+ }
+ }
+
+ as->animInProgress = TRUE;
+ aw->curWindowEvent = WindowEventShade;
+
+ if (startingNew)
+ {
+ if (as->
+ shadeEffect ==
+ AnimEffectRandom
+ || as->
+ opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
+ aw->curAnimEffect = // choose a random effect
+ shadeEffectType
+ [(int)
+ ((NUM_SHADE_EFFECT -
+ 2) * (double)rand () / RAND_MAX) + 2];
+ else
+ aw->curAnimEffect = as->shadeEffect;
+
+ aw->animTotalTime =
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_SHADE_DURATION].
+ value.f * 1000;
+ aw->animRemainingTime = aw->animTotalTime;
+ }
+ if (!animEnsureModel
+ (w, WindowEventShade, aw->curAnimEffect))
+ {
+ postAnimationCleanup (w, TRUE);
+ }
+
+ aw->unmapCnt++;
+ w->unmapRefCnt++;
+
+ addWindowDamage (w);
+ }
+ }
+ else if (!w->invisible
+ && as->minimizeEffect
+ && (as->minimizeWMask & w->type))
+ {
+ // MINIMIZE event!
+
+ //printf("MINIMIZE event! %X\n", (unsigned)aw);
+
+ IPCS_SetBool (IPCS_OBJECT (w), aw->animatedAtom, TRUE);
+ Bool startingNew = TRUE;
+ if (aw->curWindowEvent != WindowEventNone)
+ {
+ if (aw->curWindowEvent != WindowEventUnminimize)
+ postAnimationCleanup (w, TRUE);
+ else
+ {
+ // Play the unminimize effect backwards from where it left
+ aw->animRemainingTime =
+ aw->animTotalTime - aw->animRemainingTime;
+
+ // avoid window remains
+ if (aw->animRemainingTime == 0)
+ aw->animRemainingTime = 1;
+
+ startingNew = FALSE;
+ if (aw->animOverrideProgressDir == 0)
+ aw->animOverrideProgressDir = 2;
+ else if (aw->animOverrideProgressDir == 1)
+ aw->animOverrideProgressDir = 0;
+ }
+ }
+
+ aw->newState = IconicState;
+ as->animInProgress = TRUE;
+ aw->curWindowEvent = WindowEventMinimize;
+
+ if (startingNew)
+ {
+ if (as->minimizeEffect ==
+ AnimEffectRandom
+ || as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
+ aw->curAnimEffect = // choose a random effect
+ minimizeEffectType
+ [(int)
+ ((NUM_MINIMIZE_EFFECT -
+ 2) * (double)rand () / RAND_MAX) + 2];
+ else
+ aw->curAnimEffect = as->minimizeEffect;
+
+ aw->animTotalTime =
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_MINIMIZE_DURATION].
+ value.f * 1000;
+ aw->animRemainingTime = aw->animTotalTime;
+ }
+ if (!animEnsureModel
+ (w, WindowEventMinimize, aw->curAnimEffect))
+ {
+ postAnimationCleanup (w, TRUE);
+ }
+ else
+ {
+ if (!animGetWindowIconGeometry (w, &aw->icon))
+ {
+ // minimize to bottom-center if there is no window list
+ aw->icon.x = w->screen->width / 2;
+ aw->icon.y = w->screen->height;
+ aw->icon.width = 100;
+ aw->icon.height = 20;
+ }
+ if ((aw->curAnimEffect ==
+ AnimEffectZoom
+ || aw->
+ curAnimEffect ==
+ AnimEffectSidekick)
+ &&
+ (as->zoomFC == ZoomFromCenterOn ||
+ as->zoomFC == ZoomFromCenterMin))
+ {
+ aw->icon.x =
+ WIN_X (w) +
+ WIN_W (w) / 2 - aw->icon.width / 2;
+ aw->icon.y =
+ WIN_Y (w) +
+ WIN_H (w) / 2 - aw->icon.height / 2;
+ }
+
+ aw->unmapCnt++;
+ w->unmapRefCnt++;
+
+ addWindowDamage (w);
+ }
+ }
+ }
+ else // X -> Withdrawn
+ {
+ ANIM_WINDOW (w);
+
+ AnimEffect windowsCloseEffect = AnimEffectNone;
+ int whichClose = 1; // either 1 or 2
+
+ if (as->close1Effect && (as->close1WMask & w->type))
+ windowsCloseEffect = as->close1Effect;
+ else if (as->close2Effect && (as->close2WMask & w->type))
+ {
+ windowsCloseEffect = as->close2Effect;
+ whichClose = 2;
+ }
+ // CLOSE event!
+
+ if (windowsCloseEffect)
+ {
+ IPCS_SetBool (IPCS_OBJECT (w), aw->animatedAtom, TRUE);
+ int tmpSteps = 0;
+
+ //printf("CLOSE event! %X\n", (unsigned)aw);
+
+ Bool startingNew = TRUE;
+
+ if (aw->animRemainingTime > 0 &&
+ aw->curWindowEvent != WindowEventCreate)
+ {
+ tmpSteps = aw->animRemainingTime;
+ aw->animRemainingTime = 0;
+ }
+ if (aw->curWindowEvent != WindowEventNone)
+ {
+ if (aw->curWindowEvent == WindowEventCreate)
+ {
+ // Play the create effect backward from where it left
+ aw->animRemainingTime =
+ aw->animTotalTime - aw->animRemainingTime;
+
+ // avoid window remains
+ if (aw->animRemainingTime <= 0)
+ aw->animRemainingTime = 1;
+
+ startingNew = FALSE;
+ if (aw->animOverrideProgressDir == 0)
+ aw->animOverrideProgressDir = 2;
+ else if (aw->animOverrideProgressDir == 1)
+ aw->animOverrideProgressDir = 0;
+ }
+ else if (aw->curWindowEvent == WindowEventClose)
+ {
+ if (aw->animOverrideProgressDir == 2)
+ {
+ aw->animRemainingTime = tmpSteps;
+ startingNew = FALSE;
+ }
+ }
+ else
+ {
+ postAnimationCleanup (w, TRUE);
+ }
+ }
+
+ aw->state = NormalState;
+ aw->newState = WithdrawnState;
+ as->animInProgress = TRUE;
+ aw->curWindowEvent = WindowEventClose;
+
+ if (startingNew)
+ {
+ if (windowsCloseEffect ==
+ AnimEffectRandom
+ || as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
+ aw->curAnimEffect = // choose a random effect
+ closeEffectType
+ [(int)
+ ((NUM_CLOSE_EFFECT -
+ 2) * (double)rand () / RAND_MAX) + 2];
+ else
+ aw->curAnimEffect = windowsCloseEffect;
+
+ aw->animTotalTime =
+ as->opt[whichClose ==
+ 1 ?
+ ANIM_SCREEN_OPTION_CLOSE1_DURATION
+ :
+ ANIM_SCREEN_OPTION_CLOSE2_DURATION].
+ value.f * 1000;
+ aw->animRemainingTime = aw->animTotalTime;
+ }
+ if (!animEnsureModel
+ (w, WindowEventClose, aw->curAnimEffect))
+ {
+ postAnimationCleanup (w, TRUE);
+ }
+ else if (getMousePointerXY
+ (w->screen, &aw->icon.x, &aw->icon.y))
+ {
+ aw->icon.width = FAKE_ICON_SIZE;
+ aw->icon.height = FAKE_ICON_SIZE;
+ aw->icon.x -= FAKE_ICON_SIZE / 2;
+ aw->icon.y -= FAKE_ICON_SIZE / 2;
+ if ((aw->curAnimEffect ==
+ AnimEffectZoom
+ || aw->
+ curAnimEffect ==
+ AnimEffectSidekick)
+ &&
+ (as->zoomFC == ZoomFromCenterOn ||
+ as->zoomFC == ZoomFromCenterCreate))
+ {
+ aw->icon.x =
+ WIN_X (w) +
+ WIN_W (w) / 2 - aw->icon.width / 2;
+ aw->icon.y =
+ WIN_Y (w) +
+ WIN_H (w) / 2 - aw->icon.height / 2;
+ }
+
+ aw->unmapCnt++;
+ w->unmapRefCnt++;
+
+ addWindowDamage (w);
+ }
+ }
+ else if ((as->create1Effect
+ && (as->create1WMask & w->type))
+ || (as->create2Effect
+ && (as->create2WMask & w->type)))
+ {
+ // stop the current animation and prevent it from rewinding
+
+ if (aw->animRemainingTime > 0 &&
+ aw->curWindowEvent != WindowEventCreate)
+ {
+ aw->animRemainingTime = 0;
+ }
+ if ((aw->curWindowEvent !=
+ WindowEventNone)
+ && (aw->curWindowEvent != WindowEventClose))
+ {
+ postAnimationCleanup (w, TRUE);
+ }
+ // set some properties to make sure this window will use the
+ // correct create effect the next time it's "created"
+
+ aw->state = NormalState;
+ aw->newState = WithdrawnState;
+ as->animInProgress = TRUE;
+ aw->curWindowEvent = WindowEventClose;
+
+ aw->unmapCnt++;
+ w->unmapRefCnt++;
+
+ addWindowDamage (w);
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ UNWRAP (ad, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP (ad, d, handleEvent, animHandleEvent);
+
+ switch (event->type)
+ {
+ case PropertyNotify:
+ if (event->xproperty.atom == d->winActiveAtom)
+ {
+ if (d->activeWindow != activeWindow)
+ {
+ w = findWindowAtDisplay (d, d->activeWindow);
+ if (w)
+ {
+ ANIM_WINDOW (w);
+ ANIM_SCREEN (w->screen);
+
+ if (aw->curWindowEvent != WindowEventNone)
+ return;
+
+ if ((as->focusWMask & w->type) && as->focusEffect &&
+ // On unminimization, focus event is fired first.
+ // When this happens and minimize is in progress,
+ // don't prevent rewinding of minimize when unminimize is fired
+ // right after this focus event.
+ aw->curWindowEvent !=
+ WindowEventMinimize
+ && animEnsureModel (w,
+ WindowEventFocus,
+ as->focusEffect))
+ {
+ // FOCUS event!
+
+ //printf("FOCUS event! %X\n", (unsigned)aw);
+
+ IPCS_SetBool (IPCS_OBJECT
+ (w), aw->animatedAtom, TRUE);
+ if (aw->curWindowEvent != WindowEventNone)
+ {
+ postAnimationCleanup (w, TRUE);
+ }
+
+ as->animInProgress = TRUE;
+ aw->curWindowEvent = WindowEventFocus;
+ aw->curAnimEffect = as->focusEffect;
+ aw->animTotalTime =
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_FOCUS_DURATION].
+ value.f * 1000;
+ aw->animRemainingTime = aw->animTotalTime;
+
+ damageScreen (w->screen);
+ }
+ }
+ }
+ }
+
+ default:
+ break;
+ }
}
-static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
+static Bool
+animDamageWindowRect (CompWindow * w, Bool initial, BoxPtr rect)
{
- Bool status;
-
- ANIM_SCREEN(w->screen);
-
- if (initial) // Unminimize or Create
- {
- ANIM_WINDOW(w);
-
- if (aw->state == IconicState) {
- if (!w->invisible && as->unminimizeEffect
- && (as->unminimizeWMask & w->type)) {
- // UNMINIMIZE event!
-
- //printf("UNMINIMIZE event! %X\n", (unsigned)aw);
-
- IPCS_SetBool(IPCS_OBJECT(w),
- aw->animatedAtom, TRUE);
- Bool startingNew = TRUE;
- if (aw->curWindowEvent != WindowEventNone) {
- if (aw->curWindowEvent !=
- WindowEventMinimize)
- postAnimationCleanup(w,
- TRUE);
- else {
- // Play the minimize effect backwards from where it left
- aw->animRemainingTime =
- aw->animTotalTime -
- aw->animRemainingTime;
-
- // avoid window remains
- if (aw->
- animRemainingTime <= 0)
- aw->animRemainingTime = 1;
-
- startingNew = FALSE;
- if (aw->
- animOverrideProgressDir
- == 0)
- aw->animOverrideProgressDir = 1;
- else if (aw->
- animOverrideProgressDir
- == 2)
- aw->animOverrideProgressDir = 0;
- }
- }
- as->animInProgress = TRUE;
- aw->curWindowEvent = WindowEventUnminimize;
-
- if (startingNew) {
- if (as->unminimizeEffect ==
- AnimEffectRandom
- || as->
- opt
- [ANIM_SCREEN_OPTION_ALL_RANDOM].
- value.b)
- aw->curAnimEffect = // choose a random effect
- minimizeEffectType[(int)
- ((NUM_MINIMIZE_EFFECT - 2) * (double) rand() / RAND_MAX) + 2];
- else
- aw->curAnimEffect =
- as->unminimizeEffect;
-
- aw->animTotalTime =
- as->
- opt
- [ANIM_SCREEN_OPTION_UNMINIMIZE_DURATION].
- value.f * 1000;
- aw->animRemainingTime =
- aw->animTotalTime;
- }
-
- if (animEnsureModel
- (w, WindowEventUnminimize,
- aw->curAnimEffect)) {
- if (!animGetWindowIconGeometry
- (w, &aw->icon)) {
- // minimize to bottom-center if there is no window list
- aw->icon.x =
- w->screen->width / 2;
- aw->icon.y =
- w->screen->height;
- aw->icon.width = 100;
- aw->icon.height = 20;
- }
- if ((aw->curAnimEffect ==
- AnimEffectZoom
- || aw->curAnimEffect ==
- AnimEffectSidekick)
- &&
- (as->zoomFC == ZoomFromCenterOn ||
- as->zoomFC == ZoomFromCenterMin)
- ) {
- aw->icon.x =
- WIN_X(w) +
- WIN_W(w) / 2 -
- aw->icon.width / 2;
- aw->icon.y =
- WIN_Y(w) +
- WIN_H(w) / 2 -
- aw->icon.height / 2;
- }
- addWindowDamage(w);
- } else
- postAnimationCleanup(w, TRUE);
- }
- } else if (aw->nowShaded) {
- // UNSHADE event!
- //printf("UNSHADE event! %X\n", (unsigned)aw);
-
- IPCS_SetBool(IPCS_OBJECT(w), aw->animatedAtom,
- TRUE);
- aw->nowShaded = FALSE;
-
- if (as->unshadeEffect
- && (as->unshadeWMask & w->type)) {
- Bool startingNew = TRUE;
- if (aw->curWindowEvent != WindowEventNone) {
- if (aw->curWindowEvent !=
- WindowEventShade)
- postAnimationCleanup(w,
- TRUE);
- else {
- // Play the shade effect backwards from where it left
- aw->animRemainingTime =
- aw->animTotalTime -
- aw->animRemainingTime;
-
- // avoid window remains
- if (aw->
- animRemainingTime <= 0)
- aw->animRemainingTime = 1;
-
- startingNew = FALSE;
- if (aw->
- animOverrideProgressDir
- == 0)
- aw->animOverrideProgressDir = 1;
- else if (aw->
- animOverrideProgressDir
- == 2)
- aw->animOverrideProgressDir = 0;
- }
- }
- as->animInProgress = TRUE;
- aw->curWindowEvent = WindowEventUnshade;
-
- if (startingNew) {
- if (as->unshadeEffect ==
- AnimEffectRandom
- || as->
- opt
- [ANIM_SCREEN_OPTION_ALL_RANDOM].
- value.b)
- aw->curAnimEffect = // choose a random effect
- shadeEffectType[(int)
- ((NUM_SHADE_EFFECT - 2) * (double) rand() / RAND_MAX) + 2];
- else
- aw->curAnimEffect =
- as->unshadeEffect;
-
- aw->animTotalTime =
- as->
- opt
- [ANIM_SCREEN_OPTION_UNSHADE_DURATION].
- value.f * 1000;
- aw->animRemainingTime =
- aw->animTotalTime;
- }
-
- if (animEnsureModel
- (w, WindowEventUnshade,
- aw->curAnimEffect))
- addWindowDamage(w);
- else
- postAnimationCleanup(w, TRUE);
- }
- } else if (aw->state != NormalState && !w->invisible) {
- AnimEffect windowsCreateEffect = AnimEffectNone;
-
- int whichCreate = 1; // either 1 or 2
-
- if (as->create1Effect
- && (as->create1WMask & w->type))
- windowsCreateEffect = as->create1Effect;
- else if (as->create2Effect
- && (as->create2WMask & w->type)) {
- windowsCreateEffect = as->create2Effect;
- whichCreate = 2;
- }
-
- if (windowsCreateEffect &&
- getMousePointerXY(w->screen, &aw->icon.x,
- &aw->icon.y)) {
- // CREATE event!
-
- //printf("CREATE event! %X\n", (unsigned)aw);
-
- IPCS_SetBool(IPCS_OBJECT(w),
- aw->animatedAtom, TRUE);
- Bool startingNew = TRUE;
- if (aw->curWindowEvent != WindowEventNone) {
- if (aw->curWindowEvent !=
- WindowEventClose)
- postAnimationCleanup(w,
- TRUE);
- else {
- // Play the close effect backwards from where it left
- aw->animRemainingTime =
- aw->animTotalTime -
- aw->animRemainingTime;
-
- // avoid window remains
- if (aw->
- animRemainingTime == 0)
- aw->animRemainingTime = 1;
-
- startingNew = FALSE;
- if (aw->
- animOverrideProgressDir
- == 0)
- aw->animOverrideProgressDir = 1;
- else if (aw->
- animOverrideProgressDir
- == 2)
- aw->animOverrideProgressDir = 0;
- }
- }
- as->animInProgress = TRUE;
- aw->curWindowEvent = WindowEventCreate;
-
- if (startingNew) {
- if (windowsCreateEffect ==
- AnimEffectRandom
- || as->
- opt
- [ANIM_SCREEN_OPTION_ALL_RANDOM].
- value.b)
- aw->curAnimEffect = // choose a random effect
- closeEffectType[(int)
- ((NUM_CLOSE_EFFECT - 2) * (double) rand() / RAND_MAX) + 2];
- else
- aw->curAnimEffect =
- windowsCreateEffect;
-
- aw->animTotalTime =
- as->opt[whichCreate == 1 ?
- ANIM_SCREEN_OPTION_CREATE1_DURATION
- :
- ANIM_SCREEN_OPTION_CREATE2_DURATION].
- value.f * 1000;
- aw->animRemainingTime =
- aw->animTotalTime;
- }
-
- aw->icon.width = FAKE_ICON_SIZE;
- aw->icon.height = FAKE_ICON_SIZE;
- aw->icon.x -= FAKE_ICON_SIZE / 2;
- aw->icon.y -= FAKE_ICON_SIZE / 2;
- if ((aw->curAnimEffect == AnimEffectZoom ||
- aw->curAnimEffect ==
- AnimEffectSidekick)
- &&
- (as->zoomFC == ZoomFromCenterOn ||
- as->zoomFC == ZoomFromCenterCreate)
- ) {
- aw->icon.x =
- WIN_X(w) + WIN_W(w) / 2 -
- aw->icon.width / 2;
- aw->icon.y =
- WIN_Y(w) + WIN_H(w) / 2 -
- aw->icon.height / 2;
- }
- aw->state = IconicState; // we're doing this as a hack, it may not be necessary
-
- if (animEnsureModel
- (w, WindowEventCreate,
- aw->curAnimEffect))
- addWindowDamage(w);
- else
- postAnimationCleanup(w, TRUE);
- }
- }
-
- aw->newState = NormalState;
- }
-
- UNWRAP(as, w->screen, damageWindowRect);
- status = (*w->screen->damageWindowRect) (w, initial, rect);
- WRAP(as, w->screen, damageWindowRect, animDamageWindowRect);
-
- return status;
+ Bool status;
+
+ ANIM_SCREEN (w->screen);
+
+ if (initial) // Unminimize or Create
+ {
+ ANIM_WINDOW (w);
+
+ if (aw->state == IconicState)
+ {
+ if (!w->invisible && as->unminimizeEffect
+ && (as->unminimizeWMask & w->type))
+ {
+ // UNMINIMIZE event!
+
+ //printf("UNMINIMIZE event! %X\n", (unsigned)aw);
+
+ IPCS_SetBool (IPCS_OBJECT (w), aw->animatedAtom, TRUE);
+ Bool startingNew = TRUE;
+ if (aw->curWindowEvent != WindowEventNone)
+ {
+ if (aw->curWindowEvent != WindowEventMinimize)
+ postAnimationCleanup (w, TRUE);
+ else
+ {
+ // Play the minimize effect backwards from where it left
+ aw->animRemainingTime =
+ aw->animTotalTime - aw->animRemainingTime;
+
+ // avoid window remains
+ if (aw->animRemainingTime <= 0)
+ aw->animRemainingTime = 1;
+
+ startingNew = FALSE;
+ if (aw->animOverrideProgressDir == 0)
+ aw->animOverrideProgressDir = 1;
+ else if (aw->animOverrideProgressDir == 2)
+ aw->animOverrideProgressDir = 0;
+ }
+ }
+ as->animInProgress = TRUE;
+ aw->curWindowEvent = WindowEventUnminimize;
+
+ if (startingNew)
+ {
+ if (as->unminimizeEffect ==
+ AnimEffectRandom
+ || as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
+ aw->curAnimEffect = // choose a random effect
+ minimizeEffectType[(int)
+ ((NUM_MINIMIZE_EFFECT -
+ 2) * (double)rand () /
+ RAND_MAX) + 2];
+ else
+ aw->curAnimEffect = as->unminimizeEffect;
+
+ aw->animTotalTime =
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_UNMINIMIZE_DURATION].
+ value.f * 1000;
+ aw->animRemainingTime = aw->animTotalTime;
+ }
+
+ if (animEnsureModel
+ (w, WindowEventUnminimize, aw->curAnimEffect))
+ {
+ if (!animGetWindowIconGeometry (w, &aw->icon))
+ {
+ // minimize to bottom-center if there is no window list
+ aw->icon.x = w->screen->width / 2;
+ aw->icon.y = w->screen->height;
+ aw->icon.width = 100;
+ aw->icon.height = 20;
+ }
+ if ((aw->curAnimEffect ==
+ AnimEffectZoom
+ || aw->curAnimEffect ==
+ AnimEffectSidekick)
+ &&
+ (as->zoomFC == ZoomFromCenterOn ||
+ as->zoomFC == ZoomFromCenterMin))
+ {
+ aw->icon.x =
+ WIN_X (w) + WIN_W (w) / 2 - aw->icon.width / 2;
+ aw->icon.y =
+ WIN_Y (w) + WIN_H (w) / 2 - aw->icon.height / 2;
+ }
+ addWindowDamage (w);
+ }
+ else
+ postAnimationCleanup (w, TRUE);
+ }
+ }
+ else if (aw->nowShaded)
+ {
+ // UNSHADE event!
+ //printf("UNSHADE event! %X\n", (unsigned)aw);
+
+ IPCS_SetBool (IPCS_OBJECT (w), aw->animatedAtom, TRUE);
+ aw->nowShaded = FALSE;
+
+ if (as->unshadeEffect && (as->unshadeWMask & w->type))
+ {
+ Bool startingNew = TRUE;
+ if (aw->curWindowEvent != WindowEventNone)
+ {
+ if (aw->curWindowEvent != WindowEventShade)
+ postAnimationCleanup (w, TRUE);
+ else
+ {
+ // Play the shade effect backwards from where it left
+ aw->animRemainingTime =
+ aw->animTotalTime - aw->animRemainingTime;
+
+ // avoid window remains
+ if (aw->animRemainingTime <= 0)
+ aw->animRemainingTime = 1;
+
+ startingNew = FALSE;
+ if (aw->animOverrideProgressDir == 0)
+ aw->animOverrideProgressDir = 1;
+ else if (aw->animOverrideProgressDir == 2)
+ aw->animOverrideProgressDir = 0;
+ }
+ }
+ as->animInProgress = TRUE;
+ aw->curWindowEvent = WindowEventUnshade;
+
+ if (startingNew)
+ {
+ if (as->unshadeEffect ==
+ AnimEffectRandom
+ || as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
+ aw->curAnimEffect = // choose a random effect
+ shadeEffectType[(int)
+ ((NUM_SHADE_EFFECT -
+ 2) * (double)rand () /
+ RAND_MAX) + 2];
+ else
+ aw->curAnimEffect = as->unshadeEffect;
+
+ aw->animTotalTime =
+ as->
+ opt
+ [ANIM_SCREEN_OPTION_UNSHADE_DURATION].value.f * 1000;
+ aw->animRemainingTime = aw->animTotalTime;
+ }
+
+ if (animEnsureModel
+ (w, WindowEventUnshade, aw->curAnimEffect))
+ addWindowDamage (w);
+ else
+ postAnimationCleanup (w, TRUE);
+ }
+ }
+ else if (aw->state != NormalState && !w->invisible)
+ {
+ AnimEffect windowsCreateEffect = AnimEffectNone;
+
+ int whichCreate = 1; // either 1 or 2
+
+ if (as->create1Effect && (as->create1WMask & w->type))
+ windowsCreateEffect = as->create1Effect;
+ else if (as->create2Effect && (as->create2WMask & w->type))
+ {
+ windowsCreateEffect = as->create2Effect;
+ whichCreate = 2;
+ }
+
+ if (windowsCreateEffect &&
+ getMousePointerXY (w->screen, &aw->icon.x, &aw->icon.y))
+ {
+ // CREATE event!
+
+ //printf("CREATE event! %X\n", (unsigned)aw);
+
+ IPCS_SetBool (IPCS_OBJECT (w), aw->animatedAtom, TRUE);
+ Bool startingNew = TRUE;
+ if (aw->curWindowEvent != WindowEventNone)
+ {
+ if (aw->curWindowEvent != WindowEventClose)
+ postAnimationCleanup (w, TRUE);
+ else
+ {
+ // Play the close effect backwards from where it left
+ aw->animRemainingTime =
+ aw->animTotalTime - aw->animRemainingTime;
+
+ // avoid window remains
+ if (aw->animRemainingTime == 0)
+ aw->animRemainingTime = 1;
+
+ startingNew = FALSE;
+ if (aw->animOverrideProgressDir == 0)
+ aw->animOverrideProgressDir = 1;
+ else if (aw->animOverrideProgressDir == 2)
+ aw->animOverrideProgressDir = 0;
+ }
+ }
+ as->animInProgress = TRUE;
+ aw->curWindowEvent = WindowEventCreate;
+
+ if (startingNew)
+ {
+ if (windowsCreateEffect ==
+ AnimEffectRandom
+ || as->opt[ANIM_SCREEN_OPTION_ALL_RANDOM].value.b)
+ aw->curAnimEffect = // choose a random effect
+ closeEffectType[(int)
+ ((NUM_CLOSE_EFFECT -
+ 2) * (double)rand () /
+ RAND_MAX) + 2];
+ else
+ aw->curAnimEffect = windowsCreateEffect;
+
+ aw->animTotalTime =
+ as->opt[whichCreate == 1 ?
+ ANIM_SCREEN_OPTION_CREATE1_DURATION
+ :
+ ANIM_SCREEN_OPTION_CREATE2_DURATION].
+ value.f * 1000;
+ aw->animRemainingTime = aw->animTotalTime;
+ }
+
+ aw->icon.width = FAKE_ICON_SIZE;
+ aw->icon.height = FAKE_ICON_SIZE;
+ aw->icon.x -= FAKE_ICON_SIZE / 2;
+ aw->icon.y -= FAKE_ICON_SIZE / 2;
+ if ((aw->curAnimEffect == AnimEffectZoom ||
+ aw->curAnimEffect ==
+ AnimEffectSidekick)
+ &&
+ (as->zoomFC == ZoomFromCenterOn ||
+ as->zoomFC == ZoomFromCenterCreate))
+ {
+ aw->icon.x =
+ WIN_X (w) + WIN_W (w) / 2 - aw->icon.width / 2;
+ aw->icon.y =
+ WIN_Y (w) + WIN_H (w) / 2 - aw->icon.height / 2;
+ }
+ aw->state = IconicState; // we're doing this as a hack, it may not be necessary
+
+ if (animEnsureModel (w, WindowEventCreate, aw->curAnimEffect))
+ addWindowDamage (w);
+ else
+ postAnimationCleanup (w, TRUE);
+ }
+ }
+
+ aw->newState = NormalState;
+ }
+
+ UNWRAP (as, w->screen, damageWindowRect);
+ status = (*w->screen->damageWindowRect) (w, initial, rect);
+ WRAP (as, w->screen, damageWindowRect, animDamageWindowRect);
+
+ return status;
}
-static void animWindowResizeNotify(CompWindow * w)
+static void
+animWindowResizeNotify (CompWindow * w)
{
- ANIM_SCREEN(w->screen);
- ANIM_WINDOW(w);
-
- if (aw->animRemainingTime > 0) {
- aw->animRemainingTime = 0;
- postAnimationCleanup(w, TRUE);
- }
-
- if (aw->model) {
- modelInitObjects(aw->model,
- WIN_X(w), WIN_Y(w), WIN_W(w), WIN_H(w));
- }
-
- aw->state = w->state;
-
- UNWRAP(as, w->screen, windowResizeNotify);
- (*w->screen->windowResizeNotify) (w);
- WRAP(as, w->screen, windowResizeNotify, animWindowResizeNotify);
+ ANIM_SCREEN (w->screen);
+ ANIM_WINDOW (w);
+
+ if (aw->animRemainingTime > 0)
+ {
+ aw->animRemainingTime = 0;
+ postAnimationCleanup (w, TRUE);
+ }
+
+ if (aw->model)
+ {
+ modelInitObjects (aw->model,
+ WIN_X (w), WIN_Y (w), WIN_W (w), WIN_H (w));
+ }
+
+ aw->state = w->state;
+
+ UNWRAP (as, w->screen, windowResizeNotify);
+ (*w->screen->windowResizeNotify) (w);
+ WRAP (as, w->screen, windowResizeNotify, animWindowResizeNotify);
}
static void
-animWindowMoveNotify(CompWindow * w, int dx, int dy, Bool immediate)
+animWindowMoveNotify (CompWindow * w, int dx, int dy, Bool immediate)
{
- ANIM_SCREEN(w->screen);
- ANIM_WINDOW(w);
-
- CompWindow *w2;
-
- if (aw->animRemainingTime > 0 && aw->grabbed) {
- aw->animRemainingTime = 0;
- if (as->animInProgress) {
- as->animInProgress = FALSE;
- for (w2 = w->screen->windows; w2; w2 = w2->next) {
- AnimWindow *aw2;
- aw2 = GET_ANIM_WINDOW(w2, as);
- if (aw2->animRemainingTime > 0) {
- as->animInProgress = TRUE;
- break;
- }
- }
- }
- postAnimationCleanup(w, TRUE);
- } else if (aw->model) {
- modelMove(aw->model, dx, dy);
- }
-
- UNWRAP(as, w->screen, windowMoveNotify);
- (*w->screen->windowMoveNotify) (w, dx, dy, immediate);
- WRAP(as, w->screen, windowMoveNotify, animWindowMoveNotify);
+ ANIM_SCREEN (w->screen);
+ ANIM_WINDOW (w);
+
+ CompWindow *w2;
+
+ if (aw->animRemainingTime > 0 && aw->grabbed)
+ {
+ aw->animRemainingTime = 0;
+ if (as->animInProgress)
+ {
+ as->animInProgress = FALSE;
+ for (w2 = w->screen->windows; w2; w2 = w2->next)
+ {
+ AnimWindow *aw2;
+ aw2 = GET_ANIM_WINDOW (w2, as);
+ if (aw2->animRemainingTime > 0)
+ {
+ as->animInProgress = TRUE;
+ break;
+ }
+ }
+ }
+ postAnimationCleanup (w, TRUE);
+ }
+ else if (aw->model)
+ {
+ modelMove (aw->model, dx, dy);
+ }
+
+ UNWRAP (as, w->screen, windowMoveNotify);
+ (*w->screen->windowMoveNotify) (w, dx, dy, immediate);
+ WRAP (as, w->screen, windowMoveNotify, animWindowMoveNotify);
}
static void
-animWindowGrabNotify(CompWindow * w,
- int x, int y, unsigned int state, unsigned int mask)
+animWindowGrabNotify (CompWindow * w,
+ int x, int y, unsigned int state, unsigned int mask)
{
- ANIM_SCREEN(w->screen);
- ANIM_WINDOW(w);
+ ANIM_SCREEN (w->screen);
+ ANIM_WINDOW (w);
- aw->grabbed = TRUE;
+ aw->grabbed = TRUE;
- UNWRAP(as, w->screen, windowGrabNotify);
- (*w->screen->windowGrabNotify) (w, x, y, state, mask);
- WRAP(as, w->screen, windowGrabNotify, animWindowGrabNotify);
+ UNWRAP (as, w->screen, windowGrabNotify);
+ (*w->screen->windowGrabNotify) (w, x, y, state, mask);
+ WRAP (as, w->screen, windowGrabNotify, animWindowGrabNotify);
}
-static void animWindowUngrabNotify(CompWindow * w)
+static void
+animWindowUngrabNotify (CompWindow * w)
{
- ANIM_SCREEN(w->screen);
- ANIM_WINDOW(w);
+ ANIM_SCREEN (w->screen);
+ ANIM_WINDOW (w);
- aw->grabbed = FALSE;
+ aw->grabbed = FALSE;
- UNWRAP(as, w->screen, windowUngrabNotify);
- (*w->screen->windowUngrabNotify) (w);
- WRAP(as, w->screen, windowUngrabNotify, animWindowUngrabNotify);
+ UNWRAP (as, w->screen, windowUngrabNotify);
+ (*w->screen->windowUngrabNotify) (w);
+ WRAP (as, w->screen, windowUngrabNotify, animWindowUngrabNotify);
}
static Bool
-animPaintScreen(CompScreen * s,
- const ScreenPaintAttrib * sAttrib,
- Region region, int output, unsigned int mask)
+animPaintScreen (CompScreen * s,
+ const ScreenPaintAttrib * sAttrib,
+ Region region, int output, unsigned int mask)
{
- Bool status;
+ Bool status;
- ANIM_SCREEN(s);
+ ANIM_SCREEN (s);
- if (as->animInProgress)
- mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
+ if (as->animInProgress)
+ mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
- UNWRAP(as, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, output, mask);
- WRAP(as, s, paintScreen, animPaintScreen);
+ UNWRAP (as, s, paintScreen);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
+ WRAP (as, s, paintScreen, animPaintScreen);
- return status;
+ return status;
}
-static Bool animInitDisplay(CompPlugin * p, CompDisplay * d)
+static Bool
+animInitDisplay (CompPlugin * p, CompDisplay * d)
{
- AnimDisplay *ad;
+ AnimDisplay *ad;
- ad = malloc(sizeof(AnimDisplay));
- if (!ad)
- return FALSE;
+ ad = malloc (sizeof (AnimDisplay));
+ if (!ad)
+ return FALSE;
- ad->screenPrivateIndex = allocateScreenPrivateIndex(d);
- if (ad->screenPrivateIndex < 0) {
- free(ad);
- return FALSE;
- }
+ ad->screenPrivateIndex = allocateScreenPrivateIndex (d);
+ if (ad->screenPrivateIndex < 0)
+ {
+ free (ad);
+ return FALSE;
+ }
- ad->wmHintsAtom = XInternAtom(d->display, "WM_HINTS", FALSE);
- ad->winIconGeometryAtom =
- XInternAtom(d->display, "_NET_WM_ICON_GEOMETRY", 0);
+ ad->wmHintsAtom = XInternAtom (d->display, "WM_HINTS", FALSE);
+ ad->winIconGeometryAtom =
+ XInternAtom (d->display, "_NET_WM_ICON_GEOMETRY", 0);
- WRAP(ad, d, handleEvent, animHandleEvent);
+ WRAP (ad, d, handleEvent, animHandleEvent);
- d->privates[displayPrivateIndex].ptr = ad;
+ d->privates[displayPrivateIndex].ptr = ad;
- return TRUE;
+ return TRUE;
}
-static void animFiniDisplay(CompPlugin * p, CompDisplay * d)
+static void
+animFiniDisplay (CompPlugin * p, CompDisplay * d)
{
- ANIM_DISPLAY(d);
+ ANIM_DISPLAY (d);
- freeScreenPrivateIndex(d, ad->screenPrivateIndex);
+ freeScreenPrivateIndex (d, ad->screenPrivateIndex);
- UNWRAP(ad, d, handleEvent);
+ UNWRAP (ad, d, handleEvent);
- free(ad);
+ free (ad);
}
-static Bool animInitScreen(CompPlugin * p, CompScreen * s)
+static Bool
+animInitScreen (CompPlugin * p, CompScreen * s)
{
- AnimScreen *as;
-
- ANIM_DISPLAY(s->display);
-
- as = calloc(1, sizeof(AnimScreen));
- if (!as)
- return FALSE;
-
- as->windowPrivateIndex = allocateWindowPrivateIndex(s);
- if (as->windowPrivateIndex < 0) {
- free(as);
- return FALSE;
- }
- as->animInProgress = FALSE;
- as->minimizeEffect = ANIM_MINIMIZE_DEFAULT;
- as->unminimizeEffect = ANIM_UNMINIMIZE_DEFAULT;
- as->create1Effect = ANIM_CREATE1_DEFAULT;
- as->create2Effect = ANIM_CREATE2_DEFAULT;
- as->close1Effect = ANIM_CLOSE1_DEFAULT;
- as->close2Effect = ANIM_CLOSE2_DEFAULT;
- as->focusEffect = ANIM_FOCUS_DEFAULT;
- as->shadeEffect = ANIM_SHADE_DEFAULT;
- as->unshadeEffect = ANIM_UNSHADE_DEFAULT;
-
- as->zoomFC = ANIM_ZOOM_FROM_CENTER_DEFAULT;
-
- as->ppDisabling = ANIM_DISABLE_PP_FX_DEFAULT;
-
- animScreenInitOptions(as);
-
- WRAP(as, s, preparePaintScreen, animPreparePaintScreen);
- WRAP(as, s, donePaintScreen, animDonePaintScreen);
- WRAP(as, s, paintScreen, animPaintScreen);
- WRAP(as, s, paintWindow, animPaintWindow);
- WRAP(as, s, damageWindowRect, animDamageWindowRect);
- WRAP(as, s, addWindowGeometry, animAddWindowGeometry);
- WRAP(as, s, drawWindowGeometry, animDrawWindowGeometry);
- WRAP(as, s, windowResizeNotify, animWindowResizeNotify);
- WRAP(as, s, windowMoveNotify, animWindowMoveNotify);
- WRAP(as, s, windowGrabNotify, animWindowGrabNotify);
- WRAP(as, s, windowUngrabNotify, animWindowUngrabNotify);
-
- s->privates[ad->screenPrivateIndex].ptr = as;
-
- return TRUE;
+ AnimScreen *as;
+
+ ANIM_DISPLAY (s->display);
+
+ as = calloc (1, sizeof (AnimScreen));
+ if (!as)
+ return FALSE;
+
+ as->windowPrivateIndex = allocateWindowPrivateIndex (s);
+ if (as->windowPrivateIndex < 0)
+ {
+ free (as);
+ return FALSE;
+ }
+ as->animInProgress = FALSE;
+ as->minimizeEffect = ANIM_MINIMIZE_DEFAULT;
+ as->unminimizeEffect = ANIM_UNMINIMIZE_DEFAULT;
+ as->create1Effect = ANIM_CREATE1_DEFAULT;
+ as->create2Effect = ANIM_CREATE2_DEFAULT;
+ as->close1Effect = ANIM_CLOSE1_DEFAULT;
+ as->close2Effect = ANIM_CLOSE2_DEFAULT;
+ as->focusEffect = ANIM_FOCUS_DEFAULT;
+ as->shadeEffect = ANIM_SHADE_DEFAULT;
+ as->unshadeEffect = ANIM_UNSHADE_DEFAULT;
+
+ as->zoomFC = ANIM_ZOOM_FROM_CENTER_DEFAULT;
+
+ as->ppDisabling = ANIM_DISABLE_PP_FX_DEFAULT;
+
+ animScreenInitOptions (as);
+
+ WRAP (as, s, preparePaintScreen, animPreparePaintScreen);
+ WRAP (as, s, donePaintScreen, animDonePaintScreen);
+ WRAP (as, s, paintScreen, animPaintScreen);
+ WRAP (as, s, paintWindow, animPaintWindow);
+ WRAP (as, s, damageWindowRect, animDamageWindowRect);
+ WRAP (as, s, addWindowGeometry, animAddWindowGeometry);
+ WRAP (as, s, drawWindowGeometry, animDrawWindowGeometry);
+ WRAP (as, s, windowResizeNotify, animWindowResizeNotify);
+ WRAP (as, s, windowMoveNotify, animWindowMoveNotify);
+ WRAP (as, s, windowGrabNotify, animWindowGrabNotify);
+ WRAP (as, s, windowUngrabNotify, animWindowUngrabNotify);
+
+ s->privates[ad->screenPrivateIndex].ptr = as;
+
+ return TRUE;
}
-static void animFiniScreen(CompPlugin * p, CompScreen * s)
+static void
+animFiniScreen (CompPlugin * p, CompScreen * s)
{
- ANIM_SCREEN(s);
-
- freeWindowPrivateIndex(s, as->windowPrivateIndex);
-
- free(as->opt[ANIM_SCREEN_OPTION_MINIMIZE_EFFECT].value.s);
- free(as->opt[ANIM_SCREEN_OPTION_UNMINIMIZE_EFFECT].value.s);
- free(as->opt[ANIM_SCREEN_OPTION_CREATE1_EFFECT].value.s);
- free(as->opt[ANIM_SCREEN_OPTION_CREATE2_EFFECT].value.s);
- free(as->opt[ANIM_SCREEN_OPTION_CLOSE1_EFFECT].value.s);
- free(as->opt[ANIM_SCREEN_OPTION_CLOSE2_EFFECT].value.s);
- free(as->opt[ANIM_SCREEN_OPTION_FOCUS_EFFECT].value.s);
- free(as->opt[ANIM_SCREEN_OPTION_SHADE_EFFECT].value.s);
- free(as->opt[ANIM_SCREEN_OPTION_UNSHADE_EFFECT].value.s);
-
- UNWRAP(as, s, preparePaintScreen);
- UNWRAP(as, s, donePaintScreen);
- UNWRAP(as, s, paintScreen);
- UNWRAP(as, s, paintWindow);
- UNWRAP(as, s, damageWindowRect);
- UNWRAP(as, s, addWindowGeometry);
- UNWRAP(as, s, drawWindowGeometry);
- UNWRAP(as, s, windowResizeNotify);
- UNWRAP(as, s, windowMoveNotify);
- UNWRAP(as, s, windowGrabNotify);
- UNWRAP(as, s, windowUngrabNotify);
-
- free(as);
+ ANIM_SCREEN (s);
+
+ freeWindowPrivateIndex (s, as->windowPrivateIndex);
+
+ free (as->opt[ANIM_SCREEN_OPTION_MINIMIZE_EFFECT].value.s);
+ free (as->opt[ANIM_SCREEN_OPTION_UNMINIMIZE_EFFECT].value.s);
+ free (as->opt[ANIM_SCREEN_OPTION_CREATE1_EFFECT].value.s);
+ free (as->opt[ANIM_SCREEN_OPTION_CREATE2_EFFECT].value.s);
+ free (as->opt[ANIM_SCREEN_OPTION_CLOSE1_EFFECT].value.s);
+ free (as->opt[ANIM_SCREEN_OPTION_CLOSE2_EFFECT].value.s);
+ free (as->opt[ANIM_SCREEN_OPTION_FOCUS_EFFECT].value.s);
+ free (as->opt[ANIM_SCREEN_OPTION_SHADE_EFFECT].value.s);
+ free (as->opt[ANIM_SCREEN_OPTION_UNSHADE_EFFECT].value.s);
+
+ UNWRAP (as, s, preparePaintScreen);
+ UNWRAP (as, s, donePaintScreen);
+ UNWRAP (as, s, paintScreen);
+ UNWRAP (as, s, paintWindow);
+ UNWRAP (as, s, damageWindowRect);
+ UNWRAP (as, s, addWindowGeometry);
+ UNWRAP (as, s, drawWindowGeometry);
+ UNWRAP (as, s, windowResizeNotify);
+ UNWRAP (as, s, windowMoveNotify);
+ UNWRAP (as, s, windowGrabNotify);
+ UNWRAP (as, s, windowUngrabNotify);
+
+ free (as);
}
-static Bool animInitWindow(CompPlugin * p, CompWindow * w)
+static Bool
+animInitWindow (CompPlugin * p, CompWindow * w)
{
- AnimWindow *aw;
-
- ANIM_SCREEN(w->screen);
-
- aw = calloc(1, sizeof(AnimWindow));
- if (!aw)
- return FALSE;
-
- aw->animatedAtom = IPCS_GetAtom(IPCS_OBJECT(w), IPCS_BOOL,
- "is_animated", True);
- IPCS_SetBool(IPCS_OBJECT(w), aw->animatedAtom, FALSE);
- aw->model = 0;
- aw->state = w->state;
- aw->animRemainingTime = 0;
- aw->animInitialized = FALSE;
- aw->curAnimEffect = AnimEffectNone;
- aw->curWindowEvent = WindowEventNone;
- aw->animOverrideProgressDir = 0;
- w->indexCount = 0;
-
- aw->unmapCnt = 0;
- aw->destroyCnt = 0;
-
- aw->grabbed = FALSE;
-
- aw->useDrawRegion = FALSE;
- aw->drawRegion = NULL;
-
- if (w->shaded) {
- aw->state = aw->newState = NormalState;
- aw->nowShaded = TRUE;
- } else {
- aw->state = aw->newState = animGetWindowState(w);
- aw->nowShaded = FALSE;
- }
-
- w->privates[as->windowPrivateIndex].ptr = aw;
-
- return TRUE;
+ AnimWindow *aw;
+
+ ANIM_SCREEN (w->screen);
+
+ aw = calloc (1, sizeof (AnimWindow));
+ if (!aw)
+ return FALSE;
+
+ aw->animatedAtom = IPCS_GetAtom (IPCS_OBJECT (w), IPCS_BOOL,
+ "is_animated", True);
+ IPCS_SetBool (IPCS_OBJECT (w), aw->animatedAtom, FALSE);
+ aw->model = 0;
+ aw->state = w->state;
+ aw->animRemainingTime = 0;
+ aw->animInitialized = FALSE;
+ aw->curAnimEffect = AnimEffectNone;
+ aw->curWindowEvent = WindowEventNone;
+ aw->animOverrideProgressDir = 0;
+ w->indexCount = 0;
+
+ aw->unmapCnt = 0;
+ aw->destroyCnt = 0;
+
+ aw->grabbed = FALSE;
+
+ aw->useDrawRegion = FALSE;
+ aw->drawRegion = NULL;
+
+ if (w->shaded)
+ {
+ aw->state = aw->newState = NormalState;
+ aw->nowShaded = TRUE;
+ }
+ else
+ {
+ aw->state = aw->newState = animGetWindowState (w);
+ aw->nowShaded = FALSE;
+ }
+
+ w->privates[as->windowPrivateIndex].ptr = aw;
+
+ return TRUE;
}
-static void animFiniWindow(CompPlugin * p, CompWindow * w)
+static void
+animFiniWindow (CompPlugin * p, CompWindow * w)
{
- ANIM_WINDOW(w);
+ ANIM_WINDOW (w);
- postAnimationCleanup(w, FALSE);
+ postAnimationCleanup (w, FALSE);
- if (aw->model) {
- if (aw->model->magicLampWaves)
- free(aw->model->magicLampWaves);
- aw->model->magicLampWaves = 0;
- free(aw->model->objects);
- aw->model->objects = 0;
- free(aw->model);
- aw->model = 0;
- }
+ if (aw->model)
+ {
+ if (aw->model->magicLampWaves)
+ free (aw->model->magicLampWaves);
+ aw->model->magicLampWaves = 0;
+ free (aw->model->objects);
+ aw->model->objects = 0;
+ free (aw->model);
+ aw->model = 0;
+ }
- while (aw->unmapCnt--)
- unmapWindow(w);
+ while (aw->unmapCnt--)
+ unmapWindow (w);
- free(aw);
+ free (aw);
}
-static Bool animInit(CompPlugin * p)
+static Bool
+animInit (CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex();
- if (displayPrivateIndex < 0)
- return FALSE;
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
+ if (displayPrivateIndex < 0)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-static void animFini(CompPlugin * p)
+static void
+animFini (CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex(displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex (displayPrivateIndex);
}
CompPluginDep animDeps[] = {
- {CompPluginRuleAfter, "decoration"}
+ {CompPluginRuleAfter, "decoration"}
};
CompPluginVTable animVTable = {
- "animation",
- N_("Animations"),
- N_("Use various animations as window effects"),
- animInit,
- animFini,
- animInitDisplay,
- animFiniDisplay,
- animInitScreen,
- animFiniScreen,
- animInitWindow,
- animFiniWindow,
- 0,
- 0,
- animGetScreenOptions,
- animSetScreenOption,
- animDeps,
- sizeof(animDeps) / sizeof(animDeps[0]),
- 0,
- 0,
- BERYL_ABI_INFO,
- "beryl-plugins",
- "effects"
+ "animation",
+ N_("Animations"),
+ N_("Use various animations as window effects"),
+ animInit,
+ animFini,
+ animInitDisplay,
+ animFiniDisplay,
+ animInitScreen,
+ animFiniScreen,
+ animInitWindow,
+ animFiniWindow,
+ 0,
+ 0,
+ animGetScreenOptions,
+ animSetScreenOption,
+ animDeps,
+ sizeof (animDeps) / sizeof (animDeps[0]),
+ 0,
+ 0,
+ BERYL_ABI_INFO,
+ "beryl-plugins",
+ "effects"
};
-CompPluginVTable *getCompPluginInfo(void)
+CompPluginVTable *
+getCompPluginInfo (void)
{
- return &animVTable;
+ return &animVTable;
}
diff --git a/beryl-plugins/src/annotate.c b/beryl-plugins/src/annotate.c
index 784bcb8..46b29f6 100644
--- a/beryl-plugins/src/annotate.c
+++ b/beryl-plugins/src/annotate.c
@@ -83,28 +83,30 @@ static int annoLastPointerY = 0;
#define ANNO_NUMBER_CONTEXTS 12
-typedef struct _AnnoDisplay {
- int screenPrivateIndex;
- HandleEventProc handleEvent;
+typedef struct _AnnoDisplay
+{
+ int screenPrivateIndex;
+ HandleEventProc handleEvent;
- CompOption opt[ANNO_DISPLAY_OPTION_NUM];
+ CompOption opt[ANNO_DISPLAY_OPTION_NUM];
} AnnoDisplay;
-typedef struct _AnnoScreen {
+typedef struct _AnnoScreen
+{
PaintScreenProc paintScreen;
- int grabIndex;
+ int grabIndex;
- Pixmap pixmap[ANNO_NUMBER_CONTEXTS];
- CompTexture texture[ANNO_NUMBER_CONTEXTS];
+ Pixmap pixmap[ANNO_NUMBER_CONTEXTS];
+ CompTexture texture[ANNO_NUMBER_CONTEXTS];
cairo_surface_t *surface[ANNO_NUMBER_CONTEXTS];
- cairo_t *cairo[ANNO_NUMBER_CONTEXTS];
- Bool content[ANNO_NUMBER_CONTEXTS];
- int currentContext;
+ cairo_t *cairo[ANNO_NUMBER_CONTEXTS];
+ Bool content[ANNO_NUMBER_CONTEXTS];
+ int currentContext;
- RsvgHandle **svgHandle;
- int nSvgHandle;
+ RsvgHandle **svgHandle;
+ int nSvgHandle;
- Bool eraseMode;
+ Bool eraseMode;
} AnnoScreen;
#define GET_ANNO_DISPLAY(d) \
@@ -124,210 +126,213 @@ typedef struct _AnnoScreen {
#define NUM_TOOLS (sizeof (tools) / sizeof (tools[0]))
-static void annoCairoClear(CompScreen * s, cairo_t * cr, int context)
+static void
+annoCairoClear (CompScreen * s, cairo_t * cr, int context)
{
- ANNO_SCREEN(s);
+ ANNO_SCREEN (s);
- cairo_save(cr);
- cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint(cr);
- cairo_restore(cr);
+ cairo_save (cr);
+ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+ cairo_paint (cr);
+ cairo_restore (cr);
- as->content[context] = FALSE;
+ as->content[context] = FALSE;
}
-static cairo_t *annoCairoContext(CompScreen * s, int contextID)
+static cairo_t *
+annoCairoContext (CompScreen * s, int contextID)
{
- ANNO_SCREEN(s);
+ ANNO_SCREEN (s);
- if (!as->cairo || !as->cairo[contextID]) {
- XRenderPictFormat *format;
- Screen *screen;
- int w, h;
+ if (!as->cairo || !as->cairo[contextID])
+ {
+ XRenderPictFormat *format;
+ Screen *screen;
+ int w, h;
- screen =
- ScreenOfDisplay(s->display->display, s->screenNum);
+ screen = ScreenOfDisplay (s->display->display, s->screenNum);
- w = s->width;
- h = s->height;
+ w = s->width;
+ h = s->height;
- format = XRenderFindStandardFormat(s->display->display,
- PictStandardARGB32);
+ format = XRenderFindStandardFormat (s->display->display,
+ PictStandardARGB32);
- as->pixmap[contextID] =
- XCreatePixmap(s->display->display, s->root, w, h, 32);
+ as->pixmap[contextID] =
+ XCreatePixmap (s->display->display, s->root, w, h, 32);
- if (!bindPixmapToTexture (s, &as->texture[contextID],
- as->pixmap[contextID], w, h, 32)) {
- fprintf(stderr,
- "%s: Couldn't bind annotate pixmap 0x%x to "
- "texture\n", getProgramName(),
- (int) as->pixmap[contextID]);
+ if (!bindPixmapToTexture (s, &as->texture[contextID],
+ as->pixmap[contextID], w, h, 32))
+ {
+ fprintf (stderr,
+ "%s: Couldn't bind annotate pixmap 0x%x to "
+ "texture\n", getProgramName (),
+ (int)as->pixmap[contextID]);
- XFreePixmap(s->display->display, as->pixmap[contextID]);
+ XFreePixmap (s->display->display, as->pixmap[contextID]);
- return NULL;
- }
+ return NULL;
+ }
- as->surface[contextID] =
- cairo_xlib_surface_create_with_xrender_format(s->display->display,
- as->pixmap[contextID],
- screen,
- format,
- w, h);
+ as->surface[contextID] =
+ cairo_xlib_surface_create_with_xrender_format (s->display->
+ display,
+ as->
+ pixmap[contextID],
+ screen, format, w,
+ h);
- as->cairo[contextID] = cairo_create(as->surface[contextID]);
+ as->cairo[contextID] = cairo_create (as->surface[contextID]);
- annoCairoClear(s, as->cairo[contextID], contextID);
- }
+ annoCairoClear (s, as->cairo[contextID], contextID);
+ }
- return as->cairo[contextID];
+ return as->cairo[contextID];
}
static Bool
-annoCanvasSwitchContext (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+annoCanvasSwitchContext (CompDisplay * d,
+ CompAction * action,
+ CompActionState state,
+ CompOption * option, int nOption)
{
Window xid;
int contextNumber;
CompScreen *s;
- xid = getIntOptionNamed (option, nOption, "root", 0);
+ xid = getIntOptionNamed (option, nOption, "root", 0);
contextNumber = getIntOptionNamed (option, nOption, "context", 0);
s = findScreenAtDisplay (d, xid);
if (s)
{
- ANNO_SCREEN (s);
+ ANNO_SCREEN (s);
as->currentContext = contextNumber;
- damageScreen (s);
+ damageScreen (s);
- return TRUE;
+ return TRUE;
}
return FALSE;
}
-static void annoSetSourceColor(cairo_t * cr, unsigned short *color)
+static void
+annoSetSourceColor (cairo_t * cr, unsigned short *color)
{
- cairo_set_source_rgba(cr,
- (double) color[0] / 0xffff,
- (double) color[1] / 0xffff,
- (double) color[2] / 0xffff,
- (double) color[3] / 0xffff);
+ cairo_set_source_rgba (cr,
+ (double)color[0] / 0xffff,
+ (double)color[1] / 0xffff,
+ (double)color[2] / 0xffff,
+ (double)color[3] / 0xffff);
}
static void
-annoDrawCircle(CompScreen * s,
- int contextID,
- double xc,
- double yc,
- double radius,
- unsigned short *fillColor,
- unsigned short *strokeColor,
- double strokeWidth)
+annoDrawCircle (CompScreen * s,
+ int contextID,
+ double xc,
+ double yc,
+ double radius,
+ unsigned short *fillColor,
+ unsigned short *strokeColor, double strokeWidth)
{
- REGION reg;
- cairo_t *cr;
-
- ANNO_SCREEN(s);
-
- cr = annoCairoContext(s, contextID);
- if (cr) {
- double ex1, ey1, ex2, ey2;
-
- annoSetSourceColor(cr, fillColor);
- cairo_arc(cr, xc, yc, radius, 0, 2 * M_PI);
- cairo_fill_preserve(cr);
- cairo_set_line_width(cr, strokeWidth);
- cairo_stroke_extents(cr, &ex1, &ey1, &ex2, &ey2);
- annoSetSourceColor(cr, strokeColor);
- cairo_stroke(cr);
-
- reg.rects = &reg.extents;
- reg.numRects = 1;
-
- reg.extents.x1 = ex1;
- reg.extents.y1 = ey1;
- reg.extents.x2 = ex2;
- reg.extents.y2 = ey2;
-
- as->content[contextID] = TRUE;
- damageScreenRegion(s, &reg);
- }
+ REGION reg;
+ cairo_t *cr;
+
+ ANNO_SCREEN (s);
+
+ cr = annoCairoContext (s, contextID);
+ if (cr)
+ {
+ double ex1, ey1, ex2, ey2;
+
+ annoSetSourceColor (cr, fillColor);
+ cairo_arc (cr, xc, yc, radius, 0, 2 * M_PI);
+ cairo_fill_preserve (cr);
+ cairo_set_line_width (cr, strokeWidth);
+ cairo_stroke_extents (cr, &ex1, &ey1, &ex2, &ey2);
+ annoSetSourceColor (cr, strokeColor);
+ cairo_stroke (cr);
+
+ reg.rects = &reg.extents;
+ reg.numRects = 1;
+
+ reg.extents.x1 = ex1;
+ reg.extents.y1 = ey1;
+ reg.extents.x2 = ex2;
+ reg.extents.y2 = ey2;
+
+ as->content[contextID] = TRUE;
+ damageScreenRegion (s, &reg);
+ }
}
static void
-annoDrawRectangle(CompScreen * s,
- int contextID,
- double x,
- double y,
- double w,
- double h,
- unsigned short *fillColor,
- unsigned short *strokeColor,
- double strokeWidth,
- double angle)
+annoDrawRectangle (CompScreen * s,
+ int contextID,
+ double x,
+ double y,
+ double w,
+ double h,
+ unsigned short *fillColor,
+ unsigned short *strokeColor,
+ double strokeWidth, double angle)
{
- REGION reg;
- cairo_t *cr;
-
- ANNO_SCREEN(s);
-
- cr = annoCairoContext(s, contextID);
- if (cr) {
- double ex1, ey1, ex2, ey2;
-
- if (angle != 0)
- {
- cairo_save (cr);
- cairo_translate (cr, x + (w/2), y + (h/2));
- cairo_rotate (cr, angle * M_PI/180);
- cairo_translate (cr, -x - (w/2), -y - (h/2));
- }
-
- annoSetSourceColor(cr, fillColor);
- cairo_rectangle(cr, x, y, w, h);
- cairo_set_line_width(cr, strokeWidth);
- cairo_fill_preserve(cr);
- cairo_stroke_extents(cr, &ex1, &ey1, &ex2, &ey2);
- annoSetSourceColor(cr, strokeColor);
- cairo_stroke(cr);
-
- if (angle != 0)
- cairo_restore (cr);
-
- reg.rects = &reg.extents;
- reg.numRects = 1;
-
- reg.extents.x1 = ex1;
- reg.extents.y1 = ey1;
- reg.extents.x2 = ex2;
- reg.extents.y2 = ey2;
-
- as->content[contextID] = TRUE;
-
- if (angle == 0)
- damageScreenRegion(s, &reg);
- else
- damageScreen (s);
- }
+ REGION reg;
+ cairo_t *cr;
+
+ ANNO_SCREEN (s);
+
+ cr = annoCairoContext (s, contextID);
+ if (cr)
+ {
+ double ex1, ey1, ex2, ey2;
+
+ if (angle != 0)
+ {
+ cairo_save (cr);
+ cairo_translate (cr, x + (w / 2), y + (h / 2));
+ cairo_rotate (cr, angle * M_PI / 180);
+ cairo_translate (cr, -x - (w / 2), -y - (h / 2));
+ }
+
+ annoSetSourceColor (cr, fillColor);
+ cairo_rectangle (cr, x, y, w, h);
+ cairo_set_line_width (cr, strokeWidth);
+ cairo_fill_preserve (cr);
+ cairo_stroke_extents (cr, &ex1, &ey1, &ex2, &ey2);
+ annoSetSourceColor (cr, strokeColor);
+ cairo_stroke (cr);
+
+ if (angle != 0)
+ cairo_restore (cr);
+
+ reg.rects = &reg.extents;
+ reg.numRects = 1;
+
+ reg.extents.x1 = ex1;
+ reg.extents.y1 = ey1;
+ reg.extents.x2 = ex2;
+ reg.extents.y2 = ey2;
+
+ as->content[contextID] = TRUE;
+
+ if (angle == 0)
+ damageScreenRegion (s, &reg);
+ else
+ damageScreen (s);
+ }
}
-typedef struct _AnnoSvgSizeCallbackData {
- char *filename;
+typedef struct _AnnoSvgSizeCallbackData
+{
+ char *filename;
CompDisplay *display;
- int handleID;
+ int handleID;
} AnnoSvgSizeCallbackData;
static void
-annoRsvgSizeCallback (gint *width,
- gint *height,
- gpointer user_data)
+annoRsvgSizeCallback (gint * width, gint * height, gpointer user_data)
{
/*
fprintf(stderr, "load callback\n");
@@ -368,79 +373,76 @@ fprintf(stderr, "load callback handle = %d\n", handleID);
}
static void
-annoDrawSvg (CompScreen *s,
- int contextID,
- int handleID,
- double x,
- double y,
- double angle,
- double scaleX,
- double scaleY)
+annoDrawSvg (CompScreen * s,
+ int contextID,
+ int handleID,
+ double x, double y, double angle, double scaleX, double scaleY)
{
- RsvgHandle *svgh;
- cairo_t *cr;
+ RsvgHandle *svgh;
+ cairo_t *cr;
ANNO_SCREEN (s);
cr = annoCairoContext (s, contextID);
if (cr && handleID)
{
- svgh = as->svgHandle[handleID];
+ svgh = as->svgHandle[handleID];
- cairo_save (cr);
- cairo_translate (cr, x, y);
- cairo_scale (cr, scaleX, scaleY);
- rsvg_handle_render_cairo (svgh, cr);
- cairo_restore(cr);
+ cairo_save (cr);
+ cairo_translate (cr, x, y);
+ cairo_scale (cr, scaleX, scaleY);
+ rsvg_handle_render_cairo (svgh, cr);
+ cairo_restore (cr);
- as->content[contextID] = TRUE;
+ as->content[contextID] = TRUE;
}
damageScreen (s);
}
static Bool
-annoLoadSvg (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+annoLoadSvg (CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
CompScreen *s;
- Window xid;
- char *filename;
- xid = getIntOptionNamed (option, nOption, "root", 0);
+ Window xid;
+ char *filename;
+ xid = getIntOptionNamed (option, nOption, "root", 0);
s = findScreenAtDisplay (d, xid);
if (s)
{
- GError *svgError = NULL;
- RsvgHandle *svgh;
- AnnoSvgSizeCallbackData callbackData;
+ GError *svgError = NULL;
+ RsvgHandle *svgh;
+ AnnoSvgSizeCallbackData callbackData;
ANNO_SCREEN (s);
- filename = getStringOptionNamed (option, nOption, "filename", "");
+ filename = getStringOptionNamed (option, nOption, "filename", "");
as->nSvgHandle++;
callbackData.filename = filename;
- callbackData.display = s->display;
+ callbackData.display = s->display;
callbackData.handleID = as->nSvgHandle;
svgh = rsvg_handle_new_from_file (filename, &svgError);
- rsvg_handle_set_size_callback (svgh, annoRsvgSizeCallback, &callbackData, NULL);
+ rsvg_handle_set_size_callback (svgh, annoRsvgSizeCallback,
+ &callbackData, NULL);
if (svgError)
{
- fprintf (stderr, "%s: Error loading svg %s\n", getProgramName(), filename);
- as->nSvgHandle--;
- rsvg_handle_free (svgh);
+ fprintf (stderr, "%s: Error loading svg %s\n", getProgramName (),
+ filename);
+ as->nSvgHandle--;
+ rsvg_handle_free (svgh);
- return FALSE;
+ return FALSE;
}
- as->svgHandle = realloc (as->svgHandle, sizeof(RsvgHandle) * as->nSvgHandle);
+ as->svgHandle =
+ realloc (as->svgHandle, sizeof (RsvgHandle) * as->nSvgHandle);
as->svgHandle[as->nSvgHandle] = svgh;
@@ -452,11 +454,7 @@ annoLoadSvg (CompDisplay *d,
option[1].type = CompOptionTypeInt;
option[1].value.i = as->nSvgHandle;
- (*d->handleBerylEvent) (d,
- "annotate",
- "svgLoaded",
- option,
- nOption);
+ (*d->handleBerylEvent) (d, "annotate", "svgLoaded", option, nOption);
return TRUE;
@@ -465,165 +463,162 @@ annoLoadSvg (CompDisplay *d,
}
static void
-annoDrawLine(CompScreen * s,
- int contextID,
- double x1,
- double y1,
- double x2,
- double y2,
- double width,
- unsigned short *color)
+annoDrawLine (CompScreen * s,
+ int contextID,
+ double x1,
+ double y1,
+ double x2, double y2, double width, unsigned short *color)
{
- REGION reg;
- cairo_t *cr;
+ REGION reg;
+ cairo_t *cr;
- ANNO_SCREEN(s);
+ ANNO_SCREEN (s);
- cr = annoCairoContext(s, contextID);
- if (cr) {
- double ex1, ey1, ex2, ey2;
+ cr = annoCairoContext (s, contextID);
+ if (cr)
+ {
+ double ex1, ey1, ex2, ey2;
- cairo_set_line_width(cr, width);
- cairo_move_to(cr, x1, y1);
- cairo_line_to(cr, x2, y2);
- cairo_stroke_extents(cr, &ex1, &ey1, &ex2, &ey2);
- annoSetSourceColor(cr, color);
- cairo_stroke(cr);
+ cairo_set_line_width (cr, width);
+ cairo_move_to (cr, x1, y1);
+ cairo_line_to (cr, x2, y2);
+ cairo_stroke_extents (cr, &ex1, &ey1, &ex2, &ey2);
+ annoSetSourceColor (cr, color);
+ cairo_stroke (cr);
- reg.rects = &reg.extents;
- reg.numRects = 1;
+ reg.rects = &reg.extents;
+ reg.numRects = 1;
- reg.extents.x1 = ex1;
- reg.extents.y1 = ey1;
- reg.extents.x2 = ex2;
- reg.extents.y2 = ey2;
+ reg.extents.x1 = ex1;
+ reg.extents.y1 = ey1;
+ reg.extents.x2 = ex2;
+ reg.extents.y2 = ey2;
- as->content[contextID] = TRUE;
- damageScreenRegion(s, &reg);
- }
+ as->content[contextID] = TRUE;
+ damageScreenRegion (s, &reg);
+ }
}
static void
-annoDrawText(CompScreen * s,
- int contextID,
- double x,
- double y,
- char *text,
- char *fontFamily,
- double fontSize,
- int fontSlant,
- int fontWeight,
- unsigned short *fillColor,
- unsigned short *strokeColor,
- double strokeWidth)
+annoDrawText (CompScreen * s,
+ int contextID,
+ double x,
+ double y,
+ char *text,
+ char *fontFamily,
+ double fontSize,
+ int fontSlant,
+ int fontWeight,
+ unsigned short *fillColor,
+ unsigned short *strokeColor, double strokeWidth)
{
- REGION reg;
- cairo_t *cr;
-
- ANNO_SCREEN(s);
-
- cr = annoCairoContext(s, contextID);
- if (cr) {
- cairo_text_extents_t extents;
-
- cairo_set_line_width(cr, strokeWidth);
- annoSetSourceColor(cr, fillColor);
- cairo_select_font_face(cr, fontFamily, fontSlant,
- fontWeight);
- cairo_set_font_size(cr, fontSize);
- cairo_text_extents(cr, text, &extents);
- cairo_save(cr);
- cairo_move_to(cr, x, y);
- cairo_text_path(cr, text);
- cairo_fill_preserve(cr);
- annoSetSourceColor(cr, strokeColor);
- cairo_stroke(cr);
- cairo_restore(cr);
-
- reg.rects = &reg.extents;
- reg.numRects = 1;
-
- reg.extents.x1 = x;
- reg.extents.y1 = y + extents.y_bearing - 2.0;
- reg.extents.x2 = x + extents.width + 20.0;
- reg.extents.y2 = y + extents.height;
-
- as->content[contextID] = TRUE;
- damageScreenRegion(s, &reg);
- }
+ REGION reg;
+ cairo_t *cr;
+
+ ANNO_SCREEN (s);
+
+ cr = annoCairoContext (s, contextID);
+ if (cr)
+ {
+ cairo_text_extents_t extents;
+
+ cairo_set_line_width (cr, strokeWidth);
+ annoSetSourceColor (cr, fillColor);
+ cairo_select_font_face (cr, fontFamily, fontSlant, fontWeight);
+ cairo_set_font_size (cr, fontSize);
+ cairo_text_extents (cr, text, &extents);
+ cairo_save (cr);
+ cairo_move_to (cr, x, y);
+ cairo_text_path (cr, text);
+ cairo_fill_preserve (cr);
+ annoSetSourceColor (cr, strokeColor);
+ cairo_stroke (cr);
+ cairo_restore (cr);
+
+ reg.rects = &reg.extents;
+ reg.numRects = 1;
+
+ reg.extents.x1 = x;
+ reg.extents.y1 = y + extents.y_bearing - 2.0;
+ reg.extents.x2 = x + extents.width + 20.0;
+ reg.extents.y2 = y + extents.height;
+
+ as->content[contextID] = TRUE;
+ damageScreenRegion (s, &reg);
+ }
}
static Bool
-annoCanvasTransform (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
+annoCanvasTransform (CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
CompScreen *s;
- Window xid;
- double p1, p2;
- char *type;
+ Window xid;
+ double p1, p2;
+ char *type;
- xid = getIntOptionNamed (option, nOption, "root", 0);
+ xid = getIntOptionNamed (option, nOption, "root", 0);
s = findScreenAtDisplay (d, xid);
if (s)
{
- cairo_t *cr;
- int contextID;
+ cairo_t *cr;
+ int contextID;
- ANNO_SCREEN (s);
+ ANNO_SCREEN (s);
- contextID = getIntOptionNamed (option, nOption, "context", as->currentContext);
- cr = annoCairoContext (s, contextID);
- if (cr)
- {
- type = getStringOptionNamed (option, nOption, "type", "");
+ contextID =
+ getIntOptionNamed (option, nOption, "context",
+ as->currentContext);
+ cr = annoCairoContext (s, contextID);
+ if (cr)
+ {
+ type = getStringOptionNamed (option, nOption, "type", "");
if (type)
{
- if (strcasecmp (type, "save")==0)
- {
- cairo_save (cr);
- return TRUE;
- }
- else if (strcasecmp (type, "restore")==0)
- {
- cairo_restore (cr);
- return TRUE;
- }
- else if (strcasecmp (type, "translate")==0)
- {
- p1 = getFloatOptionNamed (option, nOption, "x", 0.0);
- p2 = getFloatOptionNamed (option, nOption, "y", 0.0);
- if (p1 || p2)
- {
- cairo_translate (cr, p1, p2);
- return TRUE;
- }
- return FALSE;
- }
- else if (strcasecmp (type, "scale")==0)
- {
- p1 = getFloatOptionNamed (option, nOption, "x", 0.0);
- p2 = getFloatOptionNamed (option, nOption, "y", 0.0);
- if (p1 || p2)
- {
- cairo_scale (cr, p1, p2);
- return TRUE;
- }
- return FALSE;
- }
- else if (strcasecmp (type, "rotate")==0)
- {
- p1 = getFloatOptionNamed (option, nOption, "angle", 0.0);
- if (p1)
- {
- cairo_rotate (cr, p1);
- return TRUE;
- }
- return FALSE;
- }
+ if (strcasecmp (type, "save") == 0)
+ {
+ cairo_save (cr);
+ return TRUE;
+ }
+ else if (strcasecmp (type, "restore") == 0)
+ {
+ cairo_restore (cr);
+ return TRUE;
+ }
+ else if (strcasecmp (type, "translate") == 0)
+ {
+ p1 = getFloatOptionNamed (option, nOption, "x", 0.0);
+ p2 = getFloatOptionNamed (option, nOption, "y", 0.0);
+ if (p1 || p2)
+ {
+ cairo_translate (cr, p1, p2);
+ return TRUE;
+ }
+ return FALSE;
+ }
+ else if (strcasecmp (type, "scale") == 0)
+ {
+ p1 = getFloatOptionNamed (option, nOption, "x", 0.0);
+ p2 = getFloatOptionNamed (option, nOption, "y", 0.0);
+ if (p1 || p2)
+ {
+ cairo_scale (cr, p1, p2);
+ return TRUE;
+ }
+ return FALSE;
+ }
+ else if (strcasecmp (type, "rotate") == 0)
+ {
+ p1 = getFloatOptionNamed (option, nOption, "angle", 0.0);
+ if (p1)
+ {
+ cairo_rotate (cr, p1);
+ return TRUE;
+ }
+ return FALSE;
+ }
}
}
}
@@ -631,824 +626,842 @@ annoCanvasTransform (CompDisplay *d,
}
static Bool
-annoDraw(CompDisplay * d,
- CompAction * action,
- CompActionState state,
- CompOption *option,
- int nOption)
+annoDraw (CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
-
- xid = getIntOptionNamed(option, nOption, "root", 0);
-
- s = findScreenAtDisplay(d, xid);
- if (s) {
- cairo_t *cr;
- int context;
-
- ANNO_SCREEN (s);
-
- context = getIntOptionNamed (option, nOption, "context", as->currentContext);
- cr = annoCairoContext(s, context);
- if (cr) {
- char *tool;
- unsigned short *fillColor, *strokeColor;
- double lineWidth, strokeWidth, angle;
- int context;
-
- ANNO_DISPLAY(d);
-
- context = getIntOptionNamed (option, nOption, "context", as->currentContext);
-
- tool =
- getStringOptionNamed(option, nOption, "tool",
- "line");
-
- cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
- cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
-
- fillColor = ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.c;
- fillColor = getColorOptionNamed(option, nOption, "fill_color",
- fillColor);
-
- strokeColor = ad->opt[ANNO_DISPLAY_OPTION_STROKE_COLOR].value.c;
- strokeColor = getColorOptionNamed(option, nOption,
- "stroke_color", strokeColor);
-
- strokeWidth = ad->opt[ANNO_DISPLAY_OPTION_STROKE_WIDTH].value.f;
- strokeWidth = getFloatOptionNamed(option, nOption, "stroke_width",
- strokeWidth);
-
- lineWidth = ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH].value.f;
- lineWidth = getFloatOptionNamed(option, nOption, "line_width",
- lineWidth);
-
- angle = getFloatOptionNamed (option, nOption, "angle",
- 0.0);
-
- if (strcasecmp(tool, "rectangle") == 0) {
- double x, y, w, h;
-
- x = getFloatOptionNamed(option, nOption, "x", 0);
- y = getFloatOptionNamed(option, nOption, "y", 0);
- w = getFloatOptionNamed(option, nOption, "w", 100);
- h = getFloatOptionNamed(option, nOption, "h", 100);
-
- annoDrawRectangle(s, context, x, y, w, h, fillColor,
- strokeColor,
- strokeWidth,
- angle);
- } else if (strcasecmp(tool, "circle") == 0) {
- double xc, yc, r;
-
- xc = getFloatOptionNamed(option, nOption, "xc", 0);
- yc = getFloatOptionNamed(option, nOption, "yc", 0);
- r = getFloatOptionNamed(option, nOption, "radius", 100);
-
- annoDrawCircle(s, context, xc, yc, r, fillColor,
- strokeColor, strokeWidth);
- } else if (strcasecmp(tool, "line") == 0) {
- double x1, y1, x2, y2;
-
- x1 = getFloatOptionNamed(option, nOption, "x1", 0);
- y1 = getFloatOptionNamed(option, nOption, "y1", 0);
- x2 = getFloatOptionNamed(option, nOption, "x2", 100);
- y2 = getFloatOptionNamed(option, nOption, "y2", 100);
-
- annoDrawLine(s, context, x1, y1, x2, y2, lineWidth,
- fillColor);
- } else if (strcasecmp(tool, "text") == 0) {
- double x, y, size;
- char *text, *family;
- unsigned int slant, weight;
- char *str;
-
- str = getStringOptionNamed(option, nOption, "slant", "");
- if (strcasecmp(str, "oblique") == 0)
- slant = CAIRO_FONT_SLANT_OBLIQUE;
- else if (strcasecmp(str, "italic") == 0)
- slant = CAIRO_FONT_SLANT_ITALIC;
- else
- slant = CAIRO_FONT_SLANT_NORMAL;
-
- str = getStringOptionNamed(option, nOption, "weight", "");
- if (strcasecmp(str, "bold") == 0)
- weight = CAIRO_FONT_WEIGHT_BOLD;
- else
- weight = CAIRO_FONT_WEIGHT_NORMAL;
-
- x = getFloatOptionNamed(option, nOption, "x", 0);
- y = getFloatOptionNamed(option, nOption, "y", 0);
- text = getStringOptionNamed(option, nOption, "text", "");
- family = getStringOptionNamed(option, nOption, "family",
- "Sans");
- size = getFloatOptionNamed(option, nOption, "size", 36.0);
-
- annoDrawText(s, context, x, y, text, family, size,
- slant, weight, fillColor,
- strokeColor, strokeWidth);
- }
- else if (strcasecmp (tool, "svg") == 0) {
- double x, y, scaleX, scaleY;
- int handleID;
-
- x = getFloatOptionNamed (option, nOption, "x", 0);
- y = getFloatOptionNamed (option, nOption, "y", 0);
- scaleX = getFloatOptionNamed (option, nOption, "scale_x",
- 1.0);
- scaleY = getFloatOptionNamed (option, nOption, "scale_y",
- 1.0);
- handleID = getIntOptionNamed (option, nOption, "handle_id",
- 0);
-
- annoDrawSvg (s, context, handleID, x, y, angle, scaleX,
- scaleY);
- }
-
- }
- }
-
- return FALSE;
+ CompScreen *s;
+ Window xid;
+
+ xid = getIntOptionNamed (option, nOption, "root", 0);
+
+ s = findScreenAtDisplay (d, xid);
+ if (s)
+ {
+ cairo_t *cr;
+ int context;
+
+ ANNO_SCREEN (s);
+
+ context =
+ getIntOptionNamed (option, nOption, "context",
+ as->currentContext);
+ cr = annoCairoContext (s, context);
+ if (cr)
+ {
+ char *tool;
+ unsigned short *fillColor, *strokeColor;
+ double lineWidth, strokeWidth, angle;
+ int context;
+
+ ANNO_DISPLAY (d);
+
+ context =
+ getIntOptionNamed (option, nOption, "context",
+ as->currentContext);
+
+ tool = getStringOptionNamed (option, nOption, "tool", "line");
+
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+
+ fillColor = ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.c;
+ fillColor = getColorOptionNamed (option, nOption, "fill_color",
+ fillColor);
+
+ strokeColor = ad->opt[ANNO_DISPLAY_OPTION_STROKE_COLOR].value.c;
+ strokeColor = getColorOptionNamed (option, nOption,
+ "stroke_color", strokeColor);
+
+ strokeWidth = ad->opt[ANNO_DISPLAY_OPTION_STROKE_WIDTH].value.f;
+ strokeWidth =
+ getFloatOptionNamed (option, nOption, "stroke_width",
+ strokeWidth);
+
+ lineWidth = ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH].value.f;
+ lineWidth = getFloatOptionNamed (option, nOption, "line_width",
+ lineWidth);
+
+ angle = getFloatOptionNamed (option, nOption, "angle", 0.0);
+
+ if (strcasecmp (tool, "rectangle") == 0)
+ {
+ double x, y, w, h;
+
+ x = getFloatOptionNamed (option, nOption, "x", 0);
+ y = getFloatOptionNamed (option, nOption, "y", 0);
+ w = getFloatOptionNamed (option, nOption, "w", 100);
+ h = getFloatOptionNamed (option, nOption, "h", 100);
+
+ annoDrawRectangle (s, context, x, y, w, h, fillColor,
+ strokeColor, strokeWidth, angle);
+ }
+ else if (strcasecmp (tool, "circle") == 0)
+ {
+ double xc, yc, r;
+
+ xc = getFloatOptionNamed (option, nOption, "xc", 0);
+ yc = getFloatOptionNamed (option, nOption, "yc", 0);
+ r = getFloatOptionNamed (option, nOption, "radius", 100);
+
+ annoDrawCircle (s, context, xc, yc, r, fillColor,
+ strokeColor, strokeWidth);
+ }
+ else if (strcasecmp (tool, "line") == 0)
+ {
+ double x1, y1, x2, y2;
+
+ x1 = getFloatOptionNamed (option, nOption, "x1", 0);
+ y1 = getFloatOptionNamed (option, nOption, "y1", 0);
+ x2 = getFloatOptionNamed (option, nOption, "x2", 100);
+ y2 = getFloatOptionNamed (option, nOption, "y2", 100);
+
+ annoDrawLine (s, context, x1, y1, x2, y2, lineWidth,
+ fillColor);
+ }
+ else if (strcasecmp (tool, "text") == 0)
+ {
+ double x, y, size;
+ char *text, *family;
+ unsigned int slant, weight;
+ char *str;
+
+ str = getStringOptionNamed (option, nOption, "slant", "");
+ if (strcasecmp (str, "oblique") == 0)
+ slant = CAIRO_FONT_SLANT_OBLIQUE;
+ else if (strcasecmp (str, "italic") == 0)
+ slant = CAIRO_FONT_SLANT_ITALIC;
+ else
+ slant = CAIRO_FONT_SLANT_NORMAL;
+
+ str = getStringOptionNamed (option, nOption, "weight", "");
+ if (strcasecmp (str, "bold") == 0)
+ weight = CAIRO_FONT_WEIGHT_BOLD;
+ else
+ weight = CAIRO_FONT_WEIGHT_NORMAL;
+
+ x = getFloatOptionNamed (option, nOption, "x", 0);
+ y = getFloatOptionNamed (option, nOption, "y", 0);
+ text = getStringOptionNamed (option, nOption, "text", "");
+ family = getStringOptionNamed (option, nOption, "family",
+ "Sans");
+ size = getFloatOptionNamed (option, nOption, "size", 36.0);
+
+ annoDrawText (s, context, x, y, text, family, size,
+ slant, weight, fillColor,
+ strokeColor, strokeWidth);
+ }
+ else if (strcasecmp (tool, "svg") == 0)
+ {
+ double x, y, scaleX, scaleY;
+ int handleID;
+
+ x = getFloatOptionNamed (option, nOption, "x", 0);
+ y = getFloatOptionNamed (option, nOption, "y", 0);
+ scaleX = getFloatOptionNamed (option, nOption, "scale_x",
+ 1.0);
+ scaleY = getFloatOptionNamed (option, nOption, "scale_y",
+ 1.0);
+ handleID = getIntOptionNamed (option, nOption, "handle_id",
+ 0);
+
+ annoDrawSvg (s, context, handleID, x, y, angle, scaleX,
+ scaleY);
+ }
+
+ }
+ }
+
+ return FALSE;
}
static Bool
-annoInitiate(CompDisplay * d,
- CompAction * action,
- CompActionState state,
- CompOption *option,
- int nOption)
+annoInitiate (CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
- xid = getIntOptionNamed(option, nOption, "root", 0);
+ xid = getIntOptionNamed (option, nOption, "root", 0);
- s = findScreenAtDisplay(d, xid);
- if (s) {
- ANNO_SCREEN(s);
+ s = findScreenAtDisplay (d, xid);
+ if (s)
+ {
+ ANNO_SCREEN (s);
- if (otherScreenGrabExist(s, 0))
- return FALSE;
+ if (otherScreenGrabExist (s, 0))
+ return FALSE;
- if (!as->grabIndex)
- as->grabIndex = pushScreenGrab(s, None, "annotate");
+ if (!as->grabIndex)
+ as->grabIndex = pushScreenGrab (s, None, "annotate");
- if (state & CompActionStateInitButton)
- action->state |= CompActionStateTermButton;
+ if (state & CompActionStateInitButton)
+ action->state |= CompActionStateTermButton;
- if (state & CompActionStateInitKey)
- action->state |= CompActionStateTermKey;
+ if (state & CompActionStateInitKey)
+ action->state |= CompActionStateTermKey;
- annoLastPointerX = d->pointerX;
- annoLastPointerY = d->pointerY;
+ annoLastPointerX = d->pointerX;
+ annoLastPointerY = d->pointerY;
- as->eraseMode = FALSE;
- }
+ as->eraseMode = FALSE;
+ }
- return TRUE;
+ return TRUE;
}
static Bool
-annoTerminate(CompDisplay * d,
- CompAction * action,
- CompActionState state,
- CompOption *option,
- int nOption)
+annoTerminate (CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
- xid = getIntOptionNamed(option, nOption, "root", 0);
+ xid = getIntOptionNamed (option, nOption, "root", 0);
- for (s = d->screens; s; s = s->next) {
- ANNO_SCREEN(s);
+ for (s = d->screens; s; s = s->next)
+ {
+ ANNO_SCREEN (s);
- if (xid && s->root != xid)
- continue;
+ if (xid && s->root != xid)
+ continue;
- if (as->grabIndex) {
- removeScreenGrab(s, as->grabIndex, NULL);
- as->grabIndex = 0;
- }
- }
+ if (as->grabIndex)
+ {
+ removeScreenGrab (s, as->grabIndex, NULL);
+ as->grabIndex = 0;
+ }
+ }
- action->state &=
- ~(CompActionStateTermKey | CompActionStateTermButton);
+ action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);
- return FALSE;
+ return FALSE;
}
static Bool
-annoEraseInitiate(CompDisplay * d,
- CompAction * action,
- CompActionState state,
- CompOption *option,
- int nOption)
+annoEraseInitiate (CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
- xid = getIntOptionNamed(option, nOption, "root", 0);
+ xid = getIntOptionNamed (option, nOption, "root", 0);
- s = findScreenAtDisplay(d, xid);
- if (s) {
- ANNO_SCREEN(s);
+ s = findScreenAtDisplay (d, xid);
+ if (s)
+ {
+ ANNO_SCREEN (s);
- if (otherScreenGrabExist(s, 0))
- return FALSE;
+ if (otherScreenGrabExist (s, 0))
+ return FALSE;
- if (!as->grabIndex)
- as->grabIndex = pushScreenGrab(s, None, "annotate");
+ if (!as->grabIndex)
+ as->grabIndex = pushScreenGrab (s, None, "annotate");
- if (state & CompActionStateInitButton)
- action->state |= CompActionStateTermButton;
+ if (state & CompActionStateInitButton)
+ action->state |= CompActionStateTermButton;
- if (state & CompActionStateInitKey)
- action->state |= CompActionStateTermKey;
+ if (state & CompActionStateInitKey)
+ action->state |= CompActionStateTermKey;
- annoLastPointerX = d->pointerX;
- annoLastPointerY = d->pointerY;
+ annoLastPointerX = d->pointerX;
+ annoLastPointerY = d->pointerY;
- as->eraseMode = TRUE;
- }
+ as->eraseMode = TRUE;
+ }
- return TRUE;
+ return TRUE;
}
static Bool
-annoClear(CompDisplay * d,
- CompAction * action,
- CompActionState state,
- CompOption *option,
- int nOption)
+annoClear (CompDisplay * d,
+ CompAction * action,
+ CompActionState state, CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
- xid = getIntOptionNamed(option, nOption, "root", 0);
+ xid = getIntOptionNamed (option, nOption, "root", 0);
- s = findScreenAtDisplay(d, xid);
- if (s) {
- int contextID;
+ s = findScreenAtDisplay (d, xid);
+ if (s)
+ {
+ int contextID;
- ANNO_SCREEN(s);
+ ANNO_SCREEN (s);
- contextID = getIntOptionNamed (option, nOption, "context",
- as->currentContext);
+ contextID = getIntOptionNamed (option, nOption, "context",
+ as->currentContext);
- if (as->content[contextID]) {
- cairo_t *cr;
+ if (as->content[contextID])
+ {
+ cairo_t *cr;
- cr = annoCairoContext(s, contextID);
- if (cr)
- annoCairoClear(s, as->cairo[contextID], contextID);
+ cr = annoCairoContext (s, contextID);
+ if (cr)
+ annoCairoClear (s, as->cairo[contextID], contextID);
- as->content[contextID] = FALSE;
+ as->content[contextID] = FALSE;
- if (contextID == as->currentContext)
- damageScreen(s);
- }
+ if (contextID == as->currentContext)
+ damageScreen (s);
+ }
- return TRUE;
- }
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
static Bool
-annoPaintScreen(CompScreen * s,
- const ScreenPaintAttrib * sAttrib,
- Region region,
- int output,
- unsigned int mask)
+annoPaintScreen (CompScreen * s,
+ const ScreenPaintAttrib * sAttrib,
+ Region region, int output, unsigned int mask)
{
- Bool status;
-
- ANNO_SCREEN(s);
-
- UNWRAP(as, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, output, mask);
- WRAP(as, s, paintScreen, annoPaintScreen);
-
- if (status && as->content[as->currentContext] && region->numRects) {
- BoxPtr pBox;
- int nBox;
-
- glPushMatrix();
-
- prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
-
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnable(GL_BLEND);
-
- enableTexture(s, &as->texture[as->currentContext],
- COMP_TEXTURE_FILTER_FAST);
-
- pBox = region->rects;
- nBox = region->numRects;
-
- glBegin(GL_QUADS);
-
- while (nBox--)
- {
- glTexCoord2f (
- COMP_TEX_COORD_X (&as->texture[as->currentContext].matrix,
- pBox->x1),
- COMP_TEX_COORD_Y (&as->texture[as->currentContext].matrix,
- pBox->y2));
- glVertex2i (pBox->x1, pBox->y2);
- glTexCoord2f (
- COMP_TEX_COORD_X (&as->texture[as->currentContext].matrix,
- pBox->x2),
- COMP_TEX_COORD_Y (&as->texture[as->currentContext].matrix,
- pBox->y2));
- glVertex2i (pBox->x2, pBox->y2);
- glTexCoord2f (
- COMP_TEX_COORD_X (&as->texture[as->currentContext].matrix,
- pBox->x2),
- COMP_TEX_COORD_Y (&as->texture[as->currentContext].matrix,
- pBox->y1));
- glVertex2i (pBox->x2, pBox->y1);
- glTexCoord2f (
- COMP_TEX_COORD_X (&as->texture[as->currentContext].matrix,
- pBox->x1),
- COMP_TEX_COORD_Y (&as->texture[as->currentContext].matrix,
- pBox->y1));
- glVertex2i (pBox->x1, pBox->y1);
-
- pBox++;
- }
-
- glEnd ();
-
- disableTexture (s, &as->texture[as->currentContext]);
-
- glDisable(GL_BLEND);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-
- glPopMatrix();
- }
-
- return status;
+ Bool status;
+
+ ANNO_SCREEN (s);
+
+ UNWRAP (as, s, paintScreen);
+ status = (*s->paintScreen) (s, sAttrib, region, output, mask);
+ WRAP (as, s, paintScreen, annoPaintScreen);
+
+ if (status && as->content[as->currentContext] && region->numRects)
+ {
+ BoxPtr pBox;
+ int nBox;
+
+ glPushMatrix ();
+
+ prepareXCoords (s, output, -DEFAULT_Z_CAMERA);
+
+ glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+ glEnable (GL_BLEND);
+
+ enableTexture (s, &as->texture[as->currentContext],
+ COMP_TEXTURE_FILTER_FAST);
+
+ pBox = region->rects;
+ nBox = region->numRects;
+
+ glBegin (GL_QUADS);
+
+ while (nBox--)
+ {
+ glTexCoord2f (COMP_TEX_COORD_X
+ (&as->texture[as->currentContext].matrix, pBox->x1),
+ COMP_TEX_COORD_Y (&as->texture[as->currentContext].
+ matrix, pBox->y2));
+ glVertex2i (pBox->x1, pBox->y2);
+ glTexCoord2f (COMP_TEX_COORD_X
+ (&as->texture[as->currentContext].matrix, pBox->x2),
+ COMP_TEX_COORD_Y (&as->texture[as->currentContext].
+ matrix, pBox->y2));
+ glVertex2i (pBox->x2, pBox->y2);
+ glTexCoord2f (COMP_TEX_COORD_X
+ (&as->texture[as->currentContext].matrix, pBox->x2),
+ COMP_TEX_COORD_Y (&as->texture[as->currentContext].
+ matrix, pBox->y1));
+ glVertex2i (pBox->x2, pBox->y1);
+ glTexCoord2f (COMP_TEX_COORD_X
+ (&as->texture[as->currentContext].matrix, pBox->x1),
+ COMP_TEX_COORD_Y (&as->texture[as->currentContext].
+ matrix, pBox->y1));
+ glVertex2i (pBox->x1, pBox->y1);
+
+ pBox++;
+ }
+
+ glEnd ();
+
+ disableTexture (s, &as->texture[as->currentContext]);
+
+ glDisable (GL_BLEND);
+ glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+
+ glPopMatrix ();
+ }
+
+ return status;
}
-static void annoHandleMotionEvent(CompScreen * s, int xRoot, int yRoot)
+static void
+annoHandleMotionEvent (CompScreen * s, int xRoot, int yRoot)
{
- ANNO_SCREEN(s);
-
- if (as->grabIndex)
- {
- if (as->eraseMode)
- {
- static unsigned short color[] = { 0, 0, 0, 0 };
-
- annoDrawLine (s, as->currentContext,
- annoLastPointerX, annoLastPointerY,
- xRoot, yRoot,
- 20.0, color);
- }
- else
- {
- char *currentTool;
-
- ANNO_DISPLAY(s->display);
-
- currentTool = ad->opt[ANNO_DISPLAY_OPTION_TOOL].value.s;
-
- if ( strcmp (currentTool, "svg") == 0 ){
- /*annoDrawSvg (s, as->currentContext,
- ad->opt[ANNO_DISPLAY_OPTION_SVG_FILE].value.s,
- xRoot, yRoot,
- 0.0, 1.0, 1.0);*/
- }
- else {
- annoDrawLine (s, as->currentContext,
- annoLastPointerX, annoLastPointerY,
- xRoot, yRoot,
- ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH].value.f,
- ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.c);
- }
- }
-
- annoLastPointerX = xRoot;
- annoLastPointerY = yRoot;
- }
+ ANNO_SCREEN (s);
+
+ if (as->grabIndex)
+ {
+ if (as->eraseMode)
+ {
+ static unsigned short color[] = { 0, 0, 0, 0 };
+
+ annoDrawLine (s, as->currentContext,
+ annoLastPointerX, annoLastPointerY,
+ xRoot, yRoot, 20.0, color);
+ }
+ else
+ {
+ char *currentTool;
+
+ ANNO_DISPLAY (s->display);
+
+ currentTool = ad->opt[ANNO_DISPLAY_OPTION_TOOL].value.s;
+
+ if (strcmp (currentTool, "svg") == 0)
+ {
+ /*annoDrawSvg (s, as->currentContext,
+ ad->opt[ANNO_DISPLAY_OPTION_SVG_FILE].value.s,
+ xRoot, yRoot,
+ 0.0, 1.0, 1.0); */
+ }
+ else
+ {
+ annoDrawLine (s, as->currentContext,
+ annoLastPointerX, annoLastPointerY,
+ xRoot, yRoot,
+ ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH].value.f,
+ ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.
+ c);
+ }
+ }
+
+ annoLastPointerX = xRoot;
+ annoLastPointerY = yRoot;
+ }
}
-static void annoHandleEvent(CompDisplay *d, XEvent *event)
+static void
+annoHandleEvent (CompDisplay * d, XEvent * event)
{
- CompScreen *s;
-
- ANNO_DISPLAY(d);
-
- switch (event->type) {
- case MotionNotify:
- s = findScreenAtDisplay(d, event->xmotion.root);
- if (s)
- annoHandleMotionEvent(s, d->pointerX, d->pointerY);
- break;
- case EnterNotify:
- case LeaveNotify:
- s = findScreenAtDisplay(d, event->xcrossing.root);
- if (s)
- annoHandleMotionEvent(s, d->pointerX, d->pointerY);
- default:
- break;
- }
-
- UNWRAP(ad, d, handleEvent);
- (*d->handleEvent) (d, event);
- WRAP(ad, d, handleEvent, annoHandleEvent);
+ CompScreen *s;
+
+ ANNO_DISPLAY (d);
+
+ switch (event->type)
+ {
+ case MotionNotify:
+ s = findScreenAtDisplay (d, event->xmotion.root);
+ if (s)
+ annoHandleMotionEvent (s, d->pointerX, d->pointerY);
+ break;
+ case EnterNotify:
+ case LeaveNotify:
+ s = findScreenAtDisplay (d, event->xcrossing.root);
+ if (s)
+ annoHandleMotionEvent (s, d->pointerX, d->pointerY);
+ default:
+ break;
+ }
+
+ UNWRAP (ad, d, handleEvent);
+ (*d->handleEvent) (d, event);
+ WRAP (ad, d, handleEvent, annoHandleEvent);
}
-static void annoDisplayInitOptions(AnnoDisplay * ad)
+static void
+annoDisplayInitOptions (AnnoDisplay * ad)
{
- CompOption *o;
-
- o = &ad->opt[ANNO_DISPLAY_OPTION_INITIATE];
- o->name = "initiate";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Initiate");
- o->longDesc = N_("Initiate annotate drawing");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = annoInitiate;
- o->value.action.terminate = annoTerminate;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = CompBindingTypeButton;
- o->value.action.state = CompActionStateInitButton;
- o->value.action.state |= CompActionStateInitKey;
- o->value.action.button.modifiers =
- ANNO_INITIATE_BUTTON_MODIFIERS_DEFAULT;
- o->value.action.button.button = ANNO_INITIATE_BUTTON_DEFAULT;
-
- o = &ad->opt[ANNO_DISPLAY_OPTION_DRAW];
- o->name = "draw";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Draw");
- o->longDesc = N_("Draw using tool");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = annoDraw;
- o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = 0;
- o->value.action.state = 0;
+ CompOption *o;
+
+ o = &ad->opt[ANNO_DISPLAY_OPTION_INITIATE];
+ o->name = "initiate";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Initiate");
+ o->longDesc = N_("Initiate annotate drawing");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = annoInitiate;
+ o->value.action.terminate = annoTerminate;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = CompBindingTypeButton;
+ o->value.action.state = CompActionStateInitButton;
+ o->value.action.state |= CompActionStateInitKey;
+ o->value.action.button.modifiers = ANNO_INITIATE_BUTTON_MODIFIERS_DEFAULT;
+ o->value.action.button.button = ANNO_INITIATE_BUTTON_DEFAULT;
+
+ o = &ad->opt[ANNO_DISPLAY_OPTION_DRAW];
+ o->name = "draw";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Draw");
+ o->longDesc = N_("Draw using tool");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = annoDraw;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = 0;
+ o->value.action.state = 0;
o = &ad->opt[ANNO_DISPLAY_OPTION_TRANSFORM];
- o->name = "transform";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Transform the canvas");
- o->longDesc = N_("Transform the canvas, also used to save and restore");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = annoCanvasTransform;
+ o->name = "transform";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Transform the canvas");
+ o->longDesc = N_("Transform the canvas, also used to save and restore");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = annoCanvasTransform;
o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = 0;
- o->value.action.state = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = 0;
+ o->value.action.state = 0;
o = &ad->opt[ANNO_DISPLAY_OPTION_PRELOAD];
- o->name = "preload";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Preload a svg");
- o->longDesc = N_("Preload a svg");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = annoLoadSvg;
+ o->name = "preload";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Preload a svg");
+ o->longDesc = N_("Preload a svg");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = annoLoadSvg;
o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = 0;
- o->value.action.state = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = 0;
+ o->value.action.state = 0;
o = &ad->opt[ANNO_DISPLAY_OPTION_SWITCH_CONTEXT];
- o->name = "switch_context";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Switch to another canvas");
- o->longDesc = N_("Switch to another canvas for drawing");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = annoCanvasSwitchContext;
+ o->name = "switch_context";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Switch to another canvas");
+ o->longDesc = N_("Switch to another canvas for drawing");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = annoCanvasSwitchContext;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = 0;
+ o->value.action.state = 0;
+
+ o = &ad->opt[ANNO_DISPLAY_OPTION_ERASE];
+ o->name = "erase";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Initiate erase");
+ o->longDesc = N_("Initiate annotate erasing");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = annoEraseInitiate;
+ o->value.action.terminate = annoTerminate;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = CompBindingTypeButton;
+ o->value.action.state = CompActionStateInitButton;
+ o->value.action.state |= CompActionStateInitKey;
+ o->value.action.button.modifiers = ANNO_ERASE_BUTTON_MODIFIERS_DEFAULT;
+ o->value.action.button.button = ANNO_ERASE_BUTTON_DEFAULT;
+
+ o = &ad->opt[ANNO_DISPLAY_OPTION_CLEAR];
+ o->name = "clear";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Clear");
+ o->longDesc = N_("Clear");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = annoClear;
o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = 0;
- o->value.action.state = 0;
-
- o = &ad->opt[ANNO_DISPLAY_OPTION_ERASE];
- o->name = "erase";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Initiate erase");
- o->longDesc = N_("Initiate annotate erasing");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = annoEraseInitiate;
- o->value.action.terminate = annoTerminate;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = CompBindingTypeButton;
- o->value.action.state = CompActionStateInitButton;
- o->value.action.state |= CompActionStateInitKey;
- o->value.action.button.modifiers = ANNO_ERASE_BUTTON_MODIFIERS_DEFAULT;
- o->value.action.button.button = ANNO_ERASE_BUTTON_DEFAULT;
-
- o = &ad->opt[ANNO_DISPLAY_OPTION_CLEAR];
- o->name = "clear";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Clear");
- o->longDesc = N_("Clear");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = annoClear;
- o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = CompBindingTypeKey;
- o->value.action.state = CompActionStateInitEdge;
- o->value.action.state |= CompActionStateInitButton;
- o->value.action.state |= CompActionStateInitKey;
- o->value.action.key.modifiers = ANNO_CLEAR_KEY_MODIFIERS_DEFAULT;
- o->value.action.key.keysym = XStringToKeysym(ANNO_CLEAR_KEY_DEFAULT);
-
- o = &ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR];
- o->name = "fill_color";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Annotate Fill Color");
- o->longDesc = N_("Fill color for annotations");
- o->type = CompOptionTypeColor;
- o->value.c[0] = ANNO_FILL_COLOR_RED_DEFAULT;
- o->value.c[1] = ANNO_FILL_COLOR_GREEN_DEFAULT;
- o->value.c[2] = ANNO_FILL_COLOR_BLUE_DEFAULT;
- o->value.c[3] = 0xffff;
-
- o = &ad->opt[ANNO_DISPLAY_OPTION_STROKE_COLOR];
- o->name = "stroke_color";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Annotate Stroke Color");
- o->longDesc = N_("Stroke color for annotations");
- o->type = CompOptionTypeColor;
- o->value.c[0] = ANNO_STROKE_COLOR_RED_DEFAULT;
- o->value.c[1] = ANNO_STROKE_COLOR_GREEN_DEFAULT;
- o->value.c[2] = ANNO_STROKE_COLOR_BLUE_DEFAULT;
- o->value.c[3] = 0xffff;
-
- o = &ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH];
- o->name = "line_width";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Line width");
- o->longDesc = N_("Line width for annotations");
- o->type = CompOptionTypeFloat;
- o->value.f = ANNO_LINE_WIDTH_DEFAULT;
- o->rest.f.min = ANNO_LINE_WIDTH_MIN;
- o->rest.f.max = ANNO_LINE_WIDTH_MAX;
- o->rest.f.precision = ANNO_LINE_WIDTH_PRECISION;
-
- o = &ad->opt[ANNO_DISPLAY_OPTION_STROKE_WIDTH];
- o->name = "stroke_width";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Stroke width");
- o->longDesc = N_("Stroke width for annotations");
- o->type = CompOptionTypeFloat;
- o->value.f = ANNO_STROKE_WIDTH_DEFAULT;
- o->rest.f.min = ANNO_STROKE_WIDTH_MIN;
- o->rest.f.max = ANNO_STROKE_WIDTH_MAX;
- o->rest.f.precision = ANNO_STROKE_WIDTH_PRECISION;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.state = CompActionStateInitEdge;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.state |= CompActionStateInitKey;
+ o->value.action.key.modifiers = ANNO_CLEAR_KEY_MODIFIERS_DEFAULT;
+ o->value.action.key.keysym = XStringToKeysym (ANNO_CLEAR_KEY_DEFAULT);
+
+ o = &ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR];
+ o->name = "fill_color";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Annotate Fill Color");
+ o->longDesc = N_("Fill color for annotations");
+ o->type = CompOptionTypeColor;
+ o->value.c[0] = ANNO_FILL_COLOR_RED_DEFAULT;
+ o->value.c[1] = ANNO_FILL_COLOR_GREEN_DEFAULT;
+ o->value.c[2] = ANNO_FILL_COLOR_BLUE_DEFAULT;
+ o->value.c[3] = 0xffff;
+
+ o = &ad->opt[ANNO_DISPLAY_OPTION_STROKE_COLOR];
+ o->name = "stroke_color";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Annotate Stroke Color");
+ o->longDesc = N_("Stroke color for annotations");
+ o->type = CompOptionTypeColor;
+ o->value.c[0] = ANNO_STROKE_COLOR_RED_DEFAULT;
+ o->value.c[1] = ANNO_STROKE_COLOR_GREEN_DEFAULT;
+ o->value.c[2] = ANNO_STROKE_COLOR_BLUE_DEFAULT;
+ o->value.c[3] = 0xffff;
+
+ o = &ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH];
+ o->name = "line_width";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Line width");
+ o->longDesc = N_("Line width for annotations");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANNO_LINE_WIDTH_DEFAULT;
+ o->rest.f.min = ANNO_LINE_WIDTH_MIN;
+ o->rest.f.max = ANNO_LINE_WIDTH_MAX;
+ o->rest.f.precision = ANNO_LINE_WIDTH_PRECISION;
+
+ o = &ad->opt[ANNO_DISPLAY_OPTION_STROKE_WIDTH];
+ o->name = "stroke_width";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Stroke width");
+ o->longDesc = N_("Stroke width for annotations");
+ o->type = CompOptionTypeFloat;
+ o->value.f = ANNO_STROKE_WIDTH_DEFAULT;
+ o->rest.f.min = ANNO_STROKE_WIDTH_MIN;
+ o->rest.f.max = ANNO_STROKE_WIDTH_MAX;
+ o->rest.f.precision = ANNO_STROKE_WIDTH_PRECISION;
o = &ad->opt[ANNO_DISPLAY_OPTION_SVG_FILE];
- o->name = "svg_file";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("SVG (custom brush) filename");
- o->longDesc = N_("SVG (custom brush) filename");
- o->type = CompOptionTypeString;
- o->value.s = strdup("");
+ o->name = "svg_file";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("SVG (custom brush) filename");
+ o->longDesc = N_("SVG (custom brush) filename");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup ("");
o->rest.s.string = 0;
o->rest.s.nString = 0;
o = &ad->opt[ANNO_DISPLAY_OPTION_TOOL];
- o->name = "tool";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("SVG (custom brush) filename");
- o->longDesc = N_("SVG (custom brush) filename");
- o->type = CompOptionTypeString;
- o->value.s = strdup("");
+ o->name = "tool";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("SVG (custom brush) filename");
+ o->longDesc = N_("SVG (custom brush) filename");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup ("");
o->rest.s.string = 0;
o->rest.s.nString = 0;
}
-static CompOption *annoGetDisplayOptions(CompDisplay * display, int *count)
+static CompOption *
+annoGetDisplayOptions (CompDisplay * display, int *count)
{
- if (display) {
- ANNO_DISPLAY(display);
-
- *count = NUM_OPTIONS(ad);
- return ad->opt;
- } else {
- AnnoDisplay *ad = malloc(sizeof(AnnoDisplay));
- annoDisplayInitOptions(ad);
- *count = NUM_OPTIONS(ad);
- return ad->opt;
- }
+ if (display)
+ {
+ ANNO_DISPLAY (display);
+
+ *count = NUM_OPTIONS (ad);
+ return ad->opt;
+ }
+ else
+ {
+ AnnoDisplay *ad = malloc (sizeof (AnnoDisplay));
+ annoDisplayInitOptions (ad);
+ *count = NUM_OPTIONS (ad);
+ return ad->opt;
+ }
}
static Bool
-annoSetDisplayOption(CompDisplay * display,
- char *name, CompOptionValue * value)
+annoSetDisplayOption (CompDisplay * display,
+ char *name, CompOptionValue * value)
{
- CompOption *o;
- int index;
-
- ANNO_DISPLAY(display);
-
- o = compFindOption(ad->opt, NUM_OPTIONS(ad), name, &index);
- if (!o)
- return FALSE;
-
- switch (index) {
- case ANNO_DISPLAY_OPTION_INITIATE:
- case ANNO_DISPLAY_OPTION_ERASE:
- case ANNO_DISPLAY_OPTION_CLEAR:
- if (setDisplayAction(display, o, value))
- return TRUE;
- break;
- case ANNO_DISPLAY_OPTION_FILL_COLOR:
- case ANNO_DISPLAY_OPTION_STROKE_COLOR:
- if (compSetColorOption(o, value))
- return TRUE;
- break;
- case ANNO_DISPLAY_OPTION_LINE_WIDTH:
- case ANNO_DISPLAY_OPTION_STROKE_WIDTH:
- if (compSetFloatOption(o, value))
- return TRUE;
- break;
- case ANNO_DISPLAY_OPTION_TOOL:
- case ANNO_DISPLAY_OPTION_SVG_FILE:
- if (compSetStringOption (o, value))
- return TRUE;
- default:
- break;
- }
-
- return FALSE;
+ CompOption *o;
+ int index;
+
+ ANNO_DISPLAY (display);
+
+ o = compFindOption (ad->opt, NUM_OPTIONS (ad), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index)
+ {
+ case ANNO_DISPLAY_OPTION_INITIATE:
+ case ANNO_DISPLAY_OPTION_ERASE:
+ case ANNO_DISPLAY_OPTION_CLEAR:
+ if (setDisplayAction (display, o, value))
+ return TRUE;
+ break;
+ case ANNO_DISPLAY_OPTION_FILL_COLOR:
+ case ANNO_DISPLAY_OPTION_STROKE_COLOR:
+ if (compSetColorOption (o, value))
+ return TRUE;
+ break;
+ case ANNO_DISPLAY_OPTION_LINE_WIDTH:
+ case ANNO_DISPLAY_OPTION_STROKE_WIDTH:
+ if (compSetFloatOption (o, value))
+ return TRUE;
+ break;
+ case ANNO_DISPLAY_OPTION_TOOL:
+ case ANNO_DISPLAY_OPTION_SVG_FILE:
+ if (compSetStringOption (o, value))
+ return TRUE;
+ default:
+ break;
+ }
+
+ return FALSE;
}
-static Bool annoInitDisplay(CompPlugin * p, CompDisplay * d)
+static Bool
+annoInitDisplay (CompPlugin * p, CompDisplay * d)
{
- AnnoDisplay *ad;
+ AnnoDisplay *ad;
- ad = malloc(sizeof(AnnoDisplay));
- if (!ad)
- return FALSE;
+ ad = malloc (sizeof (AnnoDisplay));
+ if (!ad)
+ return FALSE;
- ad->screenPrivateIndex = allocateScreenPrivateIndex(d);
- if (ad->screenPrivateIndex < 0) {
- free(ad);
- return FALSE;
- }
+ ad->screenPrivateIndex = allocateScreenPrivateIndex (d);
+ if (ad->screenPrivateIndex < 0)
+ {
+ free (ad);
+ return FALSE;
+ }
- WRAP(ad, d, handleEvent, annoHandleEvent);
+ WRAP (ad, d, handleEvent, annoHandleEvent);
- annoDisplayInitOptions(ad);
+ annoDisplayInitOptions (ad);
- d->privates[displayPrivateIndex].ptr = ad;
+ d->privates[displayPrivateIndex].ptr = ad;
- return TRUE;
+ return TRUE;
}
-static void annoFiniDisplay(CompPlugin * p, CompDisplay * d)
+static void
+annoFiniDisplay (CompPlugin * p, CompDisplay * d)
{
- ANNO_DISPLAY(d);
+ ANNO_DISPLAY (d);
- freeScreenPrivateIndex(d, ad->screenPrivateIndex);
+ freeScreenPrivateIndex (d, ad->screenPrivateIndex);
- UNWRAP(ad, d, handleEvent);
+ UNWRAP (ad, d, handleEvent);
- free(ad);
+ free (ad);
}
-static Bool annoInitScreen(CompPlugin * p, CompScreen * s)
+static Bool
+annoInitScreen (CompPlugin * p, CompScreen * s)
{
- AnnoScreen *as;
- int i;
+ AnnoScreen *as;
+ int i;
- ANNO_DISPLAY(s->display);
+ ANNO_DISPLAY (s->display);
- as = malloc(sizeof(AnnoScreen));
- if (!as)
- return FALSE;
+ as = malloc (sizeof (AnnoScreen));
+ if (!as)
+ return FALSE;
- as->grabIndex = 0;
+ as->grabIndex = 0;
- for ( i=0; i<ANNO_NUMBER_CONTEXTS; i++ )
- {
- as->surface[i] = NULL;
- as->pixmap[i] = None;
- as->cairo[i] = NULL;
- as->content[i] = FALSE;
- initTexture (s, &as->texture[i]);
- }
+ for (i = 0; i < ANNO_NUMBER_CONTEXTS; i++)
+ {
+ as->surface[i] = NULL;
+ as->pixmap[i] = None;
+ as->cairo[i] = NULL;
+ as->content[i] = FALSE;
+ initTexture (s, &as->texture[i]);
+ }
- as->currentContext = 0;
+ as->currentContext = 0;
- addScreenAction(s, &ad->opt[ANNO_DISPLAY_OPTION_INITIATE].value.action);
- addScreenAction(s, &ad->opt[ANNO_DISPLAY_OPTION_ERASE].value.action);
- addScreenAction(s, &ad->opt[ANNO_DISPLAY_OPTION_CLEAR].value.action);
+ addScreenAction (s, &ad->opt[ANNO_DISPLAY_OPTION_INITIATE].value.action);
+ addScreenAction (s, &ad->opt[ANNO_DISPLAY_OPTION_ERASE].value.action);
+ addScreenAction (s, &ad->opt[ANNO_DISPLAY_OPTION_CLEAR].value.action);
- WRAP(as, s, paintScreen, annoPaintScreen);
+ WRAP (as, s, paintScreen, annoPaintScreen);
- s->privates[ad->screenPrivateIndex].ptr = as;
+ s->privates[ad->screenPrivateIndex].ptr = as;
- return TRUE;
+ return TRUE;
}
-static void annoFiniScreen(CompPlugin * p, CompScreen * s)
+static void
+annoFiniScreen (CompPlugin * p, CompScreen * s)
{
- int i;
+ int i;
- ANNO_SCREEN(s);
+ ANNO_SCREEN (s);
- for ( i=0; i<ANNO_NUMBER_CONTEXTS; i++ )
- {
- if (as->cairo[i])
- cairo_destroy (as->cairo[i]);
+ for (i = 0; i < ANNO_NUMBER_CONTEXTS; i++)
+ {
+ if (as->cairo[i])
+ cairo_destroy (as->cairo[i]);
- if (as->surface[i])
- cairo_surface_destroy (as->surface[i]);
+ if (as->surface[i])
+ cairo_surface_destroy (as->surface[i]);
- finiTexture (s, &as->texture[i]);
+ finiTexture (s, &as->texture[i]);
- if (as->pixmap[i])
- XFreePixmap (s->display->display, as->pixmap[i]);
+ if (as->pixmap[i])
+ XFreePixmap (s->display->display, as->pixmap[i]);
}
- UNWRAP(as, s, paintScreen);
+ UNWRAP (as, s, paintScreen);
- free(as);
+ free (as);
}
-static Bool annoInit(CompPlugin * p)
+static Bool
+annoInit (CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex();
- if (displayPrivateIndex < 0)
- return FALSE;
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
+ if (displayPrivateIndex < 0)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-static void annoFini(CompPlugin * p)
+static void
+annoFini (CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex(displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex (displayPrivateIndex);
}
static CompPluginVTable annoVTable = {
- "annotate",
- N_("Annotate"),
- N_("Annotate plugin"),
- annoInit,
- annoFini,
- annoInitDisplay,
- annoFiniDisplay,
- annoInitScreen,
- annoFiniScreen,
- 0, /* InitWindow */
- 0, /* FiniWindow */
- annoGetDisplayOptions,
- annoSetDisplayOption,
- 0, /* GetScreenOptions */
- 0, /* SetScreenOption */
- 0, /* Deps */
- 0, /* nDeps */
- 0, /* Features */
- 0, /* nFeatures */
- BERYL_ABI_INFO,
- "beryl-plugins",
- "misc"
+ "annotate",
+ N_("Annotate"),
+ N_("Annotate plugin"),
+ annoInit,
+ annoFini,
+ annoInitDisplay,
+ annoFiniDisplay,
+ annoInitScreen,
+ annoFiniScreen,
+ 0, /* InitWindow */
+ 0, /* FiniWindow */
+ annoGetDisplayOptions,
+ annoSetDisplayOption,
+ 0, /* GetScreenOptions */
+ 0, /* SetScreenOption */
+ 0, /* Deps */
+ 0, /* nDeps */
+ 0, /* Features */
+ 0, /* nFeatures */
+ BERYL_ABI_INFO,
+ "beryl-plugins",
+ "misc"
};
-CompPluginVTable *getCompPluginInfo(void)
+CompPluginVTable *
+getCompPluginInfo (void)
{
- return &annoVTable;
+ return &annoVTable;
}
diff --git a/beryl-plugins/src/bench.c b/beryl-plugins/src/bench.c
index 761d29d..7ad925c 100644
--- a/beryl-plugins/src/bench.c
+++ b/beryl-plugins/src/bench.c
@@ -87,641 +87,661 @@ static GLenum gl_error;
static int displayPrivateIndex = 0;
-typedef struct _BenchDisplay {
- int screenPrivateIndex;
- Bool active;
+typedef struct _BenchDisplay
+{
+ int screenPrivateIndex;
+ Bool active;
- CompOption opt[BENCH_DISPLAY_OPTION_NUM];
+ CompOption opt[BENCH_DISPLAY_OPTION_NUM];
} BenchDisplay;
-typedef struct _BenchScreen {
- GLuint dList;
- float rrVal;
- float fps;
- float alpha;
- struct timeval initTime;
- struct timeval lastRedraw;
- float ctime;
- float frames;
-
- GLuint numTex[10];
- GLuint backTex;
-
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintScreenProc paintScreen;
+typedef struct _BenchScreen
+{
+ GLuint dList;
+ float rrVal;
+ float fps;
+ float alpha;
+ struct timeval initTime;
+ struct timeval lastRedraw;
+ float ctime;
+ float frames;
+
+ GLuint numTex[10];
+ GLuint backTex;
+
+ PreparePaintScreenProc preparePaintScreen;
+ DonePaintScreenProc donePaintScreen;
+ PaintScreenProc paintScreen;
} BenchScreen;
-static void benchPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
+static void
+benchPreparePaintScreen (CompScreen * s, int msSinceLastPaint)
{
- BENCH_SCREEN(s);
- BENCH_DISPLAY(s->display);
-
- float nRrVal;
- float ratio = 0.05;
- int timediff;
- struct timeval now;
-
- gettimeofday(&now, 0);
-
- timediff = TIMEVALDIFF(&now, &bs->lastRedraw);
-
- nRrVal = MIN(1.1, (float) s->optimalRedrawTime / (float) timediff);
-
- bs->rrVal = (bs->rrVal * (1.0 - ratio)) + (nRrVal * ratio);
-
- bs->fps =
- (bs->fps * (1.0 - ratio)) +
- (1000000.0 / TIMEVALDIFFU(&now, &bs->lastRedraw) * ratio);
-
- bs->lastRedraw = now;
-
- if (bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE].value.b
- && bd->active) {
- bs->frames++;
- bs->ctime += timediff;
- if (bs->ctime >
- bd->opt[BENCH_DISPLAY_OPTION_CONSOLE_UPDATE_TIME].
- value.i * 1000) {
- printf
- ("[BENCH] : %.0f frames in %.1f seconds = %.3f FPS\n",
- bs->frames, bs->ctime / 1000.0,
- bs->frames / (bs->ctime / 1000.0));
- bs->frames = 0;
- bs->ctime = 0;
- }
- }
-
- UNWRAP(bs, s, preparePaintScreen);
- (*s->preparePaintScreen) (s,
- (bs->alpha >
- 0.0) ? timediff : msSinceLastPaint);
- WRAP(bs, s, preparePaintScreen, benchPreparePaintScreen);
-
- if (bd->active)
- bs->alpha += timediff / 1000.0;
- else
- bs->alpha -= timediff / 1000.0;
-
- bs->alpha = MIN(1.0, MAX(0.0, bs->alpha));
+ BENCH_SCREEN (s);
+ BENCH_DISPLAY (s->display);
+
+ float nRrVal;
+ float ratio = 0.05;
+ int timediff;
+ struct timeval now;
+
+ gettimeofday (&now, 0);
+
+ timediff = TIMEVALDIFF (&now, &bs->lastRedraw);
+
+ nRrVal = MIN (1.1, (float)s->optimalRedrawTime / (float)timediff);
+
+ bs->rrVal = (bs->rrVal * (1.0 - ratio)) + (nRrVal * ratio);
+
+ bs->fps =
+ (bs->fps * (1.0 - ratio)) +
+ (1000000.0 / TIMEVALDIFFU (&now, &bs->lastRedraw) * ratio);
+
+ bs->lastRedraw = now;
+
+ if (bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE].value.b && bd->active)
+ {
+ bs->frames++;
+ bs->ctime += timediff;
+ if (bs->ctime >
+ bd->opt[BENCH_DISPLAY_OPTION_CONSOLE_UPDATE_TIME].value.i * 1000)
+ {
+ printf
+ ("[BENCH] : %.0f frames in %.1f seconds = %.3f FPS\n",
+ bs->frames, bs->ctime / 1000.0,
+ bs->frames / (bs->ctime / 1000.0));
+ bs->frames = 0;
+ bs->ctime = 0;
+ }
+ }
+
+ UNWRAP (bs, s, preparePaintScreen);
+ (*s->preparePaintScreen) (s,
+ (bs->alpha >
+ 0.0) ? timediff : msSinceLastPaint);
+ WRAP (bs, s, preparePaintScreen, benchPreparePaintScreen);
+
+ if (bd->active)
+ bs->alpha += timediff / 1000.0;
+ else
+ bs->alpha -= timediff / 1000.0;
+
+ bs->alpha = MIN (1.0, MAX (0.0, bs->alpha));
}
-static void benchDonePaintScreen(CompScreen * s)
+static void
+benchDonePaintScreen (CompScreen * s)
{
- BENCH_SCREEN(s);
- BENCH_DISPLAY(s->display);
-
- if (bs->alpha > 0.0) {
- damageScreen(s);
- glFlush();
- XSync(s->display->display, FALSE);
- if (bd->opt[BENCH_DISPLAY_OPTION_DISABLE_LIMIT].value.b) {
- s->lastRedraw = bs->initTime;
- s->timeMult = 0;
- }
- if (!bd->active)
- s->timeMult = 0;
- }
- UNWRAP(bs, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP(bs, s, donePaintScreen, benchDonePaintScreen);
+ BENCH_SCREEN (s);
+ BENCH_DISPLAY (s->display);
+
+ if (bs->alpha > 0.0)
+ {
+ damageScreen (s);
+ glFlush ();
+ XSync (s->display->display, FALSE);
+ if (bd->opt[BENCH_DISPLAY_OPTION_DISABLE_LIMIT].value.b)
+ {
+ s->lastRedraw = bs->initTime;
+ s->timeMult = 0;
+ }
+ if (!bd->active)
+ s->timeMult = 0;
+ }
+ UNWRAP (bs, s, donePaintScreen);
+ (*s->donePaintScreen) (s);
+ WRAP (bs, s, donePaintScreen, benchDonePaintScreen);
}
static Bool
-benchPaintScreen(CompScreen * s, const ScreenPaintAttrib * sa,
- Region region, int output, unsigned int mask)
+benchPaintScreen (CompScreen * s, const ScreenPaintAttrib * sa,
+ Region region, int output, unsigned int mask)
{
- Bool status, isSet;
- unsigned int fps;
- BENCH_SCREEN(s);
- BENCH_DISPLAY(s->display);
-
- UNWRAP(bs, s, paintScreen);
- status = (*s->paintScreen) (s, sa, region, output, mask);
- WRAP(bs, s, paintScreen, benchPaintScreen);
-
- if (bs->alpha <= 0.0
- || !bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_SCREEN].value.b)
- return status;
- glGetError();
- glPushAttrib(GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);
- GLERR;
-
- glPushMatrix();
- glLoadIdentity();
- prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- glColor4f(1.0, 1.0, 1.0, bs->alpha);
-
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- glTranslatef(bd->opt[BENCH_DISPLAY_OPTION_POS_X].value.i,
- bd->opt[BENCH_DISPLAY_OPTION_POS_Y].value.i, 0);
-
- glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, bs->backTex);
-
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0);
- glVertex2f(0, 0);
- glTexCoord2f(0, 1);
- glVertex2f(0, 256);
- glTexCoord2f(1, 1);
- glVertex2f(512, 256);
- glTexCoord2f(1, 0);
- glVertex2f(512, 0);
- glEnd();
-
- glBindTexture(GL_TEXTURE_2D, 0);
- glDisable(GL_TEXTURE_2D);
-
-
- glTranslatef(53, 83, 0);
- float rrVal = MIN(1.0, MAX(0.0, bs->rrVal));
- if (rrVal < 0.5) {
-
- glBegin(GL_QUADS);
- glColor4f(1.0, 0.0, 0.0, bs->alpha);
- glVertex2f(0.0, 0.0);
- glVertex2f(0.0, 25.0);
- glColor4f(1.0, rrVal * 2.0, 0.0, bs->alpha);
- glVertex2f(330.0 * rrVal, 25.0);
- glVertex2f(330.0 * rrVal, 0.0);
- glEnd();
- } else {
-
- glBegin(GL_QUADS);
- glColor4f(1.0, 0.0, 0.0, bs->alpha);
- glVertex2f(0.0, 0.0);
- glVertex2f(0.0, 25.0);
- glColor4f(1.0, 1.0, 0.0, bs->alpha);
- glVertex2f(165.0, 25.0);
- glVertex2f(165.0, 0.0);
- glEnd();
-
- glBegin(GL_QUADS);
- glColor4f(1.0, 1.0, 0.0, bs->alpha);
- glVertex2f(165.0, 0.0);
- glVertex2f(165.0, 25.0);
- glColor4f(1.0 - ((rrVal - 0.5) * 2.0), 1.0, 0.0,
- bs->alpha);
- glVertex2f(165.0 + 330.0 * (rrVal - 0.5), 25.0);
- glVertex2f(165.0 + 330.0 * (rrVal - 0.5), 0.0);
- glEnd();
-
- }
-
- glColor4f(0.0, 0.0, 0.0, bs->alpha);
-
- glCallList(bs->dList);
-
- glTranslatef(72, 45, 0);
-
- float red;
- if (bs->fps > 30.0)
- red = 0.0;
- else
- red = 1.0;
- if (bs->fps <= 30.0 && bs->fps > 20.0)
- red = 1.0 - ((bs->fps - 20.0) / 10.0);
-
- glColor4f(red, 0.0, 0.0, bs->alpha);
-
- glEnable(GL_TEXTURE_2D);
- isSet = FALSE;
- fps = (bs->fps * 100.0);
- fps = MIN(999999, fps);
-
- if (fps >= 100000) {
- glBindTexture(GL_TEXTURE_2D, bs->numTex[fps / 100000]);
- glCallList(bs->dList + 1);
- isSet = TRUE;
- }
- fps %= 100000;
- glTranslatef(12, 0, 0);
- if (fps >= 10000 || isSet) {
- glBindTexture(GL_TEXTURE_2D, bs->numTex[fps / 10000]);
- glCallList(bs->dList + 1);
- isSet = TRUE;
- }
- fps %= 10000;
- glTranslatef(12, 0, 0);
- if (fps >= 1000 || isSet) {
- glBindTexture(GL_TEXTURE_2D, bs->numTex[fps / 1000]);
- glCallList(bs->dList + 1);
- }
- fps %= 1000;
- glTranslatef(12, 0, 0);
-
- glBindTexture(GL_TEXTURE_2D, bs->numTex[fps / 100]);
- glCallList(bs->dList + 1);
- fps %= 100;
-
- glTranslatef(19, 0, 0);
-
- glBindTexture(GL_TEXTURE_2D, bs->numTex[fps / 10]);
- glCallList(bs->dList + 1);
- fps %= 10;
-
- glTranslatef(12, 0, 0);
-
- glBindTexture(GL_TEXTURE_2D, bs->numTex[fps]);
- glCallList(bs->dList + 1);
-
- glBindTexture(GL_TEXTURE_2D, 0);
- glDisable(GL_TEXTURE_2D);
-
- glPopMatrix();
-
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glColor4f(1.0, 1.0, 1.0, 1.0);
-
- glPopAttrib();
- glGetError();
-
- return status;
+ Bool status, isSet;
+ unsigned int fps;
+ BENCH_SCREEN (s);
+ BENCH_DISPLAY (s->display);
+
+ UNWRAP (bs, s, paintScreen);
+ status = (*s->paintScreen) (s, sa, region, output, mask);
+ WRAP (bs, s, paintScreen, benchPaintScreen);
+
+ if (bs->alpha <= 0.0
+ || !bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_SCREEN].value.b)
+ return status;
+ glGetError ();
+ glPushAttrib (GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT);
+ GLERR;
+
+ glPushMatrix ();
+ glLoadIdentity ();
+ prepareXCoords (s, output, -DEFAULT_Z_CAMERA);
+
+ glEnable (GL_BLEND);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ glColor4f (1.0, 1.0, 1.0, bs->alpha);
+
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ glTranslatef (bd->opt[BENCH_DISPLAY_OPTION_POS_X].value.i,
+ bd->opt[BENCH_DISPLAY_OPTION_POS_Y].value.i, 0);
+
+ glEnable (GL_TEXTURE_2D);
+ glBindTexture (GL_TEXTURE_2D, bs->backTex);
+
+ glBegin (GL_QUADS);
+ glTexCoord2f (0, 0);
+ glVertex2f (0, 0);
+ glTexCoord2f (0, 1);
+ glVertex2f (0, 256);
+ glTexCoord2f (1, 1);
+ glVertex2f (512, 256);
+ glTexCoord2f (1, 0);
+ glVertex2f (512, 0);
+ glEnd ();
+
+ glBindTexture (GL_TEXTURE_2D, 0);
+ glDisable (GL_TEXTURE_2D);
+
+
+ glTranslatef (53, 83, 0);
+ float rrVal = MIN (1.0, MAX (0.0, bs->rrVal));
+ if (rrVal < 0.5)
+ {
+
+ glBegin (GL_QUADS);
+ glColor4f (1.0, 0.0, 0.0, bs->alpha);
+ glVertex2f (0.0, 0.0);
+ glVertex2f (0.0, 25.0);
+ glColor4f (1.0, rrVal * 2.0, 0.0, bs->alpha);
+ glVertex2f (330.0 * rrVal, 25.0);
+ glVertex2f (330.0 * rrVal, 0.0);
+ glEnd ();
+ }
+ else
+ {
+
+ glBegin (GL_QUADS);
+ glColor4f (1.0, 0.0, 0.0, bs->alpha);
+ glVertex2f (0.0, 0.0);
+ glVertex2f (0.0, 25.0);
+ glColor4f (1.0, 1.0, 0.0, bs->alpha);
+ glVertex2f (165.0, 25.0);
+ glVertex2f (165.0, 0.0);
+ glEnd ();
+
+ glBegin (GL_QUADS);
+ glColor4f (1.0, 1.0, 0.0, bs->alpha);
+ glVertex2f (165.0, 0.0);
+ glVertex2f (165.0, 25.0);
+ glColor4f (1.0 - ((rrVal - 0.5) * 2.0), 1.0, 0.0, bs->alpha);
+ glVertex2f (165.0 + 330.0 * (rrVal - 0.5), 25.0);
+ glVertex2f (165.0 + 330.0 * (rrVal - 0.5), 0.0);
+ glEnd ();
+
+ }
+
+ glColor4f (0.0, 0.0, 0.0, bs->alpha);
+
+ glCallList (bs->dList);
+
+ glTranslatef (72, 45, 0);
+
+ float red;
+ if (bs->fps > 30.0)
+ red = 0.0;
+ else
+ red = 1.0;
+ if (bs->fps <= 30.0 && bs->fps > 20.0)
+ red = 1.0 - ((bs->fps - 20.0) / 10.0);
+
+ glColor4f (red, 0.0, 0.0, bs->alpha);
+
+ glEnable (GL_TEXTURE_2D);
+ isSet = FALSE;
+ fps = (bs->fps * 100.0);
+ fps = MIN (999999, fps);
+
+ if (fps >= 100000)
+ {
+ glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 100000]);
+ glCallList (bs->dList + 1);
+ isSet = TRUE;
+ }
+ fps %= 100000;
+ glTranslatef (12, 0, 0);
+ if (fps >= 10000 || isSet)
+ {
+ glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 10000]);
+ glCallList (bs->dList + 1);
+ isSet = TRUE;
+ }
+ fps %= 10000;
+ glTranslatef (12, 0, 0);
+ if (fps >= 1000 || isSet)
+ {
+ glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 1000]);
+ glCallList (bs->dList + 1);
+ }
+ fps %= 1000;
+ glTranslatef (12, 0, 0);
+
+ glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 100]);
+ glCallList (bs->dList + 1);
+ fps %= 100;
+
+ glTranslatef (19, 0, 0);
+
+ glBindTexture (GL_TEXTURE_2D, bs->numTex[fps / 10]);
+ glCallList (bs->dList + 1);
+ fps %= 10;
+
+ glTranslatef (12, 0, 0);
+
+ glBindTexture (GL_TEXTURE_2D, bs->numTex[fps]);
+ glCallList (bs->dList + 1);
+
+ glBindTexture (GL_TEXTURE_2D, 0);
+ glDisable (GL_TEXTURE_2D);
+
+ glPopMatrix ();
+
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+
+ glColor4f (1.0, 1.0, 1.0, 1.0);
+
+ glPopAttrib ();
+ glGetError ();
+
+ return status;
}
-static Bool benchInitScreen(CompPlugin * p, CompScreen * s)
+static Bool
+benchInitScreen (CompPlugin * p, CompScreen * s)
{
- int i;
-
- BENCH_DISPLAY(s->display);
-
- BenchScreen *bs = (BenchScreen *) calloc(1, sizeof(BenchScreen));
- s->privates[bd->screenPrivateIndex].ptr = bs;
-
- WRAP(bs, s, paintScreen, benchPaintScreen);
- WRAP(bs, s, preparePaintScreen, benchPreparePaintScreen);
- WRAP(bs, s, donePaintScreen, benchDonePaintScreen);
-
- glGenTextures(10, bs->numTex);
- glGenTextures(1, &bs->backTex);
-
- glGetError();
-
- glEnable(GL_TEXTURE_2D);
-
- bs->alpha = 0;
- bs->ctime = 0;
- bs->frames = 0;
-
- for (i = 0; i < 10; i++) {
- //Bind the texture
- glBindTexture(GL_TEXTURE_2D, bs->numTex[i]);
-
- //Load the parameters
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
- GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
- GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
- GL_REPEAT);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 32, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, number_data[i]);
- GLERR;
- }
-
- glBindTexture(GL_TEXTURE_2D, bs->backTex);
-
- //Load the parameters
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-
- glTexImage2D(GL_TEXTURE_2D, 0, 4, 512, 256, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, image_data);
- GLERR;
-
- glBindTexture(GL_TEXTURE_2D, 0);
- glDisable(GL_TEXTURE_2D);
-
- bs->dList = glGenLists(2);
- glNewList(bs->dList, GL_COMPILE);
-
- glLineWidth(2.0);
-
- glBegin(GL_LINE_LOOP);
- glVertex2f(0, 0);
- glVertex2f(0, 25);
- glVertex2f(330, 25);
- glVertex2f(330, 0);
- glEnd();
-
- glLineWidth(1.0);
-
- glBegin(GL_LINES);
- for (i = 33; i < 330; i += 33) {
- glVertex2f(i, 15);
- glVertex2f(i, 25);
- }
- for (i = 16; i < 330; i += 33) {
- glVertex2f(i, 20);
- glVertex2f(i, 25);
- }
- glEnd();
-
- glEndList();
-
- glNewList(bs->dList + 1, GL_COMPILE);
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0);
- glVertex2f(0, 0);
- glTexCoord2f(0, 1);
- glVertex2f(0, 32);
- glTexCoord2f(1, 1);
- glVertex2f(16, 32);
- glTexCoord2f(1, 0);
- glVertex2f(16, 0);
- glEnd();
- glEndList();
-
-
- gettimeofday(&bs->initTime, 0);
- gettimeofday(&bs->lastRedraw, 0);
-
- addScreenAction(s,
- &bd->opt[BENCH_DISPLAY_OPTION_INITIATE].value.
- action);
-
- return TRUE;
+ int i;
+
+ BENCH_DISPLAY (s->display);
+
+ BenchScreen *bs = (BenchScreen *) calloc (1, sizeof (BenchScreen));
+ s->privates[bd->screenPrivateIndex].ptr = bs;
+
+ WRAP (bs, s, paintScreen, benchPaintScreen);
+ WRAP (bs, s, preparePaintScreen, benchPreparePaintScreen);
+ WRAP (bs, s, donePaintScreen, benchDonePaintScreen);
+
+ glGenTextures (10, bs->numTex);
+ glGenTextures (1, &bs->backTex);
+
+ glGetError ();
+
+ glEnable (GL_TEXTURE_2D);
+
+ bs->alpha = 0;
+ bs->ctime = 0;
+ bs->frames = 0;
+
+ for (i = 0; i < 10; i++)
+ {
+ //Bind the texture
+ glBindTexture (GL_TEXTURE_2D, bs->numTex[i]);
+
+ //Load the parameters
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 16, 32, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, number_data[i]);
+ GLERR;
+ }
+
+ glBindTexture (GL_TEXTURE_2D, bs->backTex);
+
+ //Load the parameters
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+
+ glTexImage2D (GL_TEXTURE_2D, 0, 4, 512, 256, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, image_data);
+ GLERR;
+
+ glBindTexture (GL_TEXTURE_2D, 0);
+ glDisable (GL_TEXTURE_2D);
+
+ bs->dList = glGenLists (2);
+ glNewList (bs->dList, GL_COMPILE);
+
+ glLineWidth (2.0);
+
+ glBegin (GL_LINE_LOOP);
+ glVertex2f (0, 0);
+ glVertex2f (0, 25);
+ glVertex2f (330, 25);
+ glVertex2f (330, 0);
+ glEnd ();
+
+ glLineWidth (1.0);
+
+ glBegin (GL_LINES);
+ for (i = 33; i < 330; i += 33)
+ {
+ glVertex2f (i, 15);
+ glVertex2f (i, 25);
+ }
+ for (i = 16; i < 330; i += 33)
+ {
+ glVertex2f (i, 20);
+ glVertex2f (i, 25);
+ }
+ glEnd ();
+
+ glEndList ();
+
+ glNewList (bs->dList + 1, GL_COMPILE);
+ glBegin (GL_QUADS);
+ glTexCoord2f (0, 0);
+ glVertex2f (0, 0);
+ glTexCoord2f (0, 1);
+ glVertex2f (0, 32);
+ glTexCoord2f (1, 1);
+ glVertex2f (16, 32);
+ glTexCoord2f (1, 0);
+ glVertex2f (16, 0);
+ glEnd ();
+ glEndList ();
+
+
+ gettimeofday (&bs->initTime, 0);
+ gettimeofday (&bs->lastRedraw, 0);
+
+ addScreenAction (s, &bd->opt[BENCH_DISPLAY_OPTION_INITIATE].value.action);
+
+ return TRUE;
}
-static void benchFiniScreen(CompPlugin * p, CompScreen * s)
+static void
+benchFiniScreen (CompPlugin * p, CompScreen * s)
{
- BENCH_SCREEN(s);
- BENCH_DISPLAY(s->display);
- glDeleteLists(bs->dList, 2);
+ BENCH_SCREEN (s);
+ BENCH_DISPLAY (s->display);
+ glDeleteLists (bs->dList, 2);
- glDeleteTextures(10, bs->numTex);
- glDeleteTextures(1, &bs->backTex);
+ glDeleteTextures (10, bs->numTex);
+ glDeleteTextures (1, &bs->backTex);
- //Restore the original function
- UNWRAP(bs, s, paintScreen);
- UNWRAP(bs, s, preparePaintScreen);
- UNWRAP(bs, s, donePaintScreen);
+ //Restore the original function
+ UNWRAP (bs, s, paintScreen);
+ UNWRAP (bs, s, preparePaintScreen);
+ UNWRAP (bs, s, donePaintScreen);
- removeScreenAction(s,
- &bd->opt[BENCH_DISPLAY_OPTION_INITIATE].value.
- action);
+ removeScreenAction (s,
+ &bd->opt[BENCH_DISPLAY_OPTION_INITIATE].value.action);
- //Free the pointer
- free(bs);
+ //Free the pointer
+ free (bs);
}
static Bool
-benchSetDisplayOption(CompDisplay * display, char *name,
- CompOptionValue * value)
+benchSetDisplayOption (CompDisplay * display, char *name,
+ CompOptionValue * value)
{
- CompOption *o;
- int index;
-
- BENCH_DISPLAY(display);
-
- o = compFindOption(bd->opt, NUM_OPTIONS(bd), name, &index);
- if (!o)
- return FALSE;
-
- switch (index) {
- case BENCH_DISPLAY_OPTION_INITIATE:
- if (setDisplayAction(display, o, value))
- return TRUE;
- break;
- case BENCH_DISPLAY_OPTION_DISABLE_LIMIT:
- case BENCH_DISPLAY_OPTION_OUTPUT_SCREEN:
- case BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE:
- if (compSetBoolOption(o, value))
- return TRUE;
- break;
- case BENCH_DISPLAY_OPTION_POS_X:
- case BENCH_DISPLAY_OPTION_POS_Y:
- case BENCH_DISPLAY_OPTION_CONSOLE_UPDATE_TIME:
- if (compSetIntOption(o, value))
- return TRUE;
- break;
-
- default:
- break;
- }
-
- return FALSE;
+ CompOption *o;
+ int index;
+
+ BENCH_DISPLAY (display);
+
+ o = compFindOption (bd->opt, NUM_OPTIONS (bd), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index)
+ {
+ case BENCH_DISPLAY_OPTION_INITIATE:
+ if (setDisplayAction (display, o, value))
+ return TRUE;
+ break;
+ case BENCH_DISPLAY_OPTION_DISABLE_LIMIT:
+ case BENCH_DISPLAY_OPTION_OUTPUT_SCREEN:
+ case BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE:
+ if (compSetBoolOption (o, value))
+ return TRUE;
+ break;
+ case BENCH_DISPLAY_OPTION_POS_X:
+ case BENCH_DISPLAY_OPTION_POS_Y:
+ case BENCH_DISPLAY_OPTION_CONSOLE_UPDATE_TIME:
+ if (compSetIntOption (o, value))
+ return TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
}
static Bool
-benchInitiate(CompDisplay * d, CompAction * ac, CompActionState state,
- CompOption * option, int nOption)
+benchInitiate (CompDisplay * d, CompAction * ac, CompActionState state,
+ CompOption * option, int nOption)
{
- CompScreen *s;
- BENCH_DISPLAY(d);
- bd->active = !bd->active;
- bd->active &= bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_SCREEN].value.b
- || bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE].value.b;
- s = findScreenAtDisplay(d,
- getIntOptionNamed(option, nOption, "root",
- 0));
- if (s) {
- BENCH_SCREEN(s);
- damageScreen(s);
- bs->ctime = 0;
- bs->frames = 0;
- }
- return FALSE;
+ CompScreen *s;
+ BENCH_DISPLAY (d);
+ bd->active = !bd->active;
+ bd->active &= bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_SCREEN].value.b
+ || bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE].value.b;
+ s = findScreenAtDisplay (d,
+ getIntOptionNamed (option, nOption, "root", 0));
+ if (s)
+ {
+ BENCH_SCREEN (s);
+ damageScreen (s);
+ bs->ctime = 0;
+ bs->frames = 0;
+ }
+ return FALSE;
}
-static void benchDisplayInitOptions(BenchDisplay * bd)
+static void
+benchDisplayInitOptions (BenchDisplay * bd)
{
- CompOption *o;
-
- o = &bd->opt[BENCH_DISPLAY_OPTION_INITIATE];
- o->name = "initiate";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Initiate");
- o->longDesc = N_("Start benchmark");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = benchInitiate;
- o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = CompBindingTypeKey;
- o->value.action.state = CompActionStateInitKey;
- o->value.action.key.modifiers = BENCH_DISPLAY_OPTION_INITIATE_MOD;
- o->value.action.key.keysym =
- XStringToKeysym(BENCH_DISPLAY_OPTION_INITIATE_KEY);
-
- o = &bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_SCREEN];
- o->name = "output_screen";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Output Screen");
- o->longDesc = N_("Display FPS on screen");
- o->type = CompOptionTypeBool;
- o->value.b = BENCH_DISPLAY_OPTION_OUTPUT_SCREEN_DEFAULT;
-
- o = &bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE];
- o->name = "output_console";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Output Console");
- o->longDesc = N_("Print FPS to console");
- o->type = CompOptionTypeBool;
- o->value.b = BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE_DEFAULT;
-
- o = &bd->opt[BENCH_DISPLAY_OPTION_CONSOLE_UPDATE_TIME];
- o->name = "console_update_time";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Console Update Time");
- o->longDesc = N_("Console output update time");
- o->type = CompOptionTypeInt;
- o->value.i = BENCH_DISPLAY_OPTION_CONSOLE_UPDATE_TIME_DEFAULT;
- o->rest.i.min = 1;
- o->rest.i.max = 60;
-
- o = &bd->opt[BENCH_DISPLAY_OPTION_DISABLE_LIMIT];
- o->name = "disable_limiter";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Disable limiter");
- o->longDesc = N_("Disable beryl integrated FPS limiter");
- o->type = CompOptionTypeBool;
- o->value.b = BENCH_DISPLAY_OPTION_DISABLE_LIMIT_DEFAULT;
-
- o = &bd->opt[BENCH_DISPLAY_OPTION_POS_X];
- o->name = "position_x";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Position x");
- o->longDesc = N_("X Position of benchmark window");
- o->type = CompOptionTypeInt;
- o->value.i = BENCH_DISPLAY_OPTION_POS_X_DEFAULT;
- o->rest.i.min = 0;
- o->rest.i.max = 4096;
-
- o = &bd->opt[BENCH_DISPLAY_OPTION_POS_Y];
- o->name = "position_y";
- o->group = N_("");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Position y");
- o->longDesc = N_("Y Position of benchmark window");
- o->type = CompOptionTypeInt;
- o->value.i = BENCH_DISPLAY_OPTION_POS_X_DEFAULT;
- o->rest.i.min = 0;
- o->rest.i.max = 4096;
+ CompOption *o;
+
+ o = &bd->opt[BENCH_DISPLAY_OPTION_INITIATE];
+ o->name = "initiate";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Initiate");
+ o->longDesc = N_("Start benchmark");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = benchInitiate;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.state = CompActionStateInitKey;
+ o->value.action.key.modifiers = BENCH_DISPLAY_OPTION_INITIATE_MOD;
+ o->value.action.key.keysym =
+ XStringToKeysym (BENCH_DISPLAY_OPTION_INITIATE_KEY);
+
+ o = &bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_SCREEN];
+ o->name = "output_screen";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Output Screen");
+ o->longDesc = N_("Display FPS on screen");
+ o->type = CompOptionTypeBool;
+ o->value.b = BENCH_DISPLAY_OPTION_OUTPUT_SCREEN_DEFAULT;
+
+ o = &bd->opt[BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE];
+ o->name = "output_console";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Output Console");
+ o->longDesc = N_("Print FPS to console");
+ o->type = CompOptionTypeBool;
+ o->value.b = BENCH_DISPLAY_OPTION_OUTPUT_CONSOLE_DEFAULT;
+
+ o = &bd->opt[BENCH_DISPLAY_OPTION_CONSOLE_UPDATE_TIME];
+ o->name = "console_update_time";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Console Update Time");
+ o->longDesc = N_("Console output update time");
+ o->type = CompOptionTypeInt;
+ o->value.i = BENCH_DISPLAY_OPTION_CONSOLE_UPDATE_TIME_DEFAULT;
+ o->rest.i.min = 1;
+ o->rest.i.max = 60;
+
+ o = &bd->opt[BENCH_DISPLAY_OPTION_DISABLE_LIMIT];
+ o->name = "disable_limiter";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Disable limiter");
+ o->longDesc = N_("Disable beryl integrated FPS limiter");
+ o->type = CompOptionTypeBool;
+ o->value.b = BENCH_DISPLAY_OPTION_DISABLE_LIMIT_DEFAULT;
+
+ o = &bd->opt[BENCH_DISPLAY_OPTION_POS_X];
+ o->name = "position_x";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Position x");
+ o->longDesc = N_("X Position of benchmark window");
+ o->type = CompOptionTypeInt;
+ o->value.i = BENCH_DISPLAY_OPTION_POS_X_DEFAULT;
+ o->rest.i.min = 0;
+ o->rest.i.max = 4096;
+
+ o = &bd->opt[BENCH_DISPLAY_OPTION_POS_Y];
+ o->name = "position_y";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Position y");
+ o->longDesc = N_("Y Position of benchmark window");
+ o->type = CompOptionTypeInt;
+ o->value.i = BENCH_DISPLAY_OPTION_POS_X_DEFAULT;
+ o->rest.i.min = 0;
+ o->rest.i.max = 4096;
}
-static CompOption *benchGetDisplayOptions(CompDisplay * display,
- int *count)
+static CompOption *
+benchGetDisplayOptions (CompDisplay * display, int *count)
{
- if (display) {
- BENCH_DISPLAY(display);
-
- *count = NUM_OPTIONS(bd);
- return bd->opt;
- } else {
- BenchDisplay *bd = malloc(sizeof(BenchDisplay));
- benchDisplayInitOptions(bd);
- *count = NUM_OPTIONS(bd);
- return bd->opt;
- }
+ if (display)
+ {
+ BENCH_DISPLAY (display);
+
+ *count = NUM_OPTIONS (bd);
+ return bd->opt;
+ }
+ else
+ {
+ BenchDisplay *bd = malloc (sizeof (BenchDisplay));
+ benchDisplayInitOptions (bd);
+ *count = NUM_OPTIONS (bd);
+ return bd->opt;
+ }
}
-static Bool benchInitDisplay(CompPlugin * p, CompDisplay * d)
+static Bool
+benchInitDisplay (CompPlugin * p, CompDisplay * d)
{
- //Generate a bench display
- BenchDisplay *bd = (BenchDisplay *) malloc(sizeof(BenchDisplay));
- //Allocate a private index
- bd->screenPrivateIndex = allocateScreenPrivateIndex(d);
- //Check if its valid
- if (bd->screenPrivateIndex < 0) {
- //Its invalid so free memory and return
- free(bd);
- return FALSE;
- }
- benchDisplayInitOptions(bd);
- bd->active = FALSE;
- //Record the display
- d->privates[displayPrivateIndex].ptr = bd;
- return TRUE;
+ //Generate a bench display
+ BenchDisplay *bd = (BenchDisplay *) malloc (sizeof (BenchDisplay));
+ //Allocate a private index
+ bd->screenPrivateIndex = allocateScreenPrivateIndex (d);
+ //Check if its valid
+ if (bd->screenPrivateIndex < 0)
+ {
+ //Its invalid so free memory and return
+ free (bd);
+ return FALSE;
+ }
+ benchDisplayInitOptions (bd);
+ bd->active = FALSE;
+ //Record the display
+ d->privates[displayPrivateIndex].ptr = bd;
+ return TRUE;
}
-static void benchFiniDisplay(CompPlugin * p, CompDisplay * d)
+static void
+benchFiniDisplay (CompPlugin * p, CompDisplay * d)
{
- BENCH_DISPLAY(d);
- //Free the private index
- freeScreenPrivateIndex(d, bd->screenPrivateIndex);
- //Free the pointer
- free(bd);
+ BENCH_DISPLAY (d);
+ //Free the private index
+ freeScreenPrivateIndex (d, bd->screenPrivateIndex);
+ //Free the pointer
+ free (bd);
}
-static Bool benchInit(CompPlugin * p)
+static Bool
+benchInit (CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex();
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- return FALSE;
+ if (displayPrivateIndex < 0)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-static void benchFini(CompPlugin * p)
+static void
+benchFini (CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex(displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex (displayPrivateIndex);
}
CompPluginVTable benchVTable = {
- "bench",
- N_("Benchmark"),
- N_("A simple benchmark plugin"),
- benchInit,
- benchFini,
- benchInitDisplay,
- benchFiniDisplay,
- benchInitScreen,
- benchFiniScreen,
- 0,
- 0,
- benchGetDisplayOptions,
- benchSetDisplayOption,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- BERYL_ABI_INFO,
- "beryl-plugins",
- "misc"
+ "bench",
+ N_("Benchmark"),
+ N_("A simple benchmark plugin"),
+ benchInit,
+ benchFini,
+ benchInitDisplay,
+ benchFiniDisplay,
+ benchInitScreen,
+ benchFiniScreen,
+ 0,
+ 0,
+ benchGetDisplayOptions,
+ benchSetDisplayOption,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ BERYL_ABI_INFO,
+ "beryl-plugins",
+ "misc"
};
-CompPluginVTable *getCompPluginInfo(void)
+CompPluginVTable *
+getCompPluginInfo (void)
{
- return &benchVTable;
+ return &benchVTable;
}
diff --git a/beryl-plugins/src/blurfx.c b/beryl-plugins/src/blurfx.c
index f922ad5..62e0e2d 100644
--- a/beryl-plugins/src/blurfx.c
+++ b/beryl-plugins/src/blurfx.c
@@ -34,4862 +34,4834 @@
#include "blurfx.h"
// return plugin data
-CompPluginVTable *getCompPluginInfo(void)
+CompPluginVTable *
+getCompPluginInfo (void)
{
- return &blurfxVTable;
+ return &blurfxVTable;
}
-static Bool blurfxInit(CompPlugin * p)
+static Bool
+blurfxInit (CompPlugin * p)
{
- blurShader[0][0] = gaussian5x5_V;
- blurShader[0][1] = gaussian5x5_H;
- blurShader[1][0] = linear5x5_V;
- blurShader[1][1] = linear5x5_H;
-
- blurShader[2][0] = gaussian9x9_V;
- blurShader[2][1] = gaussian9x9_H;
- blurShader[3][0] = linear9x9_V;
- blurShader[3][1] = linear9x9_H;
-
- blurShader[4][0] = gaussian13x13_V;
- blurShader[4][1] = gaussian13x13_H;
- blurShader[5][0] = linear13x13_V;
- blurShader[5][1] = linear13x13_H;
-
- blurShader[6][0] = gaussian17x17_V;
- blurShader[6][1] = gaussian17x17_H;
- blurShader[7][0] = linear17x17_V;
- blurShader[7][1] = linear17x17_H;
-
- blurShader[8][0] = gaussian21x21_V;
- blurShader[8][1] = gaussian21x21_H;
- blurShader[9][0] = linear21x21_V;
- blurShader[9][1] = linear21x21_H;
-
- displayPrivateIndex = allocateDisplayPrivateIndex();
- if (displayPrivateIndex < 0)
- return FALSE;
- return TRUE;
+ blurShader[0][0] = gaussian5x5_V;
+ blurShader[0][1] = gaussian5x5_H;
+ blurShader[1][0] = linear5x5_V;
+ blurShader[1][1] = linear5x5_H;
+
+ blurShader[2][0] = gaussian9x9_V;
+ blurShader[2][1] = gaussian9x9_H;
+ blurShader[3][0] = linear9x9_V;
+ blurShader[3][1] = linear9x9_H;
+
+ blurShader[4][0] = gaussian13x13_V;
+ blurShader[4][1] = gaussian13x13_H;
+ blurShader[5][0] = linear13x13_V;
+ blurShader[5][1] = linear13x13_H;
+
+ blurShader[6][0] = gaussian17x17_V;
+ blurShader[6][1] = gaussian17x17_H;
+ blurShader[7][0] = linear17x17_V;
+ blurShader[7][1] = linear17x17_H;
+
+ blurShader[8][0] = gaussian21x21_V;
+ blurShader[8][1] = gaussian21x21_H;
+ blurShader[9][0] = linear21x21_V;
+ blurShader[9][1] = linear21x21_H;
+
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
+ if (displayPrivateIndex < 0)
+ return FALSE;
+ return TRUE;
}
-static void blurfxFini(CompPlugin * p)
+static void
+blurfxFini (CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex(displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex (displayPrivateIndex);
}
-static Bool blurfxInitDisplay(CompPlugin * p, CompDisplay * d)
+static Bool
+blurfxInitDisplay (CompPlugin * p, CompDisplay * d)
{
- //Generate a blur display
- BlurfxDisplay *bd =
- (BlurfxDisplay *) calloc(1, sizeof(BlurfxDisplay));
- //Allocate a private index
- bd->screenPrivateIndex = allocateScreenPrivateIndex(d);
- //Check if its valid
- if (bd->screenPrivateIndex < 0) {
- //Its invalid so free memory and return
- free(bd);
- return FALSE;
- }
-
- blurfxDisplayInitOptions(bd);
-
- //Record the display
- d->privates[displayPrivateIndex].ptr = bd;
- return TRUE;
+ //Generate a blur display
+ BlurfxDisplay *bd = (BlurfxDisplay *) calloc (1, sizeof (BlurfxDisplay));
+ //Allocate a private index
+ bd->screenPrivateIndex = allocateScreenPrivateIndex (d);
+ //Check if its valid
+ if (bd->screenPrivateIndex < 0)
+ {
+ //Its invalid so free memory and return
+ free (bd);
+ return FALSE;
+ }
+
+ blurfxDisplayInitOptions (bd);
+
+ //Record the display
+ d->privates[displayPrivateIndex].ptr = bd;
+ return TRUE;
}
-static void blurfxFiniDisplay(CompPlugin * p, CompDisplay * d)
+static void
+blurfxFiniDisplay (CompPlugin * p, CompDisplay * d)
{
- BLURFX_DISPLAY(d);
- //Free the private index
- freeScreenPrivateIndex(d, bd->screenPrivateIndex);
- //Free the pointer
- free(bd);
+ BLURFX_DISPLAY (d);
+ //Free the private index
+ freeScreenPrivateIndex (d, bd->screenPrivateIndex);
+ //Free the pointer
+ free (bd);
}
-static Bool blurfxInitScreen(CompPlugin * p, CompScreen * s)
+static Bool
+blurfxInitScreen (CompPlugin * p, CompScreen * s)
{
- BLURFX_DISPLAY(s->display);
- // Create a blur screen
- BlurfxScreen *bs =
- (BlurfxScreen *) calloc(1, sizeof(BlurfxScreen));
- s->privates[bd->screenPrivateIndex].ptr = bs;
-
- bs->blur_supported = TRUE;
- bs->fboBlur_supported = TRUE;
- bs->mblur_supported = TRUE;
- bs->reflection_supported = TRUE;
- bs->rb_supported = TRUE;
-
- const char *glExtensions =
- (const char *) glGetString(GL_EXTENSIONS);
-
- // Check for extensions and disable unsupported features
- if (!s->fbo) {
- fprintf(stderr,
- "No framebuffer_object support! (only simple blur aviable)\n");
- bs->fboBlur_supported = FALSE;
- }
- if (!s->fragmentProgram) {
- fprintf(stderr,
- "No fragment_program support! (only simple blur aviable)\n");
- bs->fboBlur_supported = FALSE;
- }
- if (!s->textureRectangle) {
- fprintf(stderr,
- "No texture_rectangle support! (blur effects disabled)\n");
- bs->blur_supported = FALSE;
- bs->fboBlur_supported = FALSE;
- bs->mblur_supported = FALSE;
- }
- if (!s->textureEnvCombine) {
- fprintf(stderr,
- "No texture_env_combine support! (blur and reflection effects disabled)\n");
- bs->blur_supported = FALSE;
- bs->fboBlur_supported = FALSE;
- bs->reflection_supported = FALSE;
- }
-
- if (strstr(glExtensions, "GL_EXT_packed_depth_stencil")
- || strstr(glExtensions, "GL_NV_packed_depth_stencil")) {
- bs->rb_supported = TRUE;
- } else {
- fprintf(stderr,
- "No packed_depth_stencil support! (this may cause some artefacts in fbo mode)\n");
- bs->rb_supported = FALSE;
- }
-
- // initialize all variables
- bs->windowPrivateIndex = allocateWindowPrivateIndex(s);
-
- bs->vertArray.vertices = 0;
- bs->vertArray.vCount = 0;
- bs->vertArray.vertexSize = 0;
-
- bs->screenDamage = XCreateRegion();
- bs->occlusion = XCreateRegion();
- bs->blurredRegion = XCreateRegion();
-
- bs->mb_activated = FALSE;
- bs->mb_update = TRUE;
-
- bs->noBlurWMask = 0;
- bs->noReflectionWMask = 0;
-
- // setup settings
- blurfxScreenInitOptions(bs);
-
- int i = 0;
- for (i = 0; i < LIST_SIZE(mBlurModes); i++)
- if (strcmp
- (bs->opt[BLURFX_SCREEN_OPTION_MOTION_BLUR_MODE].value.
- s, mBlurModes[i]) == 0)
- bs->mb_mode = i;
-
- for (i = 0; i < LIST_SIZE(blurShaderNames); i++)
- if (strcmp
- (bs->opt[BLURFX_SCREEN_OPTION_BLUR_SHADER].value.s,
- blurShaderNames[i]) == 0)
- bs->blur_shader = i;
-
- addScreenAction(s,
- &bd->opt[BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE].
- value.action);
-
- //Take over the window draw function
- WRAP(bs, s, drawWindowTexture, blurfxDrawWindowTexture);
- WRAP(bs, s, drawWindow, blurfxDrawWindow);
- WRAP(bs, s, damageWindowRect, blurfxDamageWindowRect);
- WRAP(bs, s, paintScreen, blurfxPaintScreen);
- WRAP(bs, s, addWindowGeometry, blurfxAddWindowGeometry);
- WRAP(bs, s, preparePaintScreen, blurfxPreparePaintScreen);
- WRAP(bs, s, paintTransformedScreen, blurfxPaintTransformedScreen);
-
- damageScreen(s);
-
- bs->ipcs_disable_blur =
- IPCS_GetAtom(IPCS_OBJECT(s), IPCS_BOOL, "DISABLE_BLUR", TRUE);
- bs->ipcs_disable_reflection =
- IPCS_GetAtom(IPCS_OBJECT(s), IPCS_BOOL, "DISABLE_REFLECTION",
- TRUE);
- bs->ipcs_disable_mblur =
- IPCS_GetAtom(IPCS_OBJECT(s), IPCS_BOOL, "DISABLE_MOTION_BLUR",
- TRUE);
-
- return TRUE;
+ BLURFX_DISPLAY (s->display);
+ // Create a blur screen
+ BlurfxScreen *bs = (BlurfxScreen *) calloc (1, sizeof (BlurfxScreen));
+ s->privates[bd->screenPrivateIndex].ptr = bs;
+
+ bs->blur_supported = TRUE;
+ bs->fboBlur_supported = TRUE;
+ bs->mblur_supported = TRUE;
+ bs->reflection_supported = TRUE;
+ bs->rb_supported = TRUE;
+
+ const char *glExtensions = (const char *)glGetString (GL_EXTENSIONS);
+
+ // Check for extensions and disable unsupported features
+ if (!s->fbo)
+ {
+ fprintf (stderr,
+ "No framebuffer_object support! (only simple blur aviable)\n");
+ bs->fboBlur_supported = FALSE;
+ }
+ if (!s->fragmentProgram)
+ {
+ fprintf (stderr,
+ "No fragment_program support! (only simple blur aviable)\n");
+ bs->fboBlur_supported = FALSE;
+ }
+ if (!s->textureRectangle)
+ {
+ fprintf (stderr,
+ "No texture_rectangle support! (blur effects disabled)\n");
+ bs->blur_supported = FALSE;
+ bs->fboBlur_supported = FALSE;
+ bs->mblur_supported = FALSE;
+ }
+ if (!s->textureEnvCombine)
+ {
+ fprintf (stderr,
+ "No texture_env_combine support! (blur and reflection effects disabled)\n");
+ bs->blur_supported = FALSE;
+ bs->fboBlur_supported = FALSE;
+ bs->reflection_supported = FALSE;
+ }
+
+ if (strstr (glExtensions, "GL_EXT_packed_depth_stencil")
+ || strstr (glExtensions, "GL_NV_packed_depth_stencil"))
+ {
+ bs->rb_supported = TRUE;
+ }
+ else
+ {
+ fprintf (stderr,
+ "No packed_depth_stencil support! (this may cause some artefacts in fbo mode)\n");
+ bs->rb_supported = FALSE;
+ }
+
+ // initialize all variables
+ bs->windowPrivateIndex = allocateWindowPrivateIndex (s);
+
+ bs->vertArray.vertices = 0;
+ bs->vertArray.vCount = 0;
+ bs->vertArray.vertexSize = 0;
+
+ bs->screenDamage = XCreateRegion ();
+ bs->occlusion = XCreateRegion ();
+ bs->blurredRegion = XCreateRegion ();
+
+ bs->mb_activated = FALSE;
+ bs->mb_update = TRUE;
+
+ bs->noBlurWMask = 0;
+ bs->noReflectionWMask = 0;
+
+ // setup settings
+ blurfxScreenInitOptions (bs);
+
+ int i = 0;
+ for (i = 0; i < LIST_SIZE (mBlurModes); i++)
+ if (strcmp
+ (bs->opt[BLURFX_SCREEN_OPTION_MOTION_BLUR_MODE].value.
+ s, mBlurModes[i]) == 0)
+ bs->mb_mode = i;
+
+ for (i = 0; i < LIST_SIZE (blurShaderNames); i++)
+ if (strcmp
+ (bs->opt[BLURFX_SCREEN_OPTION_BLUR_SHADER].value.s,
+ blurShaderNames[i]) == 0)
+ bs->blur_shader = i;
+
+ addScreenAction (s,
+ &bd->opt[BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE].
+ value.action);
+
+ //Take over the window draw function
+ WRAP (bs, s, drawWindowTexture, blurfxDrawWindowTexture);
+ WRAP (bs, s, drawWindow, blurfxDrawWindow);
+ WRAP (bs, s, damageWindowRect, blurfxDamageWindowRect);
+ WRAP (bs, s, paintScreen, blurfxPaintScreen);
+ WRAP (bs, s, addWindowGeometry, blurfxAddWindowGeometry);
+ WRAP (bs, s, preparePaintScreen, blurfxPreparePaintScreen);
+ WRAP (bs, s, paintTransformedScreen, blurfxPaintTransformedScreen);
+
+ damageScreen (s);
+
+ bs->ipcs_disable_blur =
+ IPCS_GetAtom (IPCS_OBJECT (s), IPCS_BOOL, "DISABLE_BLUR", TRUE);
+ bs->ipcs_disable_reflection =
+ IPCS_GetAtom (IPCS_OBJECT (s), IPCS_BOOL, "DISABLE_REFLECTION", TRUE);
+ bs->ipcs_disable_mblur =
+ IPCS_GetAtom (IPCS_OBJECT (s), IPCS_BOOL, "DISABLE_MOTION_BLUR",
+ TRUE);
+
+ return TRUE;
}
-static void blurfxFiniScreen(CompPlugin * p, CompScreen * s)
+static void
+blurfxFiniScreen (CompPlugin * p, CompScreen * s)
{
- BLURFX_SCREEN(s);
- BLURFX_DISPLAY(s->display);
-
- // delete shaders
- if (bs->blurShaderV)
- (*s->deletePrograms) (1, &bs->blurShaderV);
- if (bs->blurShaderH)
- (*s->deletePrograms) (1, &bs->blurShaderH);
-
- // delete the textures
- if (bs->backTex.handle)
- glDeleteTextures(1, &bs->backTex.handle);
- if (bs->motionTex.handle)
- glDeleteTextures(1, &bs->motionTex.handle);
- if (bs->blurTempTexV.handle)
- glDeleteTextures(1, &bs->blurTempTexV.handle);
- if (bs->blurTempTexH.handle)
- glDeleteTextures(1, &bs->blurTempTexH.handle);
- if (bs->modTex.handle)
- glDeleteTextures(1, &bs->modTex.handle);
-
- // delete framebuffer object
- if (bs->fbo) {
- s->deleteFramebuffers(1, &bs->fbo);
- if (bs->rb_supported)
- s->deleteRenderbuffers(1, &bs->rb);
- }
- // free some pointers
- free(bs->vertArray.vertices);
-
- freeWindowPrivateIndex(s, bs->windowPrivateIndex);
-
- XDestroyRegion(bs->screenDamage);
- XDestroyRegion(bs->occlusion);
- XDestroyRegion(bs->blurredRegion);
-
-
- // restore the original function
- UNWRAP(bs, s, drawWindowTexture);
- UNWRAP(bs, s, drawWindow);
- UNWRAP(bs, s, damageWindowRect);
- UNWRAP(bs, s, paintScreen);
- UNWRAP(bs, s, addWindowGeometry);
- UNWRAP(bs, s, preparePaintScreen);
- UNWRAP(bs, s, paintTransformedScreen);
-
- removeScreenAction(s,
- &bd->
- opt[BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE].
- value.action);
-
- // free the screen pointer
- free(bs);
+ BLURFX_SCREEN (s);
+ BLURFX_DISPLAY (s->display);
+
+ // delete shaders
+ if (bs->blurShaderV)
+ (*s->deletePrograms) (1, &bs->blurShaderV);
+ if (bs->blurShaderH)
+ (*s->deletePrograms) (1, &bs->blurShaderH);
+
+ // delete the textures
+ if (bs->backTex.handle)
+ glDeleteTextures (1, &bs->backTex.handle);
+ if (bs->motionTex.handle)
+ glDeleteTextures (1, &bs->motionTex.handle);
+ if (bs->blurTempTexV.handle)
+ glDeleteTextures (1, &bs->blurTempTexV.handle);
+ if (bs->blurTempTexH.handle)
+ glDeleteTextures (1, &bs->blurTempTexH.handle);
+ if (bs->modTex.handle)
+ glDeleteTextures (1, &bs->modTex.handle);
+
+ // delete framebuffer object
+ if (bs->fbo)
+ {
+ s->deleteFramebuffers (1, &bs->fbo);
+ if (bs->rb_supported)
+ s->deleteRenderbuffers (1, &bs->rb);
+ }
+ // free some pointers
+ free (bs->vertArray.vertices);
+
+ freeWindowPrivateIndex (s, bs->windowPrivateIndex);
+
+ XDestroyRegion (bs->screenDamage);
+ XDestroyRegion (bs->occlusion);
+ XDestroyRegion (bs->blurredRegion);
+
+
+ // restore the original function
+ UNWRAP (bs, s, drawWindowTexture);
+ UNWRAP (bs, s, drawWindow);
+ UNWRAP (bs, s, damageWindowRect);
+ UNWRAP (bs, s, paintScreen);
+ UNWRAP (bs, s, addWindowGeometry);
+ UNWRAP (bs, s, preparePaintScreen);
+ UNWRAP (bs, s, paintTransformedScreen);
+
+ removeScreenAction (s,
+ &bd->
+ opt[BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE].
+ value.action);
+
+ // free the screen pointer
+ free (bs);
}
-static Bool blurfxInitWindow(CompPlugin * p, CompWindow * w)
+static Bool
+blurfxInitWindow (CompPlugin * p, CompWindow * w)
{
- BlurfxWindow *bw;
-
- BLURFX_SCREEN(w->screen);
-
- // create window
- bw = calloc(1, sizeof(BlurfxWindow));
- if (!bw)
- return FALSE;
-
- // initialize variables
- bw->my_next = w->next;
- bw->lastX = w->attrib.x;
- bw->lastY = w->attrib.y;
- bw->lastPAttrib = w->lastPaint;
- bw->decoArray.vertices = NULL;
- bw->decoArray.indices = NULL;
- bw->decoArray.vCount = 0;
- bw->decoArray.vertexSize = 0;
- bw->decoArray.indexSize = 0;
- bw->decoArray.indexCount = 0;
- bw->paintRegion = XCreateRegion();
- bw->damageRegion = XCreateRegion();
- bw->texDamage = XCreateRegion();
- bw->bTexRegion = XCreateRegion();
- bw->clip = XCreateRegion();
- bw->hasTexture = FALSE;
- bw->vertArray.vertices = 0;
- bw->vertArray.vCount = 0;
- bw->vertArray.vertexSize = 0;
- bw->isSwitcher = FALSE;
-
- Atom type;
- int format;
- unsigned long nitems;
- unsigned long bytes_after;
- Window *xw;
-
- int result = XGetWindowProperty(w->screen->display->display, w->id,
- XInternAtom(w->screen->display->
- display,
- "_SWITCH_SELECT_WINDOW",
- 0),
- 0L, 1L,
- False, XA_WINDOW, &type, &format,
- &nitems,
- &bytes_after, (void *) &xw);
-
- if (result == Success && type == XA_WINDOW)
- bw->isSwitcher = TRUE;
-
- w->privates[bs->windowPrivateIndex].ptr = bw;
-
- damageScreen(w->screen);
-
- bw->ipcs_disable_blur =
- IPCS_GetAtom(IPCS_OBJECT(w), IPCS_BOOL, "DISABLE_BLUR", TRUE);
- bw->ipcs_disable_reflection =
- IPCS_GetAtom(IPCS_OBJECT(w), IPCS_BOOL, "DISABLE_REFLECTION",
- TRUE);
-
- return TRUE;
+ BlurfxWindow *bw;
+
+ BLURFX_SCREEN (w->screen);
+
+ // create window
+ bw = calloc (1, sizeof (BlurfxWindow));
+ if (!bw)
+ return FALSE;
+
+ // initialize variables
+ bw->my_next = w->next;
+ bw->lastX = w->attrib.x;
+ bw->lastY = w->attrib.y;
+ bw->lastPAttrib = w->lastPaint;
+ bw->decoArray.vertices = NULL;
+ bw->decoArray.indices = NULL;
+ bw->decoArray.vCount = 0;
+ bw->decoArray.vertexSize = 0;
+ bw->decoArray.indexSize = 0;
+ bw->decoArray.indexCount = 0;
+ bw->paintRegion = XCreateRegion ();
+ bw->damageRegion = XCreateRegion ();
+ bw->texDamage = XCreateRegion ();
+ bw->bTexRegion = XCreateRegion ();
+ bw->clip = XCreateRegion ();
+ bw->hasTexture = FALSE;
+ bw->vertArray.vertices = 0;
+ bw->vertArray.vCount = 0;
+ bw->vertArray.vertexSize = 0;
+ bw->isSwitcher = FALSE;
+
+ Atom type;
+ int format;
+ unsigned long nitems;
+ unsigned long bytes_after;
+ Window *xw;
+
+ int result = XGetWindowProperty (w->screen->display->display, w->id,
+ XInternAtom (w->screen->display->display,
+ "_SWITCH_SELECT_WINDOW",
+ 0),
+ 0L, 1L,
+ False, XA_WINDOW, &type, &format,
+ &nitems,
+ &bytes_after, (void *)&xw);
+
+ if (result == Success && type == XA_WINDOW)
+ bw->isSwitcher = TRUE;
+
+ w->privates[bs->windowPrivateIndex].ptr = bw;
+
+ damageScreen (w->screen);
+
+ bw->ipcs_disable_blur =
+ IPCS_GetAtom (IPCS_OBJECT (w), IPCS_BOOL, "DISABLE_BLUR", TRUE);
+ bw->ipcs_disable_reflection =
+ IPCS_GetAtom (IPCS_OBJECT (w), IPCS_BOOL, "DISABLE_REFLECTION", TRUE);
+
+ return TRUE;
}
-static void blurfxFiniWindow(CompPlugin * p, CompWindow * w)
+static void
+blurfxFiniWindow (CompPlugin * p, CompWindow * w)
{
- BLURFX_WINDOW(w);
-
- // free regions
- XDestroyRegion(bw->paintRegion);
- XDestroyRegion(bw->damageRegion);
- XDestroyRegion(bw->texDamage);
- XDestroyRegion(bw->bTexRegion);
- XDestroyRegion(bw->clip);
-
- // delete blur cache texture
- if (bw->hasTexture)
- glDeleteTextures(1, &bw->blurTex.handle);
-
- // free used memory
- if (bw->decoArray.vertices)
- free(bw->decoArray.vertices);
- if (bw->decoArray.indices)
- free(bw->decoArray.indices);
- if (bw->vertArray.vertices)
- free(bw->vertArray.vertices);
-
- // free window pointer
- free(bw);
+ BLURFX_WINDOW (w);
+
+ // free regions
+ XDestroyRegion (bw->paintRegion);
+ XDestroyRegion (bw->damageRegion);
+ XDestroyRegion (bw->texDamage);
+ XDestroyRegion (bw->bTexRegion);
+ XDestroyRegion (bw->clip);
+
+ // delete blur cache texture
+ if (bw->hasTexture)
+ glDeleteTextures (1, &bw->blurTex.handle);
+
+ // free used memory
+ if (bw->decoArray.vertices)
+ free (bw->decoArray.vertices);
+ if (bw->decoArray.indices)
+ free (bw->decoArray.indices);
+ if (bw->vertArray.vertices)
+ free (bw->vertArray.vertices);
+
+ // free window pointer
+ free (bw);
}
-static CompOption *blurfxGetDisplayOptions(CompDisplay * display,
- int *count)
+static CompOption *
+blurfxGetDisplayOptions (CompDisplay * display, int *count)
{
- if (display) {
- BLURFX_DISPLAY(display);
-
- *count = NUM_OPTIONS(bd);
- return bd->opt;
- } else {
- BlurfxDisplay *bd =
- (BlurfxDisplay *) calloc(1, sizeof(BlurfxDisplay));
- blurfxDisplayInitOptions(bd);
- *count = NUM_OPTIONS(bd);
- return bd->opt;
- }
+ if (display)
+ {
+ BLURFX_DISPLAY (display);
+
+ *count = NUM_OPTIONS (bd);
+ return bd->opt;
+ }
+ else
+ {
+ BlurfxDisplay *bd =
+ (BlurfxDisplay *) calloc (1, sizeof (BlurfxDisplay));
+ blurfxDisplayInitOptions (bd);
+ *count = NUM_OPTIONS (bd);
+ return bd->opt;
+ }
}
static Bool
-blurfxSetDisplayOption(CompDisplay * display, char *name,
- CompOptionValue * value)
+blurfxSetDisplayOption (CompDisplay * display, char *name,
+ CompOptionValue * value)
{
- CompOption *o;
- int index;
+ CompOption *o;
+ int index;
- BLURFX_DISPLAY(display);
+ BLURFX_DISPLAY (display);
- o = compFindOption(bd->opt, NUM_OPTIONS(bd), name, &index);
- if (!o)
- return FALSE;
+ o = compFindOption (bd->opt, NUM_OPTIONS (bd), name, &index);
+ if (!o)
+ return FALSE;
- switch (index) {
- case BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE:
- if (setDisplayAction(display, o, value))
- return TRUE;
- break;
- default:
- break;
- }
+ switch (index)
+ {
+ case BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE:
+ if (setDisplayAction (display, o, value))
+ return TRUE;
+ break;
+ default:
+ break;
+ }
- return FALSE;
+ return FALSE;
}
-static void blurfxDisplayInitOptions(BlurfxDisplay * bd)
+static void
+blurfxDisplayInitOptions (BlurfxDisplay * bd)
{
- CompOption *o;
-
- o = &bd->opt[BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE];
- o->name = "motion_blur_toggle";
- o->group = N_("Motion Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Toggle motion blur");
- o->longDesc = N_("Toggle motion blur effect");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = blurfxToggleMotionBlur;
- o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = CompBindingTypeKey;
- o->value.action.state = CompActionStateInitKey;
- o->value.action.key.modifiers =
- BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE_MOD_DEFAULT;
- o->value.action.key.keysym =
- XStringToKeysym
- (BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE_KEY_DEFAULT);
+ CompOption *o;
+
+ o = &bd->opt[BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE];
+ o->name = "motion_blur_toggle";
+ o->group = N_("Motion Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Toggle motion blur");
+ o->longDesc = N_("Toggle motion blur effect");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = blurfxToggleMotionBlur;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.state = CompActionStateInitKey;
+ o->value.action.key.modifiers =
+ BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE_MOD_DEFAULT;
+ o->value.action.key.keysym =
+ XStringToKeysym
+ (BLURFX_DISPLAY_OPTION_MOTION_BLUR_TOGGLE_KEY_DEFAULT);
}
static Bool
-blurfxSetScreenOption(CompScreen * s, char *name, CompOptionValue * value)
+blurfxSetScreenOption (CompScreen * s, char *name, CompOptionValue * value)
{
- CompOption *o;
- int index;
-
- BLURFX_SCREEN(s);
-
- o = compFindOption(bs->opt, NUM_OPTIONS(bs), name, &index);
- if (!o)
- return FALSE;
-
- switch (index) {
- case BLURFX_SCREEN_OPTION_BLUR_WINDOWS:
- case BLURFX_SCREEN_OPTION_BLUR_DECORATION:
- case BLURFX_SCREEN_OPTION_REFLECTION_WINDOWS:
- case BLURFX_SCREEN_OPTION_REFLECTION_DECORATION:
- case BLURFX_SCREEN_OPTION_BLUR_ON_TRANSFORMED_SCREEN:
- case BLURFX_SCREEN_OPTION_BLUR_TRANSFORMED_WINDOW:
- case BLURFX_SCREEN_OPTION_REFLECTION_ON_TRANSFORMED_SCREEN:
- case BLURFX_SCREEN_OPTION_REFLECTION_TRANSFORMED_WINDOW:
- case BLURFX_SCREEN_OPTION_REFLECTION_SCALE:
- case BLURFX_SCREEN_OPTION_REFLECTION_PROPORTIONAL:
- case BLURFX_SCREEN_OPTION_MOTION_BLUR_ON_TRANSFORMED_SCREEN:
- case BLURFX_SCREEN_OPTION_DISABLE_DECORATION_ALPHADEP:
- case BLURFX_SCREEN_OPTION_NO_BLUR_CACHE_ON_TRANSFORMED_SCREEN:
- if (compSetBoolOption(o, value)) {
- damageScreen(s);
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_BLUR_CACHE_TEXTURES:
- if (compSetBoolOption(o, value)) {
- if (!value->b) {
- CompWindow *w;
- for (w = s->windows; w; w = w->next) {
- BLURFX_WINDOW(w);
- if (bw->hasTexture) {
- bw->hasTexture = FALSE;
- glDeleteTextures(1,
- &bw->
- blurTex.
- handle);
- bw->blurTex.handle = 0;
- }
- }
- }
- damageScreen(s);
- return TRUE;
- }
- break;
-
- case BLURFX_SCREEN_OPTION_BLUR_SHADER:
- if (compSetStringOption(o, value)) {
- int i = 0;
- for (i = 0; i < LIST_SIZE(blurShaderNames); i++)
- if (strcmp(value->s, blurShaderNames[i]) ==
- 0)
- bs->blur_shader = i;
-
- if (bs->fboBlur_supported && bs->hasInit
- && !bs->
- opt[BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR].
- value.b) {
- loadShader(GL_FRAGMENT_PROGRAM_ARB, s,
- &bs->blurShaderV,
- blurShader[bs->blur_shader][0]);
- loadShader(GL_FRAGMENT_PROGRAM_ARB, s,
- &bs->blurShaderH,
- blurShader[bs->blur_shader][1]);
- damageScreen(s);
- CompWindow *w;
- for (w = s->windows; w; w = w->next) {
- BLURFX_WINDOW(w);
- if (bw->hasTexture) {
- bw->hasTexture = FALSE;
- glDeleteTextures(1,
- &bw->
- blurTex.
- handle);
- bw->blurTex.handle = 0;
- }
- }
- }
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_DISABLE_BLUR_ON_SCREENGRAB_OF:
- case BLURFX_SCREEN_OPTION_DISABLE_REFLECTION_ON_SCREENGRAB_OF:
- case BLURFX_SCREEN_OPTION_MOTION_BLUR_ON_SCREENGRAB_OF:
- if (compSetOptionList(o, value)) {
- damageScreen(s);
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_REFLECTION_FILE:
- if (compSetStringOption(o, value)) {
- if (bs->reflection_supported) {
- loadPngToTexture2D(s, bs, &bs->modTex, value->s);
- damageScreen(s);
- }
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_REFLECTION_USE_IMAGE_COLOR:
- case BLURFX_SCREEN_OPTION_REFLECTION_USE_IMAGE_ALPHA:
- if (compSetBoolOption(o, value)) {
- if (bs->reflection_supported) {
- loadPngToTexture2D(s, bs, &bs->modTex,
- bs->
- opt
- [BLURFX_SCREEN_OPTION_REFLECTION_FILE].
- value.s);
- damageScreen(s);
- }
- damageScreen(s);
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_BLUR_SATURATION:
- case BLURFX_SCREEN_OPTION_MOTION_BLUR_STRENGTH:
- if (compSetFloatOption(o, value)) {
- damageScreen(s);
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_DISABLE_BLUR_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- bs->noBlurWMask =
- compWindowTypeMaskFromStringList(&o->value);
- damageScreen(s);
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_DISABLE_REFLECTION_WINDOW_TYPE:
- if (compSetOptionList(o, value)) {
- bs->noReflectionWMask =
- compWindowTypeMaskFromStringList(&o->value);
- damageScreen(s);
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_MOTION_BLUR_MODE:
- if (compSetStringOption(o, value)) {
- int i;
- for (i = 0; i < LIST_SIZE(mBlurModes); i++)
- if (strcmp(value->s, mBlurModes[i]) == 0)
- bs->mb_mode = i;
-
- if (bs->hasInit && bs->mblur_supported
- && bs->motionTex.handle) {
- glDeleteTextures(1, &bs->motionTex.handle);
- bs->motionTex.handle = 0;
- }
- if (bs->hasInit && bs->mblur_supported
- && (bs->mb_mode == 0 || bs->mb_mode == 2)) {
- genBlurTexture(bs, &bs->motionTex,
- s->width, s->height,
- bs->mb_mode);
- }
- bs->mb_update = TRUE;
- damageScreen(s);
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR:
- if (compSetBoolOption(o, value)) {
- if (!bs->hasInit)
- return TRUE;
-
- if (bs->fboBlur_supported && !value->b) {
- // load shaders
- loadShader(GL_FRAGMENT_PROGRAM_ARB, s,
- &bs->blurShaderV,
- blurShader[bs->blur_shader][0]);
- loadShader(GL_FRAGMENT_PROGRAM_ARB, s,
- &bs->blurShaderH,
- blurShader[bs->blur_shader][1]);
- bs->downSample = 1.0;
- }
- CompWindow *w;
- for (w = s->windows; w; w = w->next) {
- BLURFX_WINDOW(w);
- if (bw->hasTexture) {
- bw->hasTexture = FALSE;
- glDeleteTextures(1,
- &bw->blurTex.
- handle);
- bw->blurTex.handle = 0;
- }
- }
- damageScreen(s);
- return TRUE;
- }
- break;
- case BLURFX_SCREEN_OPTION_NON_FBO_BLUR_STRENGTH:
- if (compSetIntOption(o, value)) {
- if (!bs->hasInit)
- return TRUE;
-
- if (!bs->fboBlur_supported
- || bs->
- opt[BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR].
- value.b) {
- bs->downSample =
- bs->
- opt
- [BLURFX_SCREEN_OPTION_NON_FBO_BLUR_STRENGTH].
- value.i;
- CompWindow *w;
- for (w = s->windows; w; w = w->next) {
- BLURFX_WINDOW(w);
- if (bw->hasTexture) {
- bw->hasTexture = FALSE;
- glDeleteTextures(1,
- &bw->
- blurTex.
- handle);
- bw->blurTex.handle = 0;
- }
- }
- }
- damageScreen(s);
- return TRUE;
- }
- break;
- default:
- break;
- }
- return FALSE;
+ CompOption *o;
+ int index;
+
+ BLURFX_SCREEN (s);
+
+ o = compFindOption (bs->opt, NUM_OPTIONS (bs), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index)
+ {
+ case BLURFX_SCREEN_OPTION_BLUR_WINDOWS:
+ case BLURFX_SCREEN_OPTION_BLUR_DECORATION:
+ case BLURFX_SCREEN_OPTION_REFLECTION_WINDOWS:
+ case BLURFX_SCREEN_OPTION_REFLECTION_DECORATION:
+ case BLURFX_SCREEN_OPTION_BLUR_ON_TRANSFORMED_SCREEN:
+ case BLURFX_SCREEN_OPTION_BLUR_TRANSFORMED_WINDOW:
+ case BLURFX_SCREEN_OPTION_REFLECTION_ON_TRANSFORMED_SCREEN:
+ case BLURFX_SCREEN_OPTION_REFLECTION_TRANSFORMED_WINDOW:
+ case BLURFX_SCREEN_OPTION_REFLECTION_SCALE:
+ case BLURFX_SCREEN_OPTION_REFLECTION_PROPORTIONAL:
+ case BLURFX_SCREEN_OPTION_MOTION_BLUR_ON_TRANSFORMED_SCREEN:
+ case BLURFX_SCREEN_OPTION_DISABLE_DECORATION_ALPHADEP:
+ case BLURFX_SCREEN_OPTION_NO_BLUR_CACHE_ON_TRANSFORMED_SCREEN:
+ if (compSetBoolOption (o, value))
+ {
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_BLUR_CACHE_TEXTURES:
+ if (compSetBoolOption (o, value))
+ {
+ if (!value->b)
+ {
+ CompWindow *w;
+ for (w = s->windows; w; w = w->next)
+ {
+ BLURFX_WINDOW (w);
+ if (bw->hasTexture)
+ {
+ bw->hasTexture = FALSE;
+ glDeleteTextures (1, &bw->blurTex.handle);
+ bw->blurTex.handle = 0;
+ }
+ }
+ }
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+
+ case BLURFX_SCREEN_OPTION_BLUR_SHADER:
+ if (compSetStringOption (o, value))
+ {
+ int i = 0;
+ for (i = 0; i < LIST_SIZE (blurShaderNames); i++)
+ if (strcmp (value->s, blurShaderNames[i]) == 0)
+ bs->blur_shader = i;
+
+ if (bs->fboBlur_supported && bs->hasInit
+ && !bs->opt[BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR].value.b)
+ {
+ loadShader (GL_FRAGMENT_PROGRAM_ARB, s,
+ &bs->blurShaderV, blurShader[bs->blur_shader][0]);
+ loadShader (GL_FRAGMENT_PROGRAM_ARB, s,
+ &bs->blurShaderH, blurShader[bs->blur_shader][1]);
+ damageScreen (s);
+ CompWindow *w;
+ for (w = s->windows; w; w = w->next)
+ {
+ BLURFX_WINDOW (w);
+ if (bw->hasTexture)
+ {
+ bw->hasTexture = FALSE;
+ glDeleteTextures (1, &bw->blurTex.handle);
+ bw->blurTex.handle = 0;
+ }
+ }
+ }
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_DISABLE_BLUR_ON_SCREENGRAB_OF:
+ case BLURFX_SCREEN_OPTION_DISABLE_REFLECTION_ON_SCREENGRAB_OF:
+ case BLURFX_SCREEN_OPTION_MOTION_BLUR_ON_SCREENGRAB_OF:
+ if (compSetOptionList (o, value))
+ {
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_REFLECTION_FILE:
+ if (compSetStringOption (o, value))
+ {
+ if (bs->reflection_supported)
+ {
+ loadPngToTexture2D (s, bs, &bs->modTex, value->s);
+ damageScreen (s);
+ }
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_REFLECTION_USE_IMAGE_COLOR:
+ case BLURFX_SCREEN_OPTION_REFLECTION_USE_IMAGE_ALPHA:
+ if (compSetBoolOption (o, value))
+ {
+ if (bs->reflection_supported)
+ {
+ loadPngToTexture2D (s, bs, &bs->modTex,
+ bs->
+ opt
+ [BLURFX_SCREEN_OPTION_REFLECTION_FILE].
+ value.s);
+ damageScreen (s);
+ }
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_BLUR_SATURATION:
+ case BLURFX_SCREEN_OPTION_MOTION_BLUR_STRENGTH:
+ if (compSetFloatOption (o, value))
+ {
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_DISABLE_BLUR_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ bs->noBlurWMask = compWindowTypeMaskFromStringList (&o->value);
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_DISABLE_REFLECTION_WINDOW_TYPE:
+ if (compSetOptionList (o, value))
+ {
+ bs->noReflectionWMask =
+ compWindowTypeMaskFromStringList (&o->value);
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_MOTION_BLUR_MODE:
+ if (compSetStringOption (o, value))
+ {
+ int i;
+ for (i = 0; i < LIST_SIZE (mBlurModes); i++)
+ if (strcmp (value->s, mBlurModes[i]) == 0)
+ bs->mb_mode = i;
+
+ if (bs->hasInit && bs->mblur_supported && bs->motionTex.handle)
+ {
+ glDeleteTextures (1, &bs->motionTex.handle);
+ bs->motionTex.handle = 0;
+ }
+ if (bs->hasInit && bs->mblur_supported
+ && (bs->mb_mode == 0 || bs->mb_mode == 2))
+ {
+ genBlurTexture (bs, &bs->motionTex,
+ s->width, s->height, bs->mb_mode);
+ }
+ bs->mb_update = TRUE;
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR:
+ if (compSetBoolOption (o, value))
+ {
+ if (!bs->hasInit)
+ return TRUE;
+
+ if (bs->fboBlur_supported && !value->b)
+ {
+ // load shaders
+ loadShader (GL_FRAGMENT_PROGRAM_ARB, s,
+ &bs->blurShaderV, blurShader[bs->blur_shader][0]);
+ loadShader (GL_FRAGMENT_PROGRAM_ARB, s,
+ &bs->blurShaderH, blurShader[bs->blur_shader][1]);
+ bs->downSample = 1.0;
+ }
+ CompWindow *w;
+ for (w = s->windows; w; w = w->next)
+ {
+ BLURFX_WINDOW (w);
+ if (bw->hasTexture)
+ {
+ bw->hasTexture = FALSE;
+ glDeleteTextures (1, &bw->blurTex.handle);
+ bw->blurTex.handle = 0;
+ }
+ }
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+ case BLURFX_SCREEN_OPTION_NON_FBO_BLUR_STRENGTH:
+ if (compSetIntOption (o, value))
+ {
+ if (!bs->hasInit)
+ return TRUE;
+
+ if (!bs->fboBlur_supported
+ || bs->opt[BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR].value.b)
+ {
+ bs->downSample =
+ bs->
+ opt[BLURFX_SCREEN_OPTION_NON_FBO_BLUR_STRENGTH].value.i;
+ CompWindow *w;
+ for (w = s->windows; w; w = w->next)
+ {
+ BLURFX_WINDOW (w);
+ if (bw->hasTexture)
+ {
+ bw->hasTexture = FALSE;
+ glDeleteTextures (1, &bw->blurTex.handle);
+ bw->blurTex.handle = 0;
+ }
+ }
+ }
+ damageScreen (s);
+ return TRUE;
+ }
+ break;
+ default:
+ break;
+ }
+ return FALSE;
}
-static CompOption *blurfxGetScreenOptions(CompScreen * s, int *count)
+static CompOption *
+blurfxGetScreenOptions (CompScreen * s, int *count)
{
- if (s) {
- BLURFX_SCREEN(s);
-
- *count = NUM_OPTIONS(bs);
- return bs->opt;
- } else {
- BlurfxScreen *bs =
- (BlurfxScreen *) calloc(1, sizeof(BlurfxScreen));
- blurfxScreenInitOptions(bs);
- *count = NUM_OPTIONS(bs);
- return bs->opt;
- }
+ if (s)
+ {
+ BLURFX_SCREEN (s);
+
+ *count = NUM_OPTIONS (bs);
+ return bs->opt;
+ }
+ else
+ {
+ BlurfxScreen *bs = (BlurfxScreen *) calloc (1, sizeof (BlurfxScreen));
+ blurfxScreenInitOptions (bs);
+ *count = NUM_OPTIONS (bs);
+ return bs->opt;
+ }
}
-static void blurfxScreenInitOptions(BlurfxScreen * bs)
+static void
+blurfxScreenInitOptions (BlurfxScreen * bs)
{
- CompOption *o;
- int i;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_DECORATION];
- o->name = "blur_decoration";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Blur decoration");
- o->longDesc = N_("Blur decorations");
- o->type = CompOptionTypeBool;
- o->value.b = BLURFX_SCREEN_OPTION_BLUR_DECORATION_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_WINDOWS];
- o->name = "blur_windows";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Blur windows");
- o->longDesc = N_("Blur windows");
- o->type = CompOptionTypeBool;
- o->value.b = BLURFX_SCREEN_OPTION_BLUR_WINDOWS_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_DECORATION];
- o->name = "reflection_decoration";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Reflection decoration");
- o->longDesc = N_("Draw reflection for decorations");
- o->type = CompOptionTypeBool;
- o->value.b = BLURFX_SCREEN_OPTION_REFLECTION_DECORATION_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_WINDOWS];
- o->name = "reflection_windows";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Reflection windows");
- o->longDesc = N_("Draw reflection for windows");
- o->type = CompOptionTypeBool;
- o->value.b = BLURFX_SCREEN_OPTION_REFLECTION_WINDOWS_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_ON_TRANSFORMED_SCREEN];
- o->name = "blur_transformed_screen";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Blur transformed screen");
- o->longDesc = N_("Draw blur if the screen is transformed");
- o->type = CompOptionTypeBool;
- o->value.b =
- BLURFX_SCREEN_OPTION_BLUR_ON_TRANSFORMED_SCREEN_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_TRANSFORMED_WINDOW];
- o->name = "blur_transformed_window";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Blur transformed window");
- o->longDesc = N_("Draw blur if window is transformed");
- o->type = CompOptionTypeBool;
- o->value.b = BLURFX_SCREEN_OPTION_BLUR_TRANSFORMED_WINDOW_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_SHADER];
- o->name = "blur_shader";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Blur Shader");
- o->longDesc = N_("Blur Shader");
- o->type = CompOptionTypeString;
- o->value.s = strdup(BLURFX_SCREEN_OPTION_BLUR_SHADER_DEFAULT);
- o->rest.s.string = blurShaderNames;
- o->rest.s.nString = LIST_SIZE(blurShaderNames);
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR];
- o->name = "force_non_fbo_blur";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Force non fbo blur");
- o->longDesc = N_("Force non fbo blur");
- o->type = CompOptionTypeBool;
- o->value.b = BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_NON_FBO_BLUR_STRENGTH];
- o->name = "non_fbo_blur_strength";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Non fbo blur strength");
- o->longDesc = N_("Non fbo mode blur strength");
- o->type = CompOptionTypeInt;
- o->value.i = BLURFX_SCREEN_OPTION_NON_FBO_BLUR_STRENGTH_DEFAULT;
- o->rest.i.min = 2;
- o->rest.i.max = 12;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_CACHE_TEXTURES];
- o->name = "blur_cache";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Use blur cache");
- o->longDesc = N_("Enables blur cache texture system");
- o->type = CompOptionTypeBool;
- o->value.b = BLURFX_SCREEN_OPTION_BLUR_CACHE_TEXTURES_DEFAULT;
-
- o = &bs->
- opt[BLURFX_SCREEN_OPTION_NO_BLUR_CACHE_ON_TRANSFORMED_SCREEN];
- o->name = "no_cache_when_transformed";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Disable blur cache on transformed screen");
- o->longDesc = N_("Disables blur cache on transformed screen");
- o->type = CompOptionTypeBool;
- o->value.b =
- BLURFX_SCREEN_OPTION_NO_BLUR_CACHE_ON_TRANSFORMED_SCREEN_DEFAULT;
-
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_DISABLE_DECORATION_ALPHADEP];
- o->name = "disable_deco_alpha_dep";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Disable decoration alpha dependency");
- o->longDesc = N_("Disable decoration alpha dependency");
- o->type = CompOptionTypeBool;
- o->value.b =
- BLURFX_SCREEN_OPTION_DISABLE_DECORATION_ALPHADEP_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_DISABLE_BLUR_ON_SCREENGRAB_OF];
- o->name = "disable_blur_on_screengrab_of";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Disable blur on screengrab of");
- o->longDesc =
- N_
- ("Disable drawing of blur when an other plugin grabs the input");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = LIST_SIZE(blurDisable);
- o->value.list.value =
- malloc(sizeof(CompOptionValue) * LIST_SIZE(blurDisable));
- for (i = 0; i < LIST_SIZE(blurDisable); i++)
- o->value.list.value[i].s = strdup(blurDisable[i]);
-
- o = &bs->
- opt[BLURFX_SCREEN_OPTION_REFLECTION_ON_TRANSFORMED_SCREEN];
- o->name = "reflection_transformed_screen";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Reflection transformed screen");
- o->longDesc = N_("Draw reflection if the screen is transformed");
- o->type = CompOptionTypeBool;
- o->value.b =
- BLURFX_SCREEN_OPTION_REFLECTION_ON_TRANSFORMED_SCREEN_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_TRANSFORMED_WINDOW];
- o->name = "reflection_transformed_window";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Reflection transformed window");
- o->longDesc = N_("Draw reflection if the screen is transformed");
- o->type = CompOptionTypeBool;
- o->value.b =
- BLURFX_SCREEN_OPTION_REFLECTION_TRANSFORMED_WINDOW_DEFAULT;
-
- o = &bs->
- opt[BLURFX_SCREEN_OPTION_DISABLE_REFLECTION_ON_SCREENGRAB_OF];
- o->name = "disable_reflection_on_screengrab_of";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Disable reflection on screengrab of");
- o->longDesc =
- N_
- ("Disable drawing of reflection when an other plugin grabs the input");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = 0;
- o->value.list.value = NULL;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_FILE];
- o->name = "reflection_file";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "file;image;pngonly;";
- o->shortDesc = N_("Reflection file");
- o->longDesc = N_("Reflection image file");
- o->type = CompOptionTypeString;
- o->value.s = strdup(BLURFX_SCREEN_OPTION_REFLECTION_FILE_DEFAULT);
- o->rest.s.string = 0;
- o->rest.s.nString = 0;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_SCALE];
- o->name = "reflection_scale";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Reflection scale");
- o->longDesc = N_("Scale reflection image");
- o->type = CompOptionTypeBool;
- o->value.b = BLURFX_SCREEN_OPTION_REFLECTION_SCALE_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_PROPORTIONAL];
- o->name = "reflection_proportional";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Reflection proportional");
- o->longDesc = N_("Scale proportional");
- o->type = CompOptionTypeBool;
- o->value.b = BLURFX_SCREEN_OPTION_REFLECTION_PROPORTIONAL_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_USE_IMAGE_COLOR];
- o->name = "reflection_use_image_colors";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Reflection Use Colors");
- o->longDesc = N_("Do not generate grayscale reflection");
- o->type = CompOptionTypeBool;
- o->value.b =
- BLURFX_SCREEN_OPTION_REFLECTION_USE_IMAGE_COLOR_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_USE_IMAGE_ALPHA];
- o->name = "reflection_use_image_alpha";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Reflection Use Alpha");
- o->longDesc = N_("Use image alpha channel");
- o->type = CompOptionTypeBool;
- o->value.b =
- BLURFX_SCREEN_OPTION_REFLECTION_USE_IMAGE_ALPHA_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_MOTION_BLUR_MODE];
- o->name = "motion_blur_mode";
- o->group = N_("Motion Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Motion Blur Mode");
- o->longDesc =
- N_
- ("Motion blur mode: simple = uses texture copy and blending; accum ="
- " uses gl accumulation buffer; fbo = uses framebuffer objects and float texture;");
- o->type = CompOptionTypeString;
- o->value.s = strdup(BLURFX_SCREEN_OPTION_MOTION_BLUR_MODE_DEFAULT);
- o->rest.s.string = mBlurModes;
- o->rest.s.nString = LIST_SIZE(mBlurModes);
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_MOTION_BLUR_ON_SCREENGRAB_OF];
- o->name = "motion_blur_on_screengrab_of";
- o->group = N_("Motion Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Motion blur on screengrab of");
- o->longDesc = N_("Activate motion blur on screengrab");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = 0;
- o->value.list.value = NULL;
-
- o = &bs->
- opt[BLURFX_SCREEN_OPTION_MOTION_BLUR_ON_TRANSFORMED_SCREEN];
- o->name = "motion_blur_on_transformed_screen";
- o->group = N_("Motion Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Motion blur on transformed screen");
- o->longDesc =
- N_("Execute motion blur if the screen is transformed");
- o->type = CompOptionTypeBool;
- o->value.b =
- BLURFX_SCREEN_OPTION_MOTION_BLUR_ON_TRANSFORMED_SCREEN_DEFAULT;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_MOTION_BLUR_STRENGTH];
- o->name = "motion_blur_strength";
- o->group = N_("Motion Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Motion blur strength");
- o->longDesc = N_("Motion blur strength");
- o->type = CompOptionTypeFloat;
- o->value.f = BLURFX_SCREEN_OPTION_MOTION_BLUR_STRENGTH_DEFAULT;
- o->rest.f.min = 0.0;
- o->rest.f.max = 100.0;
- o->rest.f.precision = 0.01;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_DISABLE_BLUR_WINDOW_TYPE];
- o->name = "disable_blur_window_types";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Disable Blur Window Types");
- o->longDesc = N_("Window types for that blur should be disabled");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = 0;
- o->value.list.value = NULL;
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_DISABLE_REFLECTION_WINDOW_TYPE];
- o->name = "disable_reflection_window_types";
- o->group = N_("Reflection");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Disable Reflection Window Types");
- o->longDesc =
- N_("Window types for that reflection should be disabled");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = 0;
- o->value.list.value = NULL;
- o->rest.s.string = (char **) windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_SATURATION];
- o->name = "blur_saturation";
- o->group = N_("Blur");
- o->subGroup = N_("");
- o->displayHints = "";
- o->shortDesc = N_("Blur saturation");
- o->longDesc = N_("Blur saturation");
- o->type = CompOptionTypeFloat;
- o->value.f = BLURFX_SCREEN_OPTION_BLUR_SATURATION_DEFAULT;
- o->rest.f.min = 0.0;
- o->rest.f.max = 100.0;
- o->rest.f.precision = 0.1;
+ CompOption *o;
+ int i;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_DECORATION];
+ o->name = "blur_decoration";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Blur decoration");
+ o->longDesc = N_("Blur decorations");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_BLUR_DECORATION_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_WINDOWS];
+ o->name = "blur_windows";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Blur windows");
+ o->longDesc = N_("Blur windows");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_BLUR_WINDOWS_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_DECORATION];
+ o->name = "reflection_decoration";
+ o->group = N_("Reflection");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Reflection decoration");
+ o->longDesc = N_("Draw reflection for decorations");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_REFLECTION_DECORATION_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_WINDOWS];
+ o->name = "reflection_windows";
+ o->group = N_("Reflection");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Reflection windows");
+ o->longDesc = N_("Draw reflection for windows");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_REFLECTION_WINDOWS_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_ON_TRANSFORMED_SCREEN];
+ o->name = "blur_transformed_screen";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Blur transformed screen");
+ o->longDesc = N_("Draw blur if the screen is transformed");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_BLUR_ON_TRANSFORMED_SCREEN_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_TRANSFORMED_WINDOW];
+ o->name = "blur_transformed_window";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Blur transformed window");
+ o->longDesc = N_("Draw blur if window is transformed");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_BLUR_TRANSFORMED_WINDOW_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_SHADER];
+ o->name = "blur_shader";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Blur Shader");
+ o->longDesc = N_("Blur Shader");
+ o->type = CompOptionTypeString;
+ o->value.s = strdup (BLURFX_SCREEN_OPTION_BLUR_SHADER_DEFAULT);
+ o->rest.s.string = blurShaderNames;
+ o->rest.s.nString = LIST_SIZE (blurShaderNames);
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR];
+ o->name = "force_non_fbo_blur";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Force non fbo blur");
+ o->longDesc = N_("Force non fbo blur");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_FORCE_NON_FBO_BLUR_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_NON_FBO_BLUR_STRENGTH];
+ o->name = "non_fbo_blur_strength";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Non fbo blur strength");
+ o->longDesc = N_("Non fbo mode blur strength");
+ o->type = CompOptionTypeInt;
+ o->value.i = BLURFX_SCREEN_OPTION_NON_FBO_BLUR_STRENGTH_DEFAULT;
+ o->rest.i.min = 2;
+ o->rest.i.max = 12;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_BLUR_CACHE_TEXTURES];
+ o->name = "blur_cache";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Use blur cache");
+ o->longDesc = N_("Enables blur cache texture system");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_BLUR_CACHE_TEXTURES_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_NO_BLUR_CACHE_ON_TRANSFORMED_SCREEN];
+ o->name = "no_cache_when_transformed";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Disable blur cache on transformed screen");
+ o->longDesc = N_("Disables blur cache on transformed screen");
+ o->type = CompOptionTypeBool;
+ o->value.b =
+ BLURFX_SCREEN_OPTION_NO_BLUR_CACHE_ON_TRANSFORMED_SCREEN_DEFAULT;
+
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_DISABLE_DECORATION_ALPHADEP];
+ o->name = "disable_deco_alpha_dep";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Disable decoration alpha dependency");
+ o->longDesc = N_("Disable decoration alpha dependency");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_DISABLE_DECORATION_ALPHADEP_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_DISABLE_BLUR_ON_SCREENGRAB_OF];
+ o->name = "disable_blur_on_screengrab_of";
+ o->group = N_("Blur");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Disable blur on screengrab of");
+ o->longDesc =
+ N_("Disable drawing of blur when an other plugin grabs the input");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = LIST_SIZE (blurDisable);
+ o->value.list.value =
+ malloc (sizeof (CompOptionValue) * LIST_SIZE (blurDisable));
+ for (i = 0; i < LIST_SIZE (blurDisable); i++)
+ o->value.list.value[i].s = strdup (blurDisable[i]);
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_ON_TRANSFORMED_SCREEN];
+ o->name = "reflection_transformed_screen";
+ o->group = N_("Reflection");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Reflection transformed screen");
+ o->longDesc = N_("Draw reflection if the screen is transformed");
+ o->type = CompOptionTypeBool;
+ o->value.b =
+ BLURFX_SCREEN_OPTION_REFLECTION_ON_TRANSFORMED_SCREEN_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_TRANSFORMED_WINDOW];
+ o->name = "reflection_transformed_window";
+ o->group = N_("Reflection");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Reflection transformed window");
+ o->longDesc = N_("Draw reflection if the screen is transformed");
+ o->type = CompOptionTypeBool;
+ o->value.b = BLURFX_SCREEN_OPTION_REFLECTION_TRANSFORMED_WINDOW_DEFAULT;
+
+ o = &bs->opt[BLURFX_SCREEN_OPTION_DISABLE_REFLECTION_ON_SCREENGRAB_OF];
+ o->name = "disable_reflection_on_screengrab_of";
+ o->group = N_("Reflection");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Disable reflection on screengrab of");
+ o->longDesc =
+ N_
+ ("Disable drawing of reflection when an other plugin grabs the input"