summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@opencompositing.org>2007-07-05 17:12:42 +0200
committerDennis Kasprzyk <onestone@opencompositing.org>2007-07-05 17:12:42 +0200
commitf62f53cb4ae233028194c4fd3b7bd31de15988cd (patch)
treef406c5e73ad8e22551b7013f46eb05fe716ed2ac
parent06c935b20940e2ea47a232f922a437465e84ebb7 (diff)
downloadsplash-f62f53cb4ae233028194c4fd3b7bd31de15988cd.tar.gz
splash-f62f53cb4ae233028194c4fd3b7bd31de15988cd.tar.bz2
Compiz indent style.
-rw-r--r--splash.c900
1 files changed, 464 insertions, 436 deletions
diff --git a/splash.c b/splash.c
index 27e10eb..23967a9 100644
--- a/splash.c
+++ b/splash.c
@@ -50,599 +50,627 @@ static int displayPrivateIndex = 0;
typedef struct _SplashDisplay
{
- Atom splashAtom;
- int screenPrivateIndex;
-} SplashDisplay;
+ Atom splashAtom;
+ int screenPrivateIndex;
+}
+SplashDisplay;
#define MESH_W 16
#define MESH_H 16
typedef struct _SplashScreen
{
- PreparePaintScreenProc preparePaintScreen;
- DonePaintScreenProc donePaintScreen;
- PaintOutputProc paintOutput;
- PaintWindowProc paintWindow;
-
- int fade_in;
- int fade_out;
- int time;
+ PreparePaintScreenProc preparePaintScreen;
+ DonePaintScreenProc donePaintScreen;
+ PaintOutputProc paintOutput;
+ PaintWindowProc paintWindow;
- CompTexture back_img, logo_img;
- unsigned int backSize[2], logoSize[2];
- Bool hasInit, hasLogo, hasBack;
+ int fade_in;
+ int fade_out;
+ int time;
- float mesh[MESH_W][MESH_H][2];
- float mMove;
+ CompTexture back_img, logo_img;
+ unsigned int backSize[2], logoSize[2];
+ Bool hasInit, hasLogo, hasBack;
- float brightness;
- float saturation;
+ float mesh[MESH_W][MESH_H][2];
+ float mMove;
- Bool initiate;
+ float brightness;
+ float saturation;
- Bool active;
+ Bool initiate;
+ Bool active;
-
-} SplashScreen;
+}
+SplashScreen;
static void
-splashPreparePaintScreen (CompScreen * s, int ms)
+splashPreparePaintScreen (CompScreen *s,
+ int ms)
{
- SPLASH_SCREEN (s);
- CompDisplay *d = s->display;
+ SPLASH_SCREEN (s);
+ CompDisplay *d = s->display;
- Bool lastShot = FALSE;
+ Bool lastShot = FALSE;
+ ss->fade_in -= ms;
- ss->fade_in -= ms;
- if (ss->fade_in < 0)
- {
- ss->time += ss->fade_in;
- ss->fade_in = 0;
- if (ss->time < 0)
- {
- if (ss->fade_out > 0 && ss->fade_out <= ms)
- lastShot = TRUE;
- ss->fade_out += ss->time;
- ss->time = 0;
- if (ss->fade_out < 0)
- ss->fade_out = 0;
- }
- }
+ if (ss->fade_in < 0)
+ {
+ ss->time += ss->fade_in;
+ ss->fade_in = 0;
- if (ss->initiate)
+ if (ss->time < 0)
{
- ss->fade_in = ss->fade_out = splashGetFadeTime (d) * 1000.0;
- ss->time = splashGetDisplayTime (d) * 1000.0;
- ss->initiate = FALSE;
+ if (ss->fade_out > 0 && ss->fade_out <= ms)
+ lastShot = TRUE;
+
+ ss->fade_out += ss->time;
+
+ ss->time = 0;
+
+ if (ss->fade_out < 0)
+ ss->fade_out = 0;
}
+ }
+
+ if (ss->initiate)
+ {
+ ss->fade_in = ss->fade_out = splashGetFadeTime (d) * 1000.0;
+ ss->time = splashGetDisplayTime (d) * 1000.0;
+ ss->initiate = FALSE;
+ }
+
+ if (ss->fade_in || ss->fade_out || ss->time || lastShot)
+ {
+ ss->active = TRUE;
+ ss->mMove += ms / 500.0;
- if (ss->fade_in || ss->fade_out || ss->time || lastShot)
+ if (!ss->hasInit)
{
- ss->active = TRUE;
- ss->mMove += ms / 500.0;
- if (!ss->hasInit)
+ ss->hasInit = TRUE;
+ ss->mMove = 0.0;
+
+ ss->hasBack =
+ readImageToTexture (s, &ss->back_img, splashGetBackground (d),
+ &ss->backSize[0], &ss->backSize[1]);
+ ss->hasLogo =
+ readImageToTexture (s, &ss->logo_img, splashGetLogo (d),
+ &ss->logoSize[0], &ss->logoSize[1]);
+
+ if (!ss->hasBack)
+ {
+ ss->hasBack =
+ readImageToTexture (s, &ss->back_img,
+ SPLASH_BACKGROUND_DEFAULT,
+ &ss->backSize[0], &ss->backSize[1]);
+
+ if (ss->hasBack)
{
- ss->hasInit = TRUE;
- ss->mMove = 0.0;
-
- ss->hasBack =
- readImageToTexture (s, &ss->back_img, splashGetBackground (d),
- &ss->backSize[0], &ss->backSize[1]);
- ss->hasLogo =
- readImageToTexture (s, &ss->logo_img, splashGetLogo (d),
- &ss->logoSize[0], &ss->logoSize[1]);
- if (!ss->hasBack)
- {
- ss->hasBack =
- readImageToTexture (s, &ss->back_img,
- SPLASH_BACKGROUND_DEFAULT,
- &ss->backSize[0], &ss->backSize[1]);
- if (ss->hasBack)
- {
- compLogMessage (d, "splash", CompLogLevelWarn,
- "Could not load splash background image \"%s\" using default!",
- splashGetBackground (d));
- }
- }
- if (!ss->hasLogo)
- {
- ss->hasLogo =
- readImageToTexture (s, &ss->logo_img,
- SPLASH_LOGO_DEFAULT,
- &ss->logoSize[0], &ss->logoSize[1]);
- if (ss->hasLogo)
- {
- compLogMessage (d, "splash", CompLogLevelWarn,
- "Could not load splash logo image \"%s\" using default!",
- splashGetLogo (d));
- }
- }
- if (!ss->hasBack)
- compLogMessage (d, "splash", CompLogLevelWarn,
- "Could not load splash background image \"%s\" !",
- splashGetBackground (d));
- if (!ss->hasLogo)
- compLogMessage (d, "splash", CompLogLevelWarn,
- "Could not load splash logo image \"%s\" !",
- splashGetLogo (d));
+ compLogMessage (d, "splash", CompLogLevelWarn,
+ "Could not load splash background image "
+ "\"%s\" using default!",
+ splashGetBackground (d) );
}
- }
- else
- {
- ss->active = FALSE;
- if (ss->hasInit)
+ }
+
+ if (!ss->hasLogo)
+ {
+ ss->hasLogo =
+ readImageToTexture (s, &ss->logo_img,
+ SPLASH_LOGO_DEFAULT,
+ &ss->logoSize[0], &ss->logoSize[1]);
+
+ if (ss->hasLogo)
{
- ss->hasInit = FALSE;
-
- if (ss->hasBack)
- {
- finiTexture (s, &ss->back_img);
- initTexture (s, &ss->back_img);
- ss->hasBack = FALSE;
- }
- if (ss->hasLogo)
- {
- finiTexture (s, &ss->logo_img);
- initTexture (s, &ss->logo_img);
- ss->hasLogo = FALSE;
- }
+ compLogMessage (d, "splash", CompLogLevelWarn,
+ "Could not load splash logo image "
+ "\"%s\" using default!",
+ splashGetLogo (d) );
}
+ }
+
+ if (!ss->hasBack)
+ compLogMessage (d, "splash", CompLogLevelWarn,
+ "Could not load splash background image "
+ "\"%s\" !", splashGetBackground (d) );
+
+ if (!ss->hasLogo)
+ compLogMessage (d, "splash", CompLogLevelWarn,
+ "Could not load splash logo image \"%s\" !",
+ splashGetLogo (d) );
}
+ }
+ else
+ {
+ ss->active = FALSE;
- UNWRAP (ss, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, ms);
- WRAP (ss, s, preparePaintScreen, splashPreparePaintScreen);
+ if (ss->hasInit)
+ {
+ ss->hasInit = FALSE;
+
+ if (ss->hasBack)
+ {
+ finiTexture (s, &ss->back_img);
+ initTexture (s, &ss->back_img);
+ ss->hasBack = FALSE;
+ }
+
+ if (ss->hasLogo)
+ {
+ finiTexture (s, &ss->logo_img);
+ initTexture (s, &ss->logo_img);
+ ss->hasLogo = FALSE;
+ }
+ }
+ }
+
+ UNWRAP (ss, s, preparePaintScreen);
+ (*s->preparePaintScreen) (s, ms);
+ WRAP (ss, s, preparePaintScreen, splashPreparePaintScreen);
}
static void
splashDonePaintScreen (CompScreen * s)
{
- SPLASH_SCREEN (s);
+ SPLASH_SCREEN (s);
- if (ss->fade_in || ss->fade_out || ss->time)
- damageScreen (s);
+ if (ss->fade_in || ss->fade_out || ss->time)
+ damageScreen (s);
- UNWRAP (ss, s, donePaintScreen);
- (*s->donePaintScreen) (s);
- WRAP (ss, s, donePaintScreen, splashDonePaintScreen);
+ UNWRAP (ss, s, donePaintScreen);
+ (*s->donePaintScreen) (s);
+ WRAP (ss, s, donePaintScreen, splashDonePaintScreen);
}
static void
-splashGetCurrentOutputRect (CompScreen * s, XRectangle * outputRect)
+splashGetCurrentOutputRect (CompScreen *s,
+ XRectangle *outputRect)
{
- int root_x = 0, root_y = 0;
- int ignore_i;
- unsigned int ignore_ui;
- int output;
- Window ignore_w;
-
-
- if (s->nOutputDev == 1)
- output = 0;
- else
- {
- XQueryPointer (s->display->display, s->root, &ignore_w, &ignore_w,
- &root_x, &root_y, &ignore_i, &ignore_i, &ignore_ui);
- output = outputDeviceForPoint (s, root_x, root_y);
- }
-
- outputRect->x = s->outputDev[output].region.extents.x1;
- outputRect->y = s->outputDev[output].region.extents.y1;
- outputRect->width =
- s->outputDev[output].region.extents.x2 -
- s->outputDev[output].region.extents.x1;
- outputRect->height =
- s->outputDev[output].region.extents.y2 -
- s->outputDev[output].region.extents.y1;
+ int root_x = 0, root_y = 0;
+ int ignore_i;
+ unsigned int ignore_ui;
+ int output;
+ Window ignore_w;
+
+
+ if (s->nOutputDev == 1)
+ output = 0;
+ else
+ {
+ XQueryPointer (s->display->display, s->root, &ignore_w, &ignore_w,
+ &root_x, &root_y, &ignore_i, &ignore_i, &ignore_ui);
+ output = outputDeviceForPoint (s, root_x, root_y);
+ }
+
+ outputRect->x = s->outputDev[output].region.extents.x1;
+ outputRect->y = s->outputDev[output].region.extents.y1;
+ outputRect->width = s->outputDev[output].region.extents.x2 -
+ s->outputDev[output].region.extents.x1;
+ outputRect->height = s->outputDev[output].region.extents.y2 -
+ s->outputDev[output].region.extents.y1;
}
-
static Bool
-splashPaintOutput (CompScreen * s, const ScreenPaintAttrib * sa,
- const CompTransform * transform,
- Region region, CompOutput *output,
- unsigned int mask)
+splashPaintOutput (CompScreen *s,
+ const ScreenPaintAttrib *sa,
+ const CompTransform *transform,
+ Region region,
+ CompOutput *output,
+ unsigned int mask)
{
- SPLASH_SCREEN (s);
- CompDisplay *d = s->display;
-
- Bool status = TRUE;
+ SPLASH_SCREEN (s);
+ CompDisplay *d = s->display;
+ CompTransform sTransform = *transform;
- float alpha = 0.0;
+ Bool status = TRUE;
- if (ss->active)
- {
- alpha = (1.0 - (ss->fade_in / (splashGetFadeTime (d) * 1000.0))) *
- (ss->fade_out / (splashGetFadeTime (d) * 1000.0));
- ss->saturation = 1.0 -
- ((1.0 - (splashGetSaturation (d) / 100.0)) * alpha);
- ss->brightness = 1.0 -
- ((1.0 - (splashGetBrightness (d) / 100.0)) * alpha);
- }
+ float alpha = 0.0;
- UNWRAP (ss, s, paintOutput);
- status = (*s->paintOutput) (s, sa, transform, region, output, mask);
- WRAP (ss, s, paintOutput, splashPaintOutput);
+ if (ss->active)
+ {
+ alpha = (1.0 - (ss->fade_in / (splashGetFadeTime (d) * 1000.0) ) ) *
+ (ss->fade_out / (splashGetFadeTime (d) * 1000.0) );
+ ss->saturation = 1.0 -
+ ((1.0 - (splashGetSaturation (d) / 100.0) ) * alpha);
+ ss->brightness = 1.0 -
+ ((1.0 - (splashGetBrightness (d) / 100.0) ) * alpha);
+ }
- if (!ss->active)
- return status;
+ UNWRAP (ss, s, paintOutput);
+ status = (*s->paintOutput) (s, sa, transform, region, output, mask);
+ WRAP (ss, s, paintOutput, splashPaintOutput);
- CompTransform sTransform = *transform;
+ if (!ss->active)
+ return status;
- transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
- glPushMatrix ();
- glLoadMatrixf (sTransform.m);
+ transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
- glEnable (GL_BLEND);
- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glPushMatrix ();
+ glLoadMatrixf (sTransform.m);
+ glEnable (GL_BLEND);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glColor4f (1.0, 1.0, 1.0, alpha);
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glColor4f (1.0, 1.0, 1.0, alpha);
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ if (ss->hasBack)
+ {
+ int x, y;
- if (ss->hasBack)
+ for (x = 0; x < MESH_W; x++)
{
- int x, y;
+ for (y = 0; y < MESH_H; y++)
+ {
+ ss->mesh[x][y][0] =
+ (x / (MESH_W - 1.0) ) +
+ (0.02 * sin ( (y / (MESH_H - 1.0) * 8) + ss->mMove) );
+ ss->mesh[x][y][1] =
+ (y / (MESH_H - 1.0) ) +
+ (0.02 * sin ( (ss->mesh[x][y][0] * 8) + ss->mMove) );
+ ;
+ }
+ }
- for (x = 0; x < MESH_W; x++)
- {
- for (y = 0; y < MESH_H; y++)
- {
- ss->mesh[x][y][0] =
- (x / (MESH_W - 1.0)) +
- (0.02 * sin ((y / (MESH_H - 1.0) * 8) + ss->mMove));
- ss->mesh[x][y][1] =
- (y / (MESH_H - 1.0)) +
- (0.02 * sin ((ss->mesh[x][y][0] * 8) + ss->mMove));;
- }
- }
+ enableTexture (s, &ss->back_img, COMP_TEXTURE_FILTER_GOOD);
- enableTexture (s, &ss->back_img, COMP_TEXTURE_FILTER_GOOD);
+ if (s->nOutputDev > 1)
+ {
+ XRectangle headOutputRect;
- if (s->nOutputDev > 1)
- {
- XRectangle headOutputRect;
+ splashGetCurrentOutputRect (s, &headOutputRect);
- splashGetCurrentOutputRect (s, &headOutputRect);
+ x = (headOutputRect.width - ss->backSize[0]) / 2;
+ y = (headOutputRect.height - ss->backSize[1]) / 2;
- x = (headOutputRect.width - ss->backSize[0]) / 2;
- y = (headOutputRect.height - ss->backSize[1]) / 2;
+ x += headOutputRect.x;
+ y += headOutputRect.y;
+ }
+ else
+ {
+ x = (s->width - ss->backSize[0]) / 2;
+ y = (s->height - ss->backSize[1]) / 2;
+ }
- x += headOutputRect.x;
- y += headOutputRect.y;
- }
- else
- {
- x = (s->width - ss->backSize[0]) / 2;
- y = (s->height - ss->backSize[1]) / 2;
- }
- CompMatrix mat = ss->back_img.matrix;
+ CompMatrix mat = ss->back_img.matrix;
- glTranslatef (x, y, 0);
+ glTranslatef (x, y, 0);
- float cx1, cx2, cy1, cy2;
+ float cx1, cx2, cy1, cy2;
- glBegin (GL_QUADS);
- for (x = 0; x < MESH_W - 1; x++)
- {
- for (y = 0; y < MESH_H - 1; y++)
- {
- cx1 = (x / (MESH_W - 1.0)) * ss->backSize[0];
- cx2 = ((x + 1) / (MESH_W - 1.0)) * ss->backSize[0];
- cy1 = (y / (MESH_H - 1.0)) * ss->backSize[1];
- cy2 = ((y + 1) / (MESH_H - 1.0)) * ss->backSize[1];
-
- glTexCoord2f (COMP_TEX_COORD_X (&mat, cx1),
- COMP_TEX_COORD_Y (&mat, cy1));
- glVertex2f (ss->mesh[x][y][0] *
- ss->backSize[0],
- ss->mesh[x][y][1] * ss->backSize[1]);
- glTexCoord2f (COMP_TEX_COORD_X (&mat, cx1),
- COMP_TEX_COORD_Y (&mat, cy2));
- glVertex2f (ss->mesh[x][y + 1][0] *
- ss->backSize[0],
- ss->mesh[x][y + 1][1] * ss->backSize[1]);
- glTexCoord2f (COMP_TEX_COORD_X (&mat, cx2),
- COMP_TEX_COORD_Y (&mat, cy2));
- glVertex2f (ss->mesh[x + 1][y + 1][0] *
- ss->backSize[0],
- ss->mesh[x + 1][y + 1][1] * ss->backSize[1]);
- glTexCoord2f (COMP_TEX_COORD_X (&mat, cx2),
- COMP_TEX_COORD_Y (&mat, cy1));
- glVertex2f (ss->mesh[x + 1][y][0] *
- ss->backSize[0],
- ss->mesh[x + 1][y][1] * ss->backSize[1]);
- }
- }
- glEnd ();
+ glBegin (GL_QUADS);
- if (s->nOutputDev > 1)
- {
- XRectangle headOutputRect;
+ for (x = 0; x < MESH_W - 1; x++)
+ {
+ for (y = 0; y < MESH_H - 1; y++)
+ {
+ cx1 = (x / (MESH_W - 1.0) ) * ss->backSize[0];
+ cx2 = ( (x + 1) / (MESH_W - 1.0) ) * ss->backSize[0];
+ cy1 = (y / (MESH_H - 1.0) ) * ss->backSize[1];
+ cy2 = ( (y + 1) / (MESH_H - 1.0) ) * ss->backSize[1];
+
+ glTexCoord2f (COMP_TEX_COORD_X (&mat, cx1),
+ COMP_TEX_COORD_Y (&mat, cy1) );
+ glVertex2f (ss->mesh[x][y][0] *
+ ss->backSize[0],
+ ss->mesh[x][y][1] * ss->backSize[1]);
+ glTexCoord2f (COMP_TEX_COORD_X (&mat, cx1),
+ COMP_TEX_COORD_Y (&mat, cy2) );
+ glVertex2f (ss->mesh[x][y + 1][0] *
+ ss->backSize[0],
+ ss->mesh[x][y + 1][1] * ss->backSize[1]);
+ glTexCoord2f (COMP_TEX_COORD_X (&mat, cx2),
+ COMP_TEX_COORD_Y (&mat, cy2) );
+ glVertex2f (ss->mesh[x + 1][y + 1][0] *
+ ss->backSize[0],
+ ss->mesh[x + 1][y + 1][1] * ss->backSize[1]);
+ glTexCoord2f (COMP_TEX_COORD_X (&mat, cx2),
+ COMP_TEX_COORD_Y (&mat, cy1) );
+ glVertex2f (ss->mesh[x + 1][y][0] *
+ ss->backSize[0],
+ ss->mesh[x + 1][y][1] * ss->backSize[1]);
+ }
+ }
- splashGetCurrentOutputRect (s, &headOutputRect);
+ glEnd ();
- x = (headOutputRect.width - ss->backSize[0]) / 2;
- y = (headOutputRect.height - ss->backSize[1]) / 2;
+ if (s->nOutputDev > 1)
+ {
+ XRectangle headOutputRect;
- x += headOutputRect.x;
- y += headOutputRect.y;
- }
- else
- {
- x = (s->width - ss->backSize[0]) / 2;
- y = (s->height - ss->backSize[1]) / 2;
- }
- glTranslatef (-x, -y, 0);
+ splashGetCurrentOutputRect (s, &headOutputRect);
- disableTexture (s, &ss->back_img);
+ x = (headOutputRect.width - ss->backSize[0]) / 2;
+ y = (headOutputRect.height - ss->backSize[1]) / 2;
+
+ x += headOutputRect.x;
+ y += headOutputRect.y;
+ }
+ else
+ {
+ x = (s->width - ss->backSize[0]) / 2;
+ y = (s->height - ss->backSize[1]) / 2;
}
- if (ss->hasLogo)
+ glTranslatef (-x, -y, 0);
+
+ disableTexture (s, &ss->back_img);
+ }
+
+ if (ss->hasLogo)
+ {
+ enableTexture (s, &ss->logo_img, COMP_TEXTURE_FILTER_GOOD);
+ int x, y;
+
+ if (s->nOutputDev > 1)
{
- enableTexture (s, &ss->logo_img, COMP_TEXTURE_FILTER_GOOD);
- int x, y;
+ XRectangle headOutputRect;
- if (s->nOutputDev > 1)
- {
- XRectangle headOutputRect;
+ splashGetCurrentOutputRect (s, &headOutputRect);
+ x = (headOutputRect.width - ss->logoSize[0]) / 2;
+ y = (headOutputRect.height - ss->logoSize[1]) / 2;
- splashGetCurrentOutputRect (s, &headOutputRect);
- x = (headOutputRect.width - ss->logoSize[0]) / 2;
- y = (headOutputRect.height - ss->logoSize[1]) / 2;
+ x += headOutputRect.x;
+ y += headOutputRect.y;
+ }
+ else
+ {
+ x = (s->width - ss->logoSize[0]) / 2;
+ y = (s->height - ss->logoSize[1]) / 2;
+ }
- x += headOutputRect.x;
- y += headOutputRect.y;
- }
- else
- {
- x = (s->width - ss->logoSize[0]) / 2;
- y = (s->height - ss->logoSize[1]) / 2;
- }
+ CompMatrix mat = ss->logo_img.matrix;
- CompMatrix mat = ss->logo_img.matrix;
+ glTranslatef (x, y, 0);
- glTranslatef (x, y, 0);
+ glBegin (GL_QUADS);
+ glTexCoord2f (COMP_TEX_COORD_X (&mat, 0), COMP_TEX_COORD_Y (&mat, 0) );
+ glVertex2f (0, 0);
+ glTexCoord2f (COMP_TEX_COORD_X (&mat, 0),
+ COMP_TEX_COORD_Y (&mat, ss->logoSize[1]) );
+ glVertex2f (0, ss->logoSize[1]);
+ glTexCoord2f (COMP_TEX_COORD_X (&mat, ss->logoSize[0]),
+ COMP_TEX_COORD_Y (&mat, ss->logoSize[1]) );
+ glVertex2f (ss->logoSize[0], ss->logoSize[1]);
+ glTexCoord2f (COMP_TEX_COORD_X (&mat, ss->logoSize[0]),
+ COMP_TEX_COORD_Y (&mat, 0) );
+ glVertex2f (ss->logoSize[0], 0);
+ glEnd ();
- glBegin (GL_QUADS);
- glTexCoord2f (COMP_TEX_COORD_X (&mat, 0), COMP_TEX_COORD_Y (&mat, 0));
- glVertex2f (0, 0);
- glTexCoord2f (COMP_TEX_COORD_X (&mat, 0),
- COMP_TEX_COORD_Y (&mat, ss->logoSize[1]));
- glVertex2f (0, ss->logoSize[1]);
- glTexCoord2f (COMP_TEX_COORD_X (&mat, ss->logoSize[0]),
- COMP_TEX_COORD_Y (&mat, ss->logoSize[1]));
- glVertex2f (ss->logoSize[0], ss->logoSize[1]);
- glTexCoord2f (COMP_TEX_COORD_X (&mat, ss->logoSize[0]),
- COMP_TEX_COORD_Y (&mat, 0));
- glVertex2f (ss->logoSize[0], 0);
- glEnd ();
+ glTranslatef (-x, -y, 0);
- glTranslatef (-x, -y, 0);
+ disableTexture (s, &ss->logo_img);
+ }
- disableTexture (s, &ss->logo_img);
- }
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glDisable (GL_BLEND);
- glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glPopMatrix ();
- return status;
+ glDisable (GL_BLEND);
+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ glPopMatrix ();
+ return status;
}
static Bool
-splashPaintWindow (CompWindow * w,
- const WindowPaintAttrib * attrib,
- const CompTransform * transform,
- Region region, unsigned int mask)
+splashPaintWindow (CompWindow *w,
+ const WindowPaintAttrib *attrib,
+ const CompTransform *transform,
+ Region region,
+ unsigned int mask)
{
- CompScreen *s = w->screen;
- Bool status;
+ CompScreen *s = w->screen;
+ Bool status;
- SPLASH_SCREEN (s);
+ SPLASH_SCREEN (s);
- if (ss->active)
- {
- WindowPaintAttrib pA = *attrib;
- pA.brightness = attrib->brightness * ss->brightness;
- pA.saturation = attrib->saturation * ss->saturation;
+ if (ss->active)
+ {
+ WindowPaintAttrib pA = *attrib;
+ pA.brightness = attrib->brightness * ss->brightness;
+ pA.saturation = attrib->saturation * ss->saturation;
- UNWRAP (ss, s, paintWindow);
- status = (*s->paintWindow) (w, &pA, transform, region, mask);
- WRAP (ss, s, paintWindow, splashPaintWindow);
- }
- else
- {
- UNWRAP (ss, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, transform, region, mask);
- WRAP (ss, s, paintWindow, splashPaintWindow);
- }
+ UNWRAP (ss, s, paintWindow);
+ status = (*s->paintWindow) (w, &pA, transform, region, mask);
+ WRAP (ss, s, paintWindow, splashPaintWindow);
+ }
+ else
+ {
+ UNWRAP (ss, s, paintWindow);
+ status = (*s->paintWindow) (w, attrib, transform, region, mask);
+ WRAP (ss, s, paintWindow, splashPaintWindow);
+ }
- return status;
+ return status;
}
static Bool
-splashInitScreen (CompPlugin * p, CompScreen * s)
+splashInitScreen (CompPlugin *p,
+ CompScreen *s)
{
- SPLASH_DISPLAY (s->display);
+ SPLASH_DISPLAY (s->display);
- SplashScreen *ss = (SplashScreen *) calloc (1, sizeof (SplashScreen));
+ SplashScreen *ss = (SplashScreen *) calloc (1, sizeof (SplashScreen) );
- s->privates[sd->screenPrivateIndex].ptr = ss;
+ s->privates[sd->screenPrivateIndex].ptr = ss;
- WRAP (ss, s, paintOutput, splashPaintOutput);
- WRAP (ss, s, preparePaintScreen, splashPreparePaintScreen);
- WRAP (ss, s, donePaintScreen, splashDonePaintScreen);
- WRAP (ss, s, paintWindow, splashPaintWindow);
+ WRAP (ss, s, paintOutput, splashPaintOutput);
+ WRAP (ss, s, preparePaintScreen, splashPreparePaintScreen);
+ WRAP (ss, s, donePaintScreen, splashDonePaintScreen);
+ WRAP (ss, s, paintWindow, splashPaintWindow);
- initTexture (s, &ss->back_img);
- initTexture (s, &ss->logo_img);
+ initTexture (s, &ss->back_img);
+ initTexture (s, &ss->logo_img);
- ss->initiate = FALSE;
+ ss->initiate = FALSE;
- if (splashGetFirststart (s->display))
- {
- Atom actual;
- int result, format;
- unsigned long n, left;
- unsigned char *propData;
+ if (splashGetFirststart (s->display) )
+ {
+ Atom actual;
+ int result, format;
+ unsigned long n, left;
+ unsigned char *propData;
- result = XGetWindowProperty (s->display->display, s->root,
- sd->splashAtom, 0L, 8192L, FALSE,
- XA_INTEGER, &actual, &format,
- &n, &left, &propData);
+ result = XGetWindowProperty (s->display->display, s->root,
+ sd->splashAtom, 0L, 8192L, FALSE,
+ XA_INTEGER, &actual, &format,
+ &n, &left, &propData);
- if (result == Success && n && propData)
- {
- XFree (propData);
- }
- else
- {
- int value = 1;
- XChangeProperty (s->display->display, s->root, sd->splashAtom,
- XA_INTEGER, 32, PropModeReplace,
- (unsigned char *)&value, 1);
- ss->initiate = TRUE;
- }
+ if (result == Success && n && propData)
+ {
+ XFree (propData);
}
+ else
+ {
+ int value = 1;
+ XChangeProperty (s->display->display, s->root, sd->splashAtom,
+ XA_INTEGER, 32, PropModeReplace,
+ (unsigned char *) &value, 1);
+ ss->initiate = TRUE;
+ }
+ }
- return TRUE;
+ return TRUE;
}
static void
-splashFiniScreen (CompPlugin * p, CompScreen * s)
+splashFiniScreen (CompPlugin *p,
+ CompScreen *s)
{
- SPLASH_SCREEN (s);
+ SPLASH_SCREEN (s);
- //Restore the original function
- UNWRAP (ss, s, paintOutput);
- UNWRAP (ss, s, preparePaintScreen);
- UNWRAP (ss, s, donePaintScreen);
- UNWRAP (ss, s, paintWindow);
+ //Restore the original function
+ UNWRAP (ss, s, paintOutput);
+ UNWRAP (ss, s, preparePaintScreen);
+ UNWRAP (ss, s, donePaintScreen);
+ UNWRAP (ss, s, paintWindow);
- finiTexture (s, &ss->back_img);
- finiTexture (s, &ss->logo_img);
+ finiTexture (s, &ss->back_img);
+ finiTexture (s, &ss->logo_img);
- //Free the pointer
- free (ss);
+ //Free the pointer
+ free (ss);
}
static Bool
-splashInitiate (CompDisplay * d, CompAction * ac, CompActionState state,
- CompOption * option, int nOption)
+splashInitiate (CompDisplay *d,
+ CompAction *ac,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
{
- CompScreen *s;
+ CompScreen *s;
- s = findScreenAtDisplay (d,
- getIntOptionNamed (option, nOption, "root", 0));
- if (s)
- {
- SPLASH_SCREEN (s);
- ss->initiate = TRUE;
- damageScreen (s);
- }
- return FALSE;
+ s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "root", 0));
+
+ if (s)
+ {
+ SPLASH_SCREEN (s);
+ ss->initiate = TRUE;
+ damageScreen (s);
+ }
+
+ return FALSE;
}
static Bool
-splashInitDisplay (CompPlugin * p, CompDisplay * d)
+splashInitDisplay (CompPlugin *p,
+ CompDisplay *d)
{
- //Generate a splash display
- SplashDisplay *sd = (SplashDisplay *) malloc (sizeof (SplashDisplay));
-
- //Allocate a private index
- sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- //Check if its valid
- if (sd->screenPrivateIndex < 0)
- {
- //Its invalid so free memory and return
- free (sd);
- return FALSE;
- }
+ /* Generate a splash display */
+ SplashDisplay *sd = (SplashDisplay *) malloc (sizeof (SplashDisplay) );
+
+ /* Allocate a private index */
+ sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
+
+ /* Check if its valid */
+ if (sd->screenPrivateIndex < 0)
+ {
+ /* It's invalid so free memory and return */
+ free (sd);
+ return FALSE;
+ }
- sd->splashAtom = XInternAtom (d->display, "_COMPIZ_WM_SPLASH", 0);
+ sd->splashAtom = XInternAtom (d->display, "_COMPIZ_WM_SPLASH", 0);
- splashSetInitiateInitiate (d, splashInitiate);
+ splashSetInitiateInitiate (d, splashInitiate);
- d->privates[displayPrivateIndex].ptr = sd;
- return TRUE;
+ d->privates[displayPrivateIndex].ptr = sd;
+ return TRUE;
}
static void
-splashFiniDisplay (CompPlugin * p, CompDisplay * d)
+splashFiniDisplay (CompPlugin *p,
+ CompDisplay *d)
{
- SPLASH_DISPLAY (d);
- //Free the private index
- freeScreenPrivateIndex (d, sd->screenPrivateIndex);
- //Free the pointer
- free (sd);
-}
+ SPLASH_DISPLAY (d);
+ /* Free the private index */
+ freeScreenPrivateIndex (d, sd->screenPrivateIndex);
+ /* Free the pointer */
+ free (sd);
+}
static Bool
-splashInit (CompPlugin * p)
+splashInit (CompPlugin *p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex ();
+ displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- return FALSE;
+ if (displayPrivateIndex < 0)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
static void
-splashFini (CompPlugin * p)
+splashFini (CompPlugin *p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex (displayPrivateIndex);
}
-CompPluginDep splashDeps[] = {
- {CompPluginRuleAfter, "png"}
-};
-
static int
-splashGetVersion (CompPlugin * plugin, int version)
+splashGetVersion (CompPlugin *plugin,
+ int version)
{
- return ABIVERSION;
+ return ABIVERSION;
}
CompPluginVTable splashVTable = {
- "splash",
- splashGetVersion,
- 0,
- splashInit,
- splashFini,
- splashInitDisplay,
- splashFiniDisplay,
- splashInitScreen,
- splashFiniScreen,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- splashDeps,
- sizeof (splashDeps) / sizeof (splashDeps[0]),
- 0,
- 0,
+
+ "splash",
+ splashGetVersion,
+ 0,
+ splashInit,
+ splashFini,
+ splashInitDisplay,
+ splashFiniDisplay,
+ splashInitScreen,
+ splashFiniScreen,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
};
CompPluginVTable *
getCompPluginInfo (void)
{
- return &splashVTable;
+ return &splashVTable;
}