summaryrefslogtreecommitdiff
path: root/beryl-plugins
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 /beryl-plugins
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
Diffstat (limited to 'beryl-plugins')
-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);
-