cleanup specfile for packaging
[profile/ivi/clutter.git] / clutter / clutter-macros.h
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Copyright (C) 2012 Intel Corporation
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20  */
21
22 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
23 #error "Only <clutter/clutter.h> can be included directly."
24 #endif
25
26 #ifndef __CLUTTER_MACROS_H__
27 #define __CLUTTER_MACROS_H__
28
29 #include <clutter/clutter-version.h>
30
31 /**
32  * CLUTTER_FLAVOUR:
33  *
34  * GL Windowing system used
35  *
36  * Since: 0.4
37  *
38  * Deprecated: 1.10: The macro evaluates to "deprecated" as Clutter can be
39  *   compiled with multiple windowing system backends. Use the various
40  *   CLUTTER_WINDOWING_* macros to detect the windowing system that Clutter
41  *   is being compiled against, and the type check macros for the
42  *   #ClutterBackend for a run-time check.
43  */
44 #define CLUTTER_FLAVOUR         "deprecated"
45
46 /**
47  * CLUTTER_COGL
48  *
49  * Cogl (internal GL abstraction utility library) backend. Can be "gl" or
50  * "gles" currently
51  *
52  * Since: 0.4
53  *
54  * Deprecated: 1.10: The macro evaluates to "deprecated" as Cogl can be
55  *   compiled against multiple GL implementations.
56  */
57 #define CLUTTER_COGL            "deprecated"
58
59 /**
60  * CLUTTER_STAGE_TYPE:
61  *
62  * The default GObject type for the Clutter stage.
63  *
64  * Since: 0.8
65  *
66  * Deprecated: 1.10: The macro evaluates to "deprecated" as Clutter can
67  *   be compiled against multiple windowing systems. You can use the
68  *   CLUTTER_WINDOWING_* macros for compile-time checks, and the type
69  *   check macros for run-time checks.
70  */
71 #define CLUTTER_STAGE_TYPE      "deprecated"
72
73 /**
74  * CLUTTER_NO_FPU:
75  *
76  * Set to 1 if Clutter was built without FPU (i.e fixed math), 0 otherwise
77  *
78  * @Deprecated: 0.6: This macro is no longer defined (identical code is used
79  *  regardless the presence of FPU).
80  */
81 #define CLUTTER_NO_FPU          (0)
82
83 /* some structures are meant to be opaque and still be allocated on the stack;
84  * in order to avoid people poking at their internals, we use this macro to
85  * ensure that users don't accidentally access a struct private members.
86  *
87  * we use the CLUTTER_COMPILATION define to allow us easier access, though.
88  */
89 #ifdef CLUTTER_COMPILATION
90 #define CLUTTER_PRIVATE_FIELD(x)        x
91 #else
92 #define CLUTTER_PRIVATE_FIELD(x)        clutter_private_ ## x
93 #endif
94
95 /* these macros are used to mark deprecated functions, and thus have to be
96  * exposed in a public header.
97  *
98  * do *not* use them in other libraries depending on Clutter: use G_DEPRECATED
99  * and G_DEPRECATED_FOR, or use your own wrappers around them.
100  */
101 #ifdef CLUTTER_DISABLE_DEPRECATION_WARNINGS
102 #define CLUTTER_DEPRECATED
103 #define CLUTTER_DEPRECATED_FOR(f)
104 #define CLUTTER_UNAVAILABLE(maj,min)
105 #else
106 #define CLUTTER_DEPRECATED G_DEPRECATED
107 #define CLUTTER_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
108 #define CLUTTER_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min)
109 #endif
110
111 /**
112  * CLUTTER_VERSION_MIN_REQUIRED:
113  *
114  * A macro that should be defined by the user prior to including the
115  * clutter.h header.
116  *
117  * The definition should be one of the predefined Clutter version macros,
118  * such as: %CLUTTER_VERSION_1_0, %CLUTTER_VERSION_1_2, ...
119  *
120  * This macro defines the lower bound for the Clutter API to be used.
121  *
122  * If a function has been deprecated in a newer version of Clutter, it
123  * is possible to use this symbol to avoid the compiler warnings without
124  * disabling warnings for every deprecated function.
125  *
126  * Since: 1.10
127  */
128 #ifndef CLUTTER_VERSION_MIN_REQUIRED
129 # define CLUTTER_VERSION_MIN_REQUIRED   (CLUTTER_VERSION_PREV_STABLE)
130 #endif
131
132 /**
133  * CLUTTER_VERSION_MAX_ALLOWED:
134  *
135  * A macro that should be define by the user prior to including the
136  * clutter.h header.
137  *
138  * The definition should be one of the predefined Clutter version macros,
139  * such as: %CLUTTER_VERSION_1_0, %CLUTTER_VERSION_1_2, ...
140  *
141  * This macro defines the upper bound for the Clutter API to be used.
142  *
143  * If a function has been introduced in a newer version of Clutter, it
144  * is possible to use this symbol to get compiler warnings when trying
145  * to use that function.
146  *
147  * Since: 1.10
148  */
149 #ifndef CLUTTER_VERSION_MAX_ALLOWED
150 # if CLUTTER_VERSION_MIN_REQUIRED > CLUTTER_VERSION_PREV_STABLE
151 #  define CLUTTER_VERSION_MAX_ALLOWED   CLUTTER_VERSION_MIN_REQUIRED
152 # else
153 #  define CLUTTER_VERSION_MAX_ALLOWED   CLUTTER_VERSION_CUR_STABLE
154 # endif
155 #endif
156
157 /* sanity checks */
158 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_MIN_REQUIRED
159 # error "CLUTTER_VERSION_MAX_ALLOWED must be >= CLUTTER_VERSION_MIN_REQUIRED"
160 #endif
161 #if CLUTTER_VERSION_MIN_REQUIRED < CLUTTER_VERSION_1_0
162 # error "CLUTTER_VERSION_MIN_REQUIRED must be >= CLUTTER_VERSION_1_0"
163 #endif
164
165 /* XXX: Every new stable minor release should add a set of macros here */
166
167 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_0
168 # define CLUTTER_DEPRECATED_IN_1_0              CLUTTER_DEPRECATED
169 # define CLUTTER_DEPRECATED_IN_1_0_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
170 #else
171 # define CLUTTER_DEPRECATED_IN_1_0
172 # define CLUTTER_DEPRECATED_IN_1_0_FOR(f)
173 #endif
174
175 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_0
176 # define CLUTTER_AVAILABLE_IN_1_0               CLUTTER_UNAVAILABLE(1, 0)
177 #else
178 # define CLUTTER_AVAILABLE_IN_1_0
179 #endif
180
181 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_2
182 # define CLUTTER_DEPRECATED_IN_1_2              CLUTTER_DEPRECATED
183 # define CLUTTER_DEPRECATED_IN_1_2_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
184 #else
185 # define CLUTTER_DEPRECATED_IN_1_2
186 # define CLUTTER_DEPRECATED_IN_1_2_FOR(f)
187 #endif
188
189 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_2
190 # define CLUTTER_AVAILABLE_IN_1_2               CLUTTER_UNAVAILABLE(1, 2)
191 #else
192 # define CLUTTER_AVAILABLE_IN_1_2
193 #endif
194
195 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_4
196 # define CLUTTER_DEPRECATED_IN_1_4              CLUTTER_DEPRECATED
197 # define CLUTTER_DEPRECATED_IN_1_4_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
198 #else
199 # define CLUTTER_DEPRECATED_IN_1_4
200 # define CLUTTER_DEPRECATED_IN_1_4_FOR(f)
201 #endif
202
203 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_4
204 # define CLUTTER_AVAILABLE_IN_1_4               CLUTTER_UNAVAILABLE(1, 4)
205 #else
206 # define CLUTTER_AVAILABLE_IN_1_4
207 #endif
208
209 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_6
210 # define CLUTTER_DEPRECATED_IN_1_6              CLUTTER_DEPRECATED
211 # define CLUTTER_DEPRECATED_IN_1_6_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
212 #else
213 # define CLUTTER_DEPRECATED_IN_1_6
214 # define CLUTTER_DEPRECATED_IN_1_6_FOR(f)
215 #endif
216
217 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_6
218 # define CLUTTER_AVAILABLE_IN_1_6               CLUTTER_UNAVAILABLE(1, 6)
219 #else
220 # define CLUTTER_AVAILABLE_IN_1_6
221 #endif
222
223 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_8
224 # define CLUTTER_DEPRECATED_IN_1_8              CLUTTER_DEPRECATED
225 # define CLUTTER_DEPRECATED_IN_1_8_FOR(f)       CLUTTER_DEPRECATED_FOR(f)
226 #else
227 # define CLUTTER_DEPRECATED_IN_1_8
228 # define CLUTTER_DEPRECATED_IN_1_8_FOR(f)
229 #endif
230
231 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_8
232 # define CLUTTER_AVAILABLE_IN_1_8               CLUTTER_UNAVAILABLE(1, 8)
233 #else
234 # define CLUTTER_AVAILABLE_IN_1_8
235 #endif
236
237 #if CLUTTER_VERSION_MIN_REQUIRED >= CLUTTER_VERSION_1_10
238 # define CLUTTER_DEPRECATED_IN_1_10             CLUTTER_DEPRECATED
239 # define CLUTTER_DEPRECATED_IN_1_10_FOR(f)      CLUTTER_DEPRECATED_FOR(f)
240 #else
241 # define CLUTTER_DEPRECATED_IN_1_10
242 # define CLUTTER_DEPRECATED_IN_1_10_FOR(f)
243 #endif
244
245 #if CLUTTER_VERSION_MAX_ALLOWED < CLUTTER_VERSION_1_10
246 # define CLUTTER_AVAILABLE_IN_1_10              CLUTTER_UNAVAILABLE(1, 10)
247 #else
248 # define CLUTTER_AVAILABLE_IN_1_10
249 #endif
250
251 /**
252  * CLUTTER_CAIRO_FORMAT_ARGB32:
253  *
254  * The #CoglPixelFormat to be used when uploading image data from
255  * and to a Cairo image surface using %CAIRO_FORMAT_ARGB32 and
256  * %CAIRO_FORMAT_RGB24 as #cairo_format_t.
257  *
258  * Since: 1.8
259  */
260
261 /* Cairo stores the data in native byte order as ARGB but Cogl's pixel
262  * formats specify the actual byte order. Therefore we need to use a
263  * different format depending on the architecture
264  */
265 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
266 #define CLUTTER_CAIRO_FORMAT_ARGB32     (COGL_PIXEL_FORMAT_BGRA_8888_PRE)
267 #else
268 #define CLUTTER_CAIRO_FORMAT_ARGB32     (COGL_PIXEL_FORMAT_ARGB_8888_PRE)
269 #endif
270
271 #endif /* __CLUTTER_MACROS_H__ */