summaryrefslogtreecommitdiff
path: root/src/snow.c
blob: 231cc5853ba63a83f7f98ae2f54e7de14d6b49aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
/**
 *
 * Beryl snow plugin
 *
 * snow.c
 *
 * Copyright (c) 2006 Eckhart P. <beryl@cornergraf.net>
 * Copyright (c) 2006 Brian Jørgensen <qte@fundanemt.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 **/

/*
 * Many thanks to Atie H. <atie.at.matrix@gmail.com> for providing
 * a clean plugin template
 * Also thanks to the folks from #beryl-dev, especially Quinn_Storm
 * for helping me make this possible
 */

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>

#include <X11/Xatom.h>
#include <X11/extensions/Xrender.h>

#include <compiz.h>
#include "snow_options.h"

#define GET_SNOW_DISPLAY(d)                            \
	((SnowDisplay *) (d)->privates[displayPrivateIndex].ptr)

#define SNOW_DISPLAY(d)                                \
	SnowDisplay *sd = GET_SNOW_DISPLAY (d)

#define GET_SNOW_SCREEN(s, sd)                         \
	((SnowScreen *) (s)->privates[(sd)->screenPrivateIndex].ptr)

#define SNOW_SCREEN(s)                                 \
	SnowScreen *ss = GET_SNOW_SCREEN (s, GET_SNOW_DISPLAY (s->display))

static int displayPrivateIndex = 0;

// ------------------------------------------------------------  STRUCTS -----------------------------------------------------
typedef struct _SnowDisplay
{
	int screenPrivateIndex;
	Bool useTextures;

	int snowTexNFiles;
	CompOptionValue *snowTexFiles;
} SnowDisplay;

typedef struct _SnowScreen SnowScreen;

typedef struct _SnowTexture
{
	CompTexture tex;
	unsigned int width;
	unsigned int height;
	Bool loaded;
	GLuint dList;
} SnowTexture;

typedef struct _SnowFlake
{
	float x;
	float y;
	float z;
	float xs;
	float ys;
	float zs;
	float ra;					//rotation angle
	float rs;					//rotation speed

	SnowTexture *tex;
} SnowFlake;

static void InitiateSnowFlake(SnowScreen * ss, SnowFlake * sf);
static void setSnowflakeTexture(SnowScreen * ss, SnowFlake * sf);
static void beginRendering(SnowScreen * ss, CompScreen * s);
static void setupDisplayList(SnowScreen * ss);

static void snowThink(SnowScreen * ss, SnowFlake * sf);
static void snowMove(CompDisplay *d, SnowFlake * sf);

struct _SnowScreen
{
	CompScreen *s;

	Bool active;

	CompTimeoutHandle timeoutHandle;

	PaintScreenProc paintScreen;
	DrawWindowProc drawWindow;

	SnowTexture *snowTex;
	int snowTexturesLoaded;

	GLuint displayList;

	Bool displayListNeedsUpdate;

	SnowFlake *allSnowFlakes;
};


static void snowThink(SnowScreen * ss, SnowFlake * sf)
{
	int boxing;

	boxing = snowGetScreenBoxing(ss->s->display);

	if (sf->y >= ss->s->height + boxing
		|| sf->x <= -boxing
		|| sf->y >= ss->s->width + boxing
		|| sf->z <= -((float)snowGetScreenDepth(ss->s->display) / 500.0) || sf->z >= 1)

	{
		InitiateSnowFlake(ss, sf);
	}
	snowMove(ss->s->display, sf);
}

static void snowMove(CompDisplay *d, SnowFlake * sf)
{
	float tmp = 1.0f / (100.0f - snowGetSnowSpeed(d));
	int snowUpdateDelay = snowGetSnowUpdateDelay(d);

	sf->x += (sf->xs * (float)snowUpdateDelay) * tmp;
	sf->y += (sf->ys * (float)snowUpdateDelay) * tmp;
	sf->z += (sf->zs * (float)snowUpdateDelay) * tmp;
	sf->ra += ((float)snowUpdateDelay) / (10.0f - sf->rs);
}

