[beryl-commits] r1556 - branches/beryl-plugins-with-snow
corner at server.beryl-project.org
corner at server.beryl-project.org
Tue Dec 5 21:06:05 CET 2006
Author: corner
Date: 2006-12-05 21:06:01 +0100 (Tue, 05 Dec 2006)
New Revision: 1556
Modified:
branches/beryl-plugins-with-snow/snow.c
Log:
windows and other plugins not working properly should be fixed. Now uses display lists
Modified: branches/beryl-plugins-with-snow/snow.c
===================================================================
--- branches/beryl-plugins-with-snow/snow.c 2006-12-05 19:38:45 UTC (rev 1555)
+++ branches/beryl-plugins-with-snow/snow.c 2006-12-05 20:06:01 UTC (rev 1556)
@@ -46,13 +46,13 @@
((SnowDisplay *) (d)->privates[displayPrivateIndex].ptr)
#define SNOW_DISPLAY(d) \
- SnowDisplay *hd = GET_SNOW_DISPLAY (d)
+ SnowDisplay *sd = GET_SNOW_DISPLAY (d)
-#define GET_SNOW_SCREEN(s, hd) \
- ((SnowScreen *) (s)->privates[(hd)->screenPrivateIndex].ptr)
+#define GET_SNOW_SCREEN(s, sd) \
+ ((SnowScreen *) (s)->privates[(sd)->screenPrivateIndex].ptr)
#define SNOW_SCREEN(s) \
- SnowScreen *hs = GET_SNOW_SCREEN (s, GET_SNOW_DISPLAY (s->display))
+ SnowScreen *ss = GET_SNOW_SCREEN (s, GET_SNOW_DISPLAY (s->display))
// ------------------------------------------------------------ OPTIONS -----------------------------------------------------
#define SNOW_DISPLAY_OPTION_NUM_SNOWFLAKES 0
@@ -60,9 +60,9 @@
#define SNOW_DISPLAY_OPTION_SNOW_SPEED 2
#define SNOW_DISPLAY_OPTION_SCREEN_BOXING 3
#define SNOW_DISPLAY_OPTION_SCREEN_DEPTH 4
-#define SNOW_DISPLAY_OPTION_MAX_FRAMES 5
-#define SNOW_DISPLAY_OPTION_SNOW_TEXTURE 6
-#define SNOW_DISPLAY_OPTION_NUM 7
+//#define SNOW_DISPLAY_OPTION_MAX_FRAMES 5
+//#define SNOW_DISPLAY_OPTION_SNOW_TEXTURE 6
+#define SNOW_DISPLAY_OPTION_NUM 5
#define SNOW_DISPLAY_OPTION_NUM_SNOWFLAKES_DEFAULT 2000.0
@@ -101,12 +101,13 @@
typedef struct _SnowScreen SnowScreen;
-static void InitiateSnowFlake(SnowScreen * hs, int i);
-static void renderSnowflake(SnowScreen * hs, int i);
-static void beginRendering(SnowScreen *hs, CompWindow *w);
-void snowThink(SnowScreen * hs, int i);
-void snowMove(SnowScreen * hs, int i) ;
+static void InitiateSnowFlake(SnowScreen * ss, int i);
+static void beginRendering(SnowScreen *ss, CompWindow *w);
+static void setupDisplayList(SnowScreen * ss);
+void snowThink(SnowScreen * ss, int i);
+void snowMove(SnowScreen * ss, int i) ;
+
struct _SnowScreen {
float alpha;
@@ -129,34 +130,33 @@
//FocusWindowProc focusWindow;
CompTexture snowTexture;
+ Bool snowTextureLoaded;
unsigned int snowTextureSize[2];
+ GLuint displayList;
// TODO: make snowflakes move in spiral/tumbling like fashion with sinus/cosinus functions.
float allSnowFlakes[MAX_SNOWFLAKES][6]; // [i][0] = xPos, [i][1] = yPos, [i][2] = zPos, [i][3] = xSpeed, [i][4] = ySpeed, [i][5] = zSpeed,
- // TODO: make number of snowflakes configurabe;
- unsigned int numSnowflakes;
- //Snowflake *snowFlakes[MAX_SNOWFLAKES];
} ;
-void snowThink(SnowScreen * hs, int i)
+void snowThink(SnowScreen * ss, int i)
{
- if ( hs->allSnowFlakes[i][1] >= hs->s->height + boxing
- || hs->allSnowFlakes[i][0] <= -boxing
- || hs->allSnowFlakes[i][0] >= hs->s->width + boxing
- || hs->allSnowFlakes[i][2] <= -(depth / 500.0)
- || hs->allSnowFlakes[i][2] >= 1)
+ if ( ss->allSnowFlakes[i][1] >= ss->s->height + boxing
+ || ss->allSnowFlakes[i][0] <= -boxing
+ || ss->allSnowFlakes[i][0] >= ss->s->width + boxing
+ || ss->allSnowFlakes[i][2] <= -(depth / 500.0)
+ || ss->allSnowFlakes[i][2] >= 1)
{
- InitiateSnowFlake(hs, i);
+ InitiateSnowFlake(ss, i);
}
- snowMove(hs, i);
+ snowMove(ss, i);
}
-void snowMove(SnowScreen * hs, int i)
+void snowMove(SnowScreen * ss, int i)
{
- hs->allSnowFlakes[i][0] += (float)(hs->allSnowFlakes[i][3] * hs->lastMsCount) / (100 - snowSpeed);
- hs->allSnowFlakes[i][1] += (float)(hs->allSnowFlakes[i][4] * hs->lastMsCount) / (100 - snowSpeed);
- hs->allSnowFlakes[i][2] += (float)(hs->allSnowFlakes[i][5] * hs->lastMsCount) / (100 - snowSpeed);
+ ss->allSnowFlakes[i][0] += (float)(ss->allSnowFlakes[i][3] * ss->lastMsCount) / (100 - snowSpeed);
+ ss->allSnowFlakes[i][1] += (float)(ss->allSnowFlakes[i][4] * ss->lastMsCount) / (100 - snowSpeed);
+ ss->allSnowFlakes[i][2] += (float)(ss->allSnowFlakes[i][5] * ss->lastMsCount) / (100 - snowSpeed);
}
// ------------------------------------------------- HELPER FUNCTIONS ----------------------------------------------------
@@ -192,25 +192,35 @@
};
// ------------------------------------------------- RENDERING ----------------------------------------------------
static void
-renderSnowflake(SnowScreen *hs, int i)
+setupDisplayList(SnowScreen * ss)
{
- // TODO: make snowSize an option;
+ // TODO: If texture isn't load draw gradient.
+ if (ss->snowTextureLoaded)
+ {
+ enableTexture (ss->s, &ss->snowTexture, COMP_TEXTURE_FILTER_GOOD);
+ }
+
+ ss->displayList =glGenLists(2);
- glTexCoord2f (0, 0);
- glVertex3f (hs->allSnowFlakes[i][0], hs->allSnowFlakes[i][1], hs->allSnowFlakes[i][2]);
+ glNewList(ss->displayList, GL_COMPILE);
+ glBegin (GL_QUADS);
+
+ glTexCoord2f (0, 0); glVertex2f (0, 0);
+ glTexCoord2f (0, ss->snowTextureSize[1]); glVertex2f (0, snowSize);
+ glTexCoord2f (ss->snowTextureSize[0], ss->snowTextureSize[1]); glVertex2f (snowSize, snowSize);
+ glTexCoord2f (ss->snowTextureSize[0], 0); glVertex2f (snowSize, 0);
+
+ glEnd ();
+ glEndList();
- glTexCoord2f (0, hs->snowTextureSize[1]);
- glVertex3f (hs->allSnowFlakes[i][0], hs->allSnowFlakes[i][1] + snowSize, hs->allSnowFlakes[i][2]);
-
- glTexCoord2f (hs->snowTextureSize[0], hs->snowTextureSize[1]);
- glVertex3f (hs->allSnowFlakes[i][0] + snowSize, hs->allSnowFlakes[i][1] + snowSize, hs->allSnowFlakes[i][2]);
-
- glTexCoord2f (hs->snowTextureSize[0], 0);
- glVertex3f (hs->allSnowFlakes[i][0] + snowSize, hs->allSnowFlakes[i][1], hs->allSnowFlakes[i][2]);
+ if (ss->snowTextureLoaded)
+ {
+ disableTexture (ss->s, &ss->snowTexture);
+ }
}
static void
-beginRendering(SnowScreen *hs, CompWindow *w)
+beginRendering(SnowScreen *ss, CompWindow *w)
{
CompScreen *s = w->screen;
@@ -220,36 +230,30 @@
glScalef (1.0f / s->width, -1.0f / s->height, 1.0f);
glTranslatef (0.0f, -s->height, 0.0f);
- float alpha = 1.0;
-
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);
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- enableTexture (s, &hs->snowTexture, COMP_TEXTURE_FILTER_GOOD);
- glColor4f (1.0, 1.0, 1.0, 1.0);
-
- glBegin (GL_QUADS);
+ enableTexture (s, &ss->snowTexture, COMP_TEXTURE_FILTER_GOOD);
+ glColor4f (1.0, 1.0, 1.0, 1.0);
int i = 0;
for (i = 0; i < numFlakes; i++)
{
- snowThink(hs, i);
- renderSnowflake(hs, i);
+ snowThink(ss, i);
+ glTranslatef(ss->allSnowFlakes[i][0], ss->allSnowFlakes[i][1], ss->allSnowFlakes[i][2]);
+ glCallList(ss->displayList);
+ glTranslatef(-ss->allSnowFlakes[i][0], -ss->allSnowFlakes[i][1], -ss->allSnowFlakes[i][2]);
}
-
- glEnd ();
-
- hs->lastMsCount = 0;
- disableTexture (s, &hs->snowTexture);
+
+ ss->lastMsCount = 0;
+ disableTexture (s, &ss->snowTexture);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glDisable (GL_BLEND);
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glPopMatrix ();
-
}
// ------------------------------------------------- FUNCTIONS ----------------------------------------------------
@@ -257,25 +261,25 @@
{
SNOW_SCREEN(s);
- hs->lastMsCount += msSinceLastPaint;
+ ss->lastMsCount += msSinceLastPaint;
- UNWRAP(hs, s, preparePaintScreen);
- (*s->preparePaintScreen) (s, 0);
- WRAP(hs, s, preparePaintScreen, snowPreparePaintScreen);
-
- hs->alpha = MIN(1.0, MAX(0.0, hs->alpha));
+ UNWRAP(ss, s, preparePaintScreen);
+ (*s->preparePaintScreen) (s, msSinceLastPaint);
+ WRAP(ss, s, preparePaintScreen, snowPreparePaintScreen);
+
+ ss->alpha = MIN(1.0, MAX(0.0, ss->alpha));
}
static void snowDonePaintScreen(CompScreen * s)
{
SNOW_SCREEN(s);
-//// if (hs->lastMsCount > 15)
+//// if (ss->lastMsCount > 15)
//// {
// // TODO: I Don't quite know which of the following is easiest on
// // CPU/GPU cycles... ought to be the second, but I am no expert.
//
-// //// if (hs->alpha > 0.0) {
+// //// if (ss->alpha > 0.0) {
// // damageScreen(s);
// // // XSync(s->display->display, FALSE);
// //// }
@@ -286,14 +290,14 @@
if (w->type & CompWindowTypeDesktopMask)
{
addWindowDamage(w);
- hs->lastMsCount = 0;
+ ss->lastMsCount = 0;
}
}
//// }
- UNWRAP(hs, s, donePaintScreen);
+ UNWRAP(ss, s, donePaintScreen);
(*s->donePaintScreen) (s);
- WRAP(hs, s, donePaintScreen, snowDonePaintScreen);
+ WRAP(ss, s, donePaintScreen, snowDonePaintScreen);
}
static Bool
@@ -305,34 +309,36 @@
SNOW_SCREEN(s);
// This line is essential. Without it the snow will be rendered above (some) other windows.
- //mask |= PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK;
+ mask |= PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK;
- UNWRAP(hs, s, paintScreen);
+ UNWRAP(ss, s, paintScreen);
status = (*s->paintScreen) (s, sa, region, output, mask);
- WRAP(hs, s, paintScreen, snowPaintScreen);
+ WRAP(ss, s, paintScreen, snowPaintScreen);
- if (hs->alpha <= 0.0)
+ if (ss->alpha <= 0.0)
return status;
return status;
}
-static void
-snowDrawWindowTexture (CompWindow *w, CompTexture *texture, const WindowPaintAttrib *attrib, unsigned int mask)
-{
- SNOW_SCREEN (w->screen);
-
- // First draw Window as usual
- UNWRAP (hs, w->screen, drawWindowTexture);
- (*w->screen->drawWindowTexture) (w, texture, attrib, mask);
- WRAP (hs, w->screen, drawWindowTexture, snowDrawWindowTexture);
-
- // Check whether this is the Desktop Window
- if (w->type & CompWindowTypeDesktopMask)
- {
- beginRendering(hs, w);
- }
-}
+//static void
+//snowDrawWindowTexture (CompWindow *w, CompTexture *texture, const WindowPaintAttrib *attrib, unsigned int mask)
+//{
+// SNOW_SCREEN (w->screen);
+//
+// mask |= PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK;
+//
+// // First draw Window as usual
+// UNWRAP (ss, w->screen, drawWindowTexture);
+// (*w->screen->drawWindowTexture) (w, texture, attrib, mask);
+// WRAP (ss, w->screen, drawWindowTexture, snowDrawWindowTexture);
+//
+// // Check whether this is the Desktop Window
+// if (w->type & CompWindowTypeDesktopMask)
+// {
+// beginRendering(ss, w);
+// }
+//}
static Bool
snowDrawWindow (CompWindow * w, const WindowPaintAttrib * attrib,
@@ -343,14 +349,14 @@
SNOW_SCREEN (w->screen);
// First draw Window as usual
- UNWRAP (hs, w->screen, drawWindow);
+ UNWRAP (ss, w->screen, drawWindow);
status = (*w->screen->drawWindow) (w, attrib, region, mask);
- WRAP (hs, w->screen, drawWindow, snowDrawWindow);
+ WRAP (ss, w->screen, drawWindow, snowDrawWindow);
// Check whether this is the Desktop Window
if (w->type & CompWindowTypeDesktopMask)
{
- beginRendering(hs, w);
+ beginRendering(ss, w);
}
return status;
}
@@ -364,61 +370,62 @@
// SNOW_SCREEN (w->screen);
//
// // First draw Window as usual
-// UNWRAP (hs, w->screen, paintWindow);
+// UNWRAP (ss, w->screen, paintWindow);
// status = (*w->screen->paintWindow) (w, attrib, region, mask);
-// WRAP (hs, w->screen, paintWindow, snowPaintWindow);
+// WRAP (ss, w->screen, paintWindow, snowPaintWindow);
//
// // Check whether this is the Desktop Window
// if (w->type & CompWindowTypeDesktopMask)
// {
-// beginRendering(hs, w);
+// beginRendering(ss, w);
// }
// return status;
//}
-static void InitiateSnowFlake(SnowScreen * hs, int i)
+static void InitiateSnowFlake(SnowScreen * ss, int i)
{
//TODO: place snowflakes based on FOV, instead of a cube.
- hs->allSnowFlakes[i][0] = mmrand(-boxing, hs->s->width + boxing, 1);
- hs->allSnowFlakes[i][1] = mmrand(-600, -500, 1);
- hs->allSnowFlakes[i][2] = mmrand(-depth, depth/10.0, 5000);
- hs->allSnowFlakes[i][3] = mmrand(-1000, 1000, 500000);
- hs->allSnowFlakes[i][4] = mmrand(1000, 3000, 1000);
- hs->allSnowFlakes[i][5] = mmrand(-1000, 1000, 500000);
+ ss->allSnowFlakes[i][0] = mmrand(-boxing, ss->s->width + boxing, 1);
+ ss->allSnowFlakes[i][1] = mmrand(-600, -500, 1);
+ ss->allSnowFlakes[i][2] = mmrand(-depth, depth/10.0, 5000);
+ ss->allSnowFlakes[i][3] = mmrand(-1000, 1000, 500000);
+ ss->allSnowFlakes[i][4] = mmrand(1000, 3000, 1000);
+ ss->allSnowFlakes[i][5] = mmrand(-1000, 1000, 500000);
}
static Bool snowInitScreen(CompPlugin * p, CompScreen * s)
{
SNOW_DISPLAY(s->display);
- SnowScreen *hs = (SnowScreen *) calloc(1, sizeof(SnowScreen));
- hs->s = s;
- s->privates[hd->screenPrivateIndex].ptr = hs;
+ SnowScreen *ss = (SnowScreen *) calloc(1, sizeof(SnowScreen));
+ ss->s = s;
+ s->privates[sd->screenPrivateIndex].ptr = ss;
// TODO: configurable texture path.
- Bool success = readImageToTexture (s, &hs->snowTexture, fileName, &hs->snowTextureSize[0], &hs->snowTextureSize[1]);
+ ss->snowTextureLoaded = readImageToTexture (s, &ss->snowTexture, fileName, &ss->snowTextureSize[0], &ss->snowTextureSize[1]);
- if (!success)
+ if (!ss->snowTextureLoaded)
{
printf("texture not found : %s\n", fileName);
}
+
+ setupDisplayList(ss);
- hs->numSnowflakes = 2000;
- hs->lastMsCount = 0;
+ ss->lastMsCount = 0;
int i = 0;
for (i = 0; i < MAX_SNOWFLAKES; i++)
{
- InitiateSnowFlake(hs, i);
+ InitiateSnowFlake(ss, i);
}
- WRAP(hs, s, paintScreen, snowPaintScreen);
- //WRAP(hs, s, paintTransformedScreen, snowPaintTransformedScreen);
- WRAP(hs, s, preparePaintScreen, snowPreparePaintScreen);
- WRAP(hs, s, donePaintScreen, snowDonePaintScreen);
- //WRAP(hs, s, paintWindow, snowPaintWindow);
- //WRAP(hs, s, drawWindow, snowDrawWindow);
- WRAP (hs, s, drawWindowTexture, snowDrawWindowTexture);
+ WRAP(ss, s, paintScreen, snowPaintScreen);
+ //WRAP(ss, s, paintTransformedScreen, snowPaintTransformedScreen);
+ WRAP(ss, s, preparePaintScreen, snowPreparePaintScreen);
+ WRAP(ss, s, donePaintScreen, snowDonePaintScreen);
+ //WRAP(ss, s, paintWindow, snowPaintWindow);
+ WRAP(ss, s, drawWindow, snowDrawWindow);
+ //WRAP (ss, s, drawWindowTexture, snowDrawWindowTexture);
return TRUE;
}
@@ -428,16 +435,16 @@
SNOW_SCREEN(s);
//Restore the original function
- UNWRAP(hs, s, paintScreen);
- //UNWRAP(hs, s, paintTransformedScreen);
- UNWRAP(hs, s, preparePaintScreen);
- UNWRAP(hs, s, donePaintScreen);
- //UNWRAP(hs, s, paintWindow);
- //UNWRAP(hs, s, drawWindow);
- UNWRAP (hs, s, drawWindowTexture);
+ UNWRAP(ss, s, paintScreen);
+ //UNWRAP(ss, s, paintTransformedScreen);
+ UNWRAP(ss, s, preparePaintScreen);
+ UNWRAP(ss, s, donePaintScreen);
+ //UNWRAP(ss, s, paintWindow);
+ UNWRAP(ss, s, drawWindow);
+ //UNWRAP (ss, s, drawWindowTexture);
//Free the pointer
- free(hs);
+ free(ss);
}
static Bool
@@ -449,7 +456,7 @@
SNOW_DISPLAY(display);
- o = compFindOption(hd->opt, NUM_OPTIONS(hd), name, &index);
+ o = compFindOption(sd->opt, NUM_OPTIONS(sd), name, &index);
if (!o)
return FALSE;
@@ -458,49 +465,49 @@
case SNOW_DISPLAY_OPTION_NUM_SNOWFLAKES:
if (compSetFloatOption (o, value))
{
- numFlakes = (int) hd->opt[SNOW_DISPLAY_OPTION_NUM_SNOWFLAKES].value.f;
+ numFlakes = (int) sd->opt[SNOW_DISPLAY_OPTION_NUM_SNOWFLAKES].value.f;
return TRUE;
}
break;
case SNOW_DISPLAY_OPTION_SNOW_SIZE:
if (compSetFloatOption (o, value))
{
- snowSize = hd->opt[SNOW_DISPLAY_OPTION_SNOW_SIZE].value.f;
+ snowSize = sd->opt[SNOW_DISPLAY_OPTION_SNOW_SIZE].value.f;
return TRUE;
}
break;
case SNOW_DISPLAY_OPTION_SNOW_SPEED:
if (compSetFloatOption (o, value))
{
- snowSpeed = hd->opt[SNOW_DISPLAY_OPTION_SNOW_SPEED].value.f;
+ snowSpeed = sd->opt[SNOW_DISPLAY_OPTION_SNOW_SPEED].value.f;
return TRUE;
}
break;
case SNOW_DISPLAY_OPTION_SCREEN_BOXING:
if (compSetFloatOption (o, value))
{
- boxing = hd->opt[SNOW_DISPLAY_OPTION_SCREEN_BOXING].value.f;
+ boxing = sd->opt[SNOW_DISPLAY_OPTION_SCREEN_BOXING].value.f;
return TRUE;
}
break;
case SNOW_DISPLAY_OPTION_SCREEN_DEPTH:
if (compSetFloatOption (o, value))
{
- depth = hd->opt[SNOW_DISPLAY_OPTION_SCREEN_DEPTH].value.f;
+ depth = sd->opt[SNOW_DISPLAY_OPTION_SCREEN_DEPTH].value.f;
return TRUE;
}
break;
- case SNOW_DISPLAY_OPTION_MAX_FRAMES:
- if (compSetFloatOption (o, value))
- return TRUE;
- break;
+// case SNOW_DISPLAY_OPTION_MAX_FRAMES:
+// if (compSetFloatOption (o, value))
+// return TRUE;
+// break;
/*
case SNOW_DISPLAY_OPTION_SNOW_TEXTURE:
if (compSetStringOption (o, value))
{
- if (hd->opt[SNOW_DISPLAY_OPTION_SNOW_TEXTURE].value.s)
+ if (sd->opt[SNOW_DISPLAY_OPTION_SNOW_TEXTURE].value.s)
{
- fileName = hd->opt[SNOW_DISPLAY_OPTION_SNOW_TEXTURE].value.s;
+ fileName = sd->opt[SNOW_DISPLAY_OPTION_SNOW_TEXTURE].value.s;
printf("Line 437: '%s'\n", fileName);
}
else
@@ -518,11 +525,11 @@
return FALSE;
}
-static void snowDisplayInitOptions(SnowDisplay * hd)
+static void snowDisplayInitOptions(SnowDisplay * sd)
{
CompOption *o;
- o = &hd->opt[SNOW_DISPLAY_OPTION_NUM_SNOWFLAKES];
+ o = &sd->opt[SNOW_DISPLAY_OPTION_NUM_SNOWFLAKES];
o->name = "num_snowflakes";
o->group=N_("");
o->subGroup=N_("");
@@ -535,7 +542,7 @@
o->rest.f.max = 10000;
o->rest.f.precision = 1;
- o = &hd->opt[SNOW_DISPLAY_OPTION_SNOW_SIZE];
+ o = &sd->opt[SNOW_DISPLAY_OPTION_SNOW_SIZE];
o->name = "snow_size";
o->group=N_("");
o->subGroup=N_("");
@@ -548,7 +555,7 @@
o->rest.f.max = 50;
o->rest.f.precision = 0.1;
- o = &hd->opt[SNOW_DISPLAY_OPTION_SNOW_SPEED];
+ o = &sd->opt[SNOW_DISPLAY_OPTION_SNOW_SPEED];
o->name = "snow_speed";
o->group=N_("");
o->subGroup=N_("");
@@ -561,7 +568,7 @@
o->rest.f.max = 100;
o->rest.f.precision = 1;
- o = &hd->opt[SNOW_DISPLAY_OPTION_SCREEN_BOXING];
+ o = &sd->opt[SNOW_DISPLAY_OPTION_SCREEN_BOXING];
o->name = "screen_boxing";
o->group=N_("");
o->subGroup=N_("");
@@ -574,7 +581,7 @@
o->rest.f.max = 2000;
o->rest.f.precision = 1;
- o = &hd->opt[SNOW_DISPLAY_OPTION_SCREEN_DEPTH];
+ o = &sd->opt[SNOW_DISPLAY_OPTION_SCREEN_DEPTH];
o->name = "screen_depth";
o->group=N_("");
o->subGroup=N_("");
@@ -587,31 +594,31 @@
o->rest.f.max = 1000;
o->rest.f.precision = 1;
- o = &hd->opt[SNOW_DISPLAY_OPTION_MAX_FRAMES];
- o->name = "max_frames";
- o->group=N_("");
- o->subGroup=N_("");
- o->displayHints="";
- o->shortDesc = N_("Max Frames");
- o->longDesc = N_("Maximum FPS to save resources. Not Implemented yet.");
- o->type = CompOptionTypeFloat;
- o->value.f = SNOW_DISPLAY_OPTION_MAX_FRAMES_DEFAULT;
- o->rest.f.min = 0;
- o->rest.f.max = 100;
- o->rest.f.precision = 1;
+// o = &sd->opt[SNOW_DISPLAY_OPTION_MAX_FRAMES];
+// o->name = "max_frames";
+// o->group=N_("");
+// o->subGroup=N_("");
+// o->displayHints="";
+// o->shortDesc = N_("Max Frames");
+// o->longDesc = N_("Maximum FPS to save resources. Not Implemented yet.");
+// o->type = CompOptionTypeFloat;
+// o->value.f = SNOW_DISPLAY_OPTION_MAX_FRAMES_DEFAULT;
+// o->rest.f.min = 0;
+// o->rest.f.max = 100;
+// o->rest.f.precision = 1;
- o = &hd->opt[SNOW_DISPLAY_OPTION_SNOW_TEXTURE];
- o->name = "snow_texture";
- o->group=N_("");
- o->subGroup=N_("");
- o->displayHints="";
- o->shortDesc = N_("Snow Texture");
- o->longDesc = N_("Snow Texture");
- o->type = CompOptionTypeString;
- setFileName();
- o->value.s = fileName;
- o->rest.s.string = 0;
- o->rest.s.nString = 0;
+// o = &sd->opt[SNOW_DISPLAY_OPTION_SNOW_TEXTURE];
+// o->name = "snow_texture";
+// o->group=N_("");
+// o->subGroup=N_("");
+// o->displayHints="";
+// o->shortDesc = N_("Snow Texture");
+// o->longDesc = N_("Snow Texture");
+// o->type = CompOptionTypeString;
+// setFileName();
+// o->value.s = fileName;
+// o->rest.s.string = 0;
+// o->rest.s.nString = 0;
}
@@ -620,28 +627,28 @@
if (display) {
SNOW_DISPLAY(display);
- *count = NUM_OPTIONS(hd);
- return hd->opt;
+ *count = NUM_OPTIONS(sd);
+ return sd->opt;
}
else {
- SnowDisplay *hd = malloc(sizeof(SnowDisplay));
- snowDisplayInitOptions(hd);
+ SnowDisplay *sd = malloc(sizeof(SnowDisplay));
+ snowDisplayInitOptions(sd);
- *count = NUM_OPTIONS(hd);
- return hd->opt;
+ *count = NUM_OPTIONS(sd);
+ return sd->opt;
}
}
static Bool snowInitDisplay(CompPlugin * p, CompDisplay * d)
{
//Generate a snow display
- SnowDisplay *hd = (SnowDisplay *) malloc(sizeof(SnowDisplay));
+ SnowDisplay *sd = (SnowDisplay *) malloc(sizeof(SnowDisplay));
//Allocate a private index
- hd->screenPrivateIndex = allocateScreenPrivateIndex(d);
+ sd->screenPrivateIndex = allocateScreenPrivateIndex(d);
//Check if its valid
- if (hd->screenPrivateIndex < 0) {
- free(hd);
+ if (sd->screenPrivateIndex < 0) {
+ free(sd);
return FALSE;
}
@@ -654,11 +661,11 @@
//fileName = SNOW_DISPLAY_OPTION_SNOW_TEXTURE_DEFAULT;
setFileName();
- snowDisplayInitOptions(hd);
+ snowDisplayInitOptions(sd);
- hd->active = FALSE;
+ sd->active = FALSE;
//Record the display
- d->privates[displayPrivateIndex].ptr = hd;
+ d->privates[displayPrivateIndex].ptr = sd;
return TRUE;
}
@@ -668,9 +675,9 @@
SNOW_DISPLAY(d);
//Free the private index
- freeScreenPrivateIndex(d, hd->screenPrivateIndex);
+ freeScreenPrivateIndex(d, sd->screenPrivateIndex);
//Free the pointer
- free(hd);
+ free(sd);
}
static Bool snowInit(CompPlugin * p)
More information about the commits
mailing list