summaryrefslogtreecommitdiff
path: root/include/compiz-cube.h
blob: f325bff6ef18c68f96bb87f5dc51c6960ae8290a (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
/*
 * Copyright © 2007 Novell, Inc.
 *
 * Permission to use, copy, modify, distribute, and sell this software
 * and its documentation for any purpose is hereby granted without
 * fee, provided that the above copyright notice appear in all copies
 * and that both that copyright notice and this permission notice
 * appear in supporting documentation, and that the name of
 * Novell, Inc. not be used in advertising or publicity pertaining to
 * distribution of the software without specific, written prior permission.
 * Novell, Inc. makes no representations about the suitability of this
 * software for any purpose. It is provided "as is" without express or
 * implied warranty.
 *
 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 * Author: David Reveman <davidr@novell.com>
 */

#ifndef _COMPIZ_CUBE_H
#define _COMPIZ_CUBE_H

#include <compiz-core.h>

COMPIZ_BEGIN_DECLS

#define CUBE_ABIVERSION 20070830

typedef struct _CubeCore {
    SetOptionForPluginProc setOptionForPlugin;
} CubeCore;

#define CUBE_MOMODE_AUTO  0
#define CUBE_MOMODE_MULTI 1
#define CUBE_MOMODE_ONE   2
#define CUBE_MOMODE_LAST  CUBE_MOMODE_ONE

#define CUBE_DISPLAY_OPTION_ABI        0
#define CUBE_DISPLAY_OPTION_INDEX      1
#define CUBE_DISPLAY_OPTION_UNFOLD_KEY 2
#define CUBE_DISPLAY_OPTION_NEXT_KEY   3
#define CUBE_DISPLAY_OPTION_PREV_KEY   4
#define CUBE_DISPLAY_OPTION_NUM        5

typedef struct _CubeDisplay {
    int	screenPrivateIndex;

    CompOption opt[CUBE_DISPLAY_OPTION_NUM];
} CubeDisplay;

#define CUBE_SCREEN_OPTION_COLOR	           0
#define CUBE_SCREEN_OPTION_IN		           1
#define CUBE_SCREEN_OPTION_SCALE_IMAGE	           2
#define CUBE_SCREEN_OPTION_IMAGES	           3
#define CUBE_SCREEN_OPTION_SKYDOME	           4
#define CUBE_SCREEN_OPTION_SKYDOME_IMG	           5
#define CUBE_SCREEN_OPTION_SKYDOME_ANIM	           6
#define CUBE_SCREEN_OPTION_SKYDOME_GRAD_START      7
#define CUBE_SCREEN_OPTION_SKYDOME_GRAD_END        8
#define CUBE_SCREEN_OPTION_ACCELERATION	           9
#define CUBE_SCREEN_OPTION_SPEED	           10
#define CUBE_SCREEN_OPTION_TIMESTEP	           11
#define CUBE_SCREEN_OPTION_MIPMAP	           12
#define CUBE_SCREEN_OPTION_BACKGROUNDS	           13
#define CUBE_SCREEN_OPTION_ADJUST_IMAGE	           14
#define CUBE_SCREEN_OPTION_ACTIVE_OPACITY          15
#define CUBE_SCREEN_OPTION_INACTIVE_OPACITY        16
#define CUBE_SCREEN_OPTION_FADE_TIME               17
#define CUBE_SCREEN_OPTION_TRANSPARENT_MANUAL_ONLY 18
#define CUBE_SCREEN_OPTION_MULTIOUTPUT_MODE        19
#define CUBE_SCREEN_OPTION_NUM                     20

typedef void (*CubeGetRotationProc) (CompScreen *s,
				     float      *x,
				     float      *v);

typedef void (*CubeClearTargetOutputProc) (CompScreen *s,
					   float      xRotate,
					   float      vRotate);

typedef void (*CubePaintTopProc) (CompScreen			*s,
				  const ScreenPaintAttrib	*sAttrib,
				  const CompTransform		*transform,
				  CompOutput			*output,
				  int				size);

typedef void (*CubePaintBottomProc) (CompScreen			*s,
				     const ScreenPaintAttrib	*sAttrib,
				     const CompTransform	*transform,
				     CompOutput			*output,
				     int			size);

typedef void (*CubePaintInsideProc) (CompScreen			*s,
				     const ScreenPaintAttrib	*sAttrib,
				     const CompTransform	*transform,
				     CompOutput			*output,
				     int			size);

typedef Bool (*CubeCheckOrientationProc) (CompScreen              *s,
					  const ScreenPaintAttrib *sAttrib,
					  const CompTransform     *transform,
					  CompOutput              *output,
					  float                   points[3][3]);

typedef enum _PaintOrder {
    BTF = 0,
    FTB
} PaintOrder;

typedef enum _RotationState {
    RotationNone = 0,
    RotationChange,
    RotationManual
} RotationState;

typedef struct _CubeScreen {
    PreparePaintScreenProc       preparePaintScreen;
    DonePaintScreenProc	         donePaintScreen;
    PaintOutputProc	         paintOutput;
    PaintTransformedOutputProc   paintTransformedOutput;
    PaintBackgroundProc          paintBackground;
    PaintWindowProc              paintWindow;
    ApplyScreenTransformProc     applyScreenTransform;
    OutputChangeNotifyProc       outputChangeNotify;
    InitWindowWalkerProc         initWindowWalker;

    CubeGetRotationProc	      getRotation;
    CubeClearTargetOutputProc clearTargetOutput;
    CubePaintTopProc          paintTop;
    CubePaintBottomProc       paintBottom;
    CubePaintInsideProc       paintInside;
    CubeCheckOrientationProc  checkOrientation;

    CompOption opt[CUBE_SCREEN_OPTION_NUM];

    int       invert;
    int       xRotations;
    PaintOrder paintOrder;

    RotationState rotationState;

    GLfloat  distance;
    GLushort color[3];
    GLfloat  tc[12];

    int grabIndex;

    int srcOutput;

    Bool    unfolded;
    GLfloat unfold, unfoldVelocity;

    GLfloat  *vertices;
    int      nVertices;

    GLuint skyListId;

    int		 pw, ph;
    unsigned int skyW, skyH;
    CompTexture  texture, sky;

    int	imgCurFile;

    int nOutput;
    int output[64];
    int outputMask[64];

    Bool cleared[64];

    Bool capsPainted[64];

    Bool fullscreenOutput;

    float outputXScale;
    float outputYScale;
    float outputXOffset;
    float outputYOffset;

    float desktopOpacity;
    float toOpacity;

    CompTexture *bg;
    int		nBg;

    int  moMode;
    Bool recalcOutput;
} CubeScreen;

#define GET_CUBE_CORE(c)					\
    ((CubeCore *) (c)->base.privates[cubeCorePrivateIndex].ptr)

#define CUBE_CORE(c)		     \
    CubeCore *cc = GET_CUBE_CORE (c)

#define GET_CUBE_DISPLAY(d)					      \
    ((CubeDisplay *) (d)->base.privates[cubeDisplayPrivateIndex].ptr)

#define CUBE_DISPLAY(d)			   \
    CubeDisplay *cd = GET_CUBE_DISPLAY (d)

#define GET_CUBE_SCREEN(s, cd)					      \
    ((CubeScreen *) (s)->base.privates[(cd)->screenPrivateIndex].ptr)

#define CUBE_SCREEN(s)							\
    CubeScreen *cs = GET_CUBE_SCREEN (s, GET_CUBE_DISPLAY (s->display))

COMPIZ_END_DECLS

#endif