1 #include "compiz-elements.h"
2 #include "elements_options.h"
3 #include <compiz-text.h>
4 
5 #define GET_ELEMENTS_DISPLAY(d)                            \
6     ((ElementsDisplay *) (d)->base.privates[displayPrivateIndex].ptr)
7 
8 #define ELEMENTS_DISPLAY(d)                                \
9     ElementsDisplay *ed = GET_ELEMENTS_DISPLAY (d)
10 
11 #define GET_ELEMENTS_SCREEN(s, ed)                         \
12     ((ElementsScreen *) (s)->base.privates[(ed)->screenPrivateIndex].ptr)
13 
14 #define ELEMENTS_SCREEN(s)                                 \
15     ElementsScreen *es = GET_ELEMENTS_SCREEN (s,           \
16 			 GET_ELEMENTS_DISPLAY (s->display))
17 
18 #define GLOW_STAGES		5
19 #define MAX_AUTUMN_AGE		100
20 
21 extern int displayPrivateIndex;
22 
23 typedef struct _ElementsDisplay
24 {
25     int screenPrivateIndex;
26 
27     TextFunc *textFunc;
28 
29     ElementTypeInfo *elementTypes;
30 } ElementsDisplay;
31 
32 typedef struct _ElementsScreen
33 {
34     PaintOutputProc paintOutput;
35     DrawWindowProc  drawWindow;
36 
37     CompTimeoutHandle timeoutHandle;
38 
39     /* text display support */
40     CompTextData *textData;
41     Bool         renderText;
42 
43     /* Information texture rendering */
44     ElementTexture    *eTexture;
45     int               ntTextures;
46     int	              nTexture;
47     Bool	      renderTexture;
48     CompTimeoutHandle renderTimeout;
49     CompTimeoutHandle switchTimeout;
50 
51     /* position in list */
52     int listIter;
53 
54     /* animation number according to user set option */
55     int animIter;
56 
57     GLuint displayList;
58     Bool   needUpdate;
59 
60     ElementAnimation *animations;
61 } ElementsScreen;
62 
63 /* autumn.c */
64 typedef struct _AutumnElement
65 {
66     float autumnFloat[2][MAX_AUTUMN_AGE];
67     int   autumnAge[2];
68     int   autumnChange;
69 } AutumnElement;
70 
71 void
72 initiateAutumnElement (CompScreen *s,
73 		       Element    *e);
74 void
75 autumnMove (CompScreen       *s,
76 	    ElementAnimation *anim,
77 	    Element          *e,
78 	    int              updateDelay);
79 
80 void
81 autumnFini (CompScreen *s,
82 	    Element    *e);
83 
84 /* fireflies.c */
85 typedef struct _FireflyElement
86 {
87     float lifespan;
88     float age;
89     float lifecycle;
90     float dx[4], dy[4], dz[4];
91 } FireflyElement;
92 
93 void
94 initiateFireflyElement (CompScreen *s,
95 		       Element     *e);
96 
97 void
98 fireflyMove (CompScreen      *s,
99 	    ElementAnimation *anim,
100 	    Element          *e,
101 	    int              updateDelay);
102 
103 void
104 fireflyFini (CompScreen *s,
105 	     Element    *e);
106 
107 /* snow.c */
108 void
109 initiateSnowElement (CompScreen *s,
110 		     Element    *e);
111 
112 void
113 snowMove (CompScreen       *s,
114 	  ElementAnimation *anim,
115 	  Element          *e,
116 	  int              updateDelay);
117 
118 void
119 snowFini (CompScreen *s,
120 	  Element    *e);
121 
122 /* stars.c */
123 void
124 initiateStarElement (CompScreen *s,
125 		     Element    *e);
126 
127 void
128 starMove (CompScreen       *s,
129 	  ElementAnimation *anim,
130 	  Element          *e,
131 	  int              updateDelay);
132 
133 void
134 starFini (CompScreen *s,
135 	  Element    *e);
136 
137 /* bubbles.c */
138 typedef struct _BubbleElement
139 {
140     float bubbleFloat[2][MAX_AUTUMN_AGE];
141     int   bubbleAge[2];
142     int   bubbleChange;
143 } BubbleElement;
144 
145 void
146 initiateBubbleElement (CompScreen *s,
147 		       Element    *e);
148 
149 void
150 bubbleMove (CompScreen       *s,
151 	    ElementAnimation *anim,
152 	    Element          *e,
153 	    int              updateDelay);
154 
155 void
156 bubbleFini (CompScreen *s,
157 	    Element    *e);
158