static Bool stepSnowPositions(void *sc)
{
	CompScreen *s = sc;
	SNOW_SCREEN(s);

	if (!ss->active)
		return TRUE;

	int i = 0;
	SnowFlake *snowFlake = ss->allSnowFlakes;
	int numFlakes = snowGetNumSnowflakes(s->display);
	Bool onTop = snowGetSnowOverWindows(s->display);

	for (i = 0; i < numFlakes; i++)
		snowThink(ss, snowFlake++);

	if (ss->active && !onTop)
	{
		CompWindow *w;

		for (w = s->windows; w; w = w->next)
		{
			if (w->type & CompWindowTypeDesktopMask)
			{
				addWindowDamage(w);
			}
		}
	}
	else if (ss->active)
		damageScreen(s);

	return True;
}

static Bool
snowToggle(CompDisplay * d, CompAction * action, CompActionState state,
		   CompOption * option, int nOption)
{
	CompScreen *s;
	Window xid;

	xid = getIntOptionNamed(option, nOption, "root", 0);
	s = findScreenAtDisplay(d, xid);

	if (s)
	{
		SNOW_SCREEN(s);
		ss->active = !ss->active;
		if (!ss->active)
			damageScreen(s);
	}

	return TRUE;
}

// -------------------------------------------------  HELPER FUNCTIONS ----------------------------------------------------

int GetRand(int min, int max);
int GetRand(int min, int max)
{
	return (rand() % (max - min + 1) + min);
}

float mmrand(int min, int max, float divisor);
float mmrand(int min, int max, float divisor)
{
	return ((float)GetRand(min, max)) / divisor;
};

// ------------------------------------------------- RENDERING ----------------------------------------------------
static void setupDisplayList(SnowScreen * ss)
{
	float snowSize = snowGetSnowSize(ss->s->display);
	// ----------------- untextured list

	ss->displayList = glGenLists(1);

	glNewList(ss->displayList, GL_COMPILE);
	glBegin(GL_QUADS);

	glColor4f(1.0, 1.0, 1.0, 1.0);
	glVertex3f(0, 0, -0.0);
	glColor4f(1.0, 1.0, 1.0, 1.0);
	glVertex3f(0, snowSize, -0.0);
	glColor4f(1.0, 1.0, 1.0, 1.0);
	glVertex3f(snowSize, snowSize, -0.0);
	glColor4f(1.0, 1.0, 1.0, 1.0);
	glVertex3f(snowSize, 0, -0.0);

	glEnd();
	glEndList();

}

static void beginRendering(SnowScreen * ss, CompScreen * s)
{
	if (snowGetUseBlending(s->display))
		glEnable(GL_BLEND);

	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

	if (ss->displayListNeedsUpdate)
	{
		setupDisplayList(ss);
		ss->displayListNeedsUpdate = FALSE;
	}

	glColor4f(1.0, 1.0, 1.0, 1.0);
	if (ss->snowTexturesLoaded && snowGetUseTextures(s->display))
	{
		int j = 0;

		for (j = 0; j < ss->snowTexturesLoaded; j++)
		{
			enableTexture(ss->s, &ss->snowTex[j].tex,
						  COMP_TEXTURE_FILTER_GOOD);

			int i = 0;
			SnowFlake *snowFlake = ss->allSnowFlakes;
			int numFlakes = snowGetNumSnowflakes(s->display);
			Bool snowRotate = snowGetSnowRotation(s->display);

			for (i = 0; i < numFlakes; i++)
			{
				if (snowFlake->tex == &ss->snowTex[j])
				{
					glTranslatef(snowFlake->x, snowFlake->y, snowFlake->z);
					if (snowRotate)
						glRotatef(snowFlake->ra, 0, 0, 1);
					glCallList(ss->snowTex[j].dList);
					if (snowRotate)
						glRotatef(-snowFlake->ra, 0, 0, 1);
					glTranslatef(-snowFlake->x, -snowFlake->y, -snowFlake->z);
				}
				snowFlake++;
			}
			disableTexture(ss->s, &ss->snowTex[j].tex);
		}
	}
	else
	{
		int i = 0;
		SnowFlake *snowFlake = ss->allSnowFlakes;
		int numFlakes = snowGetNumSnowflakes(s->display);

		for (i = 0; i < numFlakes; i++)
		{
			glTranslatef(snowFlake->x, snowFlake->y, snowFlake->z);
			glRotatef(snowFlake->ra, 0, 0, 1);
			glCallList(ss->displayList);
			glRotatef(-snowFlake->ra, 0, 0, 1);
			glTranslatef(-snowFlake->x, -snowFlake->y, -snowFlake->z);
			snowFlake++;
		}
	}

	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	if (snowGetUseBlending(s->display))
	{
		glDisable(GL_BLEND);
		glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
	}
}

