summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Thomas <lupine@nick.lupine.me.uk>2007-04-04 12:24:22 +0100
committerNicholas Thomas <lupine@nick.lupine.me.uk>2007-04-04 12:24:22 +0100
commit94238b22a14b27102b297fc059ffa26f43bbd3c3 (patch)
tree898a241359cf6d0ccdc6b9460a44779e09457cb3
parentd90287c08132d456ce6c51b4bfee1603a6fda621 (diff)
downloadplugin-serenity-94238b22a14b27102b297fc059ffa26f43bbd3c3.tar.gz
plugin-serenity-94238b22a14b27102b297fc059ffa26f43bbd3c3.tar.bz2
Fix build errors; multiple coding faux pas. bcop currently seems to generate incorrect _options files, though
-rw-r--r--Makefile4
-rw-r--r--serenity.c83
2 files changed, 53 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 878b829..0bb0b38 100644
--- a/Makefile
+++ b/Makefile
@@ -21,10 +21,10 @@
## configuration
#enter beryl or compiz here
-TARGET = beryl
+TARGET = compiz
#enter plugin name here
-PLUGIN = xxx
+PLUGIN = serenity
#enter dependencies here
PKG_DEP =
diff --git a/serenity.c b/serenity.c
index e72e784..7060ec1 100644
--- a/serenity.c
+++ b/serenity.c
@@ -36,6 +36,8 @@ Pretty basic stuff, really, but should be pretty. Good for a single leaf, or a *
Don't like it? GTFO ;)
*/
#include <compiz/compiz.h>
+#include <stdlib.h>
+
#include "serenity_options.h"
#define GET_SERENITY_DISPLAY(d) \
@@ -52,11 +54,13 @@ Don't like it? GTFO ;)
#define NUM_OPTIONS(d) (sizeof ((d)->opt) / sizeof (CompOption))
+static int displayPrivateIndex;
+
typedef struct _SerenityTexture
{
- CompTexture t;
+ CompTexture *t;
unsigned int height;
- unsinged int width;
+ unsigned int width;
Bool loaded;
GLuint list;
@@ -65,31 +69,43 @@ typedef struct _SerenityTexture
typedef struct _SerenityDisplay
{
CompDisplay *d;
+ int screenPrivateIndex;
} SerenityDisplay;
typedef struct _SerenityScreen
{
CompScreen *s;
- SerenityTexture textures[];
- unsigned int numTextures;
+ PreparePaintScreenProc preparePaintScreen;
+ PaintScreenProc paintScreen;
- //Top-left corner of the current position of our image
- int object_x;
+ int object_x; //Top-left corner of the current position of our image
int object_y;
+
+ unsigned int numTextures;
+ SerenityTexture *textures;
+
} SerenityScreen;
-void serenityPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
+static void serenityPreparePaintScreen(CompScreen * s, int msSinceLastPaint);
+static Bool serenityPaintScreen(CompScreen * s, const ScreenPaintAttrib * sAttrib, const CompTransform *transform, Region region,
+ int output, unsigned int mask);
+static Bool serenityInitTextures(SerenityScreen *ss, unsigned int numTextures);
+static void serenityFiniTextures(SerenityScreen *ss);
+static void serenityCreateList(SerenityTexture *tex);
+static void serenityScreenOptionChanged(CompScreen *s, CompOption *opt, SerenityScreenOptions num);
+
+static void serenityPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
{
}
// TODO: Apply movement, etc here
-Bool serenityPaintScreen(CompScreen * s,
+static Bool serenityPaintScreen(CompScreen * s,
const ScreenPaintAttrib * sAttrib,
const CompTransform *transform,
Region region, int output, unsigned int mask)
{
- SERENITY_SCREEN(s);
+// SERENITY_SCREEN(s);
return FALSE;
}
@@ -105,9 +121,9 @@ static Bool serenityInitTextures(SerenityScreen *ss, unsigned int numTextures)
for (n = 0; n < numTextures; n++)
{
- ss->textures[n].loaded = false;
- ss->textures[n].t = createTexture();
- if (!ss->textures[n].t)
+ ss->textures[n].loaded = FALSE;
+ ss->textures[n].t = createTexture(ss->s);
+ if (ss->textures[n].t == NULL)
return FALSE;
ss->textures[n].height = 0;
@@ -123,28 +139,29 @@ static void serenityFiniTextures(SerenityScreen *ss)
unsigned int n;
for (n = 0; n < ss->numTextures; n++)
{
- ss->textures[n].loaded = false;
- destroyTexture(ss->textures[n].t;
+ ss->textures[n].loaded = FALSE;
+ destroyTexture(ss->s, ss->textures[n].t);
+ ss->textures[n].height = 0;
+ ss->textures[n].width = 0;
};
}
// TODO: Check I don't fail at making lists.
static void serenityCreateList(SerenityTexture *tex)
{
- CompMatrix *mat = &ss->snowTex[count].tex.matrix;
- SnowTexture *sTex = &ss->snowTex[count];
-
+ CompMatrix *matrix;
+ matrix = &tex->t->matrix;
tex->list = glGenLists(1);
-
+
glNewList(tex->list, GL_COMPILE);
glBegin(GL_QUADS);
- glTexCoord2f(COMP_TEX_COORD_X(tex->matrix, 0), COMP_TEX_COORD_Y(tex->matrix, 0));
+ glTexCoord2f(COMP_TEX_COORD_X(matrix, 0), COMP_TEX_COORD_Y(matrix, 0));
glVertex2f(0, 0);
- glTexCoord2f(COMP_TEX_COORD_X(tex->matrix, 0), COMP_TEX_COORD_Y(tex->matrix, tex->height));
+ glTexCoord2f(COMP_TEX_COORD_X(matrix, 0), COMP_TEX_COORD_Y(matrix, tex->height));
glVertex2f(0, tex->height);
- glTexCoord2f(COMP_TEX_COORD_X(tex->matrix, tex->width), COMP_TEX_COORD_Y(tex->matrix, tex->height));
+ glTexCoord2f(COMP_TEX_COORD_X(matrix, tex->width), COMP_TEX_COORD_Y(matrix, tex->height));
glVertex2f(tex->width, tex->height);
- glTexCoord2f(COMP_TEX_COORD_X(tex->matrix, tex->width), COMP_TEX_COORD_Y(tex->matrix, 0));
+ glTexCoord2f(COMP_TEX_COORD_X(matrix, tex->width), COMP_TEX_COORD_Y(matrix, 0));
glVertex2f(tex->width, 0);
glEnd();
glEndList();
@@ -158,24 +175,27 @@ static void serenityScreenOptionChanged(CompScreen *s, CompOption *opt, Serenity
{
case SerenityScreenOptionSerenityTextures:
{
- serenityfiniTextures(ss); // First, destroy everything
- if (serenityinitTextures(ss, opt->value.list.nValue)) // Now recreate everything
+ serenityFiniTextures(ss); // First, destroy everything
+ if (serenityInitTextures(ss, opt->value.list.nValue)) // Now recreate everything
for(n = 0; n < ss->numTextures; n++)
+ {
+ SerenityTexture *cTex = &ss->textures[n];
if (!readImageToTexture(s,
- ss->texture.t,
- *opt->value.list.value[n].s,
- &ss->textures[n].width,
- &ss->textures[n].height))
+ cTex->t,
+ opt->value.list.value[n].s,
+ &cTex->width,
+ &cTex->height))
// Error condition
{
}
else
{
- serenityCreateList(ss->textures[n]);
+ serenityCreateList(cTex);
ss->textures[n].loaded = TRUE;
};
+ };
- }
+ };
break;
default: break;
}
@@ -202,7 +222,6 @@ static Bool serenityInitDisplay(CompPlugin * p, CompDisplay * d)
if (!sd)
return FALSE;
- sd->textures_loaded = FALSE;
d->privates[displayPrivateIndex].ptr = sd;
sd->screenPrivateIndex = allocateScreenPrivateIndex(d);
@@ -282,4 +301,4 @@ CompPluginVTable SerenityVTable = {
CompPluginVTable *getCompPluginInfo(void)
{
return &SerenityVTable;
-} \ No newline at end of file
+}