// -------------------------------------------------  FUNCTIONS ----------------------------------------------------

static Bool
snowPaintScreen(CompScreen * s,
								const ScreenPaintAttrib * sa,
								const CompTransform		* transform,
								Region region, int output, unsigned int mask)
{
	Bool status;

	SNOW_SCREEN(s);

	if (!snowGetSnowOverWindows(s->display) && ss->active)
	{
		// This line is essential. Without it the snow will be rendered above (some) other windows.
		mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
	}

	UNWRAP(ss, s, paintScreen);
	status = (*s->paintScreen) (s, sa, transform, region, output, mask);
	WRAP(ss, s, paintScreen, snowPaintScreen);

	if (snowGetSnowOverWindows(s->display) && ss->active)
	{
		CompTransform sTransform = *transform;
		transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);

		glPushMatrix();
		glLoadMatrixf (sTransform.m);
		beginRendering(ss, s);
		glPopMatrix();
	}

	return status;
}

static Bool
snowDrawWindow(CompWindow * w, const CompTransform *transform, const FragmentAttrib *attrib,
				Region region, unsigned int mask)
{
	int status;;

	SNOW_SCREEN(w->screen);

	// First draw Window as usual
	UNWRAP(ss, w->screen, drawWindow);
	status = (*w->screen->drawWindow) (w, transform, attrib, region, mask);
	WRAP(ss, w->screen, drawWindow, snowDrawWindow);

	// Check whether this is the Desktop Window
	if (w->type & CompWindowTypeDesktopMask && ss->active && !snowGetSnowOverWindows(w->screen->display))
		beginRendering(ss, w->screen);

	return status;
}

static void InitiateSnowFlake(SnowScreen * ss, SnowFlake * sf)
{
	//TODO: possibly place snowflakes based on FOV, instead of a cube.
	int boxing = snowGetScreenBoxing(ss->s->display);

	switch(snowGetSnowDirection(ss->s->display))
	{
		case SnowDirectionTopbottom:
			sf->x = mmrand(-boxing, ss->s->width + boxing, 1);
			sf->xs = mmrand(-1, 1, 500);
			sf->y = mmrand(-300, 0, 1);
			sf->ys = mmrand(1, 3, 1);
			break;
		case SnowDirectionBottomtop:
			sf->x = mmrand(-boxing, ss->s->width + boxing, 1);
			sf->xs = mmrand(-1, 1, 500);
			sf->y = mmrand(ss->s->height, ss->s->height + 300, 1);
			sf->ys = -mmrand(1, 3, 1);
			break;
		case SnowDirectionRightleft:
			sf->x = mmrand(ss->s->width, ss->s->width + 300, 1);
			sf->xs = -mmrand(1, 3, 1);
			sf->y = mmrand(-boxing, ss->s->height + boxing, 1);
			sf->ys = mmrand(-1, 1, 500);
			break;
		case SnowDirectionLeftright:
			sf->x = mmrand(-300, 0, 1);
			sf->xs = mmrand(1, 3, 1);
			sf->y = mmrand(-boxing, ss->s->height + boxing, 1);
			sf->ys = mmrand(-1, 1, 500);
			break;
		default:
			break;
	}

	sf->z = mmrand(-snowGetScreenDepth(ss->s->display), 0.1, 5000);
	sf->zs = mmrand(-1000, 1000, 500000);
	sf->ra = mmrand(-1000, 1000, 50);
	sf->rs = mmrand(-1000, 1000, 1000);
}

static void setSnowflakeTexture(SnowScreen * ss, SnowFlake * sf)
{
	if (ss->snowTexturesLoaded)
		sf->tex = &ss->snowTex[rand() % ss->snowTexturesLoaded];
}

static void updateSnowTextures(CompScreen * s)
{
	SNOW_SCREEN(s);
	SNOW_DISPLAY(s->display);
	int i = 0;

	for (i = 0; i < ss->snowTexturesLoaded; i++)
	{
		finiTexture(s, &ss->snowTex[i].tex);
		glDeleteLists(ss->snowTex[i].dList, 1);
	}
	if (ss->snowTexturesLoaded)
		free(ss->snowTex);
	ss->snowTexturesLoaded = 0;

	ss->snowTex = calloc(1, sizeof(SnowTexture) * sd->snowTexNFiles);

	int count = 0;
	float snowSize = snowGetSnowSize(s->display);

	for (i = 0; i < sd->snowTexNFiles; i++)
	{
		ss->snowTex[count].loaded =
				readImageToTexture(s, &ss->snowTex[count].tex,
								   sd->snowTexFiles[i].s,
								   &ss->snowTex[count].width,
								   &ss->snowTex[count].height);
		if (!ss->snowTex[count].loaded)
		{
			printf("[Snow]: Texture not found : %s\n", sd->snowTexFiles[i].s);
			continue;
		}
		printf("[Snow]: Loaded Texture %s\n", sd->snowTexFiles[i].s);
		CompMatrix *mat = &ss->snowTex[count].tex.matrix;
		SnowTexture *sTex = &ss->snowTex[count];

		sTex->dList = glGenLists(1);

		glNewList(sTex->dList, GL_COMPILE);

		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, sTex->height));
		glVertex2f(0, snowSize * sTex->height / sTex->width);
		glTexCoord2f(COMP_TEX_COORD_X(mat, sTex->width),
					 COMP_TEX_COORD_Y(mat, sTex->height));
		glVertex2f(snowSize, snowSize * sTex->height / sTex->width);
		glTexCoord2f(COMP_TEX_COORD_X(mat, sTex->width),
					 COMP_TEX_COORD_Y(mat, 0));
		glVertex2f(snowSize, 0);

		glEnd();
		glEndList();

		count++;
	}

	ss->snowTexturesLoaded = count;
	if (count < sd->snowTexNFiles)
		ss->snowTex = realloc(ss->snowTex, sizeof(SnowTexture) * count);

	SnowFlake *snowFlake = ss->allSnowFlakes;
	int numFlakes = snowGetNumSnowflakes(s->display);

	for (i = 0; i < numFlakes; i++)
	{
		setSnowflakeTexture(ss, snowFlake++);
	}
}

static Bool snowInitScreen(CompPlugin * p, CompScreen * s)
{
	SNOW_DISPLAY(s->display);

	SnowScreen *ss = (SnowScreen *) calloc(1, sizeof(SnowScreen));

	ss->s = s;
	s->privates[sd->screenPrivateIndex].ptr = ss;

	ss->snowTexturesLoaded = 0;
	ss->snowTex = NULL;
	ss->active = FALSE;
	ss->displayListNeedsUpdate = FALSE;

	int i = 0;
	int numFlakes = snowGetNumSnowflakes(s->display);

	ss->allSnowFlakes = malloc(numFlakes * sizeof(SnowFlake));
	SnowFlake *snowFlake = ss->allSnowFlakes;

	for (i = 0; i < numFlakes; i++)
	{
		InitiateSnowFlake(ss, snowFlake);
		setSnowflakeTexture(ss, snowFlake);
		snowFlake++;
	}

	updateSnowTextures(s);
	setupDisplayList(ss);

	WRAP(ss, s, paintScreen, snowPaintScreen);
	WRAP(ss, s, drawWindow, snowDrawWindow);

	ss->timeoutHandle = compAddTimeout(snowGetSnowUpdateDelay(s->display), stepSnowPositions, s);

	return TRUE;
}

static void snowFiniScreen(CompPlugin * p, CompScreen * s)
{
	SNOW_SCREEN(s);

	if (ss->timeoutHandle)
		compRemoveTimeout(ss->timeoutHandle);

	int i = 0;

	for (i = 0; i < ss->snowTexturesLoaded; i++)
	{
		finiTexture(s, &ss->snowTex[i].tex);
		glDeleteLists(ss->snowTex[i].dList, 1);
	}
	if (ss->snowTexturesLoaded)
		free(ss->snowTex);

	if (ss->allSnowFlakes)
		free(ss->allSnowFlakes);

	//Restore the original function
	UNWRAP(ss, s, paintScreen);
	UNWRAP(ss, s, drawWindow);

	//Free the pointer
	free(ss);
}

static void snowDisplayOptionChanged(CompDisplay *d, CompOption *opt, SnowDisplayOptions num)
{
	SNOW_DISPLAY(d);

	switch (num)
	{
		case SnowDisplayOptionSnowSize:
			{
				CompScreen *s;

				for (s = d->screens; s; s = s->next)
				{
					SNOW_SCREEN(s);
					ss->displayListNeedsUpdate = TRUE;
					updateSnowTextures(s);
				}
			}
			break;
		case SnowDisplayOptionSnowUpdateDelay:
			{
				CompScreen *s;

				for (s = d->screens; s; s = s->next)
				{
					SNOW_SCREEN(s);
					
					if (ss->timeoutHandle)
						compRemoveTimeout(ss->timeoutHandle);
					ss->timeoutHandle =
						compAddTimeout(snowGetSnowUpdateDelay(d), stepSnowPositions, s);
				}
			}
			break;
		case SnowDisplayOptionNumSnowflakes:
			{
				CompScreen *s;
				int i, numFlakes;
				SnowFlake *snowFlake;

				numFlakes = snowGetNumSnowflakes(d);
				for (s = d->screens; s; s = s->next)
				{
					SNOW_SCREEN(s);
					ss->allSnowFlakes = realloc(ss->allSnowFlakes, numFlakes * sizeof(SnowFlake));
					snowFlake = ss->allSnowFlakes;

					for (i = 0; i < numFlakes; i++)
					{
						InitiateSnowFlake(ss, snowFlake);
						setSnowflakeTexture(ss, snowFlake);
						snowFlake++;
					}
				}
			}
			break;
		case SnowDisplayOptionSnowTextures:
			{
				CompScreen *s;
				CompOption *texOpt;

				texOpt = snowGetSnowTexturesOption(d);

				sd->snowTexFiles = texOpt->value.list.value;
				sd->snowTexNFiles = texOpt->value.list.nValue;

				for (s = d->screens; s; s = s->next)
					updateSnowTextures(s);
			}
			break;
		default:
			break;
	}
}

static Bool snowInitDisplay(CompPlugin * p, CompDisplay * d)
{
	CompOption *texOpt;
	//Generate a snow display
	SnowDisplay *sd = (SnowDisplay *) malloc(sizeof(SnowDisplay));

	//Allocate a private index
	sd->screenPrivateIndex = allocateScreenPrivateIndex(d);

	//Check if its valid
	if (sd->screenPrivateIndex < 0)
	{
		free(sd);
		return FALSE;
	}
	
	snowSetToggleInitiate(d, snowToggle);
	snowSetNumSnowflakesNotify(d, snowDisplayOptionChanged);
	snowSetSnowSizeNotify(d, snowDisplayOptionChanged);
	snowSetSnowUpdateDelayNotify(d, snowDisplayOptionChanged);
	snowSetSnowTexturesNotify(d, snowDisplayOptionChanged);

	texOpt = snowGetSnowTexturesOption(d);
	sd->snowTexFiles = texOpt->value.list.value;
	sd->snowTexNFiles = texOpt->value.list.nValue;

	//Record the display
	d->privates[displayPrivateIndex].ptr = sd;

	return TRUE;
}

static void snowFiniDisplay(CompPlugin * p, CompDisplay * d)
{
	SNOW_DISPLAY(d);

	//Free the private index
	freeScreenPrivateIndex(d, sd->screenPrivateIndex);
	//Free the pointer
	free(sd);
}

static Bool snowInit(CompPlugin * p)
{
	displayPrivateIndex = allocateDisplayPrivateIndex();

	if (displayPrivateIndex < 0)
		return FALSE;

	return TRUE;
}

static void snowFini(CompPlugin * p)
{
	if (displayPrivateIndex >= 0)
		freeDisplayPrivateIndex(displayPrivateIndex);
}

static int snowGetVersion(CompPlugin *p, int version)
{
	return ABIVERSION;
}

CompPluginVTable snowVTable = {
	"snow",
	N_("Snow"),
	N_("XSnow for Beryl"),
	snowGetVersion,
	snowInit,
	snowFini,
	snowInitDisplay,
	snowFiniDisplay,
	snowInitScreen,
	snowFiniScreen,
	0,
	0,
	0,
	0,
	0,							/*snowGetScreenOptions */
	0,							/*snowSetScreenOption */
	0,
	0,
	0,
	0
};

CompPluginVTable *getCompPluginInfo(void)
{
	return &snowVTable;
}