diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/ecore/src/lib/ecore_evas | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to '')
16 files changed, 18023 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h new file mode 100644 index 0000000..256e57c --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h | |||
@@ -0,0 +1,1660 @@ | |||
1 | #ifndef _ECORE_EVAS_H | ||
2 | #define _ECORE_EVAS_H | ||
3 | |||
4 | #include <Evas.h> | ||
5 | #include <Ecore_Getopt.h> | ||
6 | #include <Ecore_Input.h> | ||
7 | |||
8 | #ifdef EAPI | ||
9 | # undef EAPI | ||
10 | #endif | ||
11 | |||
12 | #ifdef _WIN32 | ||
13 | # ifdef EFL_ECORE_EVAS_BUILD | ||
14 | # ifdef DLL_EXPORT | ||
15 | # define EAPI __declspec(dllexport) | ||
16 | # else | ||
17 | # define EAPI | ||
18 | # endif /* ! DLL_EXPORT */ | ||
19 | # else | ||
20 | # define EAPI __declspec(dllimport) | ||
21 | # endif /* ! EFL_ECORE_EVAS_BUILD */ | ||
22 | #else | ||
23 | # ifdef __GNUC__ | ||
24 | # if __GNUC__ >= 4 | ||
25 | # define EAPI __attribute__ ((visibility("default"))) | ||
26 | # else | ||
27 | # define EAPI | ||
28 | # endif | ||
29 | # else | ||
30 | # define EAPI | ||
31 | # endif | ||
32 | #endif /* ! _WIN32 */ | ||
33 | |||
34 | /** | ||
35 | * @file Ecore_Evas.h | ||
36 | * @brief Evas wrapper functions | ||
37 | * | ||
38 | * The following is a list of example that partially exemplify Ecore_Evas's API: | ||
39 | * @li @ref ecore_evas_callbacks_example_c | ||
40 | * @li @ref ecore_evas_object_example_c | ||
41 | * @li @ref ecore_evas_basics_example_c | ||
42 | */ | ||
43 | |||
44 | /* FIXME: | ||
45 | * to do soon: | ||
46 | * - iconfication api needs to work | ||
47 | * - maximization api needs to work | ||
48 | * - document all calls | ||
49 | * | ||
50 | * later: | ||
51 | * - buffer back-end that renders to an evas_image_object ??? | ||
52 | * - qt back-end ??? | ||
53 | * - dfb back-end ??? (dfb's threads make this REALLY HARD) | ||
54 | */ | ||
55 | |||
56 | #ifdef __cplusplus | ||
57 | extern "C" { | ||
58 | #endif | ||
59 | |||
60 | /** | ||
61 | * @defgroup Ecore_Evas_Group Ecore_Evas wrapper/helper set of functions | ||
62 | * | ||
63 | * This is a list of examples of these functions: | ||
64 | * - @ref Ecore_Evas_Window_Sizes_Example_c | ||
65 | * - @ref Ecore_Evas_Buffer_Example_01_c | ||
66 | * - @ref Ecore_Evas_Buffer_Example_02_c | ||
67 | * @{ | ||
68 | */ | ||
69 | |||
70 | /* these are dummy and just tell u what API levels ecore_evas supports - not if | ||
71 | * the actual support is compiled in. you need to query for that separately. | ||
72 | */ | ||
73 | #define HAVE_ECORE_EVAS_X 1 | ||
74 | #define HAVE_ECORE_EVAS_FB 1 | ||
75 | #define HAVE_ECORE_EVAS_X11_GL 1 | ||
76 | #define HAVE_ECORE_EVAS_X11_16 1 | ||
77 | #define HAVE_ECORE_EVAS_DIRECTFB 1 | ||
78 | #define HAVE_ECORE_EVAS_WIN32 1 | ||
79 | #define HAVE_ECORE_EVAS_COCOA 1 | ||
80 | #define HAVE_ECORE_EVAS_SDL 1 | ||
81 | #define HAVE_ECORE_EVAS_WINCE 1 | ||
82 | #define HAVE_ECORE_EVAS_EWS 1 | ||
83 | #define HAVE_ECORE_EVAS_PSL1GHT 1 | ||
84 | |||
85 | typedef enum _Ecore_Evas_Engine_Type | ||
86 | { | ||
87 | ECORE_EVAS_ENGINE_SOFTWARE_BUFFER, | ||
88 | ECORE_EVAS_ENGINE_SOFTWARE_XLIB, | ||
89 | ECORE_EVAS_ENGINE_XRENDER_X11, | ||
90 | ECORE_EVAS_ENGINE_OPENGL_X11, | ||
91 | ECORE_EVAS_ENGINE_SOFTWARE_XCB, | ||
92 | ECORE_EVAS_ENGINE_XRENDER_XCB, | ||
93 | ECORE_EVAS_ENGINE_SOFTWARE_GDI, | ||
94 | ECORE_EVAS_ENGINE_SOFTWARE_DDRAW, | ||
95 | ECORE_EVAS_ENGINE_DIRECT3D, | ||
96 | ECORE_EVAS_ENGINE_OPENGL_GLEW, | ||
97 | ECORE_EVAS_ENGINE_OPENGL_COCOA, | ||
98 | ECORE_EVAS_ENGINE_SOFTWARE_SDL, | ||
99 | ECORE_EVAS_ENGINE_DIRECTFB, | ||
100 | ECORE_EVAS_ENGINE_SOFTWARE_FB, | ||
101 | ECORE_EVAS_ENGINE_SOFTWARE_8_X11, | ||
102 | ECORE_EVAS_ENGINE_SOFTWARE_16_X11, | ||
103 | ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW, | ||
104 | ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE, | ||
105 | ECORE_EVAS_ENGINE_OPENGL_SDL, | ||
106 | ECORE_EVAS_ENGINE_EWS, | ||
107 | ECORE_EVAS_ENGINE_PSL1GHT | ||
108 | } Ecore_Evas_Engine_Type; | ||
109 | |||
110 | typedef enum _Ecore_Evas_Avoid_Damage_Type | ||
111 | { | ||
112 | ECORE_EVAS_AVOID_DAMAGE_NONE = 0, | ||
113 | ECORE_EVAS_AVOID_DAMAGE_EXPOSE = 1, | ||
114 | ECORE_EVAS_AVOID_DAMAGE_BUILT_IN = 2 | ||
115 | } Ecore_Evas_Avoid_Damage_Type; | ||
116 | |||
117 | typedef enum _Ecore_Evas_Object_Associate_Flags | ||
118 | { | ||
119 | ECORE_EVAS_OBJECT_ASSOCIATE_BASE = 0, | ||
120 | ECORE_EVAS_OBJECT_ASSOCIATE_STACK = 1 << 0, | ||
121 | ECORE_EVAS_OBJECT_ASSOCIATE_LAYER = 1 << 1, | ||
122 | ECORE_EVAS_OBJECT_ASSOCIATE_DEL = 1 << 2 | ||
123 | } Ecore_Evas_Object_Associate_Flags; | ||
124 | |||
125 | #ifndef _ECORE_X_H | ||
126 | #define _ECORE_X_WINDOW_PREDEF | ||
127 | typedef unsigned int Ecore_X_Window; | ||
128 | #endif | ||
129 | |||
130 | #ifndef _ECORE_DIRECTFB_H | ||
131 | #define _ECORE_DIRECTFB_WINDOW_PREDEF | ||
132 | typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window; | ||
133 | #endif | ||
134 | |||
135 | #ifndef __ECORE_WIN32_H__ | ||
136 | typedef struct _Ecore_Win32_Window Ecore_Win32_Window; | ||
137 | #endif | ||
138 | |||
139 | #ifndef __ECORE_WINCE_H__ | ||
140 | typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window; | ||
141 | #endif | ||
142 | |||
143 | #ifndef __ECORE_COCOA_H__ | ||
144 | typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; | ||
145 | #endif | ||
146 | |||
147 | #ifndef _ECORE_EVAS_PRIVATE_H | ||
148 | /* basic data types */ | ||
149 | typedef struct _Ecore_Evas Ecore_Evas; | ||
150 | #endif | ||
151 | |||
152 | /* module setup/shutdown calls */ | ||
153 | |||
154 | EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine); | ||
155 | |||
156 | /** | ||
157 | * @brief Init the Ecore_Evas system. | ||
158 | * | ||
159 | * @return How many times the lib has been initialized, 0 indicates failure. | ||
160 | * | ||
161 | * Set up the Evas wrapper system. Init Evas and Ecore libraries. | ||
162 | * | ||
163 | * @see ecore_evas_shutdown() | ||
164 | */ | ||
165 | EAPI int ecore_evas_init(void); | ||
166 | /** | ||
167 | * @brief Shut down the Ecore_Evas system. | ||
168 | * | ||
169 | * @return 0 if ecore evas is fully shut down, or > 0 if it still being used. | ||
170 | * | ||
171 | * This closes the Evas wrapper system down. Shut down Evas and Ecore libraries. | ||
172 | * | ||
173 | * @see ecore_evas_init() | ||
174 | */ | ||
175 | EAPI int ecore_evas_shutdown(void); | ||
176 | |||
177 | EAPI void ecore_evas_app_comp_sync_set(Eina_Bool do_sync); | ||
178 | EAPI Eina_Bool ecore_evas_app_comp_sync_get(void); | ||
179 | |||
180 | /** | ||
181 | * @brief Returns a list of supported engines names. | ||
182 | * | ||
183 | * @return Newly allocated list with engines names. Engines names | ||
184 | * strings are internal and should be considered constants, do not | ||
185 | * free or modify them, to free the list use ecore_evas_engines_free(). | ||
186 | */ | ||
187 | EAPI Eina_List *ecore_evas_engines_get(void); | ||
188 | /** | ||
189 | * @brief Free list returned by ecore_evas_engines_get() | ||
190 | */ | ||
191 | EAPI void ecore_evas_engines_free(Eina_List *engines); | ||
192 | /** | ||
193 | * @brief Creates a new Ecore_Evas based on engine name and common parameters. | ||
194 | * | ||
195 | * @param engine_name engine name as returned by | ||
196 | * ecore_evas_engines_get() or NULL to use environment variable | ||
197 | * ECORE_EVAS_ENGINE, that can be undefined and in this case | ||
198 | * this call will try to find the first working engine. | ||
199 | * @param x horizontal position of window (not supported in all engines) | ||
200 | * @param y vertical position of window (not supported in all engines) | ||
201 | * @param w width of window | ||
202 | * @param h height of window | ||
203 | * @param extra_options string with extra parameter, dependent on engines | ||
204 | * or NULL. String is usually in the form: 'key1=value1;key2=value2'. | ||
205 | * Pay attention that when getting that from shell commands, most | ||
206 | * consider ';' as the command terminator, so you need to escape | ||
207 | * it or use quotes. | ||
208 | * | ||
209 | * @return Ecore_Evas instance or NULL if creation failed. | ||
210 | */ | ||
211 | EAPI Ecore_Evas *ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options); | ||
212 | /** | ||
213 | * @brief Set whether an Ecore_Evas has an alpha channel or not. | ||
214 | * | ||
215 | * @param ee The Ecore_Evas to shape | ||
216 | * @param alpha EINA_TRUE to enable the alpha channel, EINA_FALSE to disable it | ||
217 | * | ||
218 | * This function allows you to make an Ecore_Evas translucent using an | ||
219 | * alpha channel. See ecore_evas_shaped_set() for details. The difference | ||
220 | * between a shaped window and a window with an alpha channel is that an | ||
221 | * alpha channel supports multiple levels of transpararency, as opposed to | ||
222 | * the 1 bit transparency of a shaped window (a pixel is either opaque, or | ||
223 | * it's transparent). | ||
224 | * | ||
225 | * @warning Support for this depends on the underlying windowing system. | ||
226 | */ | ||
227 | EAPI void ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha); | ||
228 | /** | ||
229 | * @brief Query whether an Ecore_Evas has an alpha channel. | ||
230 | * @param ee The Ecore_Evas to query. | ||
231 | * @return EINA_TRUE if ee has an alpha channel, EINA_FALSE if it does not. | ||
232 | * | ||
233 | * This function returns EINA_TRUE if @p ee has an alpha channel, and EINA_FALSE | ||
234 | * if it does not. | ||
235 | * | ||
236 | * @see ecore_evas_alpha_set() | ||
237 | */ | ||
238 | EAPI Eina_Bool ecore_evas_alpha_get(const Ecore_Evas *ee); | ||
239 | /** | ||
240 | * @brief Set whether an Ecore_Evas has an transparent window or not. | ||
241 | * | ||
242 | * @param ee The Ecore_Evas to shape | ||
243 | * @param transparent EINA_TRUE to enable the transparent window, EINA_FALSE to | ||
244 | * disable it | ||
245 | * | ||
246 | * This function sets some translucency options, for more complete support see | ||
247 | * ecore_evas_alpha_set(). | ||
248 | * | ||
249 | * @warning Support for this depends on the underlying windowing system. | ||
250 | * | ||
251 | * @see ecore_evas_alpha_set() | ||
252 | */ | ||
253 | EAPI void ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent); | ||
254 | /** | ||
255 | * @brief Query whether an Ecore_Evas is transparent. | ||
256 | * | ||
257 | * @param ee The Ecore_Evas to query. | ||
258 | * @return EINA_TRUE if ee is transparent, EINA_FALSE if it isn't. | ||
259 | * | ||
260 | * @see ecore_evas_transparent_set() | ||
261 | */ | ||
262 | EAPI Eina_Bool ecore_evas_transparent_get(const Ecore_Evas *ee); | ||
263 | /** | ||
264 | * @brief Get the geometry of an Ecore_Evas. | ||
265 | * | ||
266 | * @param ee The Ecore_Evas whose geometry y | ||
267 | * @param x A pointer to an int to place the x coordinate in | ||
268 | * @param y A pointer to an int to place the y coordinate in | ||
269 | * @param w A pointer to an int to place the w size in | ||
270 | * @param h A pointer to an int to place the h size in | ||
271 | * | ||
272 | * This function takes four pointers to (already allocated) ints, and places | ||
273 | * the geometry of @p ee in them. If any of the parameters is not desired you | ||
274 | * may pass NULL on them. | ||
275 | * | ||
276 | * @code | ||
277 | * int x, y, w, h; | ||
278 | * ecore_evas_geometry_get(ee, &x, &y, &w, &h); | ||
279 | * @endcode | ||
280 | * | ||
281 | * @see ecore_evas_new() | ||
282 | * @see ecore_evas_resize() | ||
283 | * @see ecore_evas_move() | ||
284 | * @see ecore_evas_move_resize() | ||
285 | */ | ||
286 | EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); | ||
287 | /** | ||
288 | * @brief Get the geometry which an Ecore_Evas was latest recently requested. | ||
289 | * | ||
290 | * @param ee The Ecore_Evas whose geometry y | ||
291 | * @param x A pointer to an int to place the x coordinate in | ||
292 | * @param y A pointer to an int to place the y coordinate in | ||
293 | * @param w A pointer to an int to place the w size in | ||
294 | * @param h A pointer to an int to place the h size in | ||
295 | * | ||
296 | * This function takes four pointers to (already allocated) ints, and places | ||
297 | * the geometry which @p ee was latest recently requested . If any of the parameters is not desired you | ||
298 | * may pass NULL on them. | ||
299 | * This function can represent recently requested geomety. | ||
300 | * ecore_evas_geometry_get function returns the value is updated after engine finished request. | ||
301 | * By comparison, ecore_evas_request_geometry_get returns recently requested value. | ||
302 | * | ||
303 | * @code | ||
304 | * int x, y, w, h; | ||
305 | * ecore_evas_request_geometry_get(ee, &x, &y, &w, &h); | ||
306 | * @endcode | ||
307 | * | ||
308 | * @since 1.1 | ||
309 | */ | ||
310 | EAPI void ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); | ||
311 | /** | ||
312 | * @brief Set the focus of an Ecore_Evas' window. | ||
313 | * | ||
314 | * @param ee The Ecore_Evas | ||
315 | * @param on EINA_TRUE for focus, EINA_FALSE to defocus. | ||
316 | * | ||
317 | * This function focuses @p ee if @p on is EINA_TRUE, or unfocuses @p ee if @p | ||
318 | * on is EINA_FALSE. | ||
319 | * | ||
320 | * @warning Support for this depends on the underlying windowing system. | ||
321 | */ | ||
322 | EAPI void ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on); | ||
323 | /** | ||
324 | * @brief Query whether an Ecore_Evas' window is focused or not. | ||
325 | * | ||
326 | * @param ee The Ecore_Evas to set | ||
327 | * @return EINA_TRUE if @p ee if focused, EINA_FALSE if not. | ||
328 | * | ||
329 | * @see ecore_evas_focus_set() | ||
330 | */ | ||
331 | EAPI Eina_Bool ecore_evas_focus_get(const Ecore_Evas *ee); | ||
332 | /** | ||
333 | * @brief Iconify or uniconify an Ecore_Evas' window. | ||
334 | * | ||
335 | * @param ee The Ecore_Evas | ||
336 | * @param on EINA_TRUE to iconify, EINA_FALSE to uniconify. | ||
337 | * | ||
338 | * This function iconifies @p ee if @p on is EINA_TRUE, or uniconifies @p ee if | ||
339 | * @p on is EINA_FALSE. | ||
340 | * | ||
341 | * @note Iconify and minize are synonims. | ||
342 | * | ||
343 | * @warning Support for this depends on the underlying windowing system. | ||
344 | */ | ||
345 | EAPI void ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on); | ||
346 | /** | ||
347 | * @brief Query whether an Ecore_Evas' window is iconified or not. | ||
348 | * | ||
349 | * @param ee The Ecore_Evas to set | ||
350 | * @return EINA_TRUE if @p ee is iconified, EINA_FALSE if not. | ||
351 | * | ||
352 | * @note Iconify and minize are synonims. | ||
353 | * | ||
354 | * @see ecore_evas_iconified_set() | ||
355 | */ | ||
356 | EAPI Eina_Bool ecore_evas_iconified_get(const Ecore_Evas *ee); | ||
357 | /** | ||
358 | * @brief Set whether an Ecore_Evas' window is borderless or not. | ||
359 | * | ||
360 | * @param ee The Ecore_Evas | ||
361 | * @param on EINA_TRUE for borderless, EINA_FALSE for bordered. | ||
362 | * | ||
363 | * This function makes @p ee borderless if @p on is EINA_TRUE, or bordered if @p | ||
364 | * on is EINA_FALSE. | ||
365 | * | ||
366 | * @warning Support for this depends on the underlying windowing system. | ||
367 | */ | ||
368 | EAPI void ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on); | ||
369 | /** | ||
370 | * @brief Query whether an Ecore_Evas' window is borderless or not. | ||
371 | * | ||
372 | * @param ee The Ecore_Evas to set | ||
373 | * @return EINA_TRUE if @p ee is borderless, EINA_FALSE if not. | ||
374 | * | ||
375 | * @see ecore_evas_borderless_set() | ||
376 | */ | ||
377 | EAPI Eina_Bool ecore_evas_borderless_get(const Ecore_Evas *ee); | ||
378 | /** | ||
379 | * @brief Set whether or not an Ecore_Evas' window is fullscreen. | ||
380 | * | ||
381 | * @param ee The Ecore_Evas | ||
382 | * @param on EINA_TRUE fullscreen, EINA_FALSE not. | ||
383 | * | ||
384 | * This function causes @p ee to be fullscreen if @p on is EINA_TRUE, | ||
385 | * or not if @p on is EINA_FALSE. | ||
386 | * | ||
387 | * @warning Support for this depends on the underlying windowing system. | ||
388 | */ | ||
389 | EAPI void ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on); | ||
390 | /** | ||
391 | * @brief Query whether an Ecore_Evas' window is fullscreen or not. | ||
392 | * | ||
393 | * @param ee The Ecore_Evas to set | ||
394 | * @return EINA_TRUE if @p ee is fullscreen, EINA_FALSE if not. | ||
395 | * | ||
396 | * @see ecore_evas_fullscreen_set() | ||
397 | */ | ||
398 | EAPI Eina_Bool ecore_evas_fullscreen_get(const Ecore_Evas *ee); | ||
399 | /** | ||
400 | * @brief Set if this evas should ignore @b all events. | ||
401 | * | ||
402 | * @param ee The Ecore_Evas whose window's to ignore events. | ||
403 | * @param ignore The Ecore_Evas new ignore state. | ||
404 | * | ||
405 | * @warning Support for this depends on the underlying windowing system. | ||
406 | */ | ||
407 | EAPI void ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore); | ||
408 | /** | ||
409 | * @brief Returns the ignore state of an Ecore_Evas' window. | ||
410 | * | ||
411 | * @param ee The Ecore_Evas whose window's ignore events state is returned. | ||
412 | * @return The Ecore_Evas window's ignore state. | ||
413 | * | ||
414 | * @see ecore_evas_ignore_events_set() | ||
415 | */ | ||
416 | EAPI Eina_Bool ecore_evas_ignore_events_get(const Ecore_Evas *ee); | ||
417 | /** | ||
418 | * @brief Query whether an Ecore_Evas' window is visible or not. | ||
419 | * | ||
420 | * @param ee The Ecore_Evas to query. | ||
421 | * @return 1 if visible, 0 if not. | ||
422 | * | ||
423 | * This function queries @p ee and returns 1 if it is visible, and 0 if not. | ||
424 | * | ||
425 | * @see ecore_evas_show() | ||
426 | * @see ecore_evas_hide() | ||
427 | */ | ||
428 | EAPI int ecore_evas_visibility_get(const Ecore_Evas *ee); | ||
429 | /** | ||
430 | * @brief Set the layer of an Ecore_Evas' window. | ||
431 | * | ||
432 | * @param ee The Ecore_Evas | ||
433 | * @param layer The layer to put @p ee on. | ||
434 | * | ||
435 | * This function moves @p ee to the layer @p layer. | ||
436 | * | ||
437 | * @warning Support for this depends on the underlying windowing system. | ||
438 | * | ||
439 | * @see ecore_evas_lower() | ||
440 | * @see ecore_evas_raise() | ||
441 | */ | ||
442 | EAPI void ecore_evas_layer_set(Ecore_Evas *ee, int layer); | ||
443 | /** | ||
444 | * @brief Get the layer of an Ecore_Evas' window. | ||
445 | * | ||
446 | * @param ee The Ecore_Evas to set | ||
447 | * @return the layer @p ee's window is on. | ||
448 | * | ||
449 | * @see ecore_evas_layer_set() | ||
450 | * @see ecore_evas_lower() | ||
451 | * @see ecore_evas_raise() | ||
452 | */ | ||
453 | EAPI int ecore_evas_layer_get(const Ecore_Evas *ee); | ||
454 | /** | ||
455 | * @brief Maximize (or unmaximize) an Ecore_Evas' window. | ||
456 | * | ||
457 | * @param ee The Ecore_Evas | ||
458 | * @param on EINA_TRUE to maximize, EINA_FALSE to unmaximize. | ||
459 | * | ||
460 | * This function maximizes @p ee if @p on is EINA_TRUE, or unmaximizes @p ee | ||
461 | * if @p on is EINA_FALSE. | ||
462 | * | ||
463 | * @warning Support for this depends on the underlying windowing system. | ||
464 | */ | ||
465 | EAPI void ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on); | ||
466 | /** | ||
467 | * @brief Query whether an Ecore_Evas' window is maximized or not. | ||
468 | * | ||
469 | * @param ee The Ecore_Evas to set | ||
470 | * @return EINA_TRUE if @p ee is maximized, EINA_FALSE if not. | ||
471 | * | ||
472 | * @see ecore_evas_maximized_set() | ||
473 | */ | ||
474 | EAPI Eina_Bool ecore_evas_maximized_get(const Ecore_Evas *ee); | ||
475 | /** | ||
476 | * @brief Move an Ecore_Evas. | ||
477 | * | ||
478 | * @param ee The Ecore_Evas to move | ||
479 | * @param x The x coordinate to move to | ||
480 | * @param y The y coordinate to move to | ||
481 | * | ||
482 | * This moves @p ee to the screen coordinates (@p x, @p y) | ||
483 | * | ||
484 | * @warning Support for this depends on the underlying windowing system. | ||
485 | * | ||
486 | * @see ecore_evas_new() | ||
487 | * @see ecore_evas_resize() | ||
488 | * @see ecore_evas_move_resize() | ||
489 | */ | ||
490 | EAPI void ecore_evas_move(Ecore_Evas *ee, int x, int y); | ||
491 | /** | ||
492 | * @brief Resize an Ecore_Evas. | ||
493 | * | ||
494 | * @param ee The Ecore_Evas to move | ||
495 | * @param w The w coordinate to resize to | ||
496 | * @param h The h coordinate to resize to | ||
497 | * | ||
498 | * This resizes @p ee to @p w x @p h. | ||
499 | * | ||
500 | * @warning Support for this depends on the underlying windowing system. | ||
501 | * | ||
502 | * @see ecore_evas_new() | ||
503 | * @see ecore_evas_move() | ||
504 | * @see ecore_evas_move_resize() | ||
505 | */ | ||
506 | EAPI void ecore_evas_resize(Ecore_Evas *ee, int w, int h); | ||
507 | /** | ||
508 | * @brief Move and resize an Ecore_Evas | ||
509 | * | ||
510 | * @param ee The Ecore_Evas to move and resize | ||
511 | * @param x The x coordinate to move to | ||
512 | * @param y The y coordinate to move to | ||
513 | * @param w The w coordinate to resize to | ||
514 | * @param h The h coordinate to resize to | ||
515 | * | ||
516 | * This moves @p ee to the screen coordinates (@p x, @p y) and resizes | ||
517 | * it to @p w x @p h. | ||
518 | * | ||
519 | * @warning Support for this depends on the underlying windowing system. | ||
520 | * | ||
521 | * @see ecore_evas_new() | ||
522 | * @see ecore_evas_move() | ||
523 | * @see ecore_evas_resize() | ||
524 | */ | ||
525 | EAPI void ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h); | ||
526 | /** | ||
527 | * @brief Set the rotation of an Ecore_Evas' window. | ||
528 | * | ||
529 | * @param ee The Ecore_Evas | ||
530 | * @param rot the angle (in degrees) of rotation. | ||
531 | * | ||
532 | * The allowed values of @p rot depend on the engine being used. Most only | ||
533 | * allow multiples of 90. | ||
534 | * | ||
535 | * @warning Support for this depends on the underlying windowing system. | ||
536 | * | ||
537 | * @see ecore_evas_rotation_with_resize_set() | ||
538 | */ | ||
539 | EAPI void ecore_evas_rotation_set(Ecore_Evas *ee, int rot); | ||
540 | /** | ||
541 | * @brief Set the rotation of an Ecore_Evas' window | ||
542 | * | ||
543 | * @param ee The Ecore_Evas | ||
544 | * @param rot the angle (in degrees) of rotation. | ||
545 | * | ||
546 | * Like ecore_evas_rotation_set(), but it also resizes the window's contents so | ||
547 | * that they fit inside the current window geometry. | ||
548 | * | ||
549 | * @warning Support for this depends on the underlying windowing system. | ||
550 | * | ||
551 | * @see ecore_evas_rotation_set() | ||
552 | */ | ||
553 | EAPI void ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot); | ||
554 | /** | ||
555 | * @brief Get the rotation of an Ecore_Evas' window | ||
556 | * | ||
557 | * @param ee The Ecore_Evas | ||
558 | * @return the angle (in degrees) of rotation. | ||
559 | * | ||
560 | * @see ecore_evas_rotation_set() | ||
561 | * @see ecore_evas_rotation_with_resize_set() | ||
562 | */ | ||
563 | EAPI int ecore_evas_rotation_get(const Ecore_Evas *ee); | ||
564 | /** | ||
565 | * @brief Raise an Ecore_Evas' window. | ||
566 | * | ||
567 | * @param ee The Ecore_Evas to raise. | ||
568 | * | ||
569 | * This functions raises the Ecore_Evas to the front. | ||
570 | * | ||
571 | * @warning Support for this depends on the underlying windowing system. | ||
572 | * | ||
573 | * @see ecore_evas_lower() | ||
574 | * @see ecore_evas_layer_set() | ||
575 | */ | ||
576 | EAPI void ecore_evas_raise(Ecore_Evas *ee); | ||
577 | /** | ||
578 | * @brief Lower an Ecore_Evas' window. | ||
579 | * | ||
580 | * @param ee The Ecore_Evas to raise. | ||
581 | * | ||
582 | * This functions lowers the Ecore_Evas to the back. | ||
583 | * | ||
584 | * @warning Support for this depends on the underlying windowing system. | ||
585 | * | ||
586 | * @see ecore_evas_raise() | ||
587 | * @see ecore_evas_layer_set() | ||
588 | */ | ||
589 | EAPI void ecore_evas_lower(Ecore_Evas *ee); | ||
590 | /** | ||
591 | * @brief Set the title of an Ecore_Evas' window. | ||
592 | * | ||
593 | * @param ee The Ecore_Evas whose title you wish to set. | ||
594 | * @param t The title | ||
595 | * | ||
596 | * This function sets the title of @p ee to @p t. | ||
597 | * | ||
598 | * @warning Support for this depends on the underlying windowing system. | ||
599 | */ | ||
600 | EAPI void ecore_evas_title_set(Ecore_Evas *ee, const char *t); | ||
601 | /** | ||
602 | * @brief Get the title of an Ecore_Evas' window. | ||
603 | * | ||
604 | * @param ee The Ecore_Evas whose title you wish to get. | ||
605 | * @return The title of @p ee. | ||
606 | * | ||
607 | * This function returns the title of @p ee. | ||
608 | * | ||
609 | * @see ecore_evas_title_set() | ||
610 | */ | ||
611 | EAPI const char *ecore_evas_title_get(const Ecore_Evas *ee); | ||
612 | /** | ||
613 | * @brief Set the name and class of an Ecore_Evas' window. | ||
614 | * | ||
615 | * @param ee the Ecore_Evas | ||
616 | * @param n the name | ||
617 | * @param c the class | ||
618 | * | ||
619 | * This function sets the name of @p ee to @p n, and its class to @p c. The | ||
620 | * meaning of @p name and @p class depends on the underlying windowing system. | ||
621 | * | ||
622 | * @warning Support for this depends on the underlying windowing system. | ||
623 | */ | ||
624 | EAPI void ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c); | ||
625 | /** | ||
626 | * @brief Get the name and class of an Ecore_Evas' window | ||
627 | * | ||
628 | * @p ee The Ecore_Evas to query | ||
629 | * @p n A pointer to a string to place the name in. | ||
630 | * @p c A pointer to a string to place the class in. | ||
631 | * | ||
632 | * This function gets the name of @p ee into @p n, and its class into | ||
633 | * @p c. | ||
634 | * | ||
635 | * @see ecore_evas_name_class_set() | ||
636 | */ | ||
637 | EAPI void ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c); | ||
638 | /** | ||
639 | * @brief Returns a pointer to the underlying window. | ||
640 | * | ||
641 | * @param ee The Ecore_Evas whose window is desired. | ||
642 | * | ||
643 | * @warning Support for this depends on the underlying windowing system. | ||
644 | */ | ||
645 | EAPI Ecore_Window ecore_evas_window_get(const Ecore_Evas *ee); | ||
646 | |||
647 | |||
648 | /* engine/target specific init calls */ | ||
649 | EAPI Ecore_Evas *ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); | ||
650 | EAPI Ecore_X_Window ecore_evas_software_x11_window_get(const Ecore_Evas *ee); | ||
651 | EAPI void ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
652 | EAPI Eina_Bool ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee); | ||
653 | EAPI void ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
654 | |||
655 | #define ECORE_EVAS_GL_X11_OPT_NONE 0 | ||
656 | #define ECORE_EVAS_GL_X11_OPT_INDIRECT 1 | ||
657 | #define ECORE_EVAS_GL_X11_OPT_VSYNC 2 | ||
658 | #define ECORE_EVAS_GL_X11_OPT_LAST 3 | ||
659 | |||
660 | EAPI Ecore_Evas *ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); | ||
661 | EAPI Ecore_Evas *ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h, const int *opt); | ||
662 | EAPI Ecore_X_Window ecore_evas_gl_x11_window_get(const Ecore_Evas *ee); | ||
663 | EAPI void ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
664 | EAPI Eina_Bool ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee); | ||
665 | EAPI void ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
666 | EAPI void ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e)); | ||
667 | |||
668 | EAPI Ecore_Evas *ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); | ||
669 | EAPI Ecore_X_Window ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee); | ||
670 | EAPI void ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
671 | EAPI Eina_Bool ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee); | ||
672 | EAPI void ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
673 | |||
674 | EAPI Ecore_Evas *ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); | ||
675 | EAPI Ecore_X_Window ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee); | ||
676 | EAPI Ecore_X_Window ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee); | ||
677 | EAPI void ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
678 | EAPI Eina_Bool ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee); | ||
679 | EAPI void ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
680 | |||
681 | EAPI Ecore_Evas *ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); | ||
682 | EAPI Ecore_X_Window ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee); | ||
683 | EAPI void ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
684 | EAPI Eina_Bool ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee); | ||
685 | EAPI void ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
686 | |||
687 | EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h); | ||
688 | |||
689 | EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h); | ||
690 | EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee); | ||
691 | |||
692 | /** | ||
693 | * @brief Create a new @c Ecore_Evas canvas bound to the Evas | ||
694 | * @b buffer engine | ||
695 | * | ||
696 | * @param w The width of the canvas, in pixels | ||
697 | * @param h The height of the canvas, in pixels | ||
698 | * @return A new @c Ecore_Evas instance or @c NULL, on failure | ||
699 | * | ||
700 | * This creates a new buffer canvas wrapper, with image data array | ||
701 | * @b bound to the ARGB format, 8 bits per pixel. | ||
702 | * | ||
703 | * This function will allocate the needed pixels array with canonical | ||
704 | * @c malloc(). If you wish a custom function to allocate it, consider | ||
705 | * using ecore_evas_buffer_allocfunc_new(), instead. | ||
706 | * | ||
707 | * @note This function actually is a wrapper on | ||
708 | * ecore_evas_buffer_allocfunc_new(), using the same @a w and @a h | ||
709 | * arguments and canonical @c malloc() and @c free() to the memory | ||
710 | * allocation and freeing functions. See that function's documentation | ||
711 | * for more details. | ||
712 | */ | ||
713 | EAPI Ecore_Evas *ecore_evas_buffer_new(int w, int h); | ||
714 | |||
715 | /** | ||
716 | * @brief Create a new @c Ecore_Evas canvas bound to the Evas | ||
717 | * @b buffer engine, giving custom allocation and freeing functions for | ||
718 | * the canvas memory region | ||
719 | * | ||
720 | * @param w The width of the canvas, in canvas units | ||
721 | * @param h The height of the canvas, in canvas units | ||
722 | * @param alloc_func Function to be called to allocate the memory | ||
723 | * needed for the new buffer canvas. @a data will be passed the same | ||
724 | * value as the @p data of this function, while @a size will be passed | ||
725 | * @p w times @p h times @c sizeof(int). | ||
726 | * @param free_func Function to be called to free the memory used by | ||
727 | * the new buffer canvas. @a data will be passed the same value as the | ||
728 | * @p data of this function, while @a pix will be passed the canvas | ||
729 | * memory pointer. | ||
730 | * @param data Custom data to be passed to the allocation and freeing | ||
731 | * functions | ||
732 | * @return A new @c Ecore_Evas instance or @c NULL, on failure | ||
733 | * | ||
734 | * This creates a new buffer canvas wrapper, with image data array | ||
735 | * @b bound to the ARGB format, 8 bits per pixel. | ||
736 | * | ||
737 | * This function is useful when one wants an @c Ecore_Evas buffer | ||
738 | * canvas with a custom allocation function, like one getting memory | ||
739 | * chunks from a memory pool, for example. | ||
740 | * | ||
741 | * On any resizing of this @c Ecore_Evas buffer canvas, its image data | ||
742 | * will be @b freed, to be allocated again with the new size. | ||
743 | * | ||
744 | * @note @p w and @p h sizes have to greater or equal to 1. Otherwise, | ||
745 | * they'll be interpreted as 1, exactly. | ||
746 | * | ||
747 | * @see ecore_evas_buffer_new() | ||
748 | */ | ||
749 | EAPI Ecore_Evas *ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, int size), void (*free_func) (void *data, void *pix), const void *data); | ||
750 | |||
751 | /** | ||
752 | * @brief Grab a pointer to the actual pixels array of a given | ||
753 | * @c Ecore_Evas @b buffer canvas/window. | ||
754 | * | ||
755 | * @param ee An @c Ecore_Evas handle | ||
756 | * @return A pointer to the internal pixels array of @p ee | ||
757 | * | ||
758 | * Besides returning a pointer to the actual pixel array of the given | ||
759 | * canvas, this call will force a <b>rendering update on @p ee</b>, | ||
760 | * first. | ||
761 | * | ||
762 | * A common use case for this call is to create an image object, from | ||
763 | * @b another canvas, to have as data @p ee's contents, thus | ||
764 | * snapshoting the canvas. For that case, one can also use the | ||
765 | * ecore_evas_object_image_new() helper function. | ||
766 | */ | ||
767 | EAPI const void *ecore_evas_buffer_pixels_get(Ecore_Evas *ee); | ||
768 | |||
769 | /** | ||
770 | * @brief Create a new @c Ecore_Evas canvas bound to the Evas | ||
771 | * @b ews (Ecore + Evas Single Process Windowing System) engine | ||
772 | * | ||
773 | * EWS is a simple single process windowing system. The backing store | ||
774 | * is also an @c Ecore_Evas that can be setup with | ||
775 | * ecore_evas_ews_setup() and retrieved with | ||
776 | * ecore_evas_ews_ecore_evas_get(). It will allow window management | ||
777 | * using events prefixed with @c ECORE_EVAS_EVENT_EWS_. | ||
778 | * | ||
779 | * The EWS windows (returned by this function or | ||
780 | * ecore_evas_new("ews"...)) will all be software buffer windows | ||
781 | * automatic rendered to the backing store. | ||
782 | * | ||
783 | * @param x horizontal position of window, in pixels | ||
784 | * @param y vertical position of window, in pixels | ||
785 | * @param w The width of the canvas, in pixels | ||
786 | * @param h The height of the canvas, in pixels | ||
787 | * @return A new @c Ecore_Evas instance or @c NULL, on failure | ||
788 | * | ||
789 | * @see ecore_evas_ews_setup() | ||
790 | * @see ecore_evas_ews_ecore_evas_get() | ||
791 | * | ||
792 | * @since 1.1 | ||
793 | */ | ||
794 | EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h); | ||
795 | |||
796 | |||
797 | /** | ||
798 | * Returns the backing store image object that represents the given | ||
799 | * window in EWS. | ||
800 | * | ||
801 | * @note This should not be modified anyhow, but may be helpful to | ||
802 | * determine stacking and geometry of it for window managers | ||
803 | * that decorate windows. | ||
804 | * | ||
805 | * @see ecore_evas_ews_manager_set() | ||
806 | * @see ecore_evas_ews_evas_get() | ||
807 | * @since 1.1 | ||
808 | */ | ||
809 | EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee); | ||
810 | |||
811 | /** | ||
812 | * Calls the window to be deleted (freed), but can let user decide to | ||
813 | * forbid it by using ecore_evas_callback_delete_request_set() | ||
814 | * | ||
815 | * @since 1.1 | ||
816 | */ | ||
817 | EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee); | ||
818 | |||
819 | /** | ||
820 | * @brief Create an Evas image object with image data <b>bound to an | ||
821 | * own, internal @c Ecore_Evas canvas wrapper<b> | ||
822 | * | ||
823 | * @param ee_target @c Ecore_Evas to have the canvas receiving the new | ||
824 | * image object | ||
825 | * @return A handle to the new image object | ||
826 | * | ||
827 | * This will create a @b special Evas image object. The image's pixel | ||
828 | * array will get bound to the same image data array of an @b internal | ||
829 | * @b buffer @c Ecore_Evas canvas. The user of this function is, then, | ||
830 | * supposed to grab that @c Ecore_Evas handle, with | ||
831 | * ecore_evas_object_ecore_evas_get(), and use its canvas to render | ||
832 | * whichever contents he/she wants, @b independently of the contents | ||
833 | * of the canvas owned by @p ee_target. Those contents will reflect on | ||
834 | * the canvas of @p ee, though, being exactly the image data of the | ||
835 | * object returned by this function. | ||
836 | * | ||
837 | * This is a helper function for the scenario of one wanting to grab a | ||
838 | * buffer canvas' contents (with ecore_evas_buffer_pixels_get()) to be | ||
839 | * used on another canvas, for whichever reason. The most common goal | ||
840 | * of this setup is to @b save an image file with a whole canvas as | ||
841 | * contents, which could not be achieved by using an image file within | ||
842 | * the target canvas. | ||
843 | * | ||
844 | * @warning Always resize the returned image and its underlying | ||
845 | * @c Ecore_Evas handle accordingly. They must be kept with same sizes | ||
846 | * for things to work as expected. Also, you @b must issue | ||
847 | * @c evas_object_image_size_set() on the image with that same size. If | ||
848 | * the image is to be shown in a canvas bound to an engine different | ||
849 | * than the buffer one, then you must also set this image's @b fill | ||
850 | * properties accordingly. | ||
851 | * | ||
852 | * @note The image returned will always be bound to the | ||
853 | * @c EVAS_COLORSPACE_ARGB8888 colorspace, always. | ||
854 | * | ||
855 | * @note Use ecore_evas_object_evas_get() to grab the image's internal | ||
856 | * own canvas directly. | ||
857 | * | ||
858 | * @note If snapshoting this image's internal canvas, remember to | ||
859 | * flush its internal @c Ecore_Evas firstly, with | ||
860 | * ecore_evas_manual_render(). | ||
861 | */ | ||
862 | EAPI Evas_Object *ecore_evas_object_image_new(Ecore_Evas *ee_target); | ||
863 | |||
864 | /** | ||
865 | * @brief Retrieve the internal @c Ecore_Evas handle of an image | ||
866 | * object created via ecore_evas_object_image_new() | ||
867 | * | ||
868 | * @param obj A handle to an image object created via | ||
869 | * ecore_evas_object_image_new() | ||
870 | * @return The underlying @c Ecore_Evas handle in @p obj | ||
871 | */ | ||
872 | EAPI Ecore_Evas *ecore_evas_object_ecore_evas_get(Evas_Object *obj); | ||
873 | |||
874 | /** | ||
875 | * @brief Retrieve the canvas bound to the internal @c Ecore_Evas | ||
876 | * handle of an image object created via ecore_evas_object_image_new() | ||
877 | * | ||
878 | * @param obj A handle to an image object created via | ||
879 | * ecore_evas_object_image_new() | ||
880 | * @return A handle to @p obj's underlying @c Ecore_Evas's canvas | ||
881 | */ | ||
882 | EAPI Evas *ecore_evas_object_evas_get(Evas_Object *obj); | ||
883 | |||
884 | EAPI Ecore_Evas *ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, | ||
885 | int x, | ||
886 | int y, | ||
887 | int width, | ||
888 | int height); | ||
889 | |||
890 | EAPI Ecore_Evas *ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, | ||
891 | int x, | ||
892 | int y, | ||
893 | int width, | ||
894 | int height); | ||
895 | |||
896 | EAPI Ecore_Evas *ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent, | ||
897 | int x, | ||
898 | int y, | ||
899 | int width, | ||
900 | int height); | ||
901 | |||
902 | EAPI Ecore_Evas *ecore_evas_direct3d_new(Ecore_Win32_Window *parent, | ||
903 | int x, | ||
904 | int y, | ||
905 | int width, | ||
906 | int height); | ||
907 | |||
908 | EAPI Ecore_Evas *ecore_evas_gl_glew_new(Ecore_Win32_Window *parent, | ||
909 | int x, | ||
910 | int y, | ||
911 | int width, | ||
912 | int height); | ||
913 | |||
914 | EAPI Ecore_Win32_Window *ecore_evas_win32_window_get(const Ecore_Evas *ee); | ||
915 | |||
916 | EAPI Ecore_Evas *ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha); | ||
917 | EAPI Ecore_Evas *ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha); | ||
918 | EAPI Ecore_Evas *ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe); | ||
919 | |||
920 | EAPI Ecore_Evas *ecore_evas_software_wince_new(Ecore_WinCE_Window *parent, | ||
921 | int x, | ||
922 | int y, | ||
923 | int width, | ||
924 | int height); | ||
925 | |||
926 | EAPI Ecore_Evas *ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent, | ||
927 | int x, | ||
928 | int y, | ||
929 | int width, | ||
930 | int height); | ||
931 | |||
932 | EAPI Ecore_Evas *ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent, | ||
933 | int x, | ||
934 | int y, | ||
935 | int width, | ||
936 | int height); | ||
937 | |||
938 | EAPI Ecore_Evas *ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent, | ||
939 | int x, | ||
940 | int y, | ||
941 | int width, | ||
942 | int height); | ||
943 | |||
944 | EAPI Ecore_Evas *ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent, | ||
945 | int x, | ||
946 | int y, | ||
947 | int width, | ||
948 | int height); | ||
949 | |||
950 | EAPI Ecore_WinCE_Window *ecore_evas_software_wince_window_get(const Ecore_Evas *ee); | ||
951 | |||
952 | EAPI Ecore_Evas *ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, | ||
953 | int x, | ||
954 | int y, | ||
955 | int w, | ||
956 | int h); | ||
957 | |||
958 | EAPI Ecore_Evas *ecore_evas_psl1ght_new(const char* name, int w, int h); | ||
959 | |||
960 | |||
961 | /* generic manipulation calls */ | ||
962 | /** | ||
963 | * @brief Get the engine name used by this Ecore_Evas(window). | ||
964 | * | ||
965 | * @param ee Ecore_Evas whose engine's name is desired. | ||
966 | * @return A string that can(usually) be used in ecore_evas_new() | ||
967 | * | ||
968 | * @see ecore_evas_free() | ||
969 | */ | ||
970 | EAPI const char *ecore_evas_engine_name_get(const Ecore_Evas *ee); | ||
971 | /** | ||
972 | * @brief Return the Ecore_Evas for this Evas | ||
973 | * | ||
974 | * @param e The Evas to get the Ecore_Evas from | ||
975 | * @return The Ecore_Evas that holds this Evas, or NULL if not held by one. | ||
976 | * | ||
977 | * @warning Only use on Evas' created with ecore evas! | ||
978 | */ | ||
979 | EAPI Ecore_Evas *ecore_evas_ecore_evas_get(const Evas *e); | ||
980 | /** | ||
981 | * @brief Free an Ecore_Evas | ||
982 | * | ||
983 | * @param ee The Ecore_Evas to free | ||
984 | * | ||
985 | * This frees up any memory used by the Ecore_Evas. | ||
986 | */ | ||
987 | EAPI void ecore_evas_free(Ecore_Evas *ee); | ||
988 | /** | ||
989 | * @brief Retrieve user data associated with an Ecore_Evas. | ||
990 | * | ||
991 | * @param ee The Ecore_Evas to retrieve the user data from. | ||
992 | * @param key The key which the user data to be retrieved is associated with. | ||
993 | * | ||
994 | * This function retrieves user specific data that has been stored within an | ||
995 | * Ecore_Evas structure with ecore_evas_data_set(). | ||
996 | * | ||
997 | * @returns NULL on error or no data found, A pointer to the user data on | ||
998 | * success. | ||
999 | * | ||
1000 | * @see ecore_evas_data_set() | ||
1001 | */ | ||
1002 | EAPI void *ecore_evas_data_get(const Ecore_Evas *ee, const char *key); | ||
1003 | /** | ||
1004 | * @brief Store user data in an Ecore_Evas structure. | ||
1005 | * | ||
1006 | * @param ee The Ecore_Evas to store the user data in. | ||
1007 | * @param key A unique string to associate the user data against. Cannot | ||
1008 | * be NULL. | ||
1009 | * @param data A pointer to the user data to store. | ||
1010 | * | ||
1011 | * This function associates the @p data with a @p key which is stored by | ||
1012 | * the Ecore_Evas @p ee. Be aware that a call to ecore_evas_free() will | ||
1013 | * not free any memory for the associated user data, this is the responsibility | ||
1014 | * of the caller. | ||
1015 | * | ||
1016 | * @see ecore_evas_callback_pre_free_set() | ||
1017 | * @see ecore_evas_free() | ||
1018 | * @see ecore_evas_data_get() | ||
1019 | */ | ||
1020 | EAPI void ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data); | ||
1021 | /** | ||
1022 | * Set a callback for Ecore_Evas resize events. | ||
1023 | * @param ee The Ecore_Evas to set callbacks on | ||
1024 | * @param func The function to call | ||
1025 | |||
1026 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1027 | * @p func to be called whenever @p ee is resized. | ||
1028 | * | ||
1029 | * @warning If and when this function is called depends on the underlying | ||
1030 | * windowing system. | ||
1031 | */ | ||
1032 | EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1033 | /** | ||
1034 | * Set a callback for Ecore_Evas move events. | ||
1035 | * @param ee The Ecore_Evas to set callbacks on | ||
1036 | * @param func The function to call | ||
1037 | |||
1038 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1039 | * @p func to be called whenever @p ee is moved. | ||
1040 | * | ||
1041 | * @warning If and when this function is called depends on the underlying | ||
1042 | * windowing system. | ||
1043 | */ | ||
1044 | EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1045 | /** | ||
1046 | * Set a callback for Ecore_Evas show events. | ||
1047 | * @param ee The Ecore_Evas to set callbacks on | ||
1048 | * @param func The function to call | ||
1049 | |||
1050 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1051 | * @p func to be called whenever @p ee is shown. | ||
1052 | * | ||
1053 | * @warning If and when this function is called depends on the underlying | ||
1054 | * windowing system. | ||
1055 | */ | ||
1056 | EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1057 | /** | ||
1058 | * Set a callback for Ecore_Evas hide events. | ||
1059 | * @param ee The Ecore_Evas to set callbacks on | ||
1060 | * @param func The function to call | ||
1061 | |||
1062 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1063 | * @p func to be called whenever @p ee is hidden. | ||
1064 | * | ||
1065 | * @warning If and when this function is called depends on the underlying | ||
1066 | * windowing system. | ||
1067 | */ | ||
1068 | EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1069 | /** | ||
1070 | * Set a callback for Ecore_Evas delete request events. | ||
1071 | * @param ee The Ecore_Evas to set callbacks on | ||
1072 | * @param func The function to call | ||
1073 | |||
1074 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1075 | * @p func to be called whenever @p ee gets a delete request. | ||
1076 | * | ||
1077 | * @warning If and when this function is called depends on the underlying | ||
1078 | * windowing system. | ||
1079 | */ | ||
1080 | EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1081 | /** | ||
1082 | * Set a callback for Ecore_Evas destroy events. | ||
1083 | * @param ee The Ecore_Evas to set callbacks on | ||
1084 | * @param func The function to call | ||
1085 | |||
1086 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1087 | * @p func to be called whenever @p ee is destroyed. | ||
1088 | * | ||
1089 | * @warning If and when this function is called depends on the underlying | ||
1090 | * windowing system. | ||
1091 | */ | ||
1092 | EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1093 | /** | ||
1094 | * Set a callback for Ecore_Evas focus in events. | ||
1095 | * @param ee The Ecore_Evas to set callbacks on | ||
1096 | * @param func The function to call | ||
1097 | |||
1098 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1099 | * @p func to be called whenever @p ee gets focus. | ||
1100 | * | ||
1101 | * @warning If and when this function is called depends on the underlying | ||
1102 | * windowing system. | ||
1103 | */ | ||
1104 | EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1105 | /** | ||
1106 | * Set a callback for Ecore_Evas focus out events. | ||
1107 | * @param ee The Ecore_Evas to set callbacks on | ||
1108 | * @param func The function to call | ||
1109 | |||
1110 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1111 | * @p func to be called whenever @p ee loses focus. | ||
1112 | * | ||
1113 | * @warning If and when this function is called depends on the underlying | ||
1114 | * windowing system. | ||
1115 | */ | ||
1116 | EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1117 | /** | ||
1118 | * Set a callback for Ecore_Evas sticky events. | ||
1119 | * @param ee The Ecore_Evas to set callbacks on | ||
1120 | * @param func The function to call | ||
1121 | |||
1122 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1123 | * @p func to be called whenever @p ee becomes sticky. | ||
1124 | * | ||
1125 | * @warning If and when this function is called depends on the underlying | ||
1126 | * windowing system. | ||
1127 | */ | ||
1128 | EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1129 | /** | ||
1130 | * Set a callback for Ecore_Evas un-sticky events. | ||
1131 | * @param ee The Ecore_Evas to set callbacks on | ||
1132 | * @param func The function to call | ||
1133 | |||
1134 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1135 | * @p func to be called whenever @p ee becomes un-sticky. | ||
1136 | * | ||
1137 | * @warning If and when this function is called depends on the underlying | ||
1138 | * windowing system. | ||
1139 | */ | ||
1140 | EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1141 | /** | ||
1142 | * Set a callback for Ecore_Evas mouse in events. | ||
1143 | * @param ee The Ecore_Evas to set callbacks on | ||
1144 | * @param func The function to call | ||
1145 | |||
1146 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1147 | * @p func to be called whenever the mouse enters @p ee. | ||
1148 | * | ||
1149 | * @warning If and when this function is called depends on the underlying | ||
1150 | * windowing system. | ||
1151 | */ | ||
1152 | EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1153 | /** | ||
1154 | * Set a callback for Ecore_Evas mouse out events. | ||
1155 | * @param ee The Ecore_Evas to set callbacks on | ||
1156 | * @param func The function to call | ||
1157 | |||
1158 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1159 | * @p func to be called whenever the mouse leaves @p ee. | ||
1160 | * | ||
1161 | * @warning If and when this function is called depends on the underlying | ||
1162 | * windowing system. | ||
1163 | */ | ||
1164 | EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1165 | /** | ||
1166 | * Set a callback for Ecore_Evas pre render events. | ||
1167 | * @param ee The Ecore_Evas to set callbacks on | ||
1168 | * @param func The function to call | ||
1169 | |||
1170 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1171 | * @p func to be called just before the evas in @p ee is rendered. | ||
1172 | * | ||
1173 | * @warning If and when this function is called depends on the underlying | ||
1174 | * windowing system. | ||
1175 | */ | ||
1176 | EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1177 | /** | ||
1178 | * Set a callback for Ecore_Evas mouse post render events. | ||
1179 | * @param ee The Ecore_Evas to set callbacks on | ||
1180 | * @param func The function to call | ||
1181 | |||
1182 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1183 | * @p func to be called just after the evas in @p ee is rendered. | ||
1184 | * | ||
1185 | * @warning If and when this function is called depends on the underlying | ||
1186 | * windowing system. | ||
1187 | */ | ||
1188 | EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1189 | /** | ||
1190 | * Set a callback for Ecore_Evas pre-free event. | ||
1191 | * @param ee The Ecore_Evas to set callbacks on | ||
1192 | * @param func The function to call | ||
1193 | * | ||
1194 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1195 | * @p func to be called just before the instance @p ee is freed. | ||
1196 | * | ||
1197 | * @warning If and when this function is called depends on the underlying | ||
1198 | * windowing system. | ||
1199 | */ | ||
1200 | EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
1201 | EAPI Evas *ecore_evas_get(const Ecore_Evas *ee); | ||
1202 | EAPI void ecore_evas_managed_move(Ecore_Evas *ee, int x, int y); | ||
1203 | EAPI void ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped); | ||
1204 | EAPI Eina_Bool ecore_evas_shaped_get(const Ecore_Evas *ee); | ||
1205 | /** | ||
1206 | * @brief Show an Ecore_Evas' window | ||
1207 | * | ||
1208 | * @param ee The Ecore_Evas to show. | ||
1209 | * | ||
1210 | * This function makes @p ee visible. | ||
1211 | */ | ||
1212 | EAPI void ecore_evas_show(Ecore_Evas *ee); | ||
1213 | /** | ||
1214 | * @brief Hide an Ecore_Evas' window | ||
1215 | * | ||
1216 | * @param ee The Ecore_Evas to hide. | ||
1217 | * | ||
1218 | * This function makes @p ee hidden(not visible). | ||
1219 | */ | ||
1220 | EAPI void ecore_evas_hide(Ecore_Evas *ee); | ||
1221 | EAPI void ecore_evas_activate(Ecore_Evas *ee); | ||
1222 | |||
1223 | |||
1224 | /** | ||
1225 | * Set the minimum size of a given @c Ecore_Evas window | ||
1226 | * | ||
1227 | * @param ee An @c Ecore_Evas window's handle | ||
1228 | * @param w The minimum width | ||
1229 | * @param h The minimum height | ||
1230 | * | ||
1231 | * This function sets the minimum size of @p ee to be @p w x @p h. | ||
1232 | * One won't be able to resize that window to dimensions smaller than | ||
1233 | * the ones set. | ||
1234 | * | ||
1235 | * @note When base sizes are set, via ecore_evas_size_base_set(), | ||
1236 | * they'll be used to calculate a window's minimum size, instead of | ||
1237 | * those set by this function. | ||
1238 | * | ||
1239 | * @see ecore_evas_size_min_get() | ||
1240 | */ | ||
1241 | EAPI void ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h); | ||
1242 | |||
1243 | /** | ||
1244 | * Get the minimum size set for a given @c Ecore_Evas window | ||
1245 | * | ||
1246 | * @param ee An @c Ecore_Evas window's handle | ||
1247 | * @param w A pointer to an int to place the minimum width in. | ||
1248 | * @param h A pointer to an int to place the minimum height in. | ||
1249 | * | ||
1250 | * @note Use @c NULL pointers on the size components you're not | ||
1251 | * interested in: they'll be ignored by the function. | ||
1252 | * | ||
1253 | * @see ecore_evas_size_min_set() for more details | ||
1254 | */ | ||
1255 | EAPI void ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h); | ||
1256 | |||
1257 | /** | ||
1258 | * Set the maximum size of a given @c Ecore_Evas window | ||
1259 | * | ||
1260 | * @param ee An @c Ecore_Evas window's handle | ||
1261 | * @param w The maximum width | ||
1262 | * @param h The maximum height | ||
1263 | * | ||
1264 | * This function sets the maximum size of @p ee to be @p w x @p h. | ||
1265 | * One won't be able to resize that window to dimensions bigger than | ||
1266 | * the ones set. | ||
1267 | * | ||
1268 | * @see ecore_evas_size_max_get() | ||
1269 | */ | ||
1270 | EAPI void ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h); | ||
1271 | |||
1272 | /** | ||
1273 | * Get the maximum size set for a given @c Ecore_Evas window | ||
1274 | * | ||
1275 | * @param ee An @c Ecore_Evas window's handle | ||
1276 | * @param w A pointer to an int to place the maximum width in. | ||
1277 | * @param h A pointer to an int to place the maximum height in. | ||
1278 | * | ||
1279 | * @note Use @c NULL pointers on the size components you're not | ||
1280 | * interested in: they'll be ignored by the function. | ||
1281 | * | ||
1282 | * @see ecore_evas_size_max_set() for more details | ||
1283 | */ | ||
1284 | EAPI void ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h); | ||
1285 | |||
1286 | /** | ||
1287 | * Set the base size for a given @c Ecore_Evas window | ||
1288 | * | ||
1289 | * @param ee An @c Ecore_Evas window's handle | ||
1290 | * @param w The base width | ||
1291 | * @param h The base height | ||
1292 | * | ||
1293 | * This function sets the @b base size of @p ee to be @p w x @p h. | ||
1294 | * When base sizes are set, they'll be used to calculate a window's | ||
1295 | * @b minimum size, instead of those set by ecore_evas_size_min_get(). | ||
1296 | * | ||
1297 | * @see ecore_evas_size_base_get() | ||
1298 | */ | ||
1299 | EAPI void ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h); | ||
1300 | |||
1301 | /** | ||
1302 | * Get the base size set for a given @c Ecore_Evas window | ||
1303 | * | ||
1304 | * @param ee An @c Ecore_Evas window's handle | ||
1305 | * @param w A pointer to an int to place the base width in. | ||
1306 | * @param h A pointer to an int to place the base height in. | ||
1307 | * | ||
1308 | * @note Use @c NULL pointers on the size components you're not | ||
1309 | * interested in: they'll be ignored by the function. | ||
1310 | * | ||
1311 | * @see ecore_evas_size_base_set() for more details | ||
1312 | */ | ||
1313 | EAPI void ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h); | ||
1314 | |||
1315 | /** | ||
1316 | * Set the "size step" for a given @c Ecore_Evas window | ||
1317 | * | ||
1318 | * @param ee An @c Ecore_Evas window's handle | ||
1319 | * @param w The step width | ||
1320 | * @param h The step height | ||
1321 | * | ||
1322 | * This function sets the size steps of @p ee to be @p w x @p h. This | ||
1323 | * limits the size of this @cEcore_Evas window to be @b always an | ||
1324 | * integer multiple of the step size, for each axis. | ||
1325 | */ | ||
1326 | EAPI void ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h); | ||
1327 | |||
1328 | /** | ||
1329 | * Get the "size step" set for a given @c Ecore_Evas window | ||
1330 | * | ||
1331 | * @param ee An @c Ecore_Evas window's handle | ||
1332 | * @param w A pointer to an int to place the step width in. | ||
1333 | * @param h A pointer to an int to place the step height in. | ||
1334 | * | ||
1335 | * @note Use @c NULL pointers on the size components you're not | ||
1336 | * interested in: they'll be ignored by the function. | ||
1337 | * | ||
1338 | * @see ecore_evas_size_base_set() for more details | ||
1339 | */ | ||
1340 | EAPI void ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h); | ||
1341 | |||
1342 | /** | ||
1343 | * @brief Set the cursor of an Ecore_Evas. | ||
1344 | * | ||
1345 | * @param ee The Ecore_Evas | ||
1346 | * @param file The path to an image file for the cursor. | ||
1347 | * @param layer The layer in which the cursor will appear. | ||
1348 | * @param hot_x The x coordinate of the cursor's hot spot. | ||
1349 | * @param hot_y The y coordinate of the cursor's hot spot. | ||
1350 | * | ||
1351 | * This function makes the mouse cursor over @p ee be the image specified by | ||
1352 | * @p file. The actual point within the image that the mouse is at is specified | ||
1353 | * by @p hot_x and @p hot_y, which are coordinates with respect to the top left | ||
1354 | * corner of the cursor image. | ||
1355 | * | ||
1356 | * @note This function creates an object from the image and uses | ||
1357 | * ecore_evas_object_cursor_set(). | ||
1358 | * | ||
1359 | * @see ecore_evas_object_cursor_set() | ||
1360 | */ | ||
1361 | EAPI void ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y); | ||
1362 | /** | ||
1363 | * @brief Get information about an Ecore_Evas' cursor | ||
1364 | * | ||
1365 | * @param ee The Ecore_Evas to set | ||
1366 | * @param obj A pointer to an Evas_Object to place the cursor Evas_Object. | ||
1367 | * @param layer A pointer to an int to place the cursor's layer in. | ||
1368 | * @param hot_x A pointer to an int to place the cursor's hot_x coordinate in. | ||
1369 | * @param hot_y A pointer to an int to place the cursor's hot_y coordinate in. | ||
1370 | * | ||
1371 | * This function queries information about an Ecore_Evas' cursor. | ||
1372 | * | ||
1373 | * @see ecore_evas_cursor_set() | ||
1374 | * @see ecore_evas_object_cursor_set() | ||
1375 | */ | ||
1376 | EAPI void ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y); | ||
1377 | /** | ||
1378 | * @brief Set the cursor of an Ecore_Evas | ||
1379 | * | ||
1380 | * @param ee The Ecore_Evas | ||
1381 | * | ||
1382 | * @param obj The Evas_Object which will be the cursor. | ||
1383 | * @param layer The layer in which the cursor will appear. | ||
1384 | * @param hot_x The x coordinate of the cursor's hot spot. | ||
1385 | * @param hot_y The y coordinate of the cursor's hot spot. | ||
1386 | * | ||
1387 | * This function makes the mouse cursor over @p ee be the object specified by | ||
1388 | * @p obj. The actual point within the object that the mouse is at is specified | ||
1389 | * by @p hot_x and @p hot_y, which are coordinates with respect to the top left | ||
1390 | * corner of the cursor object. | ||
1391 | * | ||
1392 | * @see ecore_evas_cursor_set() | ||
1393 | */ | ||
1394 | EAPI void ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); | ||
1395 | EAPI void ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on); | ||
1396 | EAPI Eina_Bool ecore_evas_override_get(const Ecore_Evas *ee); | ||
1397 | EAPI void ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on); | ||
1398 | EAPI Ecore_Evas_Avoid_Damage_Type ecore_evas_avoid_damage_get(const Ecore_Evas *ee); | ||
1399 | EAPI void ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn); | ||
1400 | EAPI Eina_Bool ecore_evas_withdrawn_get(const Ecore_Evas *ee); | ||
1401 | EAPI void ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky); | ||
1402 | EAPI Eina_Bool ecore_evas_sticky_get(const Ecore_Evas *ee); | ||
1403 | EAPI void ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render); | ||
1404 | EAPI Eina_Bool ecore_evas_manual_render_get(const Ecore_Evas *ee); | ||
1405 | |||
1406 | /** | ||
1407 | * @brief Registers an @c Ecore_Evas to receive events through ecore_input_evas. | ||
1408 | * | ||
1409 | * @param ee The @c Ecore_Evas handle. | ||
1410 | * | ||
1411 | * This function calls ecore_event_window_register() with the @p ee as its @c | ||
1412 | * id argument, @c window argument, and uses its @c Evas too. It is useful when | ||
1413 | * no @c window information is available on a given @c Ecore_Evas backend. | ||
1414 | * | ||
1415 | * @see ecore_evas_input_event_unregister() | ||
1416 | * @since 1.1 | ||
1417 | */ | ||
1418 | EAPI void ecore_evas_input_event_register(Ecore_Evas *ee); | ||
1419 | /** | ||
1420 | * @brief Unregisters an @c Ecore_Evas receiving events through ecore_input_evas. | ||
1421 | * | ||
1422 | * @param ee The @c Ecore_Evas handle. | ||
1423 | * | ||
1424 | * @see ecore_evas_input_event_register() | ||
1425 | * @since 1.1 | ||
1426 | */ | ||
1427 | EAPI void ecore_evas_input_event_unregister(Ecore_Evas *ee); | ||
1428 | |||
1429 | /** | ||
1430 | * @brief Force immediate rendering on a given @c Ecore_Evas window | ||
1431 | * | ||
1432 | * @param ee An @c Ecore_Evas handle | ||
1433 | * | ||
1434 | * Use this call to forcefully flush the @p ee's canvas rendering | ||
1435 | * pipeline, thus bring its window to an up to date state. | ||
1436 | */ | ||
1437 | EAPI void ecore_evas_manual_render(Ecore_Evas *ee); | ||
1438 | EAPI void ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync); | ||
1439 | EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee); | ||
1440 | /** | ||
1441 | * @brief Get geometry of screen associated with this Ecore_Evas. | ||
1442 | * | ||
1443 | * @param ee The Ecore_Evas whose window's to query container screen geometry. | ||
1444 | * @param x where to return the horizontal offset value. May be NULL. | ||
1445 | * @param y where to return the vertical offset value. May be NULL. | ||
1446 | * @param w where to return the width value. May be NULL. | ||
1447 | * @param h where to return the height value. May be NULL. | ||
1448 | * | ||
1449 | * @since 1.1 | ||
1450 | */ | ||
1451 | EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); | ||
1452 | |||
1453 | /** | ||
1454 | * @brief Associate the given object to this ecore evas. | ||
1455 | * | ||
1456 | * @param ee The Ecore_Evas to associate to @a obj | ||
1457 | * @param obj The object to associate to @a ee | ||
1458 | * @param flags The association flags. | ||
1459 | * @return EINA_TRUE on success, EINA_FALSE otherwise. | ||
1460 | * | ||
1461 | * Association means that operations on one will affect the other, for | ||
1462 | * example moving the object will move the window, resize the object will | ||
1463 | * also affect the ecore evas window, hide and show applies as well. | ||
1464 | * | ||
1465 | * This is meant to simplify development, since you often need to associate | ||
1466 | * these events with your "base" objects, background or bottom-most object. | ||
1467 | * | ||
1468 | * Be aware that some methods might not be what you would like, deleting | ||
1469 | * either the window or the object will delete the other. If you want to | ||
1470 | * change that behavior, let's say to hide window when it's closed, you | ||
1471 | * must use ecore_evas_callback_delete_request_set() and set your own code, | ||
1472 | * like ecore_evas_hide(). Just remember that if you override delete_request | ||
1473 | * and still want to delete the window/object, you must do that yourself. | ||
1474 | * | ||
1475 | * Since we now define delete_request, deleting windows will not quit | ||
1476 | * main loop, if you wish to do so, you should listen for EVAS_CALLBACK_FREE | ||
1477 | * on the object, that way you get notified and you can call | ||
1478 | * ecore_main_loop_quit(). | ||
1479 | * | ||
1480 | * Flags can be OR'ed of: | ||
1481 | * @li ECORE_EVAS_OBJECT_ASSOCIATE_BASE (or 0): to listen to basic events | ||
1482 | * like delete, resize and move, but no stacking or layer are used. | ||
1483 | * @li ECORE_EVAS_OBJECT_ASSOCIATE_STACK: stacking operations will act | ||
1484 | * on the Ecore_Evas, not the object. So evas_object_raise() will | ||
1485 | * call ecore_evas_raise(). Relative operations (stack_above, stack_below) | ||
1486 | * are still not implemented. | ||
1487 | * @li ECORE_EVAS_OBJECT_ASSOCIATE_LAYER: stacking operations will act | ||
1488 | * on the Ecore_Evas, not the object. So evas_object_layer_set() will | ||
1489 | * call ecore_evas_layer_set(). | ||
1490 | * @li ECORE_EVAS_OBJECT_ASSOCIATE_DEL: the object delete will delete the | ||
1491 | * ecore_evas as well as delete_requests on the ecore_evas will delete | ||
1492 | * etc. | ||
1493 | */ | ||
1494 | EAPI Eina_Bool ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags); | ||
1495 | /** | ||
1496 | * @brief Cancel the association set with ecore_evas_object_associate(). | ||
1497 | * | ||
1498 | * @param ee The Ecore_Evas to dissociate from @a obj | ||
1499 | * @param obj The object to dissociate from @a ee | ||
1500 | * @return EINA_TRUE on success, EINA_FALSE otherwise. | ||
1501 | */ | ||
1502 | EAPI Eina_Bool ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj); | ||
1503 | /** | ||
1504 | * @brief Get the object associated with @p ee | ||
1505 | * | ||
1506 | * @param ee The Ecore_Evas to get the object from. | ||
1507 | * @return The associated object, or NULL if there is no associated object. | ||
1508 | */ | ||
1509 | EAPI Evas_Object *ecore_evas_object_associate_get(const Ecore_Evas *ee); | ||
1510 | |||
1511 | /* helper function to be used with ECORE_GETOPT_CALLBACK_*() */ | ||
1512 | EAPI unsigned char ecore_getopt_callback_ecore_evas_list_engines(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, const char *str, void *data, Ecore_Getopt_Value *storage); | ||
1513 | |||
1514 | /** | ||
1515 | * @brief Get a list of all the ecore_evases. | ||
1516 | * | ||
1517 | * @return A list of ecore_evases. | ||
1518 | * | ||
1519 | * The returned list of ecore evases is only valid until the canvases are | ||
1520 | * destroyed (and should not be cached for instance). The list can be freed by | ||
1521 | * just deleting the list. | ||
1522 | */ | ||
1523 | EAPI Eina_List *ecore_evas_ecore_evas_list_get(void); | ||
1524 | |||
1525 | /* specific calls to an x11 environment ecore_evas */ | ||
1526 | EAPI void ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win); | ||
1527 | EAPI Ecore_X_Window ecore_evas_x11_leader_get(Ecore_Evas *ee); | ||
1528 | EAPI void ecore_evas_x11_leader_default_set(Ecore_Evas *ee); | ||
1529 | EAPI void ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h); | ||
1530 | EAPI void ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h); | ||
1531 | EAPI void ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h); | ||
1532 | EAPI void ecore_evas_x11_shape_input_empty(Ecore_Evas *ee); | ||
1533 | EAPI void ecore_evas_x11_shape_input_reset(Ecore_Evas *ee); | ||
1534 | EAPI void ecore_evas_x11_shape_input_apply(Ecore_Evas *ee); | ||
1535 | |||
1536 | /** | ||
1537 | * @defgroup Ecore_Evas_Ews Ecore_Evas Single Process Windowing System. | ||
1538 | * | ||
1539 | * These are global scope functions to manage the EWS to be used by | ||
1540 | * ecore_evas_ews_new(). | ||
1541 | * | ||
1542 | * @since 1.1 | ||
1543 | * @{ | ||
1544 | */ | ||
1545 | |||
1546 | /** | ||
1547 | * Sets the engine to be used by the backing store engine. | ||
1548 | * | ||
1549 | * @return EINA_TRUE on success, EINA_FALSE if ews is already in use. | ||
1550 | * @since 1.1 | ||
1551 | */ | ||
1552 | EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options); | ||
1553 | |||
1554 | /** | ||
1555 | * Reconfigure the backing store used. | ||
1556 | * @since 1.1 | ||
1557 | */ | ||
1558 | EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h); | ||
1559 | |||
1560 | /** | ||
1561 | * Return the internal backing store in use. | ||
1562 | * | ||
1563 | * @note this will foced it to be created, making future calls to | ||
1564 | * ecore_evas_ews_engine_set() void. | ||
1565 | * | ||
1566 | * @see ecore_evas_ews_evas_get() | ||
1567 | * @since 1.1 | ||
1568 | */ | ||
1569 | EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void); | ||
1570 | |||
1571 | /** | ||
1572 | * Return the internal backing store in use. | ||
1573 | * | ||
1574 | * @note this will foced it to be created, making future calls to | ||
1575 | * ecore_evas_ews_engine_set() void. | ||
1576 | * | ||
1577 | * @see ecore_evas_ews_ecore_evas_get() | ||
1578 | * @since 1.1 | ||
1579 | */ | ||
1580 | EAPI Evas *ecore_evas_ews_evas_get(void); | ||
1581 | |||
1582 | /** | ||
1583 | * Get the current background. | ||
1584 | */ | ||
1585 | EAPI Evas_Object *ecore_evas_ews_background_get(void); | ||
1586 | |||
1587 | /** | ||
1588 | * Set the current background, must be created at evas ecore_evas_ews_evas_get() | ||
1589 | * | ||
1590 | * It will be kept at lowest layer (EVAS_LAYER_MIN) and below | ||
1591 | * everything else. You can set any object, default is a black | ||
1592 | * rectangle. | ||
1593 | * | ||
1594 | * @note previous object will be deleted! | ||
1595 | */ | ||
1596 | EAPI void ecore_evas_ews_background_set(Evas_Object *o); | ||
1597 | |||
1598 | /** | ||
1599 | * Return all Ecore_Evas* created by EWS. | ||
1600 | * | ||
1601 | * @note do not change the returned list or its contents. | ||
1602 | * @since 1.1 | ||
1603 | */ | ||
1604 | EAPI const Eina_List *ecore_evas_ews_children_get(void); | ||
1605 | |||
1606 | /** | ||
1607 | * Set the identifier of the manager taking care of internal windows. | ||
1608 | * | ||
1609 | * The ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE event is issued. Consider | ||
1610 | * handling it to know if you should stop handling events yourself | ||
1611 | * (ie: another manager took over) | ||
1612 | * | ||
1613 | * @param manager any unique identifier address. | ||
1614 | * | ||
1615 | * @see ecore_evas_ews_manager_get() | ||
1616 | * @since 1.1 | ||
1617 | */ | ||
1618 | EAPI void ecore_evas_ews_manager_set(const void *manager); | ||
1619 | |||
1620 | /** | ||
1621 | * Get the identifier of the manager taking care of internal windows. | ||
1622 | * | ||
1623 | * @return the value set by ecore_evas_ews_manager_set() | ||
1624 | * @since 1.1 | ||
1625 | */ | ||
1626 | EAPI const void *ecore_evas_ews_manager_get(void); | ||
1627 | |||
1628 | EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed */ | ||
1629 | EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created */ | ||
1630 | EAPI extern int ECORE_EVAS_EWS_EVENT_DEL; /**< window was deleted, pointer is already invalid but may be used as reference for further cleanup work. */ | ||
1631 | EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized */ | ||
1632 | EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved */ | ||
1633 | EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible */ | ||
1634 | EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden */ | ||
1635 | EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused */ | ||
1636 | EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus */ | ||
1637 | EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised */ | ||
1638 | EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered */ | ||
1639 | EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated */ | ||
1640 | |||
1641 | EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed */ | ||
1642 | EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed */ | ||
1643 | EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed */ | ||
1644 | EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed */ | ||
1645 | EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) */ | ||
1646 | |||
1647 | /** | ||
1648 | * @} | ||
1649 | */ | ||
1650 | |||
1651 | |||
1652 | /** | ||
1653 | * @} | ||
1654 | */ | ||
1655 | |||
1656 | #ifdef __cplusplus | ||
1657 | } | ||
1658 | #endif | ||
1659 | |||
1660 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.am b/libraries/ecore/src/lib/ecore_evas/Makefile.am new file mode 100644 index 0000000..fbb7190 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/Makefile.am | |||
@@ -0,0 +1,131 @@ | |||
1 | MAINTAINERCLEANFILES = Makefile.in | ||
2 | |||
3 | if BUILD_ECORE_X | ||
4 | ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @ECORE_XCB_CFLAGS@ | ||
5 | ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @ECORE_XCB_LIBS@ | ||
6 | else | ||
7 | ECORE_X_INC = | ||
8 | ECORE_X_LIB = | ||
9 | endif | ||
10 | |||
11 | if BUILD_ECORE_FB | ||
12 | ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb | ||
13 | ECORE_FB_LIB = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la | ||
14 | else | ||
15 | ECORE_FB_INC = | ||
16 | ECORE_FB_LIB = | ||
17 | endif | ||
18 | |||
19 | if BUILD_ECORE_DIRECTFB | ||
20 | ECORE_DIRECTFB_INC = -I$(top_srcdir)/src/lib/ecore_directfb -I@DIRECTFB_CFLAGS@ | ||
21 | ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la | ||
22 | else | ||
23 | ECORE_DIRECTFB_INC = | ||
24 | ECORE_DIRECTFB_LIB = | ||
25 | endif | ||
26 | |||
27 | if BUILD_ECORE_WIN32 | ||
28 | ECORE_WIN32_INC = -I$(top_srcdir)/src/lib/ecore_win32 | ||
29 | ECORE_WIN32_LIB = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la | ||
30 | else | ||
31 | ECORE_WIN32_INC = | ||
32 | ECORE_WIN32_LIB = | ||
33 | endif | ||
34 | |||
35 | if BUILD_ECORE_SDL | ||
36 | ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@ | ||
37 | ECORE_SDL_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la | ||
38 | ECORE_SDL_LIBADD = @SDL_LIBS@ $(ECORE_SDL_LIB) | ||
39 | else | ||
40 | ECORE_SDL_INC = | ||
41 | ECORE_SDL_LIB = | ||
42 | ECORE_SDL_LIBADD = | ||
43 | endif | ||
44 | |||
45 | if BUILD_ECORE_COCOA | ||
46 | ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa | ||
47 | ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la | ||
48 | else | ||
49 | ECORE_COCOA_INC = | ||
50 | ECORE_COCOA_LIB = | ||
51 | endif | ||
52 | |||
53 | if BUILD_ECORE_WINCE | ||
54 | ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince | ||
55 | ECORE_WINCE_LIB = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la | ||
56 | else | ||
57 | ECORE_WINCE_INC = | ||
58 | ECORE_WINCE_LIB = | ||
59 | endif | ||
60 | |||
61 | if BUILD_ECORE_PSL1GHT | ||
62 | ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght | ||
63 | ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la | ||
64 | else | ||
65 | ECORE_PSL1GHT_INC = | ||
66 | ECORE_PSL1GHT_LIB = | ||
67 | endif | ||
68 | |||
69 | AM_CPPFLAGS = \ | ||
70 | -I$(top_srcdir)/src/lib/ecore \ | ||
71 | -I$(top_srcdir)/src/lib/ecore_evas \ | ||
72 | -I$(top_srcdir)/src/lib/ecore_input \ | ||
73 | -I$(top_srcdir)/src/lib/ecore_input_evas \ | ||
74 | -I$(top_builddir)/src/lib/ecore \ | ||
75 | -I$(top_builddir)/src/lib/ecore_evas \ | ||
76 | -I$(top_builddir)/src/lib/ecore_input \ | ||
77 | -I$(top_builddir)/src/lib/ecore_input_evas \ | ||
78 | @EFL_ECORE_EVAS_BUILD@ \ | ||
79 | $(ECORE_X_INC) \ | ||
80 | $(ECORE_FB_INC) \ | ||
81 | $(ECORE_DIRECTFB_INC) \ | ||
82 | $(ECORE_WIN32_INC) \ | ||
83 | $(ECORE_SDL_INC) \ | ||
84 | $(ECORE_COCOA_INC) \ | ||
85 | $(ECORE_WINCE_INC) \ | ||
86 | $(ECORE_PSL1GHT_INC) \ | ||
87 | @EVAS_CFLAGS@ \ | ||
88 | @EINA_CFLAGS@ \ | ||
89 | @EVIL_CFLAGS@ | ||
90 | |||
91 | AM_CFLAGS = @WIN32_CFLAGS@ | ||
92 | |||
93 | lib_LTLIBRARIES = libecore_evas.la | ||
94 | includes_HEADERS = Ecore_Evas.h | ||
95 | includesdir = $(includedir)/ecore-@VMAJ@ | ||
96 | |||
97 | libecore_evas_la_SOURCES = \ | ||
98 | ecore_evas.c \ | ||
99 | ecore_evas_util.c \ | ||
100 | ecore_evas_x.c \ | ||
101 | ecore_evas_fb.c \ | ||
102 | ecore_evas_buffer.c \ | ||
103 | ecore_evas_directfb.c \ | ||
104 | ecore_evas_win32.c \ | ||
105 | ecore_evas_sdl.c \ | ||
106 | ecore_evas_cocoa.c \ | ||
107 | ecore_evas_wince.c \ | ||
108 | ecore_evas_ews.c \ | ||
109 | ecore_evas_psl1ght.c | ||
110 | |||
111 | libecore_evas_la_LIBADD = \ | ||
112 | $(ECORE_X_LIB) \ | ||
113 | $(ECORE_FB_LIB) \ | ||
114 | $(ECORE_DIRECTFB_LIB) \ | ||
115 | $(ECORE_WIN32_LIB) \ | ||
116 | $(ECORE_SDL_LIB) \ | ||
117 | $(ECORE_SDL_LIBADD) \ | ||
118 | $(ECORE_COCOA_LIB) \ | ||
119 | $(ECORE_WINCE_LIB) \ | ||
120 | $(ECORE_PSL1GHT_LIB) \ | ||
121 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | ||
122 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ | ||
123 | $(top_builddir)/src/lib/ecore/libecore.la \ | ||
124 | @EVAS_LIBS@ \ | ||
125 | @EINA_LIBS@ \ | ||
126 | @EVIL_LIBS@ | ||
127 | |||
128 | libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ | ||
129 | |||
130 | EXTRA_DIST = \ | ||
131 | ecore_evas_private.h | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.in b/libraries/ecore/src/lib/ecore_evas/Makefile.in new file mode 100644 index 0000000..793e59d --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/Makefile.in | |||
@@ -0,0 +1,921 @@ | |||
1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. | ||
2 | # @configure_input@ | ||
3 | |||
4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, | ||
6 | # Inc. | ||
7 | # This Makefile.in is free software; the Free Software Foundation | ||
8 | # gives unlimited permission to copy and/or distribute it, | ||
9 | # with or without modifications, as long as this notice is preserved. | ||
10 | |||
11 | # This program is distributed in the hope that it will be useful, | ||
12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
14 | # PARTICULAR PURPOSE. | ||
15 | |||
16 | @SET_MAKE@ | ||
17 | |||
18 | |||
19 | VPATH = @srcdir@ | ||
20 | pkgdatadir = $(datadir)/@PACKAGE@ | ||
21 | pkgincludedir = $(includedir)/@PACKAGE@ | ||
22 | pkglibdir = $(libdir)/@PACKAGE@ | ||
23 | pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||
24 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||
25 | install_sh_DATA = $(install_sh) -c -m 644 | ||
26 | install_sh_PROGRAM = $(install_sh) -c | ||
27 | install_sh_SCRIPT = $(install_sh) -c | ||
28 | INSTALL_HEADER = $(INSTALL_DATA) | ||
29 | transform = $(program_transform_name) | ||
30 | NORMAL_INSTALL = : | ||
31 | PRE_INSTALL = : | ||
32 | POST_INSTALL = : | ||
33 | NORMAL_UNINSTALL = : | ||
34 | PRE_UNINSTALL = : | ||
35 | POST_UNINSTALL = : | ||
36 | build_triplet = @build@ | ||
37 | host_triplet = @host@ | ||
38 | subdir = src/lib/ecore_evas | ||
39 | DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ | ||
40 | $(srcdir)/Makefile.in | ||
41 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
42 | am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ | ||
43 | $(top_srcdir)/m4/ac_path_generic.m4 \ | ||
44 | $(top_srcdir)/m4/check_x_extension.m4 \ | ||
45 | $(top_srcdir)/m4/ecore_check_module.m4 \ | ||
46 | $(top_srcdir)/m4/ecore_check_options.m4 \ | ||
47 | $(top_srcdir)/m4/efl_compiler_flag.m4 \ | ||
48 | $(top_srcdir)/m4/efl_doxygen.m4 \ | ||
49 | $(top_srcdir)/m4/efl_examples.m4 \ | ||
50 | $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ | ||
51 | $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ | ||
52 | $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ | ||
53 | $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ | ||
54 | $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ | ||
55 | $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ | ||
56 | $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ | ||
57 | $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ | ||
58 | $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ | ||
59 | $(top_srcdir)/configure.ac | ||
60 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
61 | $(ACLOCAL_M4) | ||
62 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs | ||
63 | CONFIG_HEADER = $(top_builddir)/config.h | ||
64 | CONFIG_CLEAN_FILES = | ||
65 | CONFIG_CLEAN_VPATH_FILES = | ||
66 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | ||
67 | am__vpath_adj = case $$p in \ | ||
68 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | ||
69 | *) f=$$p;; \ | ||
70 | esac; | ||
71 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; | ||
72 | am__install_max = 40 | ||
73 | am__nobase_strip_setup = \ | ||
74 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` | ||
75 | am__nobase_strip = \ | ||
76 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" | ||
77 | am__nobase_list = $(am__nobase_strip_setup); \ | ||
78 | for p in $$list; do echo "$$p $$p"; done | \ | ||
79 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ | ||
80 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ | ||
81 | if (++n[$$2] == $(am__install_max)) \ | ||
82 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ | ||
83 | END { for (dir in files) print dir, files[dir] }' | ||
84 | am__base_list = \ | ||
85 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ | ||
86 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | ||
87 | am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" | ||
88 | LTLIBRARIES = $(lib_LTLIBRARIES) | ||
89 | @BUILD_ECORE_X_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/src/lib/ecore_x/libecore_x.la | ||
90 | @BUILD_ECORE_FB_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la | ||
91 | @BUILD_ECORE_DIRECTFB_TRUE@am__DEPENDENCIES_3 = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la | ||
92 | @BUILD_ECORE_WIN32_TRUE@am__DEPENDENCIES_4 = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la | ||
93 | @BUILD_ECORE_SDL_TRUE@am__DEPENDENCIES_5 = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la | ||
94 | @BUILD_ECORE_SDL_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_5) | ||
95 | @BUILD_ECORE_COCOA_TRUE@am__DEPENDENCIES_7 = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la | ||
96 | @BUILD_ECORE_WINCE_TRUE@am__DEPENDENCIES_8 = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la | ||
97 | @BUILD_ECORE_PSL1GHT_TRUE@am__DEPENDENCIES_9 = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la | ||
98 | libecore_evas_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ | ||
99 | $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ | ||
100 | $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \ | ||
101 | $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_7) \ | ||
102 | $(am__DEPENDENCIES_8) $(am__DEPENDENCIES_9) \ | ||
103 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | ||
104 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ | ||
105 | $(top_builddir)/src/lib/ecore/libecore.la | ||
106 | am_libecore_evas_la_OBJECTS = ecore_evas.lo ecore_evas_util.lo \ | ||
107 | ecore_evas_x.lo ecore_evas_fb.lo ecore_evas_buffer.lo \ | ||
108 | ecore_evas_directfb.lo ecore_evas_win32.lo ecore_evas_sdl.lo \ | ||
109 | ecore_evas_cocoa.lo ecore_evas_wince.lo ecore_evas_ews.lo \ | ||
110 | ecore_evas_psl1ght.lo | ||
111 | libecore_evas_la_OBJECTS = $(am_libecore_evas_la_OBJECTS) | ||
112 | AM_V_lt = $(am__v_lt_$(V)) | ||
113 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | ||
114 | am__v_lt_0 = --silent | ||
115 | libecore_evas_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ | ||
116 | $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ | ||
117 | $(AM_CFLAGS) $(CFLAGS) $(libecore_evas_la_LDFLAGS) $(LDFLAGS) \ | ||
118 | -o $@ | ||
119 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) | ||
120 | depcomp = $(SHELL) $(top_srcdir)/depcomp | ||
121 | am__depfiles_maybe = depfiles | ||
122 | am__mv = mv -f | ||
123 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | ||
124 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||
125 | LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
126 | $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ | ||
127 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | ||
128 | $(AM_CFLAGS) $(CFLAGS) | ||
129 | AM_V_CC = $(am__v_CC_$(V)) | ||
130 | am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) | ||
131 | am__v_CC_0 = @echo " CC " $@; | ||
132 | AM_V_at = $(am__v_at_$(V)) | ||
133 | am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) | ||
134 | am__v_at_0 = @ | ||
135 | CCLD = $(CC) | ||
136 | LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
137 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | ||
138 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
139 | AM_V_CCLD = $(am__v_CCLD_$(V)) | ||
140 | am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) | ||
141 | am__v_CCLD_0 = @echo " CCLD " $@; | ||
142 | AM_V_GEN = $(am__v_GEN_$(V)) | ||
143 | am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) | ||
144 | am__v_GEN_0 = @echo " GEN " $@; | ||
145 | SOURCES = $(libecore_evas_la_SOURCES) | ||
146 | DIST_SOURCES = $(libecore_evas_la_SOURCES) | ||
147 | HEADERS = $(includes_HEADERS) | ||
148 | ETAGS = etags | ||
149 | CTAGS = ctags | ||
150 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
151 | ACLOCAL = @ACLOCAL@ | ||
152 | ALLOCA = @ALLOCA@ | ||
153 | AMTAR = @AMTAR@ | ||
154 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | ||
155 | AR = @AR@ | ||
156 | AS = @AS@ | ||
157 | AUTOCONF = @AUTOCONF@ | ||
158 | AUTOHEADER = @AUTOHEADER@ | ||
159 | AUTOMAKE = @AUTOMAKE@ | ||
160 | AWK = @AWK@ | ||
161 | CARES_CFLAGS = @CARES_CFLAGS@ | ||
162 | CARES_LIBS = @CARES_LIBS@ | ||
163 | CC = @CC@ | ||
164 | CCDEPMODE = @CCDEPMODE@ | ||
165 | CFLAGS = @CFLAGS@ | ||
166 | CHECK_CFLAGS = @CHECK_CFLAGS@ | ||
167 | CHECK_LIBS = @CHECK_LIBS@ | ||
168 | CPP = @CPP@ | ||
169 | CPPFLAGS = @CPPFLAGS@ | ||
170 | CURL_CFLAGS = @CURL_CFLAGS@ | ||
171 | CURL_LIBS = @CURL_LIBS@ | ||
172 | CXX = @CXX@ | ||
173 | CXXCPP = @CXXCPP@ | ||
174 | CXXDEPMODE = @CXXDEPMODE@ | ||
175 | CXXFLAGS = @CXXFLAGS@ | ||
176 | CYGPATH_W = @CYGPATH_W@ | ||
177 | DEFS = @DEFS@ | ||
178 | DEPDIR = @DEPDIR@ | ||
179 | DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ | ||
180 | DIRECTFB_LIBS = @DIRECTFB_LIBS@ | ||
181 | DLLTOOL = @DLLTOOL@ | ||
182 | DSYMUTIL = @DSYMUTIL@ | ||
183 | DUMPBIN = @DUMPBIN@ | ||
184 | ECHO_C = @ECHO_C@ | ||
185 | ECHO_N = @ECHO_N@ | ||
186 | ECHO_T = @ECHO_T@ | ||
187 | ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ | ||
188 | ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ | ||
189 | EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ | ||
190 | EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ | ||
191 | EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ | ||
192 | EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ | ||
193 | EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ | ||
194 | EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ | ||
195 | EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ | ||
196 | EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ | ||
197 | EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ | ||
198 | EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ | ||
199 | EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ | ||
200 | EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ | ||
201 | EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ | ||
202 | EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ | ||
203 | EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ | ||
204 | EGREP = @EGREP@ | ||
205 | EINA_CFLAGS = @EINA_CFLAGS@ | ||
206 | EINA_LIBS = @EINA_LIBS@ | ||
207 | ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ | ||
208 | ESCAPE_LIBS = @ESCAPE_LIBS@ | ||
209 | EVAS_CFLAGS = @EVAS_CFLAGS@ | ||
210 | EVAS_LIBS = @EVAS_LIBS@ | ||
211 | EVIL_CFLAGS = @EVIL_CFLAGS@ | ||
212 | EVIL_LIBS = @EVIL_LIBS@ | ||
213 | EXEEXT = @EXEEXT@ | ||
214 | FGREP = @FGREP@ | ||
215 | GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ | ||
216 | GLIB_CFLAGS = @GLIB_CFLAGS@ | ||
217 | GLIB_LIBS = @GLIB_LIBS@ | ||
218 | GMSGFMT = @GMSGFMT@ | ||
219 | GMSGFMT_015 = @GMSGFMT_015@ | ||
220 | GREP = @GREP@ | ||
221 | INSTALL = @INSTALL@ | ||
222 | INSTALL_DATA = @INSTALL_DATA@ | ||
223 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
224 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
225 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
226 | INTLLIBS = @INTLLIBS@ | ||
227 | INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ | ||
228 | KEYSYMDEFS = @KEYSYMDEFS@ | ||
229 | LD = @LD@ | ||
230 | LDFLAGS = @LDFLAGS@ | ||
231 | LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ | ||
232 | LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ | ||
233 | LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ | ||
234 | LIBICONV = @LIBICONV@ | ||
235 | LIBINTL = @LIBINTL@ | ||
236 | LIBOBJS = @LIBOBJS@ | ||
237 | LIBS = @LIBS@ | ||
238 | LIBTOOL = @LIBTOOL@ | ||
239 | LIPO = @LIPO@ | ||
240 | LN_S = @LN_S@ | ||
241 | LTLIBICONV = @LTLIBICONV@ | ||
242 | LTLIBINTL = @LTLIBINTL@ | ||
243 | LTLIBOBJS = @LTLIBOBJS@ | ||
244 | MAKEINFO = @MAKEINFO@ | ||
245 | MKDIR_P = @MKDIR_P@ | ||
246 | MSGFMT = @MSGFMT@ | ||
247 | MSGFMT_015 = @MSGFMT_015@ | ||
248 | MSGMERGE = @MSGMERGE@ | ||
249 | NM = @NM@ | ||
250 | NMEDIT = @NMEDIT@ | ||
251 | OBJC = @OBJC@ | ||
252 | OBJCDEPMODE = @OBJCDEPMODE@ | ||
253 | OBJCFLAGS = @OBJCFLAGS@ | ||
254 | OBJDUMP = @OBJDUMP@ | ||
255 | OBJEXT = @OBJEXT@ | ||
256 | OTOOL = @OTOOL@ | ||
257 | OTOOL64 = @OTOOL64@ | ||
258 | PACKAGE = @PACKAGE@ | ||
259 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
260 | PACKAGE_NAME = @PACKAGE_NAME@ | ||
261 | PACKAGE_STRING = @PACKAGE_STRING@ | ||
262 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
263 | PACKAGE_URL = @PACKAGE_URL@ | ||
264 | PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
265 | PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
266 | PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ | ||
267 | PIXMAN_LIBS = @PIXMAN_LIBS@ | ||
268 | PKG_CONFIG = @PKG_CONFIG@ | ||
269 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ | ||
270 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ | ||
271 | POSUB = @POSUB@ | ||
272 | RANLIB = @RANLIB@ | ||
273 | SDL_CFLAGS = @SDL_CFLAGS@ | ||
274 | SDL_CONFIG = @SDL_CONFIG@ | ||
275 | SDL_LIBS = @SDL_LIBS@ | ||
276 | SED = @SED@ | ||
277 | SET_MAKE = @SET_MAKE@ | ||
278 | SHELL = @SHELL@ | ||
279 | SSL_CFLAGS = @SSL_CFLAGS@ | ||
280 | SSL_LIBS = @SSL_LIBS@ | ||
281 | STRIP = @STRIP@ | ||
282 | TLS2_CFLAGS = @TLS2_CFLAGS@ | ||
283 | TLS2_LIBS = @TLS2_LIBS@ | ||
284 | TLS_CFLAGS = @TLS_CFLAGS@ | ||
285 | TLS_LIBS = @TLS_LIBS@ | ||
286 | TSLIB_CFLAGS = @TSLIB_CFLAGS@ | ||
287 | TSLIB_LIBS = @TSLIB_LIBS@ | ||
288 | USE_NLS = @USE_NLS@ | ||
289 | VERSION = @VERSION@ | ||
290 | VMAJ = @VMAJ@ | ||
291 | WIN32_CFLAGS = @WIN32_CFLAGS@ | ||
292 | WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ | ||
293 | WIN32_LIBS = @WIN32_LIBS@ | ||
294 | XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ | ||
295 | XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ | ||
296 | XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ | ||
297 | XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ | ||
298 | XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ | ||
299 | XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ | ||
300 | XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ | ||
301 | XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ | ||
302 | XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ | ||
303 | XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ | ||
304 | XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ | ||
305 | XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ | ||
306 | XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ | ||
307 | XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ | ||
308 | XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ | ||
309 | XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ | ||
310 | XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ | ||
311 | XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ | ||
312 | XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ | ||
313 | XCB_X11_LIBS = @XCB_X11_LIBS@ | ||
314 | XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ | ||
315 | XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ | ||
316 | XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ | ||
317 | XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ | ||
318 | XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ | ||
319 | XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ | ||
320 | XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ | ||
321 | XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ | ||
322 | XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ | ||
323 | XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ | ||
324 | XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ | ||
325 | XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ | ||
326 | XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ | ||
327 | XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ | ||
328 | XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ | ||
329 | XDAMAGE_LIBS = @XDAMAGE_LIBS@ | ||
330 | XDPMS_CFLAGS = @XDPMS_CFLAGS@ | ||
331 | XDPMS_LIBS = @XDPMS_LIBS@ | ||
332 | XFIXES_CFLAGS = @XFIXES_CFLAGS@ | ||
333 | XFIXES_LIBS = @XFIXES_LIBS@ | ||
334 | XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ | ||
335 | XGESTURE_LIBS = @XGESTURE_LIBS@ | ||
336 | XGETTEXT = @XGETTEXT@ | ||
337 | XGETTEXT_015 = @XGETTEXT_015@ | ||
338 | XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ | ||
339 | XI2_CFLAGS = @XI2_CFLAGS@ | ||
340 | XI2_LIBS = @XI2_LIBS@ | ||
341 | XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ | ||
342 | XINERAMA_LIBS = @XINERAMA_LIBS@ | ||
343 | XKB_CFLAGS = @XKB_CFLAGS@ | ||
344 | XKB_LIBS = @XKB_LIBS@ | ||
345 | XMKMF = @XMKMF@ | ||
346 | XPRINT_CFLAGS = @XPRINT_CFLAGS@ | ||
347 | XPRINT_LIBS = @XPRINT_LIBS@ | ||
348 | XRANDR_CFLAGS = @XRANDR_CFLAGS@ | ||
349 | XRANDR_LIBS = @XRANDR_LIBS@ | ||
350 | XRENDER_CFLAGS = @XRENDER_CFLAGS@ | ||
351 | XRENDER_LIBS = @XRENDER_LIBS@ | ||
352 | XSS_CFLAGS = @XSS_CFLAGS@ | ||
353 | XSS_LIBS = @XSS_LIBS@ | ||
354 | XTEST_CFLAGS = @XTEST_CFLAGS@ | ||
355 | XTEST_LIBS = @XTEST_LIBS@ | ||
356 | X_CFLAGS = @X_CFLAGS@ | ||
357 | X_EXTRA_LIBS = @X_EXTRA_LIBS@ | ||
358 | X_LIBS = @X_LIBS@ | ||
359 | X_PRE_LIBS = @X_PRE_LIBS@ | ||
360 | Xcursor_cflags = @Xcursor_cflags@ | ||
361 | Xcursor_libs = @Xcursor_libs@ | ||
362 | abs_builddir = @abs_builddir@ | ||
363 | abs_srcdir = @abs_srcdir@ | ||
364 | abs_top_builddir = @abs_top_builddir@ | ||
365 | abs_top_srcdir = @abs_top_srcdir@ | ||
366 | ac_ct_CC = @ac_ct_CC@ | ||
367 | ac_ct_CXX = @ac_ct_CXX@ | ||
368 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | ||
369 | ac_ct_OBJC = @ac_ct_OBJC@ | ||
370 | am__include = @am__include@ | ||
371 | am__leading_dot = @am__leading_dot@ | ||
372 | am__quote = @am__quote@ | ||
373 | am__tar = @am__tar@ | ||
374 | am__untar = @am__untar@ | ||
375 | bindir = @bindir@ | ||
376 | build = @build@ | ||
377 | build_alias = @build_alias@ | ||
378 | build_cpu = @build_cpu@ | ||
379 | build_os = @build_os@ | ||
380 | build_vendor = @build_vendor@ | ||
381 | builddir = @builddir@ | ||
382 | cocoa_ldflags = @cocoa_ldflags@ | ||
383 | datadir = @datadir@ | ||
384 | datarootdir = @datarootdir@ | ||
385 | dlopen_libs = @dlopen_libs@ | ||
386 | docdir = @docdir@ | ||
387 | dvidir = @dvidir@ | ||
388 | ecore_cocoa_cflags = @ecore_cocoa_cflags@ | ||
389 | ecore_cocoa_libs = @ecore_cocoa_libs@ | ||
390 | ecore_con_cflags = @ecore_con_cflags@ | ||
391 | ecore_con_libs = @ecore_con_libs@ | ||
392 | ecore_directfb_cflags = @ecore_directfb_cflags@ | ||
393 | ecore_directfb_libs = @ecore_directfb_libs@ | ||
394 | ecore_evas_cflags = @ecore_evas_cflags@ | ||
395 | ecore_evas_libs = @ecore_evas_libs@ | ||
396 | ecore_fb_cflags = @ecore_fb_cflags@ | ||
397 | ecore_fb_libs = @ecore_fb_libs@ | ||
398 | ecore_file_cflags = @ecore_file_cflags@ | ||
399 | ecore_file_libs = @ecore_file_libs@ | ||
400 | ecore_imf_cflags = @ecore_imf_cflags@ | ||
401 | ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ | ||
402 | ecore_imf_evas_libs = @ecore_imf_evas_libs@ | ||
403 | ecore_imf_libs = @ecore_imf_libs@ | ||
404 | ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ | ||
405 | ecore_imf_xim_libs = @ecore_imf_xim_libs@ | ||
406 | ecore_input_cflags = @ecore_input_cflags@ | ||
407 | ecore_input_evas_cflags = @ecore_input_evas_cflags@ | ||
408 | ecore_input_evas_libs = @ecore_input_evas_libs@ | ||
409 | ecore_input_libs = @ecore_input_libs@ | ||
410 | ecore_ipc_cflags = @ecore_ipc_cflags@ | ||
411 | ecore_ipc_libs = @ecore_ipc_libs@ | ||
412 | ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ | ||
413 | ecore_psl1ght_libs = @ecore_psl1ght_libs@ | ||
414 | ecore_sdl_cflags = @ecore_sdl_cflags@ | ||
415 | ecore_sdl_libs = @ecore_sdl_libs@ | ||
416 | ecore_win32_cflags = @ecore_win32_cflags@ | ||
417 | ecore_win32_libs = @ecore_win32_libs@ | ||
418 | ecore_wince_cflags = @ecore_wince_cflags@ | ||
419 | ecore_wince_libs = @ecore_wince_libs@ | ||
420 | ecore_x_cflags = @ecore_x_cflags@ | ||
421 | ecore_x_libs = @ecore_x_libs@ | ||
422 | ecore_x_libs_private = @ecore_x_libs_private@ | ||
423 | efl_doxygen = @efl_doxygen@ | ||
424 | efl_have_doxygen = @efl_have_doxygen@ | ||
425 | exec_prefix = @exec_prefix@ | ||
426 | have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ | ||
427 | host = @host@ | ||
428 | host_alias = @host_alias@ | ||
429 | host_cpu = @host_cpu@ | ||
430 | host_os = @host_os@ | ||
431 | host_vendor = @host_vendor@ | ||
432 | htmldir = @htmldir@ | ||
433 | includedir = @includedir@ | ||
434 | infodir = @infodir@ | ||
435 | install_sh = @install_sh@ | ||
436 | libdir = @libdir@ | ||
437 | libexecdir = @libexecdir@ | ||
438 | localedir = @localedir@ | ||
439 | localstatedir = @localstatedir@ | ||
440 | lt_ECHO = @lt_ECHO@ | ||
441 | lt_enable_auto_import = @lt_enable_auto_import@ | ||
442 | mandir = @mandir@ | ||
443 | mkdir_p = @mkdir_p@ | ||
444 | oldincludedir = @oldincludedir@ | ||
445 | pdfdir = @pdfdir@ | ||
446 | pkgconfig_requires_private = @pkgconfig_requires_private@ | ||
447 | prefix = @prefix@ | ||
448 | program_transform_name = @program_transform_name@ | ||
449 | psdir = @psdir@ | ||
450 | release_info = @release_info@ | ||
451 | requirements_ecore = @requirements_ecore@ | ||
452 | requirements_ecore_cocoa = @requirements_ecore_cocoa@ | ||
453 | requirements_ecore_con = @requirements_ecore_con@ | ||
454 | requirements_ecore_directfb = @requirements_ecore_directfb@ | ||
455 | requirements_ecore_evas = @requirements_ecore_evas@ | ||
456 | requirements_ecore_fb = @requirements_ecore_fb@ | ||
457 | requirements_ecore_file = @requirements_ecore_file@ | ||
458 | requirements_ecore_imf = @requirements_ecore_imf@ | ||
459 | requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ | ||
460 | requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ | ||
461 | requirements_ecore_input = @requirements_ecore_input@ | ||
462 | requirements_ecore_input_evas = @requirements_ecore_input_evas@ | ||
463 | requirements_ecore_ipc = @requirements_ecore_ipc@ | ||
464 | requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ | ||
465 | requirements_ecore_sdl = @requirements_ecore_sdl@ | ||
466 | requirements_ecore_win32 = @requirements_ecore_win32@ | ||
467 | requirements_ecore_wince = @requirements_ecore_wince@ | ||
468 | requirements_ecore_x = @requirements_ecore_x@ | ||
469 | rt_libs = @rt_libs@ | ||
470 | sbindir = @sbindir@ | ||
471 | sharedstatedir = @sharedstatedir@ | ||
472 | srcdir = @srcdir@ | ||
473 | sysconfdir = @sysconfdir@ | ||
474 | target_alias = @target_alias@ | ||
475 | top_build_prefix = @top_build_prefix@ | ||
476 | top_builddir = @top_builddir@ | ||
477 | top_srcdir = @top_srcdir@ | ||
478 | version_info = @version_info@ | ||
479 | x_cflags = @x_cflags@ | ||
480 | x_includes = @x_includes@ | ||
481 | x_libs = @x_libs@ | ||
482 | MAINTAINERCLEANFILES = Makefile.in | ||
483 | @BUILD_ECORE_X_FALSE@ECORE_X_INC = | ||
484 | @BUILD_ECORE_X_TRUE@ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @ECORE_XCB_CFLAGS@ | ||
485 | @BUILD_ECORE_X_FALSE@ECORE_X_LIB = | ||
486 | @BUILD_ECORE_X_TRUE@ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @ECORE_XCB_LIBS@ | ||
487 | @BUILD_ECORE_FB_FALSE@ECORE_FB_INC = | ||
488 | @BUILD_ECORE_FB_TRUE@ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb | ||
489 | @BUILD_ECORE_FB_FALSE@ECORE_FB_LIB = | ||
490 | @BUILD_ECORE_FB_TRUE@ECORE_FB_LIB = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la | ||
491 | @BUILD_ECORE_DIRECTFB_FALSE@ECORE_DIRECTFB_INC = | ||
492 | @BUILD_ECORE_DIRECTFB_TRUE@ECORE_DIRECTFB_INC = -I$(top_srcdir)/src/lib/ecore_directfb -I@DIRECTFB_CFLAGS@ | ||
493 | @BUILD_ECORE_DIRECTFB_FALSE@ECORE_DIRECTFB_LIB = | ||
494 | @BUILD_ECORE_DIRECTFB_TRUE@ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la | ||
495 | @BUILD_ECORE_WIN32_FALSE@ECORE_WIN32_INC = | ||
496 | @BUILD_ECORE_WIN32_TRUE@ECORE_WIN32_INC = -I$(top_srcdir)/src/lib/ecore_win32 | ||
497 | @BUILD_ECORE_WIN32_FALSE@ECORE_WIN32_LIB = | ||
498 | @BUILD_ECORE_WIN32_TRUE@ECORE_WIN32_LIB = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la | ||
499 | @BUILD_ECORE_SDL_FALSE@ECORE_SDL_INC = | ||
500 | @BUILD_ECORE_SDL_TRUE@ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@ | ||
501 | @BUILD_ECORE_SDL_FALSE@ECORE_SDL_LIB = | ||
502 | @BUILD_ECORE_SDL_TRUE@ECORE_SDL_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la | ||
503 | @BUILD_ECORE_SDL_FALSE@ECORE_SDL_LIBADD = | ||
504 | @BUILD_ECORE_SDL_TRUE@ECORE_SDL_LIBADD = @SDL_LIBS@ $(ECORE_SDL_LIB) | ||
505 | @BUILD_ECORE_COCOA_FALSE@ECORE_COCOA_INC = | ||
506 | @BUILD_ECORE_COCOA_TRUE@ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa | ||
507 | @BUILD_ECORE_COCOA_FALSE@ECORE_COCOA_LIB = | ||
508 | @BUILD_ECORE_COCOA_TRUE@ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la | ||
509 | @BUILD_ECORE_WINCE_FALSE@ECORE_WINCE_INC = | ||
510 | @BUILD_ECORE_WINCE_TRUE@ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince | ||
511 | @BUILD_ECORE_WINCE_FALSE@ECORE_WINCE_LIB = | ||
512 | @BUILD_ECORE_WINCE_TRUE@ECORE_WINCE_LIB = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la | ||
513 | @BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_INC = | ||
514 | @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght | ||
515 | @BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_LIB = | ||
516 | @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la | ||
517 | AM_CPPFLAGS = \ | ||
518 | -I$(top_srcdir)/src/lib/ecore \ | ||
519 | -I$(top_srcdir)/src/lib/ecore_evas \ | ||
520 | -I$(top_srcdir)/src/lib/ecore_input \ | ||
521 | -I$(top_srcdir)/src/lib/ecore_input_evas \ | ||
522 | -I$(top_builddir)/src/lib/ecore \ | ||
523 | -I$(top_builddir)/src/lib/ecore_evas \ | ||
524 | -I$(top_builddir)/src/lib/ecore_input \ | ||
525 | -I$(top_builddir)/src/lib/ecore_input_evas \ | ||
526 | @EFL_ECORE_EVAS_BUILD@ \ | ||
527 | $(ECORE_X_INC) \ | ||
528 | $(ECORE_FB_INC) \ | ||
529 | $(ECORE_DIRECTFB_INC) \ | ||
530 | $(ECORE_WIN32_INC) \ | ||
531 | $(ECORE_SDL_INC) \ | ||
532 | $(ECORE_COCOA_INC) \ | ||
533 | $(ECORE_WINCE_INC) \ | ||
534 | $(ECORE_PSL1GHT_INC) \ | ||
535 | @EVAS_CFLAGS@ \ | ||
536 | @EINA_CFLAGS@ \ | ||
537 | @EVIL_CFLAGS@ | ||
538 | |||
539 | AM_CFLAGS = @WIN32_CFLAGS@ | ||
540 | lib_LTLIBRARIES = libecore_evas.la | ||
541 | includes_HEADERS = Ecore_Evas.h | ||
542 | includesdir = $(includedir)/ecore-@VMAJ@ | ||
543 | libecore_evas_la_SOURCES = \ | ||
544 | ecore_evas.c \ | ||
545 | ecore_evas_util.c \ | ||
546 | ecore_evas_x.c \ | ||
547 | ecore_evas_fb.c \ | ||
548 | ecore_evas_buffer.c \ | ||
549 | ecore_evas_directfb.c \ | ||
550 | ecore_evas_win32.c \ | ||
551 | ecore_evas_sdl.c \ | ||
552 | ecore_evas_cocoa.c \ | ||
553 | ecore_evas_wince.c \ | ||
554 | ecore_evas_ews.c \ | ||
555 | ecore_evas_psl1ght.c | ||
556 | |||
557 | libecore_evas_la_LIBADD = \ | ||
558 | $(ECORE_X_LIB) \ | ||
559 | $(ECORE_FB_LIB) \ | ||
560 | $(ECORE_DIRECTFB_LIB) \ | ||
561 | $(ECORE_WIN32_LIB) \ | ||
562 | $(ECORE_SDL_LIB) \ | ||
563 | $(ECORE_SDL_LIBADD) \ | ||
564 | $(ECORE_COCOA_LIB) \ | ||
565 | $(ECORE_WINCE_LIB) \ | ||
566 | $(ECORE_PSL1GHT_LIB) \ | ||
567 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | ||
568 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ | ||
569 | $(top_builddir)/src/lib/ecore/libecore.la \ | ||
570 | @EVAS_LIBS@ \ | ||
571 | @EINA_LIBS@ \ | ||
572 | @EVIL_LIBS@ | ||
573 | |||
574 | libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ | ||
575 | EXTRA_DIST = \ | ||
576 | ecore_evas_private.h | ||
577 | |||
578 | all: all-am | ||
579 | |||
580 | .SUFFIXES: | ||
581 | .SUFFIXES: .c .lo .o .obj | ||
582 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
583 | @for dep in $?; do \ | ||
584 | case '$(am__configure_deps)' in \ | ||
585 | *$$dep*) \ | ||
586 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | ||
587 | && { if test -f $@; then exit 0; else break; fi; }; \ | ||
588 | exit 1;; \ | ||
589 | esac; \ | ||
590 | done; \ | ||
591 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_evas/Makefile'; \ | ||
592 | $(am__cd) $(top_srcdir) && \ | ||
593 | $(AUTOMAKE) --gnu src/lib/ecore_evas/Makefile | ||
594 | .PRECIOUS: Makefile | ||
595 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
596 | @case '$?' in \ | ||
597 | *config.status*) \ | ||
598 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
599 | *) \ | ||
600 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
601 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
602 | esac; | ||
603 | |||
604 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
605 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
606 | |||
607 | $(top_srcdir)/configure: $(am__configure_deps) | ||
608 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
609 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
610 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
611 | $(am__aclocal_m4_deps): | ||
612 | install-libLTLIBRARIES: $(lib_LTLIBRARIES) | ||
613 | @$(NORMAL_INSTALL) | ||
614 | test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" | ||
615 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | ||
616 | list2=; for p in $$list; do \ | ||
617 | if test -f $$p; then \ | ||
618 | list2="$$list2 $$p"; \ | ||
619 | else :; fi; \ | ||
620 | done; \ | ||
621 | test -z "$$list2" || { \ | ||
622 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ | ||
623 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ | ||
624 | } | ||
625 | |||
626 | uninstall-libLTLIBRARIES: | ||
627 | @$(NORMAL_UNINSTALL) | ||
628 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | ||
629 | for p in $$list; do \ | ||
630 | $(am__strip_dir) \ | ||
631 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ | ||
632 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ | ||
633 | done | ||
634 | |||
635 | clean-libLTLIBRARIES: | ||
636 | -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) | ||
637 | @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ | ||
638 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ | ||
639 | test "$$dir" != "$$p" || dir=.; \ | ||
640 | echo "rm -f \"$${dir}/so_locations\""; \ | ||
641 | rm -f "$${dir}/so_locations"; \ | ||
642 | done | ||
643 | libecore_evas.la: $(libecore_evas_la_OBJECTS) $(libecore_evas_la_DEPENDENCIES) | ||
644 | $(AM_V_CCLD)$(libecore_evas_la_LINK) -rpath $(libdir) $(libecore_evas_la_OBJECTS) $(libecore_evas_la_LIBADD) $(LIBS) | ||
645 | |||
646 | mostlyclean-compile: | ||
647 | -rm -f *.$(OBJEXT) | ||
648 | |||
649 | distclean-compile: | ||
650 | -rm -f *.tab.c | ||
651 | |||
652 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas.Plo@am__quote@ | ||
653 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_buffer.Plo@am__quote@ | ||
654 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_cocoa.Plo@am__quote@ | ||
655 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_directfb.Plo@am__quote@ | ||
656 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_ews.Plo@am__quote@ | ||
657 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_fb.Plo@am__quote@ | ||
658 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_psl1ght.Plo@am__quote@ | ||
659 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_sdl.Plo@am__quote@ | ||
660 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_util.Plo@am__quote@ | ||
661 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_win32.Plo@am__quote@ | ||
662 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wince.Plo@am__quote@ | ||
663 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_x.Plo@am__quote@ | ||
664 | |||
665 | .c.o: | ||
666 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
667 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
668 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
669 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
670 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
671 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< | ||
672 | |||
673 | .c.obj: | ||
674 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | ||
675 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
676 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
677 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
678 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
679 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` | ||
680 | |||
681 | .c.lo: | ||
682 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
683 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | ||
684 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
685 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | ||
686 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
687 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< | ||
688 | |||
689 | mostlyclean-libtool: | ||
690 | -rm -f *.lo | ||
691 | |||
692 | clean-libtool: | ||
693 | -rm -rf .libs _libs | ||
694 | install-includesHEADERS: $(includes_HEADERS) | ||
695 | @$(NORMAL_INSTALL) | ||
696 | test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" | ||
697 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
698 | for p in $$list; do \ | ||
699 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | ||
700 | echo "$$d$$p"; \ | ||
701 | done | $(am__base_list) | \ | ||
702 | while read files; do \ | ||
703 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ | ||
704 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ | ||
705 | done | ||
706 | |||
707 | uninstall-includesHEADERS: | ||
708 | @$(NORMAL_UNINSTALL) | ||
709 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
710 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ | ||
711 | test -n "$$files" || exit 0; \ | ||
712 | echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ | ||
713 | cd "$(DESTDIR)$(includesdir)" && rm -f $$files | ||
714 | |||
715 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
716 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
717 | unique=`for i in $$list; do \ | ||
718 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
719 | done | \ | ||
720 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
721 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
722 | mkid -fID $$unique | ||
723 | tags: TAGS | ||
724 | |||
725 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
726 | $(TAGS_FILES) $(LISP) | ||
727 | set x; \ | ||
728 | here=`pwd`; \ | ||
729 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
730 | unique=`for i in $$list; do \ | ||
731 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
732 | done | \ | ||
733 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
734 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
735 | shift; \ | ||
736 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ | ||
737 | test -n "$$unique" || unique=$$empty_fix; \ | ||
738 | if test $$# -gt 0; then \ | ||
739 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
740 | "$$@" $$unique; \ | ||
741 | else \ | ||
742 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
743 | $$unique; \ | ||
744 | fi; \ | ||
745 | fi | ||
746 | ctags: CTAGS | ||
747 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
748 | $(TAGS_FILES) $(LISP) | ||
749 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
750 | unique=`for i in $$list; do \ | ||
751 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
752 | done | \ | ||
753 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
754 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
755 | test -z "$(CTAGS_ARGS)$$unique" \ | ||
756 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | ||
757 | $$unique | ||
758 | |||
759 | GTAGS: | ||
760 | here=`$(am__cd) $(top_builddir) && pwd` \ | ||
761 | && $(am__cd) $(top_srcdir) \ | ||
762 | && gtags -i $(GTAGS_ARGS) "$$here" | ||
763 | |||
764 | distclean-tags: | ||
765 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||
766 | |||
767 | distdir: $(DISTFILES) | ||
768 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
769 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
770 | list='$(DISTFILES)'; \ | ||
771 | dist_files=`for file in $$list; do echo $$file; done | \ | ||
772 | sed -e "s|^$$srcdirstrip/||;t" \ | ||
773 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | ||
774 | case $$dist_files in \ | ||
775 | */*) $(MKDIR_P) `echo "$$dist_files" | \ | ||
776 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | ||
777 | sort -u` ;; \ | ||
778 | esac; \ | ||
779 | for file in $$dist_files; do \ | ||
780 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
781 | if test -d $$d/$$file; then \ | ||
782 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
783 | if test -d "$(distdir)/$$file"; then \ | ||
784 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
785 | fi; \ | ||
786 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
787 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | ||
788 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
789 | fi; \ | ||
790 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | ||
791 | else \ | ||
792 | test -f "$(distdir)/$$file" \ | ||
793 | || cp -p $$d/$$file "$(distdir)/$$file" \ | ||
794 | || exit 1; \ | ||
795 | fi; \ | ||
796 | done | ||
797 | check-am: all-am | ||
798 | check: check-am | ||
799 | all-am: Makefile $(LTLIBRARIES) $(HEADERS) | ||
800 | installdirs: | ||
801 | for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ | ||
802 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ | ||
803 | done | ||
804 | install: install-am | ||
805 | install-exec: install-exec-am | ||
806 | install-data: install-data-am | ||
807 | uninstall: uninstall-am | ||
808 | |||
809 | install-am: all-am | ||
810 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
811 | |||
812 | installcheck: installcheck-am | ||
813 | install-strip: | ||
814 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
815 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
816 | `test -z '$(STRIP)' || \ | ||
817 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
818 | mostlyclean-generic: | ||
819 | |||
820 | clean-generic: | ||
821 | |||
822 | distclean-generic: | ||
823 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
824 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||
825 | |||
826 | maintainer-clean-generic: | ||
827 | @echo "This command is intended for maintainers to use" | ||
828 | @echo "it deletes files that may require special tools to rebuild." | ||
829 | -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | ||
830 | clean: clean-am | ||
831 | |||
832 | clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ | ||
833 | mostlyclean-am | ||
834 | |||
835 | distclean: distclean-am | ||
836 | -rm -rf ./$(DEPDIR) | ||
837 | -rm -f Makefile | ||
838 | distclean-am: clean-am distclean-compile distclean-generic \ | ||
839 | distclean-tags | ||
840 | |||
841 | dvi: dvi-am | ||
842 | |||
843 | dvi-am: | ||
844 | |||
845 | html: html-am | ||
846 | |||
847 | html-am: | ||
848 | |||
849 | info: info-am | ||
850 | |||
851 | info-am: | ||
852 | |||
853 | install-data-am: install-includesHEADERS | ||
854 | |||
855 | install-dvi: install-dvi-am | ||
856 | |||
857 | install-dvi-am: | ||
858 | |||
859 | install-exec-am: install-libLTLIBRARIES | ||
860 | |||
861 | install-html: install-html-am | ||
862 | |||
863 | install-html-am: | ||
864 | |||
865 | install-info: install-info-am | ||
866 | |||
867 | install-info-am: | ||
868 | |||
869 | install-man: | ||
870 | |||
871 | install-pdf: install-pdf-am | ||
872 | |||
873 | install-pdf-am: | ||
874 | |||
875 | install-ps: install-ps-am | ||
876 | |||
877 | install-ps-am: | ||
878 | |||
879 | installcheck-am: | ||
880 | |||
881 | maintainer-clean: maintainer-clean-am | ||
882 | -rm -rf ./$(DEPDIR) | ||
883 | -rm -f Makefile | ||
884 | maintainer-clean-am: distclean-am maintainer-clean-generic | ||
885 | |||
886 | mostlyclean: mostlyclean-am | ||
887 | |||
888 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ | ||
889 | mostlyclean-libtool | ||
890 | |||
891 | pdf: pdf-am | ||
892 | |||
893 | pdf-am: | ||
894 | |||
895 | ps: ps-am | ||
896 | |||
897 | ps-am: | ||
898 | |||
899 | uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES | ||
900 | |||
901 | .MAKE: install-am install-strip | ||
902 | |||
903 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||
904 | clean-libLTLIBRARIES clean-libtool ctags distclean \ | ||
905 | distclean-compile distclean-generic distclean-libtool \ | ||
906 | distclean-tags distdir dvi dvi-am html html-am info info-am \ | ||
907 | install install-am install-data install-data-am install-dvi \ | ||
908 | install-dvi-am install-exec install-exec-am install-html \ | ||
909 | install-html-am install-includesHEADERS install-info \ | ||
910 | install-info-am install-libLTLIBRARIES install-man install-pdf \ | ||
911 | install-pdf-am install-ps install-ps-am install-strip \ | ||
912 | installcheck installcheck-am installdirs maintainer-clean \ | ||
913 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | ||
914 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | ||
915 | tags uninstall uninstall-am uninstall-includesHEADERS \ | ||
916 | uninstall-libLTLIBRARIES | ||
917 | |||
918 | |||
919 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
920 | # Otherwise a system limit (for SysV at least) may be exceeded. | ||
921 | .NOEXPORT: | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c new file mode 100644 index 0000000..dc42f92 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c | |||
@@ -0,0 +1,2588 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <string.h> | ||
6 | #include <sys/types.h> | ||
7 | #include <errno.h> | ||
8 | |||
9 | #ifndef _MSC_VER | ||
10 | # include <unistd.h> | ||
11 | #endif | ||
12 | |||
13 | #ifdef HAVE_EVIL | ||
14 | # include <Evil.h> | ||
15 | #endif | ||
16 | |||
17 | #include "Ecore.h" | ||
18 | #include "ecore_private.h" | ||
19 | #include "Ecore_Input.h" | ||
20 | |||
21 | #include "ecore_evas_private.h" | ||
22 | #include "Ecore_Evas.h" | ||
23 | |||
24 | Eina_Bool _ecore_evas_app_comp_sync = 1; | ||
25 | int _ecore_evas_log_dom = -1; | ||
26 | static int _ecore_evas_init_count = 0; | ||
27 | static Ecore_Fd_Handler *_ecore_evas_async_events_fd = NULL; | ||
28 | static Eina_Bool _ecore_evas_async_events_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); | ||
29 | |||
30 | static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; | ||
31 | static Ecore_Evas *ecore_evases = NULL; | ||
32 | static int _ecore_evas_fps_debug = 0; | ||
33 | |||
34 | static Eina_Bool | ||
35 | _ecore_evas_idle_enter(void *data __UNUSED__) | ||
36 | { | ||
37 | Ecore_Evas *ee; | ||
38 | double t1 = 0.0; | ||
39 | double t2 = 0.0; | ||
40 | int rend = 0; | ||
41 | |||
42 | if (!ecore_evases) return ECORE_CALLBACK_RENEW; | ||
43 | if (_ecore_evas_fps_debug) | ||
44 | { | ||
45 | t1 = ecore_time_get(); | ||
46 | } | ||
47 | EINA_INLIST_FOREACH(ecore_evases, ee) | ||
48 | { | ||
49 | if (!ee->manual_render) | ||
50 | { | ||
51 | if (ee->engine.func->fn_render) | ||
52 | rend |= ee->engine.func->fn_render(ee); | ||
53 | } | ||
54 | } | ||
55 | if (_ecore_evas_fps_debug) | ||
56 | { | ||
57 | t2 = ecore_time_get(); | ||
58 | if (rend) | ||
59 | _ecore_evas_fps_debug_rendertime_add(t2 - t1); | ||
60 | } | ||
61 | return ECORE_CALLBACK_RENEW; | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Query if a particular renginering engine target has support | ||
66 | * @param engine The engine to check support for | ||
67 | * @return 1 if the particular engine is supported, 0 if it is not | ||
68 | * | ||
69 | * Query if engine @param engine is supported by ecore_evas. 1 is returned if | ||
70 | * it is, and 0 is returned if it is not supported. | ||
71 | */ | ||
72 | EAPI int | ||
73 | ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) | ||
74 | { | ||
75 | switch (engine) | ||
76 | { | ||
77 | case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER: | ||
78 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
79 | return EINA_TRUE; | ||
80 | #else | ||
81 | return EINA_FALSE; | ||
82 | #endif | ||
83 | case ECORE_EVAS_ENGINE_SOFTWARE_XLIB: | ||
84 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB | ||
85 | return EINA_TRUE; | ||
86 | #else | ||
87 | return EINA_FALSE; | ||
88 | #endif | ||
89 | case ECORE_EVAS_ENGINE_XRENDER_X11: | ||
90 | return EINA_FALSE; | ||
91 | case ECORE_EVAS_ENGINE_OPENGL_X11: | ||
92 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
93 | return EINA_TRUE; | ||
94 | #else | ||
95 | return EINA_FALSE; | ||
96 | #endif | ||
97 | case ECORE_EVAS_ENGINE_SOFTWARE_XCB: | ||
98 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB | ||
99 | return EINA_TRUE; | ||
100 | #else | ||
101 | return EINA_FALSE; | ||
102 | #endif | ||
103 | case ECORE_EVAS_ENGINE_XRENDER_XCB: | ||
104 | return EINA_FALSE; | ||
105 | case ECORE_EVAS_ENGINE_SOFTWARE_GDI: | ||
106 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
107 | return EINA_TRUE; | ||
108 | #else | ||
109 | return EINA_FALSE; | ||
110 | #endif | ||
111 | case ECORE_EVAS_ENGINE_SOFTWARE_DDRAW: | ||
112 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
113 | return EINA_TRUE; | ||
114 | #else | ||
115 | return EINA_FALSE; | ||
116 | #endif | ||
117 | case ECORE_EVAS_ENGINE_DIRECT3D: | ||
118 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
119 | return EINA_TRUE; | ||
120 | #else | ||
121 | return EINA_FALSE; | ||
122 | #endif | ||
123 | case ECORE_EVAS_ENGINE_OPENGL_GLEW: | ||
124 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
125 | return EINA_TRUE; | ||
126 | #else | ||
127 | return EINA_FALSE; | ||
128 | #endif | ||
129 | case ECORE_EVAS_ENGINE_SOFTWARE_SDL: | ||
130 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
131 | return EINA_TRUE; | ||
132 | #else | ||
133 | return EINA_FALSE; | ||
134 | #endif | ||
135 | case ECORE_EVAS_ENGINE_OPENGL_SDL: | ||
136 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
137 | return EINA_TRUE; | ||
138 | #else | ||
139 | return EINA_FALSE; | ||
140 | #endif | ||
141 | case ECORE_EVAS_ENGINE_DIRECTFB: | ||
142 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
143 | return EINA_TRUE; | ||
144 | #else | ||
145 | return EINA_FALSE; | ||
146 | #endif | ||
147 | case ECORE_EVAS_ENGINE_SOFTWARE_FB: | ||
148 | #ifdef BUILD_ECORE_EVAS_FB | ||
149 | return EINA_TRUE; | ||
150 | #else | ||
151 | return EINA_FALSE; | ||
152 | #endif | ||
153 | |||
154 | case ECORE_EVAS_ENGINE_SOFTWARE_8_X11: | ||
155 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
156 | return EINA_TRUE; | ||
157 | #else | ||
158 | return EINA_FALSE; | ||
159 | #endif | ||
160 | |||
161 | case ECORE_EVAS_ENGINE_SOFTWARE_16_X11: | ||
162 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
163 | return EINA_TRUE; | ||
164 | #else | ||
165 | return EINA_FALSE; | ||
166 | #endif | ||
167 | case ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW: | ||
168 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
169 | return EINA_TRUE; | ||
170 | #else | ||
171 | return EINA_FALSE; | ||
172 | #endif | ||
173 | case ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE: | ||
174 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
175 | return EINA_TRUE; | ||
176 | #else | ||
177 | return EINA_FALSE; | ||
178 | #endif | ||
179 | case ECORE_EVAS_ENGINE_OPENGL_COCOA: | ||
180 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
181 | return EINA_TRUE; | ||
182 | #else | ||
183 | return EINA_FALSE; | ||
184 | #endif | ||
185 | case ECORE_EVAS_ENGINE_EWS: | ||
186 | #ifdef BUILD_ECORE_EVAS_EWS | ||
187 | return EINA_TRUE; | ||
188 | #else | ||
189 | return EINA_FALSE; | ||
190 | #endif | ||
191 | case ECORE_EVAS_ENGINE_PSL1GHT: | ||
192 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
193 | return EINA_TRUE; | ||
194 | #else | ||
195 | return EINA_FALSE; | ||
196 | #endif | ||
197 | default: | ||
198 | return EINA_FALSE; | ||
199 | }; | ||
200 | } | ||
201 | |||
202 | EAPI int | ||
203 | ecore_evas_init(void) | ||
204 | { | ||
205 | int fd; | ||
206 | |||
207 | if (++_ecore_evas_init_count != 1) | ||
208 | return _ecore_evas_init_count; | ||
209 | |||
210 | if (!evas_init()) | ||
211 | return --_ecore_evas_init_count; | ||
212 | |||
213 | if (!ecore_init()) | ||
214 | goto shutdown_evas; | ||
215 | |||
216 | _ecore_evas_log_dom = eina_log_domain_register | ||
217 | ("ecore_evas", ECORE_EVAS_DEFAULT_LOG_COLOR); | ||
218 | if(_ecore_evas_log_dom < 0) | ||
219 | { | ||
220 | EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas."); | ||
221 | goto shutdown_ecore; | ||
222 | } | ||
223 | |||
224 | fd = evas_async_events_fd_get(); | ||
225 | if (fd > 0) | ||
226 | _ecore_evas_async_events_fd = ecore_main_fd_handler_add(fd, | ||
227 | ECORE_FD_READ, | ||
228 | _ecore_evas_async_events_fd_handler, NULL, | ||
229 | NULL, NULL); | ||
230 | |||
231 | ecore_evas_idle_enterer = | ||
232 | ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL); | ||
233 | if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; | ||
234 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); | ||
235 | |||
236 | #ifdef BUILD_ECORE_EVAS_EWS | ||
237 | _ecore_evas_ews_events_init(); | ||
238 | #endif | ||
239 | |||
240 | if (getenv("ECORE_EVAS_COMP_NOSYNC")) | ||
241 | _ecore_evas_app_comp_sync = 0; | ||
242 | return _ecore_evas_init_count; | ||
243 | |||
244 | shutdown_ecore: | ||
245 | ecore_shutdown(); | ||
246 | shutdown_evas: | ||
247 | evas_shutdown(); | ||
248 | |||
249 | return --_ecore_evas_init_count; | ||
250 | } | ||
251 | |||
252 | EAPI int | ||
253 | ecore_evas_shutdown(void) | ||
254 | { | ||
255 | if (--_ecore_evas_init_count != 0) | ||
256 | return _ecore_evas_init_count; | ||
257 | |||
258 | while (ecore_evases) _ecore_evas_free(ecore_evases); | ||
259 | |||
260 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); | ||
261 | ecore_idle_enterer_del(ecore_evas_idle_enterer); | ||
262 | ecore_evas_idle_enterer = NULL; | ||
263 | |||
264 | #ifdef BUILD_ECORE_EVAS_X11 | ||
265 | while (_ecore_evas_x_shutdown()); | ||
266 | #endif | ||
267 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
268 | while (_ecore_evas_win32_shutdown()); | ||
269 | #endif | ||
270 | #ifdef BUILD_ECORE_EVAS_FB | ||
271 | while (_ecore_evas_fb_shutdown()); | ||
272 | #endif | ||
273 | #ifdef BUILD_ECORE_EVAS_EWS | ||
274 | while (_ecore_evas_ews_shutdown()); | ||
275 | #endif | ||
276 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
277 | while (_ecore_evas_buffer_shutdown()); | ||
278 | #endif | ||
279 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
280 | while (_ecore_evas_directfb_shutdown()); | ||
281 | #endif | ||
282 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
283 | while (_ecore_evas_wince_shutdown()); | ||
284 | #endif | ||
285 | if (_ecore_evas_async_events_fd) | ||
286 | ecore_main_fd_handler_del(_ecore_evas_async_events_fd); | ||
287 | |||
288 | eina_log_domain_unregister(_ecore_evas_log_dom); | ||
289 | _ecore_evas_log_dom = -1; | ||
290 | ecore_shutdown(); | ||
291 | evas_shutdown(); | ||
292 | |||
293 | return _ecore_evas_init_count; | ||
294 | } | ||
295 | |||
296 | EAPI void | ||
297 | ecore_evas_app_comp_sync_set(Eina_Bool do_sync) | ||
298 | { | ||
299 | _ecore_evas_app_comp_sync = do_sync; | ||
300 | } | ||
301 | |||
302 | EAPI Eina_Bool | ||
303 | ecore_evas_app_comp_sync_get(void) | ||
304 | { | ||
305 | return _ecore_evas_app_comp_sync; | ||
306 | } | ||
307 | |||
308 | struct ecore_evas_engine { | ||
309 | const char *name; | ||
310 | Ecore_Evas *(*constructor)(int x, int y, int w, int h, const char *extra_options); | ||
311 | }; | ||
312 | |||
313 | /* inline is just to avoid need to ifdef around it */ | ||
314 | static inline const char * | ||
315 | _ecore_evas_parse_extra_options_str(const char *extra_options, const char *key, char **value) | ||
316 | { | ||
317 | int len = strlen(key); | ||
318 | |||
319 | while (extra_options) | ||
320 | { | ||
321 | const char *p; | ||
322 | |||
323 | if (strncmp(extra_options, key, len) != 0) | ||
324 | { | ||
325 | extra_options = strchr(extra_options, ';'); | ||
326 | if (extra_options) | ||
327 | extra_options++; | ||
328 | continue; | ||
329 | } | ||
330 | |||
331 | extra_options += len; | ||
332 | p = strchr(extra_options, ';'); | ||
333 | if (p) | ||
334 | { | ||
335 | len = p - extra_options; | ||
336 | *value = malloc(len + 1); | ||
337 | memcpy(*value, extra_options, len); | ||
338 | (*value)[len] = '\0'; | ||
339 | extra_options = p + 1; | ||
340 | } | ||
341 | else | ||
342 | { | ||
343 | *value = strdup(extra_options); | ||
344 | extra_options = NULL; | ||
345 | } | ||
346 | } | ||
347 | return extra_options; | ||
348 | } | ||
349 | |||
350 | /* inline is just to avoid need to ifdef around it */ | ||
351 | static inline const char * | ||
352 | _ecore_evas_parse_extra_options_uint(const char *extra_options, const char *key, unsigned int *value) | ||
353 | { | ||
354 | int len = strlen(key); | ||
355 | |||
356 | while (extra_options) | ||
357 | { | ||
358 | const char *p; | ||
359 | |||
360 | if (strncmp(extra_options, key, len) != 0) | ||
361 | { | ||
362 | extra_options = strchr(extra_options, ';'); | ||
363 | if (extra_options) | ||
364 | extra_options++; | ||
365 | continue; | ||
366 | } | ||
367 | |||
368 | extra_options += len; | ||
369 | *value = strtol(extra_options, NULL, 0); | ||
370 | |||
371 | p = strchr(extra_options, ';'); | ||
372 | if (p) | ||
373 | extra_options = p + 1; | ||
374 | else | ||
375 | extra_options = NULL; | ||
376 | } | ||
377 | return extra_options; | ||
378 | } | ||
379 | |||
380 | /* inline is just to avoid need to ifdef around it */ | ||
381 | static inline const char * | ||
382 | _ecore_evas_parse_extra_options_x(const char *extra_options, char **disp_name, unsigned int *parent) | ||
383 | { | ||
384 | _ecore_evas_parse_extra_options_str(extra_options, "display=", disp_name); | ||
385 | _ecore_evas_parse_extra_options_uint(extra_options, "parent=", parent); | ||
386 | return extra_options; | ||
387 | } | ||
388 | |||
389 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
390 | static Ecore_Evas * | ||
391 | _ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *extra_options) | ||
392 | { | ||
393 | unsigned int parent = 0; | ||
394 | char *disp_name = NULL; | ||
395 | Ecore_Evas *ee; | ||
396 | |||
397 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
398 | ee = ecore_evas_software_x11_new(disp_name, parent, x, y, w, h); | ||
399 | free(disp_name); | ||
400 | |||
401 | return ee; | ||
402 | } | ||
403 | #endif | ||
404 | |||
405 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
406 | static Ecore_Evas * | ||
407 | _ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_options) | ||
408 | { | ||
409 | char *name = NULL; | ||
410 | Ecore_Evas *ee; | ||
411 | |||
412 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
413 | ee = ecore_evas_cocoa_new(NULL, x, y, w, h); | ||
414 | free(name); | ||
415 | |||
416 | if (ee) ecore_evas_move(ee, x, y); | ||
417 | return ee; | ||
418 | } | ||
419 | #endif | ||
420 | |||
421 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
422 | static Ecore_Evas * | ||
423 | _ecore_evas_constructor_opengl_x11(int x, int y, int w, int h, const char *extra_options) | ||
424 | { | ||
425 | Ecore_X_Window parent = 0; | ||
426 | char *disp_name = NULL; | ||
427 | Ecore_Evas *ee; | ||
428 | |||
429 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
430 | ee = ecore_evas_gl_x11_new(disp_name, parent, x, y, w, h); | ||
431 | free(disp_name); | ||
432 | |||
433 | return ee; | ||
434 | } | ||
435 | #endif | ||
436 | |||
437 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
438 | static Ecore_Evas * | ||
439 | _ecore_evas_constructor_software_8_x11(int x, int y, int w, int h, const char *extra_options) | ||
440 | { | ||
441 | Ecore_X_Window parent = 0; | ||
442 | char *disp_name = NULL; | ||
443 | Ecore_Evas *ee; | ||
444 | |||
445 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
446 | ee = ecore_evas_software_x11_8_new(disp_name, parent, x, y, w, h); | ||
447 | free(disp_name); | ||
448 | |||
449 | return ee; | ||
450 | } | ||
451 | #endif | ||
452 | |||
453 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
454 | static Ecore_Evas * | ||
455 | _ecore_evas_constructor_software_16_x11(int x, int y, int w, int h, const char *extra_options) | ||
456 | { | ||
457 | Ecore_X_Window parent = 0; | ||
458 | char *disp_name = NULL; | ||
459 | Ecore_Evas *ee; | ||
460 | |||
461 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
462 | ee = ecore_evas_software_x11_16_new(disp_name, parent, x, y, w, h); | ||
463 | free(disp_name); | ||
464 | |||
465 | return ee; | ||
466 | } | ||
467 | #endif | ||
468 | |||
469 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
470 | static Ecore_Evas * | ||
471 | _ecore_evas_constructor_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) | ||
472 | { | ||
473 | Ecore_Evas *ee; | ||
474 | unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0; | ||
475 | char *name = NULL; | ||
476 | |||
477 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
478 | _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); | ||
479 | _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface); | ||
480 | _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe); | ||
481 | _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha); | ||
482 | |||
483 | ee = ecore_evas_sdl_new(name, w, h, fullscreen, hwsurface, noframe, alpha); | ||
484 | free(name); | ||
485 | |||
486 | return ee; | ||
487 | } | ||
488 | |||
489 | static Ecore_Evas * | ||
490 | _ecore_evas_constructor_sdl16(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) | ||
491 | { | ||
492 | Ecore_Evas *ee; | ||
493 | unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0; | ||
494 | char *name = NULL; | ||
495 | |||
496 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
497 | _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); | ||
498 | _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface); | ||
499 | _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha); | ||
500 | |||
501 | ee = ecore_evas_sdl16_new(name, w, h, fullscreen, hwsurface, noframe, alpha); | ||
502 | free(name); | ||
503 | |||
504 | return ee; | ||
505 | } | ||
506 | #endif | ||
507 | |||
508 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
509 | static Ecore_Evas * | ||
510 | _ecore_evas_constructor_opengl_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) | ||
511 | { | ||
512 | Ecore_Evas *ee; | ||
513 | unsigned int fullscreen = 0, noframe = 0; | ||
514 | char *name = NULL; | ||
515 | |||
516 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
517 | _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); | ||
518 | _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe); | ||
519 | |||
520 | ee = ecore_evas_gl_sdl_new(name, w, h, fullscreen, noframe); | ||
521 | free(name); | ||
522 | |||
523 | return ee; | ||
524 | } | ||
525 | #endif | ||
526 | |||
527 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
528 | static Ecore_Evas * | ||
529 | _ecore_evas_constructor_directfb(int x, int y, int w, int h, const char *extra_options) | ||
530 | { | ||
531 | Ecore_Evas *ee; | ||
532 | char *disp_name = NULL; | ||
533 | unsigned int windowed = 1; | ||
534 | |||
535 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
536 | _ecore_evas_parse_extra_options_uint(extra_options, "windowed=", &windowed); | ||
537 | |||
538 | ee = ecore_evas_directfb_new(disp_name, windowed, x, y, w, h); | ||
539 | free(disp_name); | ||
540 | |||
541 | return ee; | ||
542 | } | ||
543 | #endif | ||
544 | |||
545 | #ifdef BUILD_ECORE_EVAS_FB | ||
546 | static Ecore_Evas * | ||
547 | _ecore_evas_constructor_fb(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) | ||
548 | { | ||
549 | Ecore_Evas *ee; | ||
550 | char *disp_name = NULL; | ||
551 | unsigned int rotation = 0; | ||
552 | |||
553 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
554 | _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation); | ||
555 | |||
556 | ee = ecore_evas_fb_new(disp_name, rotation, w, h); | ||
557 | free(disp_name); | ||
558 | |||
559 | return ee; | ||
560 | } | ||
561 | #endif | ||
562 | |||
563 | |||
564 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
565 | static Ecore_Evas * | ||
566 | _ecore_evas_constructor_psl1ght(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) | ||
567 | { | ||
568 | Ecore_Evas *ee; | ||
569 | char *name = NULL; | ||
570 | |||
571 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
572 | ee = ecore_evas_psl1ght_new(name, w, h); | ||
573 | free(name); | ||
574 | |||
575 | if (ee) ecore_evas_move(ee, x, y); | ||
576 | return ee; | ||
577 | } | ||
578 | #endif | ||
579 | |||
580 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
581 | static Ecore_Evas * | ||
582 | _ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options) | ||
583 | { | ||
584 | return ecore_evas_software_gdi_new(NULL, x, y, w, h); | ||
585 | } | ||
586 | #endif | ||
587 | |||
588 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
589 | static Ecore_Evas * | ||
590 | _ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options) | ||
591 | { | ||
592 | return ecore_evas_software_ddraw_new(NULL, x, y, w, h); | ||
593 | } | ||
594 | #endif | ||
595 | |||
596 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
597 | static Ecore_Evas * | ||
598 | _ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options) | ||
599 | { | ||
600 | return ecore_evas_direct3d_new(NULL, x, y, w, h); | ||
601 | } | ||
602 | #endif | ||
603 | |||
604 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
605 | static Ecore_Evas * | ||
606 | _ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options) | ||
607 | { | ||
608 | return ecore_evas_gl_glew_new(NULL, x, y, w, h); | ||
609 | } | ||
610 | #endif | ||
611 | |||
612 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
613 | static Ecore_Evas * | ||
614 | _ecore_evas_constructor_software_16_ddraw(int x, int y, int w, int h, const char *extra_options) | ||
615 | { | ||
616 | return ecore_evas_software_16_ddraw_new(NULL, x, y, w, h); | ||
617 | } | ||
618 | #endif | ||
619 | |||
620 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
621 | static Ecore_Evas * | ||
622 | _ecore_evas_constructor_software_16_wince(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
623 | { | ||
624 | return ecore_evas_software_wince_new(NULL, x, y, w, h); | ||
625 | } | ||
626 | |||
627 | static Ecore_Evas * | ||
628 | _ecore_evas_constructor_software_16_wince_fb(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
629 | { | ||
630 | return ecore_evas_software_wince_fb_new(NULL, x, y, w, h); | ||
631 | } | ||
632 | |||
633 | static Ecore_Evas * | ||
634 | _ecore_evas_constructor_software_16_wince_gapi(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
635 | { | ||
636 | return ecore_evas_software_wince_gapi_new(NULL, x, y, w, h); | ||
637 | } | ||
638 | |||
639 | static Ecore_Evas * | ||
640 | _ecore_evas_constructor_software_16_wince_gdi(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
641 | { | ||
642 | return ecore_evas_software_wince_gdi_new(NULL, x, y, w, h); | ||
643 | } | ||
644 | #endif | ||
645 | |||
646 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
647 | static Ecore_Evas * | ||
648 | _ecore_evas_constructor_buffer(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options __UNUSED__) | ||
649 | { | ||
650 | return ecore_evas_buffer_new(w, h); | ||
651 | } | ||
652 | #endif | ||
653 | |||
654 | #ifdef BUILD_ECORE_EVAS_EWS | ||
655 | static Ecore_Evas * | ||
656 | _ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
657 | { | ||
658 | return ecore_evas_ews_new(x, y, w, h); | ||
659 | } | ||
660 | #endif | ||
661 | |||
662 | /* note: keep sorted by priority, highest first */ | ||
663 | static const struct ecore_evas_engine _engines[] = { | ||
664 | /* unix */ | ||
665 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
666 | {"software_x11", _ecore_evas_constructor_software_x11}, | ||
667 | #endif | ||
668 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
669 | {"opengl_x11", _ecore_evas_constructor_opengl_x11}, | ||
670 | #endif | ||
671 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
672 | {"software_8_x11", _ecore_evas_constructor_software_8_x11}, | ||
673 | #endif | ||
674 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
675 | {"software_16_x11", _ecore_evas_constructor_software_16_x11}, | ||
676 | #endif | ||
677 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
678 | {"directfb", _ecore_evas_constructor_directfb}, | ||
679 | #endif | ||
680 | #ifdef BUILD_ECORE_EVAS_FB | ||
681 | {"fb", _ecore_evas_constructor_fb}, | ||
682 | #endif | ||
683 | |||
684 | /* windows */ | ||
685 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
686 | {"software_gdi", _ecore_evas_constructor_software_gdi}, | ||
687 | #endif | ||
688 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
689 | {"software_ddraw", _ecore_evas_constructor_software_ddraw}, | ||
690 | #endif | ||
691 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
692 | {"direct3d", _ecore_evas_constructor_direct3d}, | ||
693 | #endif | ||
694 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
695 | {"opengl_glew", _ecore_evas_constructor_opengl_glew}, | ||
696 | #endif | ||
697 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
698 | {"software_16_ddraw", _ecore_evas_constructor_software_16_ddraw}, | ||
699 | #endif | ||
700 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
701 | {"software_16_wince", _ecore_evas_constructor_software_16_wince}, | ||
702 | {"software_16_wince_fb", _ecore_evas_constructor_software_16_wince_fb}, | ||
703 | {"software_16_wince_gapi", _ecore_evas_constructor_software_16_wince_gapi}, | ||
704 | {"software_16_wince_gdi", _ecore_evas_constructor_software_16_wince_gdi}, | ||
705 | #endif | ||
706 | |||
707 | /* Apple */ | ||
708 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
709 | {"opengl_cocoa", _ecore_evas_constructor_cocoa}, | ||
710 | #endif | ||
711 | |||
712 | /* PS3 support */ | ||
713 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
714 | {"psl1ght", _ecore_evas_constructor_psl1ght}, | ||
715 | #endif | ||
716 | |||
717 | /* Last chance to have a window */ | ||
718 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
719 | {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, | ||
720 | #endif | ||
721 | |||
722 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
723 | {"sdl", _ecore_evas_constructor_sdl}, | ||
724 | {"software_16_sdl", _ecore_evas_constructor_sdl16}, | ||
725 | #endif | ||
726 | |||
727 | /* independent */ | ||
728 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
729 | {"buffer", _ecore_evas_constructor_buffer}, | ||
730 | #endif | ||
731 | |||
732 | #ifdef BUILD_ECORE_EVAS_EWS | ||
733 | {"ews", _ecore_evas_constructor_ews}, | ||
734 | #endif | ||
735 | {NULL, NULL} | ||
736 | }; | ||
737 | |||
738 | EAPI Eina_List * | ||
739 | ecore_evas_engines_get(void) | ||
740 | { | ||
741 | const struct ecore_evas_engine *itr; | ||
742 | Eina_List *lst = NULL; | ||
743 | |||
744 | for (itr = _engines; itr->name; itr++) | ||
745 | lst = eina_list_append(lst, itr->name); | ||
746 | |||
747 | return lst; | ||
748 | } | ||
749 | |||
750 | EAPI void | ||
751 | ecore_evas_engines_free(Eina_List *engines) | ||
752 | { | ||
753 | eina_list_free(engines); | ||
754 | } | ||
755 | |||
756 | static Ecore_Evas * | ||
757 | _ecore_evas_new_auto_discover(int x, int y, int w, int h, const char *extra_options) | ||
758 | { | ||
759 | const struct ecore_evas_engine *itr; | ||
760 | |||
761 | DBG("auto discover engine"); | ||
762 | |||
763 | for (itr = _engines; itr->constructor; itr++) | ||
764 | { | ||
765 | Ecore_Evas *ee = itr->constructor(x, y, w, h, extra_options); | ||
766 | if (ee) | ||
767 | { | ||
768 | INF("auto discovered '%s'", itr->name); | ||
769 | return ee; | ||
770 | } | ||
771 | } | ||
772 | |||
773 | WRN("could not auto discover."); | ||
774 | return NULL; | ||
775 | } | ||
776 | |||
777 | EAPI Ecore_Evas * | ||
778 | ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options) | ||
779 | { | ||
780 | const struct ecore_evas_engine *itr; | ||
781 | |||
782 | if (!engine_name) | ||
783 | { | ||
784 | engine_name = getenv("ECORE_EVAS_ENGINE"); | ||
785 | if (engine_name) | ||
786 | DBG("no engine_name provided, using ECORE_EVAS_ENGINE='%s'", | ||
787 | engine_name); | ||
788 | } | ||
789 | if (!engine_name) | ||
790 | return _ecore_evas_new_auto_discover(x, y, w, h, extra_options); | ||
791 | |||
792 | for (itr = _engines; itr->name; itr++) | ||
793 | if (strcmp(itr->name, engine_name) == 0) | ||
794 | { | ||
795 | INF("using engine '%s', extra_options=%s", | ||
796 | engine_name, extra_options ? extra_options : "(null)"); | ||
797 | return itr->constructor(x, y, w, h, extra_options); | ||
798 | } | ||
799 | |||
800 | WRN("unknown engine '%s'", engine_name); | ||
801 | return NULL; | ||
802 | } | ||
803 | |||
804 | EAPI const char * | ||
805 | ecore_evas_engine_name_get(const Ecore_Evas *ee) | ||
806 | { | ||
807 | if (!ee) | ||
808 | return NULL; | ||
809 | return ee->driver; | ||
810 | } | ||
811 | |||
812 | EAPI Ecore_Evas * | ||
813 | ecore_evas_ecore_evas_get(const Evas *e) | ||
814 | { | ||
815 | Ecore_Evas *ee = evas_data_attach_get(e); | ||
816 | if (!ee) return NULL; | ||
817 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
818 | { | ||
819 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get"); | ||
820 | return NULL; | ||
821 | } | ||
822 | return ee; | ||
823 | } | ||
824 | |||
825 | EAPI void | ||
826 | ecore_evas_free(Ecore_Evas *ee) | ||
827 | { | ||
828 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
829 | { | ||
830 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
831 | "ecore_evas_free"); | ||
832 | return; | ||
833 | } | ||
834 | _ecore_evas_free(ee); | ||
835 | return; | ||
836 | } | ||
837 | |||
838 | EAPI void * | ||
839 | ecore_evas_data_get(const Ecore_Evas *ee, const char *key) | ||
840 | { | ||
841 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
842 | { | ||
843 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
844 | "ecore_evas_data_get"); | ||
845 | return NULL; | ||
846 | } | ||
847 | |||
848 | if (!key) return NULL; | ||
849 | if (!ee->data) return NULL; | ||
850 | |||
851 | return eina_hash_find(ee->data, key); | ||
852 | } | ||
853 | |||
854 | EAPI void | ||
855 | ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data) | ||
856 | { | ||
857 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
858 | { | ||
859 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
860 | "ecore_evas_data_set"); | ||
861 | return; | ||
862 | } | ||
863 | |||
864 | if (!key) return; | ||
865 | |||
866 | if (ee->data) | ||
867 | eina_hash_del(ee->data, key, NULL); | ||
868 | if (data) | ||
869 | { | ||
870 | if (!ee->data) | ||
871 | ee->data = eina_hash_string_superfast_new(NULL); | ||
872 | eina_hash_add(ee->data, key, data); | ||
873 | } | ||
874 | } | ||
875 | |||
876 | #define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn | ||
877 | #define IFE return;} | ||
878 | |||
879 | EAPI void | ||
880 | ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
881 | { | ||
882 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
883 | { | ||
884 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
885 | "ecore_evas_callback_resize_set"); | ||
886 | return; | ||
887 | } | ||
888 | IFC(ee, fn_callback_resize_set) (ee, func); | ||
889 | IFE; | ||
890 | ee->func.fn_resize = func; | ||
891 | } | ||
892 | |||
893 | EAPI void | ||
894 | ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
895 | { | ||
896 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
897 | { | ||
898 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
899 | "ecore_evas_callback_move_set"); | ||
900 | return; | ||
901 | } | ||
902 | IFC(ee, fn_callback_move_set) (ee, func); | ||
903 | IFE; | ||
904 | ee->func.fn_move = func; | ||
905 | } | ||
906 | |||
907 | EAPI void | ||
908 | ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
909 | { | ||
910 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
911 | { | ||
912 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
913 | "ecore_evas_callback_show_set"); | ||
914 | return; | ||
915 | } | ||
916 | IFC(ee, fn_callback_show_set) (ee, func); | ||
917 | IFE; | ||
918 | ee->func.fn_show = func; | ||
919 | } | ||
920 | |||
921 | EAPI void | ||
922 | ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
923 | { | ||
924 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
925 | { | ||
926 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
927 | "ecore_evas_callback_hide_set"); | ||
928 | return; | ||
929 | } | ||
930 | IFC(ee, fn_callback_hide_set) (ee, func); | ||
931 | IFE; | ||
932 | ee->func.fn_hide = func; | ||
933 | } | ||
934 | |||
935 | EAPI void | ||
936 | ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
937 | { | ||
938 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
939 | { | ||
940 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
941 | "ecore_evas_callback_delete_request_set"); | ||
942 | return; | ||
943 | } | ||
944 | IFC(ee, fn_callback_delete_request_set) (ee, func); | ||
945 | IFE; | ||
946 | ee->func.fn_delete_request = func; | ||
947 | } | ||
948 | |||
949 | EAPI void | ||
950 | ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
951 | { | ||
952 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
953 | { | ||
954 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
955 | "ecore_evas_callback_destroy_set"); | ||
956 | return; | ||
957 | } | ||
958 | IFC(ee, fn_callback_destroy_set) (ee, func); | ||
959 | IFE; | ||
960 | ee->func.fn_destroy = func; | ||
961 | } | ||
962 | |||
963 | EAPI void | ||
964 | ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
965 | { | ||
966 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
967 | { | ||
968 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
969 | "ecore_evas_callback_focus_in_set"); | ||
970 | return; | ||
971 | } | ||
972 | IFC(ee, fn_callback_focus_in_set) (ee, func); | ||
973 | IFE; | ||
974 | ee->func.fn_focus_in = func; | ||
975 | } | ||
976 | |||
977 | EAPI void | ||
978 | ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
979 | { | ||
980 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
981 | { | ||
982 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
983 | "ecore_evas_callback_focus_out_set"); | ||
984 | return; | ||
985 | } | ||
986 | IFC(ee, fn_callback_focus_out_set) (ee, func); | ||
987 | IFE; | ||
988 | ee->func.fn_focus_out = func; | ||
989 | } | ||
990 | |||
991 | EAPI void | ||
992 | ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
993 | { | ||
994 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
995 | { | ||
996 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
997 | "ecore_evas_callback_sticky_set"); | ||
998 | return; | ||
999 | } | ||
1000 | IFC(ee, fn_callback_sticky_set) (ee, func); | ||
1001 | IFE; | ||
1002 | ee->func.fn_sticky = func; | ||
1003 | } | ||
1004 | |||
1005 | EAPI void | ||
1006 | ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
1007 | { | ||
1008 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1009 | { | ||
1010 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1011 | "ecore_evas_callback_unsticky_set"); | ||
1012 | return; | ||
1013 | } | ||
1014 | IFC(ee, fn_callback_unsticky_set) (ee, func); | ||
1015 | IFE; | ||
1016 | ee->func.fn_unsticky = func; | ||
1017 | } | ||
1018 | |||
1019 | EAPI void | ||
1020 | ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
1021 | { | ||
1022 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1023 | { | ||
1024 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1025 | "ecore_evas_callback_mouse_in_set"); | ||
1026 | return; | ||
1027 | } | ||
1028 | IFC(ee, fn_callback_mouse_in_set) (ee, func); | ||
1029 | IFE; | ||
1030 | ee->func.fn_mouse_in = func; | ||
1031 | } | ||
1032 | |||
1033 | EAPI void | ||
1034 | ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
1035 | { | ||
1036 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1037 | { | ||
1038 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1039 | "ecore_evas_callback_mouse_out_set"); | ||
1040 | return; | ||
1041 | } | ||
1042 | IFC(ee, fn_callback_mouse_out_set) (ee, func); | ||
1043 | IFE; | ||
1044 | ee->func.fn_mouse_out = func; | ||
1045 | } | ||
1046 | |||
1047 | EAPI void | ||
1048 | ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
1049 | { | ||
1050 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1051 | { | ||
1052 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1053 | "ecore_evas_callback_pre_render_set"); | ||
1054 | return; | ||
1055 | } | ||
1056 | IFC(ee, fn_callback_pre_render_set) (ee, func); | ||
1057 | IFE; | ||
1058 | ee->func.fn_pre_render = func; | ||
1059 | } | ||
1060 | |||
1061 | EAPI void | ||
1062 | ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
1063 | { | ||
1064 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1065 | { | ||
1066 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1067 | "ecore_evas_callback_post_render_set"); | ||
1068 | return; | ||
1069 | } | ||
1070 | IFC(ee, fn_callback_post_render_set) (ee, func); | ||
1071 | IFE; | ||
1072 | ee->func.fn_post_render = func; | ||
1073 | } | ||
1074 | |||
1075 | EAPI void | ||
1076 | ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
1077 | { | ||
1078 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1079 | { | ||
1080 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1081 | "ecore_evas_callback_pre_free_set"); | ||
1082 | return; | ||
1083 | } | ||
1084 | ee->func.fn_pre_free = func; | ||
1085 | } | ||
1086 | |||
1087 | /** | ||
1088 | * Get an Ecore_Evas's Evas | ||
1089 | * @param ee The Ecore_Evas whose Evas you wish to get | ||
1090 | * @return The Evas wrapped by @p ee | ||
1091 | * | ||
1092 | * This function returns the Evas contained within @p ee. | ||
1093 | */ | ||
1094 | EAPI Evas * | ||
1095 | ecore_evas_get(const Ecore_Evas *ee) | ||
1096 | { | ||
1097 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1098 | { | ||
1099 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1100 | "ecore_evas_get"); | ||
1101 | return NULL; | ||
1102 | } | ||
1103 | return ee->evas; | ||
1104 | } | ||
1105 | |||
1106 | EAPI void | ||
1107 | ecore_evas_move(Ecore_Evas *ee, int x, int y) | ||
1108 | { | ||
1109 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1110 | { | ||
1111 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1112 | "ecore_evas_move"); | ||
1113 | return; | ||
1114 | } | ||
1115 | if (ee->prop.fullscreen) return; | ||
1116 | IFC(ee, fn_move) (ee, x, y); | ||
1117 | IFE; | ||
1118 | } | ||
1119 | |||
1120 | /** | ||
1121 | * Provide Managed move co-ordinates for an Ecore_Evas | ||
1122 | * @param ee The Ecore_Evas to move | ||
1123 | * @param x The x coordinate to set as the managed location | ||
1124 | * @param y The y coordinate to set as the managed location | ||
1125 | * | ||
1126 | * This sets the managed geometry position of the @p ee to (@p x, @p y) | ||
1127 | */ | ||
1128 | EAPI void | ||
1129 | ecore_evas_managed_move(Ecore_Evas *ee, int x, int y) | ||
1130 | { | ||
1131 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1132 | { | ||
1133 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1134 | "ecore_evas_move"); | ||
1135 | return; | ||
1136 | } | ||
1137 | IFC(ee, fn_managed_move) (ee, x, y); | ||
1138 | IFE; | ||
1139 | } | ||
1140 | |||
1141 | EAPI void | ||
1142 | ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
1143 | { | ||
1144 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1145 | { | ||
1146 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1147 | "ecore_evas_resize"); | ||
1148 | return; | ||
1149 | } | ||
1150 | if (ee->prop.fullscreen) return; | ||
1151 | if (w < 1) w = 1; | ||
1152 | if (h < 1) h = 1; | ||
1153 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1154 | { | ||
1155 | IFC(ee, fn_resize) (ee, h, w); | ||
1156 | IFE; | ||
1157 | } | ||
1158 | else | ||
1159 | { | ||
1160 | IFC(ee, fn_resize) (ee, w, h); | ||
1161 | IFE; | ||
1162 | } | ||
1163 | } | ||
1164 | |||
1165 | EAPI void | ||
1166 | ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) | ||
1167 | { | ||
1168 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1169 | { | ||
1170 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1171 | "ecore_evas_move_resize"); | ||
1172 | return; | ||
1173 | } | ||
1174 | if (ee->prop.fullscreen) return; | ||
1175 | if (w < 1) w = 1; | ||
1176 | if (h < 1) h = 1; | ||
1177 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1178 | { | ||
1179 | IFC(ee, fn_move_resize) (ee, x, y, h, w); | ||
1180 | IFE; | ||
1181 | } | ||
1182 | else | ||
1183 | { | ||
1184 | IFC(ee, fn_move_resize) (ee, x, y, w, h); | ||
1185 | IFE; | ||
1186 | } | ||
1187 | } | ||
1188 | |||
1189 | EAPI void | ||
1190 | ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) | ||
1191 | { | ||
1192 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1193 | { | ||
1194 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1195 | "ecore_evas_geometry_get"); | ||
1196 | return; | ||
1197 | } | ||
1198 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1199 | { | ||
1200 | if (x) *x = ee->x; | ||
1201 | if (y) *y = ee->y; | ||
1202 | if (w) *w = ee->h; | ||
1203 | if (h) *h = ee->w; | ||
1204 | } | ||
1205 | else | ||
1206 | { | ||
1207 | if (x) *x = ee->x; | ||
1208 | if (y) *y = ee->y; | ||
1209 | if (w) *w = ee->w; | ||
1210 | if (h) *h = ee->h; | ||
1211 | } | ||
1212 | } | ||
1213 | |||
1214 | EAPI void | ||
1215 | ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) | ||
1216 | { | ||
1217 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1218 | { | ||
1219 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1220 | "ecore_evas_request_geometry_get"); | ||
1221 | return; | ||
1222 | } | ||
1223 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1224 | { | ||
1225 | if (x) *x = ee->req.x; | ||
1226 | if (y) *y = ee->req.y; | ||
1227 | if (w) *w = ee->req.h; | ||
1228 | if (h) *h = ee->req.w; | ||
1229 | } | ||
1230 | else | ||
1231 | { | ||
1232 | if (x) *x = ee->req.x; | ||
1233 | if (y) *y = ee->req.y; | ||
1234 | if (w) *w = ee->req.w; | ||
1235 | if (h) *h = ee->req.h; | ||
1236 | } | ||
1237 | } | ||
1238 | |||
1239 | EAPI void | ||
1240 | ecore_evas_rotation_set(Ecore_Evas *ee, int rot) | ||
1241 | { | ||
1242 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1243 | { | ||
1244 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1245 | "ecore_evas_rotation_set"); | ||
1246 | return; | ||
1247 | } | ||
1248 | rot = rot % 360; | ||
1249 | while (rot < 0) rot += 360; | ||
1250 | while (rot >= 360) rot -= 360; | ||
1251 | IFC(ee, fn_rotation_set) (ee, rot, 0); | ||
1252 | /* make sure everything gets redrawn */ | ||
1253 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1254 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1255 | IFE; | ||
1256 | } | ||
1257 | |||
1258 | EAPI void | ||
1259 | ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot) | ||
1260 | { | ||
1261 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1262 | { | ||
1263 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1264 | "ecore_evas_rotation_set"); | ||
1265 | return; | ||
1266 | } | ||
1267 | rot = rot % 360; | ||
1268 | while (rot < 0) rot += 360; | ||
1269 | while (rot >= 360) rot -= 360; | ||
1270 | IFC(ee, fn_rotation_set) (ee, rot, 1); | ||
1271 | /* make sure everything gets redrawn */ | ||
1272 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1273 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1274 | IFE; | ||
1275 | } | ||
1276 | |||
1277 | EAPI int | ||
1278 | ecore_evas_rotation_get(const Ecore_Evas *ee) | ||
1279 | { | ||
1280 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1281 | { | ||
1282 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1283 | "ecore_evas_rotation_get"); | ||
1284 | return 0; | ||
1285 | } | ||
1286 | return ee->rotation; | ||
1287 | } | ||
1288 | |||
1289 | /** | ||
1290 | * Set whether an Ecore_Evas is shaped or not. | ||
1291 | * @param ee The Ecore_Evas to shape | ||
1292 | * @param shaped EINA_TRUE to shape, EINA_FALSE to not | ||
1293 | * | ||
1294 | * This function allows one to make an Ecore_Evas shaped to the contents of the | ||
1295 | * evas. If @p shaped is EINA_TRUE, @p ee will be transparent in parts of the evas that | ||
1296 | * contain no objects. If @p shaped is EINA_FALSE, then @p ee will be rectangular, and | ||
1297 | * and parts with no data will show random framebuffer artifacting. For | ||
1298 | * non-shaped Ecore_Evases, it is recommend to cover the entire evas with a | ||
1299 | * background object. | ||
1300 | */ | ||
1301 | EAPI void | ||
1302 | ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped) | ||
1303 | { | ||
1304 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1305 | { | ||
1306 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1307 | "ecore_evas_shaped_set"); | ||
1308 | return; | ||
1309 | } | ||
1310 | IFC(ee, fn_shaped_set) (ee, shaped); | ||
1311 | IFE; | ||
1312 | } | ||
1313 | |||
1314 | /** | ||
1315 | * Query whether an Ecore_Evas is shaped or not. | ||
1316 | * @param ee The Ecore_Evas to query. | ||
1317 | * @return EINA_TRUE if shaped, EINA_FALSE if not. | ||
1318 | * | ||
1319 | * This function returns EINA_TRUE if @p ee is shaped, and EINA_FALSE if not. | ||
1320 | */ | ||
1321 | EAPI Eina_Bool | ||
1322 | ecore_evas_shaped_get(const Ecore_Evas *ee) | ||
1323 | { | ||
1324 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1325 | { | ||
1326 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1327 | "ecore_evas_shaped_get"); | ||
1328 | return EINA_FALSE; | ||
1329 | } | ||
1330 | return ee->shaped ? EINA_TRUE : EINA_FALSE; | ||
1331 | } | ||
1332 | |||
1333 | EAPI void | ||
1334 | ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha) | ||
1335 | { | ||
1336 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1337 | { | ||
1338 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1339 | "ecore_evas_alpha_set"); | ||
1340 | return; | ||
1341 | } | ||
1342 | IFC(ee, fn_alpha_set) (ee, alpha); | ||
1343 | IFE; | ||
1344 | } | ||
1345 | |||
1346 | EAPI Eina_Bool | ||
1347 | ecore_evas_alpha_get(const Ecore_Evas *ee) | ||
1348 | { | ||
1349 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1350 | { | ||
1351 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1352 | "ecore_evas_alpha_get"); | ||
1353 | return EINA_FALSE; | ||
1354 | } | ||
1355 | return ee->alpha ? EINA_TRUE : EINA_FALSE; | ||
1356 | } | ||
1357 | |||
1358 | EAPI void | ||
1359 | ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent) | ||
1360 | { | ||
1361 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1362 | { | ||
1363 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1364 | "ecore_evas_transparent_set"); | ||
1365 | return; | ||
1366 | } | ||
1367 | IFC(ee, fn_transparent_set) (ee, transparent); | ||
1368 | IFE; | ||
1369 | } | ||
1370 | |||
1371 | EAPI Eina_Bool | ||
1372 | ecore_evas_transparent_get(const Ecore_Evas *ee) | ||
1373 | { | ||
1374 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1375 | { | ||
1376 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1377 | "ecore_evas_transparent_get"); | ||
1378 | return EINA_FALSE; | ||
1379 | } | ||
1380 | return ee->transparent ? EINA_TRUE : 0; | ||
1381 | } | ||
1382 | |||
1383 | EAPI void | ||
1384 | ecore_evas_show(Ecore_Evas *ee) | ||
1385 | { | ||
1386 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1387 | { | ||
1388 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1389 | "ecore_evas_show"); | ||
1390 | return; | ||
1391 | } | ||
1392 | IFC(ee, fn_show) (ee); | ||
1393 | IFE; | ||
1394 | } | ||
1395 | |||
1396 | EAPI void | ||
1397 | ecore_evas_hide(Ecore_Evas *ee) | ||
1398 | { | ||
1399 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1400 | { | ||
1401 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1402 | "ecore_evas_hide"); | ||
1403 | return; | ||
1404 | } | ||
1405 | IFC(ee, fn_hide) (ee); | ||
1406 | IFE; | ||
1407 | } | ||
1408 | |||
1409 | EAPI int | ||
1410 | ecore_evas_visibility_get(const Ecore_Evas *ee) | ||
1411 | { | ||
1412 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1413 | { | ||
1414 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1415 | "ecore_evas_visibility_get"); | ||
1416 | return 0; | ||
1417 | } | ||
1418 | return ee->visible ? 1:0; | ||
1419 | } | ||
1420 | |||
1421 | EAPI void | ||
1422 | ecore_evas_raise(Ecore_Evas *ee) | ||
1423 | { | ||
1424 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1425 | { | ||
1426 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1427 | "ecore_evas_raise"); | ||
1428 | return; | ||
1429 | } | ||
1430 | IFC(ee, fn_raise) (ee); | ||
1431 | IFE; | ||
1432 | } | ||
1433 | |||
1434 | EAPI void | ||
1435 | ecore_evas_lower(Ecore_Evas *ee) | ||
1436 | { | ||
1437 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1438 | { | ||
1439 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1440 | "ecore_evas_lower"); | ||
1441 | return; | ||
1442 | } | ||
1443 | IFC(ee, fn_lower) (ee); | ||
1444 | IFE; | ||
1445 | } | ||
1446 | |||
1447 | /** | ||
1448 | * Activate (set focus to, via the window manager) an Ecore_Evas' window. | ||
1449 | * @param ee The Ecore_Evas to activate. | ||
1450 | * | ||
1451 | * This functions activates the Ecore_Evas. | ||
1452 | */ | ||
1453 | EAPI void | ||
1454 | ecore_evas_activate(Ecore_Evas *ee) | ||
1455 | { | ||
1456 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1457 | { | ||
1458 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1459 | "ecore_evas_activate"); | ||
1460 | return; | ||
1461 | } | ||
1462 | IFC(ee, fn_activate) (ee); | ||
1463 | IFE; | ||
1464 | } | ||
1465 | |||
1466 | EAPI void | ||
1467 | ecore_evas_title_set(Ecore_Evas *ee, const char *t) | ||
1468 | { | ||
1469 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1470 | { | ||
1471 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1472 | "ecore_evas_title_set"); | ||
1473 | return; | ||
1474 | } | ||
1475 | IFC(ee, fn_title_set) (ee, t); | ||
1476 | IFE; | ||
1477 | } | ||
1478 | |||
1479 | EAPI const char * | ||
1480 | ecore_evas_title_get(const Ecore_Evas *ee) | ||
1481 | { | ||
1482 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1483 | { | ||
1484 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1485 | "ecore_evas_title_get"); | ||
1486 | return NULL; | ||
1487 | } | ||
1488 | return ee->prop.title; | ||
1489 | } | ||
1490 | |||
1491 | EAPI void | ||
1492 | ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
1493 | { | ||
1494 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1495 | { | ||
1496 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1497 | "ecore_evas_name_class_set"); | ||
1498 | return; | ||
1499 | } | ||
1500 | IFC(ee, fn_name_class_set) (ee, n, c); | ||
1501 | IFE; | ||
1502 | } | ||
1503 | |||
1504 | EAPI void | ||
1505 | ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c) | ||
1506 | { | ||
1507 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1508 | { | ||
1509 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1510 | "ecore_evas_name_class_get"); | ||
1511 | return; | ||
1512 | } | ||
1513 | if (n) *n = ee->prop.name; | ||
1514 | if (c) *c = ee->prop.clas; | ||
1515 | } | ||
1516 | |||
1517 | EAPI void | ||
1518 | ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h) | ||
1519 | { | ||
1520 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1521 | { | ||
1522 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1523 | "ecore_evas_size_min_set"); | ||
1524 | return; | ||
1525 | } | ||
1526 | if (w < 0) w = 0; | ||
1527 | if (h < 0) h = 0; | ||
1528 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1529 | { | ||
1530 | IFC(ee, fn_size_min_set) (ee, h, w); | ||
1531 | IFE; | ||
1532 | } | ||
1533 | else | ||
1534 | { | ||
1535 | IFC(ee, fn_size_min_set) (ee, w, h); | ||
1536 | IFE; | ||
1537 | } | ||
1538 | } | ||
1539 | |||
1540 | EAPI void | ||
1541 | ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h) | ||
1542 | { | ||
1543 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1544 | { | ||
1545 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1546 | "ecore_evas_size_min_get"); | ||
1547 | return; | ||
1548 | } | ||
1549 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1550 | { | ||
1551 | if (w) *w = ee->prop.min.h; | ||
1552 | if (h) *h = ee->prop.min.w; | ||
1553 | } | ||
1554 | else | ||
1555 | { | ||
1556 | if (w) *w = ee->prop.min.w; | ||
1557 | if (h) *h = ee->prop.min.h; | ||
1558 | } | ||
1559 | } | ||
1560 | |||
1561 | EAPI void | ||
1562 | ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h) | ||
1563 | { | ||
1564 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1565 | { | ||
1566 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1567 | "ecore_evas_size_max_set"); | ||
1568 | return; | ||
1569 | } | ||
1570 | if (w < 0) w = 0; | ||
1571 | if (h < 0) h = 0; | ||
1572 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1573 | { | ||
1574 | IFC(ee, fn_size_max_set) (ee, h, w); | ||
1575 | IFE; | ||
1576 | } | ||
1577 | else | ||
1578 | { | ||
1579 | IFC(ee, fn_size_max_set) (ee, w, h); | ||
1580 | IFE; | ||
1581 | } | ||
1582 | } | ||
1583 | |||
1584 | EAPI void | ||
1585 | ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h) | ||
1586 | { | ||
1587 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1588 | { | ||
1589 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1590 | "ecore_evas_size_max_get"); | ||
1591 | return; | ||
1592 | } | ||
1593 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1594 | { | ||
1595 | if (w) *w = ee->prop.max.h; | ||
1596 | if (h) *h = ee->prop.max.w; | ||
1597 | } | ||
1598 | else | ||
1599 | { | ||
1600 | if (w) *w = ee->prop.max.w; | ||
1601 | if (h) *h = ee->prop.max.h; | ||
1602 | } | ||
1603 | } | ||
1604 | |||
1605 | EAPI void | ||
1606 | ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h) | ||
1607 | { | ||
1608 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1609 | { | ||
1610 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1611 | "ecore_evas_size_base_set"); | ||
1612 | return; | ||
1613 | } | ||
1614 | if (w < 0) w = 0; | ||
1615 | if (h < 0) h = 0; | ||
1616 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1617 | { | ||
1618 | IFC(ee, fn_size_base_set) (ee, h, w); | ||
1619 | IFE; | ||
1620 | } | ||
1621 | else | ||
1622 | { | ||
1623 | IFC(ee, fn_size_base_set) (ee, w, h); | ||
1624 | IFE; | ||
1625 | } | ||
1626 | } | ||
1627 | |||
1628 | EAPI void | ||
1629 | ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h) | ||
1630 | { | ||
1631 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1632 | { | ||
1633 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1634 | "ecore_evas_size_base_get"); | ||
1635 | return; | ||
1636 | } | ||
1637 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1638 | { | ||
1639 | if (w) *w = ee->prop.base.h; | ||
1640 | if (h) *h = ee->prop.base.w; | ||
1641 | } | ||
1642 | else | ||
1643 | { | ||
1644 | if (w) *w = ee->prop.base.w; | ||
1645 | if (h) *h = ee->prop.base.h; | ||
1646 | } | ||
1647 | } | ||
1648 | |||
1649 | EAPI void | ||
1650 | ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h) | ||
1651 | { | ||
1652 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1653 | { | ||
1654 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1655 | "ecore_evas_size_step_set"); | ||
1656 | return; | ||
1657 | } | ||
1658 | if (w < 0) w = 0; | ||
1659 | if (h < 0) h = 0; | ||
1660 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1661 | { | ||
1662 | IFC(ee, fn_size_step_set) (ee, h, w); | ||
1663 | IFE; | ||
1664 | } | ||
1665 | else | ||
1666 | { | ||
1667 | IFC(ee, fn_size_step_set) (ee, w, h); | ||
1668 | IFE; | ||
1669 | } | ||
1670 | } | ||
1671 | |||
1672 | EAPI void | ||
1673 | ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h) | ||
1674 | { | ||
1675 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1676 | { | ||
1677 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1678 | "ecore_evas_size_step_get"); | ||
1679 | return; | ||
1680 | } | ||
1681 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1682 | { | ||
1683 | if (w) *w = ee->prop.step.h; | ||
1684 | if (h) *h = ee->prop.step.w; | ||
1685 | } | ||
1686 | else | ||
1687 | { | ||
1688 | if (w) *w = ee->prop.step.w; | ||
1689 | if (h) *h = ee->prop.step.h; | ||
1690 | } | ||
1691 | } | ||
1692 | |||
1693 | EAPI void | ||
1694 | ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y) | ||
1695 | { | ||
1696 | Evas_Object *obj = NULL; | ||
1697 | |||
1698 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1699 | { | ||
1700 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1701 | "ecore_evas_cursor_set"); | ||
1702 | return; | ||
1703 | } | ||
1704 | |||
1705 | if (file) | ||
1706 | { | ||
1707 | int x, y; | ||
1708 | |||
1709 | obj = evas_object_image_add(ee->evas); | ||
1710 | evas_object_image_file_set(obj, file, NULL); | ||
1711 | evas_object_image_size_get(obj, &x, &y); | ||
1712 | evas_object_resize(obj, x, y); | ||
1713 | evas_object_image_fill_set(obj, 0, 0, x, y); | ||
1714 | } | ||
1715 | |||
1716 | IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); | ||
1717 | IFE; | ||
1718 | } | ||
1719 | |||
1720 | EAPI void | ||
1721 | ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
1722 | { | ||
1723 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1724 | { | ||
1725 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1726 | "ecore_evas_cursor_set"); | ||
1727 | return; | ||
1728 | } | ||
1729 | IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); | ||
1730 | IFE; | ||
1731 | } | ||
1732 | |||
1733 | EAPI void | ||
1734 | ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y) | ||
1735 | { | ||
1736 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1737 | { | ||
1738 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1739 | "ecore_evas_cursor_get"); | ||
1740 | return; | ||
1741 | } | ||
1742 | if (obj) *obj = ee->prop.cursor.object; | ||
1743 | if (layer) *layer = ee->prop.cursor.layer; | ||
1744 | if (hot_x) *hot_x = ee->prop.cursor.hot.x; | ||
1745 | if (hot_y) *hot_y = ee->prop.cursor.hot.y; | ||
1746 | } | ||
1747 | |||
1748 | EAPI void | ||
1749 | ecore_evas_layer_set(Ecore_Evas *ee, int layer) | ||
1750 | { | ||
1751 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1752 | { | ||
1753 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1754 | "ecore_evas_layer_set"); | ||
1755 | return; | ||
1756 | } | ||
1757 | IFC(ee, fn_layer_set) (ee, layer); | ||
1758 | IFE; | ||
1759 | } | ||
1760 | |||
1761 | EAPI int | ||
1762 | ecore_evas_layer_get(const Ecore_Evas *ee) | ||
1763 | { | ||
1764 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1765 | { | ||
1766 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1767 | "ecore_evas_layer_get"); | ||
1768 | return 0; | ||
1769 | } | ||
1770 | return ee->prop.layer; | ||
1771 | } | ||
1772 | |||
1773 | EAPI void | ||
1774 | ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on) | ||
1775 | { | ||
1776 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1777 | { | ||
1778 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1779 | "ecore_evas_focus_set"); | ||
1780 | return; | ||
1781 | } | ||
1782 | IFC(ee, fn_focus_set) (ee, on); | ||
1783 | IFE; | ||
1784 | } | ||
1785 | |||
1786 | EAPI Eina_Bool | ||
1787 | ecore_evas_focus_get(const Ecore_Evas *ee) | ||
1788 | { | ||
1789 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1790 | { | ||
1791 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1792 | "ecore_evas_focus_get"); | ||
1793 | return EINA_FALSE; | ||
1794 | } | ||
1795 | return ee->prop.focused ? EINA_TRUE : EINA_FALSE; | ||
1796 | } | ||
1797 | |||
1798 | EAPI void | ||
1799 | ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on) | ||
1800 | { | ||
1801 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1802 | { | ||
1803 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1804 | "ecore_evas_iconified_set"); | ||
1805 | return; | ||
1806 | } | ||
1807 | IFC(ee, fn_iconified_set) (ee, on); | ||
1808 | IFE; | ||
1809 | } | ||
1810 | |||
1811 | EAPI Eina_Bool | ||
1812 | ecore_evas_iconified_get(const Ecore_Evas *ee) | ||
1813 | { | ||
1814 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1815 | { | ||
1816 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1817 | "ecore_evas_iconified_get"); | ||
1818 | return EINA_FALSE; | ||
1819 | } | ||
1820 | return ee->prop.iconified ? EINA_TRUE : EINA_FALSE; | ||
1821 | } | ||
1822 | |||
1823 | EAPI void | ||
1824 | ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on) | ||
1825 | { | ||
1826 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1827 | { | ||
1828 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1829 | "ecore_evas_borderless_set"); | ||
1830 | return; | ||
1831 | } | ||
1832 | IFC(ee, fn_borderless_set) (ee, on); | ||
1833 | IFE; | ||
1834 | } | ||
1835 | |||
1836 | EAPI Eina_Bool | ||
1837 | ecore_evas_borderless_get(const Ecore_Evas *ee) | ||
1838 | { | ||
1839 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1840 | { | ||
1841 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1842 | "ecore_evas_borderless_get"); | ||
1843 | return EINA_FALSE; | ||
1844 | } | ||
1845 | return ee->prop.borderless ? EINA_TRUE : EINA_FALSE; | ||
1846 | } | ||
1847 | |||
1848 | /** | ||
1849 | * Tell the WM whether or not to ignore an Ecore_Evas' window | ||
1850 | * @param ee The Ecore_Evas | ||
1851 | * @param on EINA_TRUE to ignore, EINA_FALSE to not. | ||
1852 | * | ||
1853 | * This function causes the window manager to ignore @p ee if @p on is EINA_TRUE, | ||
1854 | * or not ignore @p ee if @p on is EINA_FALSE. | ||
1855 | */ | ||
1856 | EAPI void | ||
1857 | ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on) | ||
1858 | { | ||
1859 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1860 | { | ||
1861 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1862 | "ecore_evas_override_set"); | ||
1863 | return; | ||
1864 | } | ||
1865 | IFC(ee, fn_override_set) (ee, on); | ||
1866 | IFE; | ||
1867 | } | ||
1868 | |||
1869 | /** | ||
1870 | * Query whether an Ecore_Evas' window is overridden or not | ||
1871 | * @param ee The Ecore_Evas to set | ||
1872 | * @return EINA_TRUE if @p ee is overridden, EINA_FALSE if not. | ||
1873 | * | ||
1874 | */ | ||
1875 | EAPI Eina_Bool | ||
1876 | ecore_evas_override_get(const Ecore_Evas *ee) | ||
1877 | { | ||
1878 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1879 | { | ||
1880 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1881 | "ecore_evas_override_get"); | ||
1882 | return EINA_FALSE; | ||
1883 | } | ||
1884 | return ee->prop.override ? EINA_TRUE : EINA_FALSE; | ||
1885 | } | ||
1886 | |||
1887 | EAPI void | ||
1888 | ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on) | ||
1889 | { | ||
1890 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1891 | { | ||
1892 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1893 | "ecore_evas_maximized_set"); | ||
1894 | return; | ||
1895 | } | ||
1896 | IFC(ee, fn_maximized_set) (ee, on); | ||
1897 | IFE; | ||
1898 | } | ||
1899 | |||
1900 | EAPI Eina_Bool | ||
1901 | ecore_evas_maximized_get(const Ecore_Evas *ee) | ||
1902 | { | ||
1903 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1904 | { | ||
1905 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1906 | "ecore_evas_maximized_get"); | ||
1907 | return EINA_FALSE; | ||
1908 | } | ||
1909 | return ee->prop.maximized ? EINA_TRUE : EINA_FALSE; | ||
1910 | } | ||
1911 | |||
1912 | EAPI void | ||
1913 | ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) | ||
1914 | { | ||
1915 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1916 | { | ||
1917 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1918 | "ecore_evas_fullscreen_set"); | ||
1919 | return; | ||
1920 | } | ||
1921 | IFC(ee, fn_fullscreen_set) (ee, on); | ||
1922 | IFE; | ||
1923 | } | ||
1924 | |||
1925 | EAPI Eina_Bool | ||
1926 | ecore_evas_fullscreen_get(const Ecore_Evas *ee) | ||
1927 | { | ||
1928 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1929 | { | ||
1930 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1931 | "ecore_evas_fullscreen_get"); | ||
1932 | return EINA_FALSE; | ||
1933 | } | ||
1934 | return ee->prop.fullscreen ? EINA_TRUE : EINA_FALSE; | ||
1935 | } | ||
1936 | |||
1937 | /** | ||
1938 | * Set whether or not an Ecore_Evas' window should avoid damage | ||
1939 | * | ||
1940 | * @param ee The Ecore_Evas | ||
1941 | * @param The type of the damage management | ||
1942 | * | ||
1943 | * This function causes @p ee to be drawn to a pixmap to avoid recalculations. | ||
1944 | * On expose events it will copy from the pixmap to the window. | ||
1945 | */ | ||
1946 | EAPI void | ||
1947 | ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on) | ||
1948 | { | ||
1949 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1950 | { | ||
1951 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1952 | "ecore_evas_avoid_damage_set"); | ||
1953 | return; | ||
1954 | } | ||
1955 | IFC(ee, fn_avoid_damage_set) (ee, on); | ||
1956 | IFE; | ||
1957 | } | ||
1958 | |||
1959 | /** | ||
1960 | * Query whether an Ecore_Evas' window avoids damage or not | ||
1961 | * @param ee The Ecore_Evas to set | ||
1962 | * @return The type of the damage management | ||
1963 | * | ||
1964 | */ | ||
1965 | EAPI Ecore_Evas_Avoid_Damage_Type | ||
1966 | ecore_evas_avoid_damage_get(const Ecore_Evas *ee) | ||
1967 | { | ||
1968 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1969 | { | ||
1970 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1971 | "ecore_evas_avoid_damage_get"); | ||
1972 | return ECORE_EVAS_AVOID_DAMAGE_NONE; | ||
1973 | } | ||
1974 | return ee->prop.avoid_damage; | ||
1975 | } | ||
1976 | |||
1977 | /** | ||
1978 | * Set the withdrawn state of an Ecore_Evas' window. | ||
1979 | * @param ee The Ecore_Evas whose window's withdrawn state is set. | ||
1980 | * @param withdrawn The Ecore_Evas window's new withdrawn state. | ||
1981 | * | ||
1982 | */ | ||
1983 | EAPI void | ||
1984 | ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn) | ||
1985 | { | ||
1986 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1987 | { | ||
1988 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1989 | "ecore_evas_withdrawn_set"); | ||
1990 | return; | ||
1991 | } | ||
1992 | |||
1993 | IFC(ee, fn_withdrawn_set) (ee, withdrawn); | ||
1994 | IFE; | ||
1995 | } | ||
1996 | |||
1997 | /** | ||
1998 | * Returns the withdrawn state of an Ecore_Evas' window. | ||
1999 | * @param ee The Ecore_Evas whose window's withdrawn state is returned. | ||
2000 | * @return The Ecore_Evas window's withdrawn state. | ||
2001 | * | ||
2002 | */ | ||
2003 | EAPI Eina_Bool | ||
2004 | ecore_evas_withdrawn_get(const Ecore_Evas *ee) | ||
2005 | { | ||
2006 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2007 | { | ||
2008 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2009 | "ecore_evas_withdrawn_get"); | ||
2010 | return EINA_FALSE; | ||
2011 | } else | ||
2012 | return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE; | ||
2013 | } | ||
2014 | |||
2015 | /** | ||
2016 | * Set the sticky state of an Ecore_Evas window. | ||
2017 | * | ||
2018 | * @param ee The Ecore_Evas whose window's sticky state is set. | ||
2019 | * @param sticky The Ecore_Evas window's new sticky state. | ||
2020 | * | ||
2021 | */ | ||
2022 | EAPI void | ||
2023 | ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky) | ||
2024 | { | ||
2025 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2026 | { | ||
2027 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2028 | "ecore_evas_sticky_set"); | ||
2029 | return; | ||
2030 | } | ||
2031 | |||
2032 | IFC(ee, fn_sticky_set) (ee, sticky); | ||
2033 | IFE; | ||
2034 | } | ||
2035 | |||
2036 | /** | ||
2037 | * Returns the sticky state of an Ecore_Evas' window. | ||
2038 | * | ||
2039 | * @param ee The Ecore_Evas whose window's sticky state is returned. | ||
2040 | * @return The Ecore_Evas window's sticky state. | ||
2041 | * | ||
2042 | */ | ||
2043 | EAPI Eina_Bool | ||
2044 | ecore_evas_sticky_get(const Ecore_Evas *ee) | ||
2045 | { | ||
2046 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2047 | { | ||
2048 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2049 | "ecore_evas_sticky_get"); | ||
2050 | return EINA_FALSE; | ||
2051 | } else | ||
2052 | return ee->prop.sticky ? EINA_TRUE : EINA_FALSE; | ||
2053 | } | ||
2054 | |||
2055 | EAPI void | ||
2056 | ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore) | ||
2057 | { | ||
2058 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2059 | { | ||
2060 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2061 | "ecore_evas_ignore_events_set"); | ||
2062 | return; | ||
2063 | } | ||
2064 | |||
2065 | IFC(ee, fn_ignore_events_set) (ee, ignore); | ||
2066 | IFE; | ||
2067 | } | ||
2068 | |||
2069 | EAPI Eina_Bool | ||
2070 | ecore_evas_ignore_events_get(const Ecore_Evas *ee) | ||
2071 | { | ||
2072 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2073 | { | ||
2074 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2075 | "ecore_evas_ignore_events_get"); | ||
2076 | return EINA_FALSE; | ||
2077 | } | ||
2078 | return ee->ignore_events ? EINA_TRUE : EINA_FALSE; | ||
2079 | } | ||
2080 | |||
2081 | EAPI void | ||
2082 | ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render) | ||
2083 | { | ||
2084 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2085 | { | ||
2086 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2087 | "ecore_evas_manual_render_set"); | ||
2088 | return; | ||
2089 | } | ||
2090 | ee->manual_render = manual_render; | ||
2091 | } | ||
2092 | |||
2093 | EAPI Eina_Bool | ||
2094 | ecore_evas_manual_render_get(const Ecore_Evas *ee) | ||
2095 | { | ||
2096 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2097 | { | ||
2098 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2099 | "ecore_evas_manual_render_get"); | ||
2100 | return EINA_FALSE; | ||
2101 | } | ||
2102 | return ee->manual_render ? EINA_TRUE : EINA_FALSE; | ||
2103 | } | ||
2104 | |||
2105 | EAPI void | ||
2106 | ecore_evas_manual_render(Ecore_Evas *ee) | ||
2107 | { | ||
2108 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2109 | { | ||
2110 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2111 | "ecore_evas_manual_render"); | ||
2112 | return; | ||
2113 | } | ||
2114 | if (ee->engine.func->fn_render) | ||
2115 | ee->engine.func->fn_render(ee); | ||
2116 | } | ||
2117 | |||
2118 | EAPI void | ||
2119 | ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync) | ||
2120 | { | ||
2121 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2122 | { | ||
2123 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2124 | "ecore_evas_comp_sync_set"); | ||
2125 | return; | ||
2126 | } | ||
2127 | ee->no_comp_sync = !do_sync; | ||
2128 | } | ||
2129 | |||
2130 | EAPI Eina_Bool | ||
2131 | ecore_evas_comp_sync_get(const Ecore_Evas *ee) | ||
2132 | { | ||
2133 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2134 | { | ||
2135 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2136 | "ecore_evas_comp_sync_get"); | ||
2137 | return EINA_FALSE; | ||
2138 | } | ||
2139 | return !ee->no_comp_sync; | ||
2140 | } | ||
2141 | |||
2142 | EAPI Ecore_Window | ||
2143 | ecore_evas_window_get(const Ecore_Evas *ee) | ||
2144 | { | ||
2145 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2146 | { | ||
2147 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2148 | "ecore_evas_window_get"); | ||
2149 | return 0; | ||
2150 | } | ||
2151 | |||
2152 | return ee->prop.window; | ||
2153 | } | ||
2154 | |||
2155 | EAPI void | ||
2156 | ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) | ||
2157 | { | ||
2158 | if (x) *x = 0; | ||
2159 | if (y) *y = 0; | ||
2160 | if (w) *w = 0; | ||
2161 | if (h) *h = 0; | ||
2162 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2163 | { | ||
2164 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2165 | "ecore_evas_screen_geometry_get"); | ||
2166 | return; | ||
2167 | } | ||
2168 | |||
2169 | IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h); | ||
2170 | IFE; | ||
2171 | } | ||
2172 | |||
2173 | /* fps debug calls - for debugging how much time your app actually spends */ | ||
2174 | /* rendering graphics... :) */ | ||
2175 | |||
2176 | static int _ecore_evas_fps_debug_init_count = 0; | ||
2177 | static int _ecore_evas_fps_debug_fd = -1; | ||
2178 | unsigned int *_ecore_evas_fps_rendertime_mmap = NULL; | ||
2179 | |||
2180 | void | ||
2181 | _ecore_evas_fps_debug_init(void) | ||
2182 | { | ||
2183 | char buf[4096]; | ||
2184 | const char *tmp; | ||
2185 | |||
2186 | _ecore_evas_fps_debug_init_count++; | ||
2187 | if (_ecore_evas_fps_debug_init_count > 1) return; | ||
2188 | |||
2189 | #ifndef HAVE_EVIL | ||
2190 | tmp = "/tmp"; | ||
2191 | #else | ||
2192 | tmp = evil_tmpdir_get (); | ||
2193 | #endif /* HAVE_EVIL */ | ||
2194 | snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", tmp, (int)getpid()); | ||
2195 | _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); | ||
2196 | if (_ecore_evas_fps_debug_fd < 0) | ||
2197 | { | ||
2198 | unlink(buf); | ||
2199 | _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); | ||
2200 | } | ||
2201 | if (_ecore_evas_fps_debug_fd >= 0) | ||
2202 | { | ||
2203 | unsigned int zero = 0; | ||
2204 | char *buf2 = (char *)&zero; | ||
2205 | ssize_t todo = sizeof(unsigned int); | ||
2206 | |||
2207 | while (todo > 0) | ||
2208 | { | ||
2209 | ssize_t r = write(_ecore_evas_fps_debug_fd, buf2, todo); | ||
2210 | if (r > 0) | ||
2211 | { | ||
2212 | todo -= r; | ||
2213 | buf2 += r; | ||
2214 | } | ||
2215 | else if ((r < 0) && (errno == EINTR)) | ||
2216 | continue; | ||
2217 | else | ||
2218 | { | ||
2219 | ERR("could not write to file '%s' fd %d: %s", | ||
2220 | buf, _ecore_evas_fps_debug_fd, strerror(errno)); | ||
2221 | close(_ecore_evas_fps_debug_fd); | ||
2222 | _ecore_evas_fps_debug_fd = -1; | ||
2223 | return; | ||
2224 | } | ||
2225 | } | ||
2226 | _ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int), | ||
2227 | PROT_READ | PROT_WRITE, | ||
2228 | MAP_SHARED, | ||
2229 | _ecore_evas_fps_debug_fd, 0); | ||
2230 | if (_ecore_evas_fps_rendertime_mmap == MAP_FAILED) | ||
2231 | _ecore_evas_fps_rendertime_mmap = NULL; | ||
2232 | } | ||
2233 | } | ||
2234 | |||
2235 | void | ||
2236 | _ecore_evas_fps_debug_shutdown(void) | ||
2237 | { | ||
2238 | _ecore_evas_fps_debug_init_count--; | ||
2239 | if (_ecore_evas_fps_debug_init_count > 0) return; | ||
2240 | if (_ecore_evas_fps_debug_fd >= 0) | ||
2241 | { | ||
2242 | char buf[4096]; | ||
2243 | |||
2244 | snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid()); | ||
2245 | unlink(buf); | ||
2246 | if (_ecore_evas_fps_rendertime_mmap) | ||
2247 | { | ||
2248 | munmap(_ecore_evas_fps_rendertime_mmap, sizeof(int)); | ||
2249 | _ecore_evas_fps_rendertime_mmap = NULL; | ||
2250 | } | ||
2251 | close(_ecore_evas_fps_debug_fd); | ||
2252 | _ecore_evas_fps_debug_fd = -1; | ||
2253 | } | ||
2254 | } | ||
2255 | |||
2256 | void | ||
2257 | _ecore_evas_fps_debug_rendertime_add(double t) | ||
2258 | { | ||
2259 | static double rtime = 0.0; | ||
2260 | static double rlapse = 0.0; | ||
2261 | static int frames = 0; | ||
2262 | static int flapse = 0; | ||
2263 | double tim; | ||
2264 | |||
2265 | tim = ecore_time_get(); | ||
2266 | rtime += t; | ||
2267 | frames++; | ||
2268 | if (rlapse == 0.0) | ||
2269 | { | ||
2270 | rlapse = tim; | ||
2271 | flapse = frames; | ||
2272 | } | ||
2273 | else if ((tim - rlapse) >= 0.5) | ||
2274 | { | ||
2275 | printf("FRAME: %i, FPS: %3.1f, RTIME %3.0f%%\n", | ||
2276 | frames, | ||
2277 | (frames - flapse) / (tim - rlapse), | ||
2278 | (100.0 * rtime) / (tim - rlapse) | ||
2279 | ); | ||
2280 | rlapse = tim; | ||
2281 | flapse = frames; | ||
2282 | rtime = 0.0; | ||
2283 | } | ||
2284 | } | ||
2285 | |||
2286 | void | ||
2287 | _ecore_evas_register(Ecore_Evas *ee) | ||
2288 | { | ||
2289 | ee->registered = 1; | ||
2290 | ecore_evases = (Ecore_Evas *)eina_inlist_prepend | ||
2291 | (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); | ||
2292 | } | ||
2293 | |||
2294 | void | ||
2295 | _ecore_evas_ref(Ecore_Evas *ee) | ||
2296 | { | ||
2297 | ee->refcount++; | ||
2298 | } | ||
2299 | |||
2300 | void | ||
2301 | _ecore_evas_unref(Ecore_Evas *ee) | ||
2302 | { | ||
2303 | ee->refcount--; | ||
2304 | if (ee->refcount == 0) | ||
2305 | { | ||
2306 | if (ee->deleted) _ecore_evas_free(ee); | ||
2307 | } | ||
2308 | else if (ee->refcount < -1) | ||
2309 | ERR("Ecore_Evas %p->refcount=%d < 0", ee, ee->refcount); | ||
2310 | } | ||
2311 | |||
2312 | void | ||
2313 | _ecore_evas_free(Ecore_Evas *ee) | ||
2314 | { | ||
2315 | ee->deleted = EINA_TRUE; | ||
2316 | if (ee->refcount > 0) return; | ||
2317 | |||
2318 | if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee); | ||
2319 | while (ee->sub_ecore_evas) | ||
2320 | { | ||
2321 | _ecore_evas_free(ee->sub_ecore_evas->data); | ||
2322 | } | ||
2323 | if (ee->data) eina_hash_free(ee->data); | ||
2324 | ee->data = NULL; | ||
2325 | if (ee->name) free(ee->name); | ||
2326 | ee->name = NULL; | ||
2327 | if (ee->prop.title) free(ee->prop.title); | ||
2328 | ee->prop.title = NULL; | ||
2329 | if (ee->prop.name) free(ee->prop.name); | ||
2330 | ee->prop.name = NULL; | ||
2331 | if (ee->prop.clas) free(ee->prop.clas); | ||
2332 | ee->prop.clas = NULL; | ||
2333 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
2334 | ee->prop.cursor.object = NULL; | ||
2335 | if (ee->evas) evas_free(ee->evas); | ||
2336 | ee->evas = NULL; | ||
2337 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE); | ||
2338 | ee->driver = NULL; | ||
2339 | if (ee->engine.idle_flush_timer) | ||
2340 | ecore_timer_del(ee->engine.idle_flush_timer); | ||
2341 | if (ee->engine.func->fn_free) ee->engine.func->fn_free(ee); | ||
2342 | if (ee->registered) | ||
2343 | { | ||
2344 | ecore_evases = (Ecore_Evas *)eina_inlist_remove | ||
2345 | (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); | ||
2346 | } | ||
2347 | free(ee); | ||
2348 | } | ||
2349 | |||
2350 | static Eina_Bool | ||
2351 | _ecore_evas_cb_idle_flush(void *data) | ||
2352 | { | ||
2353 | Ecore_Evas *ee; | ||
2354 | |||
2355 | ee = (Ecore_Evas *)data; | ||
2356 | evas_render_idle_flush(ee->evas); | ||
2357 | ee->engine.idle_flush_timer = NULL; | ||
2358 | return ECORE_CALLBACK_CANCEL; | ||
2359 | } | ||
2360 | |||
2361 | static Eina_Bool | ||
2362 | _ecore_evas_async_events_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) | ||
2363 | { | ||
2364 | evas_async_events_process(); | ||
2365 | |||
2366 | return ECORE_CALLBACK_RENEW; | ||
2367 | } | ||
2368 | |||
2369 | void | ||
2370 | _ecore_evas_idle_timeout_update(Ecore_Evas *ee) | ||
2371 | { | ||
2372 | if (ee->engine.idle_flush_timer) | ||
2373 | ecore_timer_del(ee->engine.idle_flush_timer); | ||
2374 | ee->engine.idle_flush_timer = ecore_timer_add(IDLE_FLUSH_TIME, | ||
2375 | _ecore_evas_cb_idle_flush, | ||
2376 | ee); | ||
2377 | } | ||
2378 | |||
2379 | void | ||
2380 | _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp) | ||
2381 | { | ||
2382 | ee->mouse.x = x; | ||
2383 | ee->mouse.y = y; | ||
2384 | if (ee->prop.cursor.object) | ||
2385 | { | ||
2386 | evas_object_show(ee->prop.cursor.object); | ||
2387 | if (ee->rotation == 0) | ||
2388 | evas_object_move(ee->prop.cursor.object, | ||
2389 | x - ee->prop.cursor.hot.x, | ||
2390 | y - ee->prop.cursor.hot.y); | ||
2391 | else if (ee->rotation == 90) | ||
2392 | evas_object_move(ee->prop.cursor.object, | ||
2393 | ee->h - y - 1 - ee->prop.cursor.hot.x, | ||
2394 | x - ee->prop.cursor.hot.y); | ||
2395 | else if (ee->rotation == 180) | ||
2396 | evas_object_move(ee->prop.cursor.object, | ||
2397 | ee->w - x - 1 - ee->prop.cursor.hot.x, | ||
2398 | ee->h - y - 1 - ee->prop.cursor.hot.y); | ||
2399 | else if (ee->rotation == 270) | ||
2400 | evas_object_move(ee->prop.cursor.object, | ||
2401 | y - ee->prop.cursor.hot.x, | ||
2402 | ee->w - x - 1 - ee->prop.cursor.hot.y); | ||
2403 | } | ||
2404 | if (ee->rotation == 0) | ||
2405 | evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL); | ||
2406 | else if (ee->rotation == 90) | ||
2407 | evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL); | ||
2408 | else if (ee->rotation == 180) | ||
2409 | evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL); | ||
2410 | else if (ee->rotation == 270) | ||
2411 | evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL); | ||
2412 | } | ||
2413 | |||
2414 | void | ||
2415 | _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, | ||
2416 | int x, int y, | ||
2417 | double radius, | ||
2418 | double radius_x, double radius_y, | ||
2419 | double pressure, | ||
2420 | double angle, | ||
2421 | double mx, double my, | ||
2422 | unsigned int timestamp) | ||
2423 | { | ||
2424 | if (ee->rotation == 0) | ||
2425 | evas_event_feed_multi_move(ee->evas, device, | ||
2426 | x, y, | ||
2427 | radius, | ||
2428 | radius_x, radius_y, | ||
2429 | pressure, | ||
2430 | angle - ee->rotation, | ||
2431 | mx, my, | ||
2432 | timestamp, NULL); | ||
2433 | else if (ee->rotation == 90) | ||
2434 | evas_event_feed_multi_move(ee->evas, device, | ||
2435 | ee->h - y - 1, x, | ||
2436 | radius, | ||
2437 | radius_y, radius_x, | ||
2438 | pressure, | ||
2439 | angle - ee->rotation, | ||
2440 | ee->h - my - 1, mx, | ||
2441 | timestamp, NULL); | ||
2442 | else if (ee->rotation == 180) | ||
2443 | evas_event_feed_multi_move(ee->evas, device, | ||
2444 | ee->w - x - 1, ee->h - y - 1, | ||
2445 | radius, | ||
2446 | radius_x, radius_y, | ||
2447 | pressure, | ||
2448 | angle - ee->rotation, | ||
2449 | ee->w - mx - 1, ee->h - my - 1, | ||
2450 | timestamp, NULL); | ||
2451 | else if (ee->rotation == 270) | ||
2452 | evas_event_feed_multi_move(ee->evas, device, | ||
2453 | y, ee->w - x - 1, | ||
2454 | radius, | ||
2455 | radius_y, radius_x, | ||
2456 | pressure, | ||
2457 | angle - ee->rotation, | ||
2458 | my, ee->w - mx - 1, | ||
2459 | timestamp, NULL); | ||
2460 | } | ||
2461 | |||
2462 | void | ||
2463 | _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, | ||
2464 | int x, int y, | ||
2465 | double radius, | ||
2466 | double radius_x, double radius_y, | ||
2467 | double pressure, | ||
2468 | double angle, | ||
2469 | double mx, double my, | ||
2470 | Evas_Button_Flags flags, | ||
2471 | unsigned int timestamp) | ||
2472 | { | ||
2473 | if (ee->rotation == 0) | ||
2474 | evas_event_feed_multi_down(ee->evas, device, | ||
2475 | x, y, | ||
2476 | radius, | ||
2477 | radius_x, radius_y, | ||
2478 | pressure, | ||
2479 | angle - ee->rotation, | ||
2480 | mx, my, | ||
2481 | flags, timestamp, NULL); | ||
2482 | else if (ee->rotation == 90) | ||
2483 | evas_event_feed_multi_down(ee->evas, device, | ||
2484 | ee->h - y - 1, x, | ||
2485 | radius, | ||
2486 | radius_y, radius_x, | ||
2487 | pressure, | ||
2488 | angle - ee->rotation, | ||
2489 | ee->h - my - 1, mx, | ||
2490 | flags, timestamp, NULL); | ||
2491 | else if (ee->rotation == 180) | ||
2492 | evas_event_feed_multi_down(ee->evas, device, | ||
2493 | ee->w - x - 1, ee->h - y - 1, | ||
2494 | radius, | ||
2495 | radius_x, radius_y, | ||
2496 | pressure, | ||
2497 | angle - ee->rotation, | ||
2498 | ee->w - mx - 1, ee->h - my - 1, | ||
2499 | flags, timestamp, NULL); | ||
2500 | else if (ee->rotation == 270) | ||
2501 | evas_event_feed_multi_down(ee->evas, device, | ||
2502 | y, ee->w - x - 1, | ||
2503 | radius, | ||
2504 | radius_y, radius_x, | ||
2505 | pressure, | ||
2506 | angle - ee->rotation, | ||
2507 | my, ee->w - mx - 1, | ||
2508 | flags, timestamp, NULL); | ||
2509 | } | ||
2510 | |||
2511 | void | ||
2512 | _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, | ||
2513 | int x, int y, | ||
2514 | double radius, | ||
2515 | double radius_x, double radius_y, | ||
2516 | double pressure, | ||
2517 | double angle, | ||
2518 | double mx, double my, | ||
2519 | Evas_Button_Flags flags, | ||
2520 | unsigned int timestamp) | ||
2521 | { | ||
2522 | if (ee->rotation == 0) | ||
2523 | evas_event_feed_multi_up(ee->evas, device, | ||
2524 | x, y, | ||
2525 | radius, | ||
2526 | radius_x, radius_y, | ||
2527 | pressure, | ||
2528 | angle - ee->rotation, | ||
2529 | mx, my, | ||
2530 | flags, timestamp, NULL); | ||
2531 | else if (ee->rotation == 90) | ||
2532 | evas_event_feed_multi_up(ee->evas, device, | ||
2533 | ee->h - y - 1, x, | ||
2534 | radius, | ||
2535 | radius_y, radius_x, | ||
2536 | pressure, | ||
2537 | angle - ee->rotation, | ||
2538 | ee->h - my - 1, mx, | ||
2539 | flags, timestamp, NULL); | ||
2540 | else if (ee->rotation == 180) | ||
2541 | evas_event_feed_multi_up(ee->evas, device, | ||
2542 | ee->w - x - 1, ee->h - y - 1, | ||
2543 | radius, | ||
2544 | radius_x, radius_y, | ||
2545 | pressure, | ||
2546 | angle - ee->rotation, | ||
2547 | ee->w - mx - 1, ee->h - my - 1, | ||
2548 | flags, timestamp, NULL); | ||
2549 | else if (ee->rotation == 270) | ||
2550 | evas_event_feed_multi_up(ee->evas, device, | ||
2551 | y, ee->w - x - 1, | ||
2552 | radius, | ||
2553 | radius_y, radius_x, | ||
2554 | pressure, | ||
2555 | angle - ee->rotation, | ||
2556 | my, ee->w - mx - 1, | ||
2557 | flags, timestamp, NULL); | ||
2558 | } | ||
2559 | |||
2560 | EAPI Eina_List * | ||
2561 | ecore_evas_ecore_evas_list_get(void) | ||
2562 | { | ||
2563 | Ecore_Evas *ee; | ||
2564 | Eina_List *l = NULL; | ||
2565 | |||
2566 | EINA_INLIST_FOREACH(ecore_evases, ee) | ||
2567 | { | ||
2568 | l = eina_list_append(l, ee); | ||
2569 | } | ||
2570 | |||
2571 | return l; | ||
2572 | } | ||
2573 | |||
2574 | EAPI void | ||
2575 | ecore_evas_input_event_register(Ecore_Evas *ee) | ||
2576 | { | ||
2577 | ecore_event_window_register((Ecore_Window)ee, ee, ee->evas, | ||
2578 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2579 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2580 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2581 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2582 | } | ||
2583 | |||
2584 | EAPI void | ||
2585 | ecore_evas_input_event_unregister(Ecore_Evas *ee) | ||
2586 | { | ||
2587 | ecore_event_window_unregister((Ecore_Window)ee); | ||
2588 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c new file mode 100644 index 0000000..a3e49d6 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c | |||
@@ -0,0 +1,827 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! | ||
6 | |||
7 | #include <Ecore.h> | ||
8 | #include "ecore_private.h" | ||
9 | #include <Ecore_Input.h> | ||
10 | |||
11 | #include "ecore_evas_private.h" | ||
12 | #include "Ecore_Evas.h" | ||
13 | |||
14 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
15 | static int _ecore_evas_init_count = 0; | ||
16 | |||
17 | static int | ||
18 | _ecore_evas_buffer_init(void) | ||
19 | { | ||
20 | _ecore_evas_init_count++; | ||
21 | return _ecore_evas_init_count; | ||
22 | } | ||
23 | |||
24 | static void | ||
25 | _ecore_evas_buffer_free(Ecore_Evas *ee) | ||
26 | { | ||
27 | if (ee->engine.buffer.image) | ||
28 | { | ||
29 | Ecore_Evas *ee2; | ||
30 | |||
31 | ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent"); | ||
32 | evas_object_del(ee->engine.buffer.image); | ||
33 | ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee); | ||
34 | } | ||
35 | else | ||
36 | { | ||
37 | ee->engine.buffer.free_func(ee->engine.buffer.data, | ||
38 | ee->engine.buffer.pixels); | ||
39 | } | ||
40 | _ecore_evas_buffer_shutdown(); | ||
41 | } | ||
42 | |||
43 | static void | ||
44 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
45 | { | ||
46 | Evas_Engine_Info_Buffer *einfo; | ||
47 | int stride = 0; | ||
48 | |||
49 | if (w < 1) w = 1; | ||
50 | if (h < 1) h = 1; | ||
51 | ee->req.w = w; | ||
52 | ee->req.h = h; | ||
53 | if ((w == ee->w) && (h == ee->h)) return; | ||
54 | ee->w = w; | ||
55 | ee->h = h; | ||
56 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
57 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
58 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
59 | |||
60 | if (ee->engine.buffer.image) | ||
61 | { | ||
62 | ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1); | ||
63 | stride = evas_object_image_stride_get(ee->engine.buffer.image); | ||
64 | } | ||
65 | else | ||
66 | { | ||
67 | if (ee->engine.buffer.pixels) | ||
68 | ee->engine.buffer.free_func(ee->engine.buffer.data, | ||
69 | ee->engine.buffer.pixels); | ||
70 | ee->engine.buffer.pixels = | ||
71 | ee->engine.buffer.alloc_func(ee->engine.buffer.data, | ||
72 | ee->w * ee->h * sizeof(int)); | ||
73 | stride = ee->w * sizeof(int); | ||
74 | } | ||
75 | |||
76 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
77 | if (einfo) | ||
78 | { | ||
79 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
80 | einfo->info.dest_buffer = ee->engine.buffer.pixels; | ||
81 | einfo->info.dest_buffer_row_bytes = stride; | ||
82 | einfo->info.use_color_key = 0; | ||
83 | einfo->info.alpha_threshold = 0; | ||
84 | einfo->info.func.new_update_region = NULL; | ||
85 | einfo->info.func.free_update_region = NULL; | ||
86 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
87 | { | ||
88 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
89 | } | ||
90 | } | ||
91 | if (ee->engine.buffer.image) | ||
92 | evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels); | ||
93 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
94 | } | ||
95 | |||
96 | int | ||
97 | _ecore_evas_buffer_shutdown(void) | ||
98 | { | ||
99 | _ecore_evas_init_count--; | ||
100 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
101 | return _ecore_evas_init_count; | ||
102 | } | ||
103 | |||
104 | static void | ||
105 | _ecore_evas_show(Ecore_Evas *ee) | ||
106 | { | ||
107 | if (ee->engine.buffer.image) return; | ||
108 | if (ee->prop.focused) return; | ||
109 | ee->prop.focused = 1; | ||
110 | evas_focus_in(ee->evas); | ||
111 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
112 | } | ||
113 | |||
114 | int | ||
115 | _ecore_evas_buffer_render(Ecore_Evas *ee) | ||
116 | { | ||
117 | Eina_List *updates = NULL, *l, *ll; | ||
118 | Ecore_Evas *ee2; | ||
119 | int rend = 0; | ||
120 | |||
121 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
122 | { | ||
123 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
124 | if (ee2->engine.func->fn_render) | ||
125 | rend |= ee2->engine.func->fn_render(ee2); | ||
126 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
127 | } | ||
128 | if (ee->engine.buffer.image) | ||
129 | { | ||
130 | int w, h; | ||
131 | |||
132 | evas_object_image_size_get(ee->engine.buffer.image, &w, &h); | ||
133 | if ((w != ee->w) || (h != ee->h)) | ||
134 | _ecore_evas_resize(ee, w, h); | ||
135 | ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1); | ||
136 | } | ||
137 | if (ee->engine.buffer.pixels) | ||
138 | { | ||
139 | updates = evas_render_updates(ee->evas); | ||
140 | } | ||
141 | if (ee->engine.buffer.image) | ||
142 | { | ||
143 | Eina_Rectangle *r; | ||
144 | |||
145 | evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels); | ||
146 | EINA_LIST_FOREACH(updates, l, r) | ||
147 | evas_object_image_data_update_add(ee->engine.buffer.image, | ||
148 | r->x, r->y, r->w, r->h); | ||
149 | } | ||
150 | if (updates) | ||
151 | { | ||
152 | evas_render_updates_free(updates); | ||
153 | _ecore_evas_idle_timeout_update(ee); | ||
154 | } | ||
155 | |||
156 | return updates ? 1 : rend; | ||
157 | } | ||
158 | |||
159 | // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! | ||
160 | static void | ||
161 | _ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) | ||
162 | { | ||
163 | Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; | ||
164 | |||
165 | evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh); | ||
166 | evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh); | ||
167 | |||
168 | if (fw < 1) fw = 1; | ||
169 | if (fh < 1) fh = 1; | ||
170 | |||
171 | if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) | ||
172 | { | ||
173 | *x = (ee->w * (*x - xx)) / fw; | ||
174 | *y = (ee->h * (*y - yy)) / fh; | ||
175 | } | ||
176 | else | ||
177 | { | ||
178 | xx = (*x - xx) - fx; | ||
179 | while (xx < 0) xx += fw; | ||
180 | while (xx > fw) xx -= fw; | ||
181 | *x = (ee->w * xx) / fw; | ||
182 | |||
183 | yy = (*y - yy) - fy; | ||
184 | while (yy < 0) yy += fh; | ||
185 | while (yy > fh) yy -= fh; | ||
186 | *y = (ee->h * yy) / fh; | ||
187 | } | ||
188 | } | ||
189 | |||
190 | static void | ||
191 | _ecore_evas_buffer_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
192 | { | ||
193 | Ecore_Evas *ee; | ||
194 | Evas_Event_Mouse_In *ev; | ||
195 | |||
196 | ee = data; | ||
197 | ev = event_info; | ||
198 | evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); | ||
199 | } | ||
200 | |||
201 | static void | ||
202 | _ecore_evas_buffer_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
203 | { | ||
204 | Ecore_Evas *ee; | ||
205 | Evas_Event_Mouse_Out *ev; | ||
206 | |||
207 | ee = data; | ||
208 | ev = event_info; | ||
209 | evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); | ||
210 | } | ||
211 | |||
212 | static void | ||
213 | _ecore_evas_buffer_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
214 | { | ||
215 | Ecore_Evas *ee; | ||
216 | Evas_Event_Mouse_Down *ev; | ||
217 | |||
218 | ee = data; | ||
219 | ev = event_info; | ||
220 | evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | ||
221 | } | ||
222 | |||
223 | static void | ||
224 | _ecore_evas_buffer_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
225 | { | ||
226 | Ecore_Evas *ee; | ||
227 | Evas_Event_Mouse_Up *ev; | ||
228 | |||
229 | ee = data; | ||
230 | ev = event_info; | ||
231 | evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | ||
232 | } | ||
233 | |||
234 | static void | ||
235 | _ecore_evas_buffer_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
236 | { | ||
237 | Ecore_Evas *ee; | ||
238 | Evas_Event_Mouse_Move *ev; | ||
239 | Evas_Coord x, y; | ||
240 | |||
241 | ee = data; | ||
242 | ev = event_info; | ||
243 | x = ev->cur.canvas.x; | ||
244 | y = ev->cur.canvas.y; | ||
245 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | ||
246 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); | ||
247 | } | ||
248 | |||
249 | static void | ||
250 | _ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
251 | { | ||
252 | Ecore_Evas *ee; | ||
253 | Evas_Event_Mouse_Wheel *ev; | ||
254 | |||
255 | ee = data; | ||
256 | ev = event_info; | ||
257 | evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL); | ||
258 | } | ||
259 | |||
260 | static void | ||
261 | _ecore_evas_buffer_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
262 | { | ||
263 | Ecore_Evas *ee; | ||
264 | Evas_Event_Multi_Down *ev; | ||
265 | Evas_Coord x, y, xx, yy; | ||
266 | double xf, yf; | ||
267 | |||
268 | ee = data; | ||
269 | ev = event_info; | ||
270 | x = ev->canvas.x; | ||
271 | y = ev->canvas.y; | ||
272 | xx = x; | ||
273 | yy = y; | ||
274 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | ||
275 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | ||
276 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | ||
277 | evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); | ||
278 | } | ||
279 | |||
280 | static void | ||
281 | _ecore_evas_buffer_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
282 | { | ||
283 | Ecore_Evas *ee; | ||
284 | Evas_Event_Multi_Up *ev; | ||
285 | Evas_Coord x, y, xx, yy; | ||
286 | double xf, yf; | ||
287 | |||
288 | ee = data; | ||
289 | ev = event_info; | ||
290 | x = ev->canvas.x; | ||
291 | y = ev->canvas.y; | ||
292 | xx = x; | ||
293 | yy = y; | ||
294 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | ||
295 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | ||
296 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | ||
297 | evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); | ||
298 | } | ||
299 | |||
300 | static void | ||
301 | _ecore_evas_buffer_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
302 | { | ||
303 | Ecore_Evas *ee; | ||
304 | Evas_Event_Multi_Move *ev; | ||
305 | Evas_Coord x, y, xx, yy; | ||
306 | double xf, yf; | ||
307 | |||
308 | ee = data; | ||
309 | ev = event_info; | ||
310 | x = ev->cur.canvas.x; | ||
311 | y = ev->cur.canvas.y; | ||
312 | xx = x; | ||
313 | yy = y; | ||
314 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | ||
315 | xf = (ev->cur.canvas.xsub - (double)xx) + (double)x; | ||
316 | yf = (ev->cur.canvas.ysub - (double)yy) + (double)y; | ||
317 | evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL); | ||
318 | } | ||
319 | |||
320 | static void | ||
321 | _ecore_evas_buffer_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
322 | { | ||
323 | Ecore_Evas *ee; | ||
324 | |||
325 | ee = data; | ||
326 | if (ee->driver) _ecore_evas_free(ee); | ||
327 | } | ||
328 | |||
329 | static void | ||
330 | _ecore_evas_buffer_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
331 | { | ||
332 | Ecore_Evas *ee; | ||
333 | Evas_Event_Key_Down *ev; | ||
334 | |||
335 | ee = data; | ||
336 | ev = event_info; | ||
337 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | ||
338 | evas_key_modifier_on(ee->evas, "Shift"); | ||
339 | else | ||
340 | evas_key_modifier_off(ee->evas, "Shift"); | ||
341 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
342 | evas_key_modifier_on(ee->evas, "Control"); | ||
343 | else | ||
344 | evas_key_modifier_off(ee->evas, "Control"); | ||
345 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
346 | evas_key_modifier_on(ee->evas, "Alt"); | ||
347 | else | ||
348 | evas_key_modifier_off(ee->evas, "Alt"); | ||
349 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
350 | evas_key_modifier_on(ee->evas, "Meta"); | ||
351 | else | ||
352 | evas_key_modifier_off(ee->evas, "Meta"); | ||
353 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
354 | evas_key_modifier_on(ee->evas, "Hyper"); | ||
355 | else | ||
356 | evas_key_modifier_off(ee->evas, "Hyper"); | ||
357 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
358 | evas_key_modifier_on(ee->evas, "Super"); | ||
359 | else | ||
360 | evas_key_modifier_off(ee->evas, "Super"); | ||
361 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
362 | evas_key_lock_on(ee->evas, "Scroll_Lock"); | ||
363 | else | ||
364 | evas_key_lock_off(ee->evas, "Scroll_Lock"); | ||
365 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
366 | evas_key_lock_on(ee->evas, "Num_Lock"); | ||
367 | else | ||
368 | evas_key_lock_off(ee->evas, "Num_Lock"); | ||
369 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
370 | evas_key_lock_on(ee->evas, "Caps_Lock"); | ||
371 | else | ||
372 | evas_key_lock_off(ee->evas, "Caps_Lock"); | ||
373 | evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | ||
374 | } | ||
375 | |||
376 | static void | ||
377 | _ecore_evas_buffer_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
378 | { | ||
379 | Ecore_Evas *ee; | ||
380 | Evas_Event_Key_Up *ev; | ||
381 | |||
382 | ee = data; | ||
383 | ev = event_info; | ||
384 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | ||
385 | evas_key_modifier_on(ee->evas, "Shift"); | ||
386 | else | ||
387 | evas_key_modifier_off(ee->evas, "Shift"); | ||
388 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
389 | evas_key_modifier_on(ee->evas, "Control"); | ||
390 | else | ||
391 | evas_key_modifier_off(ee->evas, "Control"); | ||
392 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
393 | evas_key_modifier_on(ee->evas, "Alt"); | ||
394 | else | ||
395 | evas_key_modifier_off(ee->evas, "Alt"); | ||
396 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
397 | evas_key_modifier_on(ee->evas, "Meta"); | ||
398 | else | ||
399 | evas_key_modifier_off(ee->evas, "Meta"); | ||
400 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
401 | evas_key_modifier_on(ee->evas, "Hyper"); | ||
402 | else | ||
403 | evas_key_modifier_off(ee->evas, "Hyper"); | ||
404 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
405 | evas_key_modifier_on(ee->evas, "Super"); | ||
406 | else | ||
407 | evas_key_modifier_off(ee->evas, "Super"); | ||
408 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
409 | evas_key_lock_on(ee->evas, "Scroll_Lock"); | ||
410 | else | ||
411 | evas_key_lock_off(ee->evas, "Scroll_Lock"); | ||
412 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
413 | evas_key_lock_on(ee->evas, "Num_Lock"); | ||
414 | else | ||
415 | evas_key_lock_off(ee->evas, "Num_Lock"); | ||
416 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
417 | evas_key_lock_on(ee->evas, "Caps_Lock"); | ||
418 | else | ||
419 | evas_key_lock_off(ee->evas, "Caps_Lock"); | ||
420 | evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | ||
421 | } | ||
422 | |||
423 | static void | ||
424 | _ecore_evas_buffer_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
425 | { | ||
426 | Ecore_Evas *ee; | ||
427 | |||
428 | ee = data; | ||
429 | ee->prop.focused = 1; | ||
430 | evas_focus_in(ee->evas); | ||
431 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
432 | } | ||
433 | |||
434 | static void | ||
435 | _ecore_evas_buffer_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
436 | { | ||
437 | Ecore_Evas *ee; | ||
438 | |||
439 | ee = data; | ||
440 | ee->prop.focused = 0; | ||
441 | evas_focus_out(ee->evas); | ||
442 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
443 | } | ||
444 | |||
445 | static void | ||
446 | _ecore_evas_buffer_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
447 | { | ||
448 | Ecore_Evas *ee; | ||
449 | |||
450 | ee = data; | ||
451 | ee->visible = 1; | ||
452 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
453 | } | ||
454 | |||
455 | static void | ||
456 | _ecore_evas_buffer_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
457 | { | ||
458 | Ecore_Evas *ee; | ||
459 | |||
460 | ee = data; | ||
461 | ee->visible = 0; | ||
462 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
463 | } | ||
464 | |||
465 | static void | ||
466 | _ecore_evas_buffer_alpha_set(Ecore_Evas *ee, int alpha) | ||
467 | { | ||
468 | if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return; | ||
469 | ee->alpha = alpha; | ||
470 | if (ee->engine.buffer.image) | ||
471 | evas_object_image_alpha_set(ee->engine.buffer.image, ee->alpha); | ||
472 | } | ||
473 | |||
474 | static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = | ||
475 | { | ||
476 | _ecore_evas_buffer_free, | ||
477 | NULL, | ||
478 | NULL, | ||
479 | NULL, | ||
480 | NULL, | ||
481 | NULL, | ||
482 | NULL, | ||
483 | NULL, | ||
484 | NULL, | ||
485 | NULL, | ||
486 | NULL, | ||
487 | NULL, | ||
488 | NULL, | ||
489 | NULL, | ||
490 | NULL, | ||
491 | NULL, | ||
492 | NULL, | ||
493 | _ecore_evas_resize, | ||
494 | NULL, | ||
495 | NULL, | ||
496 | NULL, | ||
497 | _ecore_evas_show, | ||
498 | NULL, | ||
499 | NULL, | ||
500 | NULL, | ||
501 | NULL, | ||
502 | NULL, | ||
503 | NULL, | ||
504 | NULL, | ||
505 | NULL, | ||
506 | NULL, | ||
507 | NULL, | ||
508 | NULL, | ||
509 | NULL, | ||
510 | NULL, | ||
511 | NULL, | ||
512 | NULL, | ||
513 | NULL, | ||
514 | NULL, | ||
515 | NULL, | ||
516 | NULL, | ||
517 | NULL, | ||
518 | NULL, | ||
519 | NULL, | ||
520 | _ecore_evas_buffer_alpha_set, | ||
521 | NULL, //transparent | ||
522 | |||
523 | NULL, // render | ||
524 | NULL // screen_geometry_get | ||
525 | }; | ||
526 | #endif | ||
527 | |||
528 | static void * | ||
529 | _ecore_evas_buffer_pix_alloc(void *data __UNUSED__, int size) | ||
530 | { | ||
531 | return malloc(size); | ||
532 | } | ||
533 | |||
534 | static void | ||
535 | _ecore_evas_buffer_pix_free(void *data __UNUSED__, void *pix) | ||
536 | { | ||
537 | free(pix); | ||
538 | } | ||
539 | |||
540 | EAPI Ecore_Evas * | ||
541 | ecore_evas_buffer_new(int w, int h) | ||
542 | { | ||
543 | return ecore_evas_buffer_allocfunc_new | ||
544 | (w, h, _ecore_evas_buffer_pix_alloc, _ecore_evas_buffer_pix_free, NULL); | ||
545 | } | ||
546 | |||
547 | EAPI Ecore_Evas * | ||
548 | ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, int size), void (*free_func) (void *data, void *pix), const void *data) | ||
549 | { | ||
550 | // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! | ||
551 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
552 | Evas_Engine_Info_Buffer *einfo; | ||
553 | Ecore_Evas *ee; | ||
554 | int rmethod; | ||
555 | |||
556 | if ((!alloc_func) || (!free_func)) return NULL; | ||
557 | rmethod = evas_render_method_lookup("buffer"); | ||
558 | if (!rmethod) return NULL; | ||
559 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
560 | if (!ee) return NULL; | ||
561 | |||
562 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
563 | |||
564 | _ecore_evas_buffer_init(); | ||
565 | |||
566 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func; | ||
567 | ee->engine.buffer.alloc_func = alloc_func; | ||
568 | ee->engine.buffer.free_func = free_func; | ||
569 | ee->engine.buffer.data = (void *)data; | ||
570 | |||
571 | ee->driver = "buffer"; | ||
572 | |||
573 | if (w < 1) w = 1; | ||
574 | if (h < 1) h = 1; | ||
575 | ee->rotation = 0; | ||
576 | ee->visible = 1; | ||
577 | ee->w = w; | ||
578 | ee->h = h; | ||
579 | ee->req.w = ee->w; | ||
580 | ee->req.h = ee->h; | ||
581 | |||
582 | ee->prop.max.w = 0; | ||
583 | ee->prop.max.h = 0; | ||
584 | ee->prop.layer = 0; | ||
585 | ee->prop.focused = 1; | ||
586 | ee->prop.borderless = 1; | ||
587 | ee->prop.override = 1; | ||
588 | ee->prop.maximized = 1; | ||
589 | ee->prop.fullscreen = 0; | ||
590 | ee->prop.withdrawn = 0; | ||
591 | ee->prop.sticky = 0; | ||
592 | |||
593 | /* init evas here */ | ||
594 | ee->evas = evas_new(); | ||
595 | evas_data_attach_set(ee->evas, ee); | ||
596 | evas_output_method_set(ee->evas, rmethod); | ||
597 | evas_output_size_set(ee->evas, w, h); | ||
598 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
599 | |||
600 | ee->engine.buffer.pixels = | ||
601 | ee->engine.buffer.alloc_func | ||
602 | (ee->engine.buffer.data, w * h * sizeof(int)); | ||
603 | |||
604 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
605 | if (einfo) | ||
606 | { | ||
607 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
608 | einfo->info.dest_buffer = ee->engine.buffer.pixels; | ||
609 | einfo->info.dest_buffer_row_bytes = ee->w * sizeof(int); | ||
610 | einfo->info.use_color_key = 0; | ||
611 | einfo->info.alpha_threshold = 0; | ||
612 | einfo->info.func.new_update_region = NULL; | ||
613 | einfo->info.func.free_update_region = NULL; | ||
614 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
615 | { | ||
616 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
617 | ecore_evas_free(ee); | ||
618 | return NULL; | ||
619 | } | ||
620 | } | ||
621 | else | ||
622 | { | ||
623 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
624 | ecore_evas_free(ee); | ||
625 | return NULL; | ||
626 | } | ||
627 | evas_key_modifier_add(ee->evas, "Shift"); | ||
628 | evas_key_modifier_add(ee->evas, "Control"); | ||
629 | evas_key_modifier_add(ee->evas, "Alt"); | ||
630 | evas_key_modifier_add(ee->evas, "Meta"); | ||
631 | evas_key_modifier_add(ee->evas, "Hyper"); | ||
632 | evas_key_modifier_add(ee->evas, "Super"); | ||
633 | evas_key_lock_add(ee->evas, "Caps_Lock"); | ||
634 | evas_key_lock_add(ee->evas, "Num_Lock"); | ||
635 | evas_key_lock_add(ee->evas, "Scroll_Lock"); | ||
636 | |||
637 | evas_event_feed_mouse_in(ee->evas, 0, NULL); | ||
638 | |||
639 | ee->engine.func->fn_render = _ecore_evas_buffer_render; | ||
640 | _ecore_evas_register(ee); | ||
641 | |||
642 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
643 | |||
644 | return ee; | ||
645 | #else | ||
646 | return NULL; | ||
647 | #endif | ||
648 | } | ||
649 | |||
650 | EAPI const void * | ||
651 | ecore_evas_buffer_pixels_get(Ecore_Evas *ee) | ||
652 | { | ||
653 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
654 | _ecore_evas_buffer_render(ee); | ||
655 | return ee->engine.buffer.pixels; | ||
656 | #else | ||
657 | return NULL; | ||
658 | #endif | ||
659 | } | ||
660 | |||
661 | EAPI Evas * | ||
662 | ecore_evas_object_evas_get(Evas_Object *obj) | ||
663 | { | ||
664 | Ecore_Evas *ee; | ||
665 | |||
666 | ee = evas_object_data_get(obj, "Ecore_Evas"); | ||
667 | if (!ee) return NULL; | ||
668 | |||
669 | return ecore_evas_get(ee); | ||
670 | } | ||
671 | |||
672 | EAPI Ecore_Evas * | ||
673 | ecore_evas_object_ecore_evas_get(Evas_Object *obj) | ||
674 | { | ||
675 | return evas_object_data_get(obj, "Ecore_Evas"); | ||
676 | } | ||
677 | |||
678 | EAPI Evas_Object * | ||
679 | ecore_evas_object_image_new(Ecore_Evas *ee_target) | ||
680 | { | ||
681 | // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! | ||
682 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
683 | Evas_Object *o; | ||
684 | Evas_Engine_Info_Buffer *einfo; | ||
685 | Ecore_Evas *ee; | ||
686 | int rmethod; | ||
687 | int w = 1, h = 1; | ||
688 | |||
689 | rmethod = evas_render_method_lookup("buffer"); | ||
690 | if (!rmethod) return NULL; | ||
691 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
692 | if (!ee) return NULL; | ||
693 | |||
694 | o = evas_object_image_add(ee_target->evas); | ||
695 | evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); | ||
696 | evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); | ||
697 | evas_object_image_alpha_set(o, 0); | ||
698 | evas_object_image_size_set(o, w, h); | ||
699 | |||
700 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
701 | |||
702 | _ecore_evas_buffer_init(); | ||
703 | |||
704 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func; | ||
705 | |||
706 | ee->driver = "buffer"; | ||
707 | |||
708 | ee->rotation = 0; | ||
709 | ee->visible = 0; | ||
710 | ee->w = w; | ||
711 | ee->h = h; | ||
712 | ee->req.w = ee->w; | ||
713 | ee->req.h = ee->h; | ||
714 | |||
715 | ee->prop.max.w = 0; | ||
716 | ee->prop.max.h = 0; | ||
717 | ee->prop.layer = 0; | ||
718 | ee->prop.focused = 0; | ||
719 | ee->prop.borderless = 1; | ||
720 | ee->prop.override = 1; | ||
721 | ee->prop.maximized = 0; | ||
722 | ee->prop.fullscreen = 0; | ||
723 | ee->prop.withdrawn = 0; | ||
724 | ee->prop.sticky = 0; | ||
725 | |||
726 | /* init evas here */ | ||
727 | ee->evas = evas_new(); | ||
728 | evas_data_attach_set(ee->evas, ee); | ||
729 | evas_output_method_set(ee->evas, rmethod); | ||
730 | evas_output_size_set(ee->evas, w, h); | ||
731 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
732 | |||
733 | ee->engine.buffer.image = o; | ||
734 | evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee); | ||
735 | evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target); | ||
736 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
737 | EVAS_CALLBACK_MOUSE_IN, | ||
738 | _ecore_evas_buffer_cb_mouse_in, ee); | ||
739 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
740 | EVAS_CALLBACK_MOUSE_OUT, | ||
741 | _ecore_evas_buffer_cb_mouse_out, ee); | ||
742 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
743 | EVAS_CALLBACK_MOUSE_DOWN, | ||
744 | _ecore_evas_buffer_cb_mouse_down, ee); | ||
745 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
746 | EVAS_CALLBACK_MOUSE_UP, | ||
747 | _ecore_evas_buffer_cb_mouse_up, ee); | ||
748 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
749 | EVAS_CALLBACK_MOUSE_MOVE, | ||
750 | _ecore_evas_buffer_cb_mouse_move, ee); | ||
751 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
752 | EVAS_CALLBACK_MOUSE_WHEEL, | ||
753 | _ecore_evas_buffer_cb_mouse_wheel, ee); | ||
754 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
755 | EVAS_CALLBACK_MULTI_DOWN, | ||
756 | _ecore_evas_buffer_cb_multi_down, ee); | ||
757 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
758 | EVAS_CALLBACK_MULTI_UP, | ||
759 | _ecore_evas_buffer_cb_multi_up, ee); | ||
760 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
761 | EVAS_CALLBACK_MULTI_MOVE, | ||
762 | _ecore_evas_buffer_cb_multi_move, ee); | ||
763 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
764 | EVAS_CALLBACK_FREE, | ||
765 | _ecore_evas_buffer_cb_free, ee); | ||
766 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
767 | EVAS_CALLBACK_KEY_DOWN, | ||
768 | _ecore_evas_buffer_cb_key_down, ee); | ||
769 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
770 | EVAS_CALLBACK_KEY_UP, | ||
771 | _ecore_evas_buffer_cb_key_up, ee); | ||
772 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
773 | EVAS_CALLBACK_FOCUS_IN, | ||
774 | _ecore_evas_buffer_cb_focus_in, ee); | ||
775 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
776 | EVAS_CALLBACK_FOCUS_OUT, | ||
777 | _ecore_evas_buffer_cb_focus_out, ee); | ||
778 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
779 | EVAS_CALLBACK_SHOW, | ||
780 | _ecore_evas_buffer_cb_show, ee); | ||
781 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
782 | EVAS_CALLBACK_HIDE, | ||
783 | _ecore_evas_buffer_cb_hide, ee); | ||
784 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
785 | if (einfo) | ||
786 | { | ||
787 | ee->engine.buffer.pixels = evas_object_image_data_get(o, 1); | ||
788 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
789 | einfo->info.dest_buffer = ee->engine.buffer.pixels; | ||
790 | einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o); | ||
791 | einfo->info.use_color_key = 0; | ||
792 | einfo->info.alpha_threshold = 0; | ||
793 | einfo->info.func.new_update_region = NULL; | ||
794 | einfo->info.func.free_update_region = NULL; | ||
795 | evas_object_image_data_set(o, ee->engine.buffer.pixels); | ||
796 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
797 | { | ||
798 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
799 | ecore_evas_free(ee); | ||
800 | return NULL; | ||
801 | } | ||
802 | } | ||
803 | else | ||
804 | { | ||
805 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
806 | ecore_evas_free(ee); | ||
807 | return NULL; | ||
808 | } | ||
809 | evas_key_modifier_add(ee->evas, "Shift"); | ||
810 | evas_key_modifier_add(ee->evas, "Control"); | ||
811 | evas_key_modifier_add(ee->evas, "Alt"); | ||
812 | evas_key_modifier_add(ee->evas, "Meta"); | ||
813 | evas_key_modifier_add(ee->evas, "Hyper"); | ||
814 | evas_key_modifier_add(ee->evas, "Super"); | ||
815 | evas_key_lock_add(ee->evas, "Caps_Lock"); | ||
816 | evas_key_lock_add(ee->evas, "Num_Lock"); | ||
817 | evas_key_lock_add(ee->evas, "Scroll_Lock"); | ||
818 | |||
819 | ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee); | ||
820 | |||
821 | ee->engine.func->fn_render = _ecore_evas_buffer_render; | ||
822 | |||
823 | return o; | ||
824 | #else | ||
825 | return NULL; | ||
826 | #endif | ||
827 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c new file mode 100644 index 0000000..1f946d5 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c | |||
@@ -0,0 +1,574 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include "Ecore.h" | ||
6 | #include "ecore_private.h" | ||
7 | #include "Ecore_Input.h" | ||
8 | #include "Ecore_Input_Evas.h" | ||
9 | |||
10 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
11 | #include <Ecore_Cocoa.h> | ||
12 | #include <Evas_Engine_Gl_Cocoa.h> | ||
13 | #endif | ||
14 | |||
15 | #include "ecore_evas_private.h" | ||
16 | #include "Ecore_Evas.h" | ||
17 | |||
18 | |||
19 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
20 | |||
21 | // FIXME: this engine has lots of problems. only 1 window at a time, drawRect looks wrong, doesnt handle resizes and more | ||
22 | |||
23 | static int _ecore_evas_init_count = 0; | ||
24 | static Ecore_Evas *ecore_evases = NULL; | ||
25 | static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { | ||
26 | NULL, NULL, NULL, NULL | ||
27 | }; | ||
28 | static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; | ||
29 | static Ecore_Poller *ecore_evas_event = NULL; | ||
30 | |||
31 | static const char *ecore_evas_cocoa_default = "EFL Cocoa"; | ||
32 | |||
33 | |||
34 | static int | ||
35 | _ecore_evas_cocoa_render(Ecore_Evas *ee) | ||
36 | { | ||
37 | int rend = 0; | ||
38 | Eina_List *updates = NULL; | ||
39 | Eina_List *ll; | ||
40 | Ecore_Evas *ee2; | ||
41 | |||
42 | DBG("Render"); | ||
43 | |||
44 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
45 | { | ||
46 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
47 | if (ee2->engine.func->fn_render) | ||
48 | rend |= ee2->engine.func->fn_render(ee2); | ||
49 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
50 | } | ||
51 | |||
52 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
53 | updates = evas_render_updates(ee->evas); | ||
54 | if (ee->prop.avoid_damage) | ||
55 | { | ||
56 | updates = evas_render_updates(ee->evas); | ||
57 | if (updates) evas_render_updates_free(updates); | ||
58 | } | ||
59 | else if ((ee->visible) || | ||
60 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
61 | ((ee->should_be_visible) && (ee->prop.override))) | ||
62 | { | ||
63 | if (ee->shaped) | ||
64 | { | ||
65 | updates = evas_render_updates(ee->evas); | ||
66 | if (updates) evas_render_updates_free(updates); | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | updates = evas_render_updates(ee->evas); | ||
71 | if (updates) evas_render_updates_free(updates); | ||
72 | } | ||
73 | } | ||
74 | else | ||
75 | evas_norender(ee->evas); | ||
76 | if (updates) rend = 1; | ||
77 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
78 | |||
79 | if (rend) | ||
80 | { | ||
81 | static int frames = 0; | ||
82 | static double t0 = 0.0; | ||
83 | double t, td; | ||
84 | |||
85 | t = ecore_time_get(); | ||
86 | frames++; | ||
87 | if ((t - t0) > 1.0) | ||
88 | { | ||
89 | td = t - t0; | ||
90 | printf("FPS: %3.3f\n", (double)frames / td); | ||
91 | frames = 0; | ||
92 | t0 = t; | ||
93 | } | ||
94 | } | ||
95 | |||
96 | return rend; | ||
97 | } | ||
98 | |||
99 | |||
100 | static Ecore_Evas * | ||
101 | _ecore_evas_cocoa_match(void) | ||
102 | { | ||
103 | DBG("Match"); | ||
104 | return ecore_evases; | ||
105 | } | ||
106 | |||
107 | static int | ||
108 | _ecore_evas_cocoa_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
109 | { | ||
110 | Ecore_Evas *ee; | ||
111 | |||
112 | DBG("Got Focus"); | ||
113 | |||
114 | ee = _ecore_evas_cocoa_match(); | ||
115 | |||
116 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
117 | ee->prop.focused = 1; | ||
118 | evas_focus_in(ee->evas); | ||
119 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
120 | |||
121 | return ECORE_CALLBACK_PASS_ON; | ||
122 | } | ||
123 | |||
124 | static int | ||
125 | _ecore_evas_cocoa_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
126 | { | ||
127 | Ecore_Evas *ee; | ||
128 | |||
129 | DBG("Lost Focus"); | ||
130 | |||
131 | ee = _ecore_evas_cocoa_match(); | ||
132 | |||
133 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
134 | evas_focus_out(ee->evas); | ||
135 | ee->prop.focused = 0; | ||
136 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
137 | |||
138 | return ECORE_CALLBACK_PASS_ON; | ||
139 | } | ||
140 | |||
141 | static int | ||
142 | _ecore_evas_cocoa_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
143 | { | ||
144 | /*Ecore_Cocoa_Event_Video_Resize *e; | ||
145 | Ecore_Evas *ee; | ||
146 | |||
147 | e = event; | ||
148 | ee = _ecore_evas_cocoa_match(); | ||
149 | |||
150 | if (!ee) return 1; // pass on event | ||
151 | evas_output_size_set(ee->evas, e->w, e->h); | ||
152 | |||
153 | return 0;*/ | ||
154 | |||
155 | DBG("Video Resize"); | ||
156 | return ECORE_CALLBACK_PASS_ON; | ||
157 | } | ||
158 | |||
159 | static int | ||
160 | _ecore_evas_cocoa_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
161 | { | ||
162 | Ecore_Evas *ee; | ||
163 | int w; | ||
164 | int h; | ||
165 | |||
166 | DBG("Video Expose"); | ||
167 | |||
168 | ee = _ecore_evas_cocoa_match(); | ||
169 | |||
170 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
171 | evas_output_size_get(ee->evas, &w, &h); | ||
172 | evas_damage_rectangle_add(ee->evas, 0, 0, w, h); | ||
173 | |||
174 | return ECORE_CALLBACK_PASS_ON; | ||
175 | } | ||
176 | |||
177 | static int | ||
178 | _ecore_evas_idle_enter(void *data __UNUSED__) | ||
179 | { | ||
180 | Ecore_Evas *ee; | ||
181 | double t1 = 0.; | ||
182 | double t2 = 0.; | ||
183 | |||
184 | DBG("Idle enter"); | ||
185 | |||
186 | EINA_INLIST_FOREACH(ecore_evases, ee) | ||
187 | { | ||
188 | if (ee->visible) | ||
189 | evas_render(ee->evas); | ||
190 | else | ||
191 | evas_norender(ee->evas); | ||
192 | } | ||
193 | |||
194 | return EINA_TRUE; | ||
195 | } | ||
196 | |||
197 | static int | ||
198 | _ecore_evas_cocoa_event(void *data) | ||
199 | { | ||
200 | // ecore_cocoa_feed_events(); | ||
201 | |||
202 | DBG("Cocoa Event"); | ||
203 | |||
204 | return 1; | ||
205 | } | ||
206 | |||
207 | static int | ||
208 | _ecore_evas_cocoa_init(void) | ||
209 | { | ||
210 | DBG("Cocoa Init"); | ||
211 | _ecore_evas_init_count++; | ||
212 | if (_ecore_evas_init_count > 1) | ||
213 | return _ecore_evas_init_count; | ||
214 | |||
215 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL); | ||
216 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL); | ||
217 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL); | ||
218 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_EXPOSE, _ecore_evas_cocoa_event_video_expose, NULL); | ||
219 | |||
220 | ecore_event_evas_init(); | ||
221 | return _ecore_evas_init_count; | ||
222 | } | ||
223 | |||
224 | static int | ||
225 | _ecore_evas_cocoa_shutdown(void) | ||
226 | { | ||
227 | DBG("Cocoa SHutodwn"); | ||
228 | _ecore_evas_init_count--; | ||
229 | if (_ecore_evas_init_count == 0) | ||
230 | { | ||
231 | int i; | ||
232 | |||
233 | while (ecore_evases) _ecore_evas_free(ecore_evases); | ||
234 | |||
235 | for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) | ||
236 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
237 | ecore_event_evas_shutdown(); | ||
238 | ecore_idle_enterer_del(ecore_evas_idle_enterer); | ||
239 | ecore_evas_idle_enterer = NULL; | ||
240 | ecore_poller_del(ecore_evas_event); | ||
241 | ecore_evas_event = NULL; | ||
242 | |||
243 | ecore_event_evas_shutdown(); | ||
244 | } | ||
245 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
246 | return _ecore_evas_init_count; | ||
247 | } | ||
248 | |||
249 | static void | ||
250 | _ecore_evas_cocoa_free(Ecore_Evas *ee) | ||
251 | { | ||
252 | DBG("Cocoa Free"); | ||
253 | ecore_evases = (Ecore_Evas *) eina_inlist_remove(EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); | ||
254 | ecore_event_window_unregister(0); | ||
255 | _ecore_evas_cocoa_shutdown(); | ||
256 | ecore_cocoa_shutdown(); | ||
257 | } | ||
258 | |||
259 | static void | ||
260 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
261 | { | ||
262 | DBG("Resize"); | ||
263 | if ((w == ee->w) && (h == ee->h)) return; | ||
264 | ee->w = w; | ||
265 | ee->h = h; | ||
266 | |||
267 | printf("Ecore_Evas Resize %d %d\n", w, h); | ||
268 | |||
269 | ecore_cocoa_window_resize(ee->prop.window, w, h); | ||
270 | |||
271 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
272 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
273 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
274 | |||
275 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
276 | } | ||
277 | |||
278 | static void | ||
279 | _ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) | ||
280 | { | ||
281 | DBG("Move Resize"); | ||
282 | if ((w == ee->w) && (h == ee->h)) return; | ||
283 | ee->w = w; | ||
284 | ee->h = h; | ||
285 | |||
286 | ecore_cocoa_window_move_resize(ee->prop.window, x, y, w, h); | ||
287 | |||
288 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
289 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
290 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
291 | |||
292 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
293 | } | ||
294 | |||
295 | |||
296 | static void | ||
297 | _ecore_evas_show(Ecore_Evas *ee, int x, int y, int w, int h) | ||
298 | { | ||
299 | DBG("Show"); | ||
300 | ee->should_be_visible = 1; | ||
301 | if (ee->prop.avoid_damage) | ||
302 | _ecore_evas_cocoa_render(ee); | ||
303 | |||
304 | ecore_cocoa_window_show(ee->prop.window); | ||
305 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
306 | } | ||
307 | |||
308 | |||
309 | static void | ||
310 | _ecore_evas_hide(Ecore_Evas *ee, int x, int y, int w, int h) | ||
311 | { | ||
312 | DBG("Hide"); | ||
313 | |||
314 | ecore_cocoa_window_hide(ee->prop.window); | ||
315 | ee->should_be_visible = 0; | ||
316 | } | ||
317 | |||
318 | static void | ||
319 | _ecore_evas_title_set(Ecore_Evas *ee, const char *title) | ||
320 | { | ||
321 | INF("ecore evas title set"); | ||
322 | |||
323 | if (ee->prop.title) free(ee->prop.title); | ||
324 | ee->prop.title = NULL; | ||
325 | if (title) ee->prop.title = strdup(title); | ||
326 | ecore_cocoa_window_title_set(ee->prop.window, | ||
327 | ee->prop.title); | ||
328 | } | ||
329 | |||
330 | static void | ||
331 | _ecore_evas_object_cursor_del(void *data, Evas *e, Evas_Object *obj, void *event_info) | ||
332 | { | ||
333 | Ecore_Evas *ee; | ||
334 | |||
335 | DBG("Cursor DEL"); | ||
336 | |||
337 | ee = data; | ||
338 | if (ee) | ||
339 | ee->prop.cursor.object = NULL; | ||
340 | } | ||
341 | |||
342 | static void | ||
343 | _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
344 | { | ||
345 | int x, y; | ||
346 | DBG("Cursor Set"); | ||
347 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
348 | |||
349 | if (obj == NULL) | ||
350 | { | ||
351 | ee->prop.cursor.object = NULL; | ||
352 | ee->prop.cursor.layer = 0; | ||
353 | ee->prop.cursor.hot.x = 0; | ||
354 | ee->prop.cursor.hot.y = 0; | ||
355 | return; | ||
356 | } | ||
357 | |||
358 | ee->prop.cursor.object = obj; | ||
359 | ee->prop.cursor.layer = layer; | ||
360 | ee->prop.cursor.hot.x = hot_x; | ||
361 | ee->prop.cursor.hot.y = hot_y; | ||
362 | |||
363 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
364 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
365 | evas_object_move(ee->prop.cursor.object, | ||
366 | x - ee->prop.cursor.hot.x, | ||
367 | y - ee->prop.cursor.hot.y); | ||
368 | |||
369 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
370 | |||
371 | if (evas_pointer_inside_get(ee->evas)) | ||
372 | evas_object_show(ee->prop.cursor.object); | ||
373 | |||
374 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
375 | } | ||
376 | |||
377 | static int | ||
378 | _ecore_evas_engine_cocoa_init(Ecore_Evas *ee) | ||
379 | { | ||
380 | Evas_Engine_Info_GL_Cocoa *einfo; | ||
381 | const char *driver; | ||
382 | int rmethod; | ||
383 | |||
384 | DBG("Cocoa Init"); | ||
385 | |||
386 | driver = "gl_cocoa"; | ||
387 | |||
388 | rmethod = evas_render_method_lookup(driver); | ||
389 | if (!rmethod) | ||
390 | return 0; | ||
391 | |||
392 | ee->driver = driver; | ||
393 | evas_output_method_set(ee->evas, rmethod); | ||
394 | |||
395 | einfo = (Evas_Engine_Info_GL_Cocoa *)evas_engine_info_get(ee->evas); | ||
396 | if (einfo) | ||
397 | { | ||
398 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
399 | einfo->window = ee->prop.window; | ||
400 | //einfo->info.depth = ecore_win32_screen_depth_get(); | ||
401 | //einfo->info.rotation = 0; | ||
402 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
403 | { | ||
404 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
405 | return 0; | ||
406 | } | ||
407 | ecore_cocoa_window_view_set(einfo->window, einfo->view); | ||
408 | } | ||
409 | else | ||
410 | { | ||
411 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
412 | return 0; | ||
413 | } | ||
414 | |||
415 | return 1; | ||
416 | } | ||
417 | |||
418 | static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = | ||
419 | { | ||
420 | _ecore_evas_cocoa_free, | ||
421 | NULL, | ||
422 | NULL, | ||
423 | NULL, | ||
424 | NULL, | ||
425 | NULL, | ||
426 | NULL, | ||
427 | NULL, | ||
428 | NULL, | ||
429 | NULL, | ||
430 | NULL, | ||
431 | NULL, | ||
432 | NULL, | ||
433 | NULL, | ||
434 | NULL, | ||
435 | NULL, //move | ||
436 | NULL, | ||
437 | _ecore_evas_resize, | ||
438 | _ecore_evas_move_resize, | ||
439 | NULL, //rotation | ||
440 | NULL, //shaped | ||
441 | _ecore_evas_show, | ||
442 | _ecore_evas_hide, | ||
443 | NULL, //raise | ||
444 | NULL, //lower | ||
445 | NULL, //activate | ||
446 | _ecore_evas_title_set, | ||
447 | NULL, | ||
448 | NULL, | ||
449 | NULL, | ||
450 | NULL, | ||
451 | NULL, | ||
452 | _ecore_evas_object_cursor_set, | ||
453 | NULL, | ||
454 | NULL, | ||
455 | NULL, | ||
456 | NULL, | ||
457 | NULL, | ||
458 | NULL, | ||
459 | NULL, | ||
460 | NULL, | ||
461 | NULL, | ||
462 | NULL, | ||
463 | NULL, | ||
464 | NULL, | ||
465 | NULL, //transparent | ||
466 | NULL, // render | ||
467 | NULL | ||
468 | }; | ||
469 | #endif | ||
470 | |||
471 | EAPI Ecore_Evas * | ||
472 | ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h) | ||
473 | { | ||
474 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
475 | Evas_Engine_Info_GL_Cocoa *einfo; | ||
476 | Ecore_Evas *ee; | ||
477 | int rmethod; | ||
478 | |||
479 | DBG("Cocoa new"); | ||
480 | |||
481 | if (!ecore_cocoa_init()) | ||
482 | return NULL; | ||
483 | |||
484 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
485 | if (!ee) | ||
486 | goto shutdown_ecore_cocoa; | ||
487 | |||
488 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
489 | |||
490 | _ecore_evas_cocoa_init(); | ||
491 | |||
492 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func; | ||
493 | |||
494 | if (w < 1) w = 1; | ||
495 | if (h < 1) h = 1; | ||
496 | ee->visible = 1; | ||
497 | ee->x = x; | ||
498 | ee->y = y; | ||
499 | ee->w = w; | ||
500 | ee->h = h; | ||
501 | ee->req.x = ee->x; | ||
502 | ee->req.y = ee->y; | ||
503 | ee->req.w = ee->w; | ||
504 | ee->req.h = ee->h; | ||
505 | |||
506 | ee->semi_sync = 1; | ||
507 | |||
508 | |||
509 | ee->prop.max.w = 32767; | ||
510 | ee->prop.max.h = 32767; | ||
511 | ee->prop.layer = 4; | ||
512 | ee->prop.request_pos = 0; | ||
513 | ee->prop.sticky = 0; | ||
514 | ee->prop.window = 0; | ||
515 | |||
516 | printf("Create New Evas\n"); | ||
517 | |||
518 | ee->evas = evas_new(); | ||
519 | |||
520 | if (!ee->evas) | ||
521 | goto free_name; | ||
522 | |||
523 | evas_data_attach_set(ee->evas, ee); | ||
524 | evas_output_method_set(ee->evas, rmethod); | ||
525 | evas_output_size_set(ee->evas, w, h); | ||
526 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
527 | |||
528 | printf("Create New Cocoa Window\n"); | ||
529 | ee->prop.window = (Ecore_Cocoa_Window*)ecore_cocoa_window_new(x, y, w, h); | ||
530 | printf("Window Created %p\n", ee->prop.window); | ||
531 | if (!ee->prop.window) | ||
532 | { | ||
533 | _ecore_evas_cocoa_shutdown(); | ||
534 | free(ee); | ||
535 | return NULL; | ||
536 | } | ||
537 | |||
538 | printf("Init Evas engine cocoa\n"); | ||
539 | if (!_ecore_evas_engine_cocoa_init(ee)) | ||
540 | { | ||
541 | _ecore_evas_cocoa_shutdown(); | ||
542 | free(ee); | ||
543 | return NULL; | ||
544 | } | ||
545 | |||
546 | |||
547 | ee->engine.func->fn_render = _ecore_evas_cocoa_render; | ||
548 | _ecore_evas_register(ee); | ||
549 | ecore_event_window_register(0, ee, ee->evas, NULL, NULL, NULL, NULL); | ||
550 | |||
551 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
552 | printf("Ecore Evas returned : %p\n", ee); | ||
553 | return ee; | ||
554 | |||
555 | free_window: | ||
556 | /* FIXME: free window here */ | ||
557 | free_evas: | ||
558 | free(ee->evas); | ||
559 | free_name: | ||
560 | free(ee->name); | ||
561 | free_ee: | ||
562 | _ecore_evas_cocoa_shutdown(); | ||
563 | free(ee); | ||
564 | shutdown_ecore_cocoa: | ||
565 | ecore_cocoa_shutdown(); | ||
566 | |||
567 | return NULL; | ||
568 | #else | ||
569 | ERR("Cocoa support in ecore-evas not enabled"); | ||
570 | return NULL; | ||
571 | parent = NULL; | ||
572 | x = y = w = h = 0; | ||
573 | #endif | ||
574 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c new file mode 100644 index 0000000..457f9e9 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c | |||
@@ -0,0 +1,596 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <string.h> | ||
6 | |||
7 | #include <Ecore.h> | ||
8 | #include "ecore_private.h" | ||
9 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
10 | #include <Ecore_DirectFB.h> | ||
11 | #endif | ||
12 | |||
13 | #include "ecore_evas_private.h" | ||
14 | #include "Ecore_Evas.h" | ||
15 | |||
16 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
17 | static int _ecore_evas_init_count = 0; | ||
18 | static Ecore_Event_Handler *ecore_evas_event_handlers[13]; | ||
19 | |||
20 | static Eina_Hash *ecore_evases_hash = NULL; | ||
21 | |||
22 | static int | ||
23 | _ecore_evas_directfb_render(Ecore_Evas *ee) | ||
24 | { | ||
25 | Eina_List *updates, *ll; | ||
26 | Ecore_Evas *ee2; | ||
27 | int rend = 0; | ||
28 | |||
29 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
30 | { | ||
31 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
32 | if (ee2->engine.func->fn_render) | ||
33 | rend |= ee2->engine.func->fn_render(ee2); | ||
34 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
35 | } | ||
36 | |||
37 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
38 | updates = evas_render_updates(ee->evas); | ||
39 | if (updates) | ||
40 | { | ||
41 | evas_render_updates_free(updates); | ||
42 | _ecore_evas_idle_timeout_update(ee); | ||
43 | } | ||
44 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
45 | |||
46 | return updates ? 1 : rend; | ||
47 | } | ||
48 | |||
49 | static char * | ||
50 | _ecore_evas_directfb_winid_str_get(Ecore_X_Window win) | ||
51 | { | ||
52 | const char *vals = "qWeRtYuIoP5$&<~"; | ||
53 | static char id[9]; | ||
54 | unsigned int val; | ||
55 | val = (unsigned int)win; | ||
56 | id[0] = vals[(val >> 28) & 0xf]; | ||
57 | id[1] = vals[(val >> 24) & 0xf]; | ||
58 | id[2] = vals[(val >> 20) & 0xf]; | ||
59 | id[3] = vals[(val >> 16) & 0xf]; | ||
60 | id[4] = vals[(val >> 12) & 0xf]; | ||
61 | id[5] = vals[(val >> 8) & 0xf]; | ||
62 | id[6] = vals[(val >> 4) & 0xf]; | ||
63 | id[7] = vals[(val ) & 0xf]; | ||
64 | id[8] = 0; | ||
65 | return id; | ||
66 | } | ||
67 | |||
68 | static Ecore_Evas * | ||
69 | _ecore_evas_directfb_match(DFBWindowID win) | ||
70 | { | ||
71 | Ecore_Evas *ee; | ||
72 | |||
73 | ee = eina_hash_find(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(win)); | ||
74 | return ee; | ||
75 | } | ||
76 | |||
77 | static Eina_Bool | ||
78 | _ecore_evas_directfb_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
79 | { | ||
80 | Ecore_Evas *ee; | ||
81 | Ecore_DirectFB_Event_Key_Down *e; | ||
82 | |||
83 | e = event; | ||
84 | ee = _ecore_evas_directfb_match(e->win); | ||
85 | |||
86 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
87 | evas_event_feed_key_down(ee->evas, e->name, e->name, e->string, | ||
88 | e->key_compose, e->time, NULL); | ||
89 | return EINA_TRUE; | ||
90 | } | ||
91 | |||
92 | static Eina_Bool | ||
93 | _ecore_evas_directfb_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
94 | { | ||
95 | Ecore_Evas *ee; | ||
96 | Ecore_DirectFB_Event_Key_Up *e; | ||
97 | |||
98 | e = event; | ||
99 | ee = _ecore_evas_directfb_match(e->win); | ||
100 | |||
101 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
102 | evas_event_feed_key_up(ee->evas, e->name, e->name, e->string, | ||
103 | e->key_compose, e->time, NULL); | ||
104 | return EINA_TRUE; | ||
105 | } | ||
106 | |||
107 | static Eina_Bool | ||
108 | _ecore_evas_directfb_event_motion(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
109 | { | ||
110 | Ecore_Evas *ee; | ||
111 | Ecore_DirectFB_Event_Motion *e; | ||
112 | |||
113 | e = event; | ||
114 | ee = _ecore_evas_directfb_match(e->win); | ||
115 | |||
116 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
117 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
118 | return EINA_TRUE; | ||
119 | } | ||
120 | |||
121 | static Eina_Bool | ||
122 | _ecore_evas_directfb_event_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
123 | { | ||
124 | Ecore_Evas *ee; | ||
125 | Ecore_DirectFB_Event_Button_Down *e; | ||
126 | |||
127 | e = event; | ||
128 | ee = _ecore_evas_directfb_match(e->win); | ||
129 | |||
130 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
131 | // _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
132 | evas_event_feed_mouse_down(ee->evas, e->button, EVAS_BUTTON_NONE, e->time, NULL); | ||
133 | return EINA_TRUE; | ||
134 | } | ||
135 | |||
136 | static Eina_Bool | ||
137 | _ecore_evas_directfb_event_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
138 | { | ||
139 | Ecore_Evas *ee; | ||
140 | Ecore_DirectFB_Event_Button_Up *e; | ||
141 | Evas_Button_Flags flags = EVAS_BUTTON_NONE; | ||
142 | |||
143 | e = event; | ||
144 | ee = _ecore_evas_directfb_match(e->win); | ||
145 | |||
146 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
147 | //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
148 | evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL); | ||
149 | return EINA_TRUE; | ||
150 | } | ||
151 | |||
152 | static Eina_Bool | ||
153 | _ecore_evas_directfb_event_enter(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
154 | { | ||
155 | Ecore_Evas *ee; | ||
156 | Ecore_DirectFB_Event_Enter *e; | ||
157 | |||
158 | e = event; | ||
159 | ee = _ecore_evas_directfb_match(e->win); | ||
160 | |||
161 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
162 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | ||
163 | //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
164 | return EINA_TRUE; | ||
165 | } | ||
166 | |||
167 | static Eina_Bool | ||
168 | _ecore_evas_directfb_event_leave(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
169 | { | ||
170 | Ecore_Evas *ee; | ||
171 | Ecore_DirectFB_Event_Leave *e; | ||
172 | |||
173 | e = event; | ||
174 | ee = _ecore_evas_directfb_match(e->win); | ||
175 | |||
176 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
177 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
178 | //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
179 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
180 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
181 | return EINA_TRUE; | ||
182 | } | ||
183 | |||
184 | static Eina_Bool | ||
185 | _ecore_evas_directfb_event_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
186 | { | ||
187 | Ecore_Evas *ee; | ||
188 | Ecore_DirectFB_Event_Wheel *e; | ||
189 | |||
190 | e = event; | ||
191 | ee = _ecore_evas_directfb_match(e->win); | ||
192 | |||
193 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
194 | evas_event_feed_mouse_wheel(ee->evas, e->direction, e->z, e->time, NULL); | ||
195 | return EINA_TRUE; | ||
196 | } | ||
197 | |||
198 | static Eina_Bool | ||
199 | _ecore_evas_directfb_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
200 | { | ||
201 | Ecore_Evas *ee; | ||
202 | Ecore_DirectFB_Event_Got_Focus *e; | ||
203 | |||
204 | e = event; | ||
205 | ee = _ecore_evas_directfb_match(e->win); | ||
206 | |||
207 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
208 | ee->prop.focused = 1; | ||
209 | return EINA_TRUE; | ||
210 | } | ||
211 | |||
212 | static Eina_Bool | ||
213 | _ecore_evas_directfb_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
214 | { | ||
215 | Ecore_Evas *ee; | ||
216 | Ecore_DirectFB_Event_Lost_Focus *e; | ||
217 | |||
218 | e = event; | ||
219 | ee = _ecore_evas_directfb_match(e->win); | ||
220 | |||
221 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
222 | ee->prop.focused = 0; | ||
223 | return EINA_TRUE; | ||
224 | } | ||
225 | |||
226 | int | ||
227 | _ecore_evas_directfb_shutdown(void) | ||
228 | { | ||
229 | _ecore_evas_init_count--; | ||
230 | if (_ecore_evas_init_count == 0) | ||
231 | { | ||
232 | int i; | ||
233 | |||
234 | for (i = 0; i < 8; i++) | ||
235 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
236 | } | ||
237 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
238 | return _ecore_evas_init_count; | ||
239 | } | ||
240 | |||
241 | |||
242 | |||
243 | |||
244 | |||
245 | int | ||
246 | _ecore_evas_directfb_init(void) | ||
247 | { | ||
248 | _ecore_evas_init_count++; | ||
249 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
250 | |||
251 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, _ecore_evas_directfb_event_key_down, NULL); | ||
252 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_UP, _ecore_evas_directfb_event_key_up, NULL); | ||
253 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, _ecore_evas_directfb_event_button_down, NULL); | ||
254 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, _ecore_evas_directfb_event_button_up, NULL); | ||
255 | ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_MOTION, _ecore_evas_directfb_event_motion, NULL); | ||
256 | ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_ENTER, _ecore_evas_directfb_event_enter, NULL); | ||
257 | ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LEAVE, _ecore_evas_directfb_event_leave, NULL); | ||
258 | ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_WHEEL, _ecore_evas_directfb_event_wheel, NULL); | ||
259 | ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, _ecore_evas_directfb_event_got_focus, NULL); | ||
260 | ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, _ecore_evas_directfb_event_lost_focus, NULL); | ||
261 | ecore_evas_event_handlers[10] = NULL; | ||
262 | ecore_evas_event_handlers[11] = NULL; | ||
263 | ecore_evas_event_handlers[12] = NULL; | ||
264 | |||
265 | return _ecore_evas_init_count; | ||
266 | } | ||
267 | |||
268 | /* engine functions */ | ||
269 | /********************/ | ||
270 | |||
271 | static void | ||
272 | _ecore_evas_directfb_free(Ecore_Evas *ee) | ||
273 | { | ||
274 | eina_hash_del(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); | ||
275 | ecore_directfb_window_free(ee->engine.directfb.window); | ||
276 | _ecore_evas_directfb_shutdown(); | ||
277 | ecore_directfb_shutdown(); | ||
278 | } | ||
279 | |||
280 | static void | ||
281 | _ecore_evas_directfb_move(Ecore_Evas *ee, int x, int y) | ||
282 | { | ||
283 | ecore_directfb_window_move(ee->engine.directfb.window, x, y); | ||
284 | } | ||
285 | |||
286 | static void | ||
287 | _ecore_evas_directfb_resize(Ecore_Evas *ee, int w, int h) | ||
288 | { | ||
289 | ee->req.w = w; | ||
290 | ee->req.h = h; | ||
291 | if ((w == ee->w) && (h == ee->h)) return; | ||
292 | ecore_directfb_window_resize(ee->engine.directfb.window, w, h); | ||
293 | ee->w = w; | ||
294 | ee->h = h; | ||
295 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
296 | { | ||
297 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
298 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
303 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | static void | ||
308 | _ecore_evas_directfb_focus_set(Ecore_Evas *ee, int on __UNUSED__) | ||
309 | { | ||
310 | ecore_directfb_window_focus(ee->engine.directfb.window); | ||
311 | } | ||
312 | |||
313 | static void | ||
314 | _ecore_evas_directfb_hide(Ecore_Evas *ee) | ||
315 | { | ||
316 | ecore_directfb_window_hide(ee->engine.directfb.window); | ||
317 | ee->should_be_visible = 0; | ||
318 | } | ||
319 | |||
320 | static void | ||
321 | _ecore_evas_directfb_show(Ecore_Evas *ee) | ||
322 | { | ||
323 | ecore_directfb_window_show(ee->engine.directfb.window); | ||
324 | ee->should_be_visible = 1; | ||
325 | } | ||
326 | |||
327 | static void | ||
328 | _ecore_evas_directfb_shaped_set(Ecore_Evas *ee, int shaped) | ||
329 | { | ||
330 | if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped))) | ||
331 | return; | ||
332 | ee->shaped = shaped; | ||
333 | if(ee->shaped) | ||
334 | ecore_directfb_window_shaped_set(ee->engine.directfb.window, 1); | ||
335 | else | ||
336 | ecore_directfb_window_shaped_set(ee->engine.directfb.window, 0); | ||
337 | |||
338 | } | ||
339 | |||
340 | static void | ||
341 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
342 | { | ||
343 | Ecore_Evas *ee; | ||
344 | |||
345 | ee = data; | ||
346 | if (ee) | ||
347 | ee->prop.cursor.object = NULL; | ||
348 | } | ||
349 | |||
350 | static void | ||
351 | _ecore_evas_directfb_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
352 | { | ||
353 | int x, y; | ||
354 | |||
355 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
356 | |||
357 | if (!obj) | ||
358 | { | ||
359 | ee->prop.cursor.object = NULL; | ||
360 | ee->prop.cursor.layer = 0; | ||
361 | ee->prop.cursor.hot.x = 0; | ||
362 | ee->prop.cursor.hot.y = 0; | ||
363 | ecore_directfb_window_cursor_show(ee->engine.directfb.window, 1); | ||
364 | return; | ||
365 | |||
366 | } | ||
367 | |||
368 | ee->prop.cursor.object = obj; | ||
369 | ee->prop.cursor.layer = layer; | ||
370 | ee->prop.cursor.hot.x = hot_x; | ||
371 | ee->prop.cursor.hot.y = hot_y; | ||
372 | |||
373 | ecore_directfb_window_cursor_show(ee->engine.directfb.window, 0); | ||
374 | |||
375 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
376 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
377 | evas_object_move(ee->prop.cursor.object,x - ee->prop.cursor.hot.x,y - ee->prop.cursor.hot.y); | ||
378 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
379 | if (evas_pointer_inside_get(ee->evas)) | ||
380 | evas_object_show(ee->prop.cursor.object); | ||
381 | |||
382 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
383 | } | ||
384 | |||
385 | static void | ||
386 | _ecore_evas_directfb_fullscreen_set(Ecore_Evas *ee, int on) | ||
387 | { | ||
388 | Evas_Engine_Info_DirectFB *einfo; | ||
389 | int w; | ||
390 | int h; | ||
391 | int resized = 0; | ||
392 | |||
393 | if (((ee->prop.fullscreen) && (on)) || ((!ee->prop.fullscreen) && (!on))) | ||
394 | return; | ||
395 | |||
396 | if (on) | ||
397 | ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 1); | ||
398 | else | ||
399 | ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 0); | ||
400 | /* set the new size of the evas */ | ||
401 | ecore_directfb_window_size_get(ee->engine.directfb.window, &w, &h); | ||
402 | if( (ee->w != w) || (ee->h != h)) | ||
403 | { | ||
404 | resized = 1; | ||
405 | ee->w = w; | ||
406 | ee->h = h; | ||
407 | ee->req.w = ee->w; | ||
408 | ee->req.h = ee->h; | ||
409 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
410 | { | ||
411 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
412 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
413 | } | ||
414 | else | ||
415 | { | ||
416 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
417 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
418 | } | ||
419 | } | ||
420 | einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas); | ||
421 | if (einfo) | ||
422 | { | ||
423 | einfo->info.surface = ee->engine.directfb.window->surface; | ||
424 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
425 | { | ||
426 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
427 | } | ||
428 | } | ||
429 | ee->prop.fullscreen = on; | ||
430 | if (resized) | ||
431 | { | ||
432 | if(ee->func.fn_resize) ee->func.fn_resize(ee); | ||
433 | } | ||
434 | } | ||
435 | |||
436 | static void * | ||
437 | _ecore_evas_directfb_window_get(const Ecore_Evas *ee) | ||
438 | { | ||
439 | return ee->engine.directfb.window; | ||
440 | } | ||
441 | #endif | ||
442 | |||
443 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
444 | static Ecore_Evas_Engine_Func _ecore_directfb_engine_func = | ||
445 | { | ||
446 | _ecore_evas_directfb_free, /* free an ecore_evas */ | ||
447 | NULL, /* cb resize */ | ||
448 | NULL, /* cb move */ | ||
449 | NULL, /* cb show */ | ||
450 | NULL, /* cb hide */ | ||
451 | NULL, /* cb delete request */ | ||
452 | NULL, /* cb destroy */ | ||
453 | NULL, /* cb focus in */ | ||
454 | NULL, /* cb focus out */ | ||
455 | NULL, /* cb sticky */ | ||
456 | NULL, /* cb unsticky */ | ||
457 | NULL, /* cb mouse in */ | ||
458 | NULL, /* cb mouse out */ | ||
459 | NULL, /* cb pre render */ | ||
460 | NULL, /* cb post render */ | ||
461 | _ecore_evas_directfb_move, /* move */ | ||
462 | NULL, /* managed move */ | ||
463 | _ecore_evas_directfb_resize, /* resize */ | ||
464 | NULL, /* move resize */ | ||
465 | NULL,//_ecore_evas_directfb_rotation_set,/* rotation */ | ||
466 | _ecore_evas_directfb_shaped_set, /* shaped */ | ||
467 | _ecore_evas_directfb_show, /* show */ | ||
468 | _ecore_evas_directfb_hide, /* hide */ | ||
469 | NULL, /* raise */ | ||
470 | NULL, /* lower */ | ||
471 | NULL, /* activate */ | ||
472 | NULL, /* title set */ | ||
473 | NULL, /* name class set */ | ||
474 | NULL, /* size min */ | ||
475 | NULL, /* size max */ | ||
476 | NULL, /* size base */ | ||
477 | NULL, /* size step */ | ||
478 | _ecore_evas_directfb_object_cursor_set, /* set cursor to an evas object */ | ||
479 | NULL, /* layer set */ | ||
480 | _ecore_evas_directfb_focus_set, /* focus */ | ||
481 | NULL, /* iconified */ | ||
482 | NULL, /* borderless */ | ||
483 | NULL, /* override */ | ||
484 | NULL, /* maximized */ | ||
485 | _ecore_evas_directfb_fullscreen_set,/* fullscreen */ | ||
486 | NULL, /* avoid damage */ | ||
487 | NULL, /* withdrawn */ | ||
488 | NULL, /* sticky */ | ||
489 | NULL, /* ignore events */ | ||
490 | NULL, /* alpha */ | ||
491 | NULL, //transparent | ||
492 | |||
493 | NULL, // render | ||
494 | NULL // screen_geometry_get | ||
495 | }; | ||
496 | #endif | ||
497 | |||
498 | /* api */ | ||
499 | /*******/ | ||
500 | |||
501 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
502 | EAPI Ecore_Evas * | ||
503 | ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) | ||
504 | { | ||
505 | Evas_Engine_Info_DirectFB *einfo; | ||
506 | Ecore_Evas *ee; | ||
507 | Ecore_DirectFB_Window *window; | ||
508 | int rmethod; | ||
509 | |||
510 | rmethod = evas_render_method_lookup("directfb"); | ||
511 | if (!rmethod) return NULL; | ||
512 | if (!ecore_directfb_init(disp_name)) return NULL; | ||
513 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
514 | if (!ee) return NULL; | ||
515 | |||
516 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
517 | _ecore_evas_directfb_init(); | ||
518 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_directfb_engine_func; | ||
519 | |||
520 | ee->driver = "directfb"; | ||
521 | if (disp_name) ee->name = strdup(disp_name); | ||
522 | |||
523 | if (w < 1) w = 1; | ||
524 | if (h < 1) h = 1; | ||
525 | |||
526 | ee->rotation = 0; | ||
527 | ee->visible = 1; | ||
528 | ee->x = x; | ||
529 | ee->y = y; | ||
530 | ee->w = w; | ||
531 | ee->h = h; | ||
532 | ee->req.x = ee->x; | ||
533 | ee->req.y = ee->y; | ||
534 | ee->req.w = ee->w; | ||
535 | ee->req.h = ee->h; | ||
536 | ee->prop.layer = 1; | ||
537 | ee->prop.fullscreen = 0; | ||
538 | |||
539 | /* init evas here */ | ||
540 | ee->evas = evas_new(); | ||
541 | evas_data_attach_set(ee->evas, ee); | ||
542 | evas_output_method_set(ee->evas, rmethod); | ||
543 | evas_output_size_set(ee->evas, w, h); | ||
544 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
545 | einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas); | ||
546 | |||
547 | window = ecore_directfb_window_new(x,y,w,h); | ||
548 | ee->engine.directfb.window = window; | ||
549 | if (einfo) | ||
550 | { | ||
551 | einfo->info.dfb = ecore_directfb_interface_get(); | ||
552 | einfo->info.surface = window->surface; | ||
553 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
554 | { | ||
555 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
556 | ecore_evas_free(ee); | ||
557 | return NULL; | ||
558 | } | ||
559 | } | ||
560 | else | ||
561 | { | ||
562 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
563 | ecore_evas_free(ee); | ||
564 | return NULL; | ||
565 | } | ||
566 | |||
567 | ee->engine.func->fn_render = _ecore_evas_directfb_render; | ||
568 | _ecore_evas_register(ee); | ||
569 | |||
570 | if (!ecore_evases_hash) | ||
571 | ecore_evases_hash = eina_hash_string_superfast_new(NULL); | ||
572 | eina_hash_add(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); | ||
573 | |||
574 | return ee; | ||
575 | } | ||
576 | #else | ||
577 | EAPI Ecore_Evas * | ||
578 | ecore_evas_directfb_new(const char *disp_name __UNUSED__, int windowed __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
579 | { | ||
580 | return NULL; | ||
581 | } | ||
582 | #endif | ||
583 | |||
584 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
585 | EAPI Ecore_DirectFB_Window * | ||
586 | ecore_evas_directfb_window_get(const Ecore_Evas *ee) | ||
587 | { | ||
588 | return (Ecore_DirectFB_Window *) _ecore_evas_directfb_window_get(ee); | ||
589 | } | ||
590 | #else | ||
591 | EAPI Ecore_DirectFB_Window * | ||
592 | ecore_evas_directfb_window_get(const Ecore_Evas *ee __UNUSED__) | ||
593 | { | ||
594 | return NULL; | ||
595 | } | ||
596 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c new file mode 100644 index 0000000..e19fb05 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c | |||
@@ -0,0 +1,1454 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <Ecore.h> | ||
6 | #include "ecore_private.h" | ||
7 | #include <Ecore_Input.h> | ||
8 | |||
9 | #include "ecore_evas_private.h" | ||
10 | #include "Ecore_Evas.h" | ||
11 | |||
12 | EAPI int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = 0; | ||
13 | EAPI int ECORE_EVAS_EWS_EVENT_ADD = 0; | ||
14 | EAPI int ECORE_EVAS_EWS_EVENT_DEL = 0; | ||
15 | EAPI int ECORE_EVAS_EWS_EVENT_RESIZE = 0; | ||
16 | EAPI int ECORE_EVAS_EWS_EVENT_MOVE = 0; | ||
17 | EAPI int ECORE_EVAS_EWS_EVENT_SHOW = 0; | ||
18 | EAPI int ECORE_EVAS_EWS_EVENT_HIDE = 0; | ||
19 | EAPI int ECORE_EVAS_EWS_EVENT_FOCUS = 0; | ||
20 | EAPI int ECORE_EVAS_EWS_EVENT_UNFOCUS = 0; | ||
21 | EAPI int ECORE_EVAS_EWS_EVENT_RAISE = 0; | ||
22 | EAPI int ECORE_EVAS_EWS_EVENT_LOWER = 0; | ||
23 | EAPI int ECORE_EVAS_EWS_EVENT_ACTIVATE = 0; | ||
24 | |||
25 | EAPI int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = 0; | ||
26 | EAPI int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = 0; | ||
27 | EAPI int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = 0; | ||
28 | EAPI int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = 0; | ||
29 | EAPI int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = 0; | ||
30 | |||
31 | #ifdef BUILD_ECORE_EVAS_EWS | ||
32 | static int _ecore_evas_init_count = 0; | ||
33 | |||
34 | static Ecore_Evas *_ews_ee = NULL; | ||
35 | static Evas_Object *_ews_bg = NULL; | ||
36 | static Eina_List *_ews_children = NULL; | ||
37 | static const void *_ews_manager = NULL; | ||
38 | static char *_ews_engine = NULL; | ||
39 | static char *_ews_options = NULL; | ||
40 | static int _ews_x = 0; | ||
41 | static int _ews_y = 0; | ||
42 | static int _ews_w = 1024; | ||
43 | static int _ews_h = 768; | ||
44 | static Eina_Bool _ews_defaults_engine = EINA_TRUE; | ||
45 | static Eina_Bool _ews_defaults_geo = EINA_TRUE; | ||
46 | |||
47 | static const char EWS_ENGINE_NAME[] = "ews"; | ||
48 | |||
49 | static void | ||
50 | _ecore_evas_ews_pre_free(Ecore_Evas *ee __UNUSED__) | ||
51 | { | ||
52 | DBG("EWS backing store free'd"); | ||
53 | _ews_children = eina_list_free(_ews_children); | ||
54 | _ews_ee = NULL; | ||
55 | _ews_bg = NULL; | ||
56 | } | ||
57 | |||
58 | static void | ||
59 | _ecore_evas_ews_del_request(Ecore_Evas *ee __UNUSED__) | ||
60 | { | ||
61 | INF("EWS backing store deletion is forbidden!"); | ||
62 | } | ||
63 | |||
64 | static Ecore_Evas * | ||
65 | _ecore_evas_ews_ee_new(void) | ||
66 | { | ||
67 | Ecore_Evas *ee = ecore_evas_new(_ews_engine, _ews_x, _ews_y, _ews_w, _ews_h, | ||
68 | _ews_options); | ||
69 | if (!ee) | ||
70 | ERR("Failed: ecore_evas_new(%s, %d, %d, %d, %d, %s)", | ||
71 | _ews_engine, _ews_x, _ews_y, _ews_w, _ews_h, _ews_options); | ||
72 | else | ||
73 | { | ||
74 | ecore_evas_size_min_set(ee, _ews_w, _ews_h); | ||
75 | ecore_evas_size_max_set(ee, _ews_w, _ews_h); | ||
76 | ecore_evas_callback_pre_free_set(ee, _ecore_evas_ews_pre_free); | ||
77 | ecore_evas_callback_delete_request_set(ee, _ecore_evas_ews_del_request); | ||
78 | ecore_evas_name_class_set(ee, "ecore_evas_ews", "ews"); | ||
79 | ecore_evas_title_set | ||
80 | (ee, "EWS: Ecore + Evas Single Process Windowing System"); | ||
81 | ecore_evas_show(ee); | ||
82 | } | ||
83 | |||
84 | return ee; | ||
85 | } | ||
86 | |||
87 | static void | ||
88 | _ecore_evas_ews_env_setup(void) | ||
89 | { | ||
90 | const char *env = getenv("ECORE_EVAS_EWS"); | ||
91 | char *p, *n, *tmp; | ||
92 | |||
93 | if (_ews_defaults_engine) | ||
94 | { | ||
95 | free(_ews_engine); | ||
96 | _ews_engine = NULL; | ||
97 | free(_ews_options); | ||
98 | _ews_options = NULL; | ||
99 | } | ||
100 | if (_ews_defaults_geo) | ||
101 | { | ||
102 | _ews_x = 0; | ||
103 | _ews_y = 0; | ||
104 | _ews_w = 1024; | ||
105 | _ews_h = 768; | ||
106 | } | ||
107 | |||
108 | if ((!env) || (!*env)) return; | ||
109 | |||
110 | p = tmp = strdup(env); | ||
111 | if (!tmp) return; | ||
112 | |||
113 | n = strchr(p, ':'); | ||
114 | if (n) *n = '\0'; | ||
115 | if (_ews_defaults_engine) _ews_engine = strdup(p); | ||
116 | if (!n) goto end; | ||
117 | |||
118 | p = n + 1; | ||
119 | n = strchr(p, ':'); | ||
120 | if (!n) goto end; | ||
121 | *n = '\0'; | ||
122 | if (_ews_defaults_geo) _ews_x = atoi(p); | ||
123 | |||
124 | p = n + 1; | ||
125 | n = strchr(p, ':'); | ||
126 | if (!n) goto end; | ||
127 | *n = '\0'; | ||
128 | if (_ews_defaults_geo) _ews_y = atoi(p); | ||
129 | |||
130 | p = n + 1; | ||
131 | n = strchr(p, ':'); | ||
132 | if (!n) goto end; | ||
133 | *n = '\0'; | ||
134 | if (_ews_defaults_geo) _ews_w = atoi(p); | ||
135 | |||
136 | p = n + 1; | ||
137 | n = strchr(p, ':'); | ||
138 | if (n) *n = '\0'; | ||
139 | if (_ews_defaults_geo) _ews_h = atoi(p); | ||
140 | if (!n) goto end; | ||
141 | |||
142 | p = n + 1; | ||
143 | if (_ews_defaults_engine) _ews_options = strdup(p); | ||
144 | |||
145 | end: | ||
146 | free(tmp); | ||
147 | } | ||
148 | |||
149 | static void | ||
150 | _ecore_evas_ews_event_free(void *data __UNUSED__, void *ev) | ||
151 | { | ||
152 | Ecore_Evas *ee = ev; | ||
153 | _ecore_evas_unref(ee); | ||
154 | } | ||
155 | |||
156 | static void | ||
157 | _ecore_evas_ews_event(Ecore_Evas *ee, int event) | ||
158 | { | ||
159 | _ecore_evas_ref(ee); | ||
160 | ecore_event_add(event, ee, _ecore_evas_ews_event_free, NULL); | ||
161 | } | ||
162 | |||
163 | static void | ||
164 | _ecore_evas_ews_event_free_del(void *data __UNUSED__, void *ev __UNUSED__) | ||
165 | { | ||
166 | _ecore_evas_ews_shutdown(); | ||
167 | } | ||
168 | |||
169 | static void | ||
170 | _ecore_evas_ews_free(Ecore_Evas *ee) | ||
171 | { | ||
172 | evas_object_del(ee->engine.ews.image); | ||
173 | _ews_ee->sub_ecore_evas = eina_list_remove(_ews_ee->sub_ecore_evas, ee); | ||
174 | |||
175 | ecore_event_add(ECORE_EVAS_EWS_EVENT_DEL, ee, _ecore_evas_ews_event_free_del, NULL); | ||
176 | } | ||
177 | |||
178 | static void | ||
179 | _ecore_evas_ews_move(Ecore_Evas *ee, int x, int y) | ||
180 | { | ||
181 | ee->req.x = x; | ||
182 | ee->req.y = y; | ||
183 | |||
184 | if ((x == ee->x) && (y == ee->y)) return; | ||
185 | ee->x = x; | ||
186 | ee->y = y; | ||
187 | evas_object_move(ee->engine.ews.image, x, y); | ||
188 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
189 | |||
190 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE); | ||
191 | } | ||
192 | |||
193 | static void | ||
194 | _ecore_evas_ews_managed_move(Ecore_Evas *ee, int x, int y) | ||
195 | { | ||
196 | ee->req.x = x; | ||
197 | ee->req.y = y; | ||
198 | |||
199 | if ((x == ee->x) && (y == ee->y)) return; | ||
200 | ee->x = x; | ||
201 | ee->y = y; | ||
202 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
203 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE); | ||
204 | } | ||
205 | |||
206 | static void | ||
207 | _ecore_evas_ews_resize_internal(Ecore_Evas *ee, int w, int h) | ||
208 | { | ||
209 | Evas_Engine_Info_Buffer *einfo; | ||
210 | void *pixels; | ||
211 | int stride; | ||
212 | |||
213 | evas_output_size_set(ee->evas, w, h); | ||
214 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
215 | evas_damage_rectangle_add(ee->evas, 0, 0, w, h); | ||
216 | |||
217 | evas_object_image_size_set(ee->engine.ews.image, w, h); | ||
218 | evas_object_image_fill_set(ee->engine.ews.image, 0, 0, w, h); | ||
219 | evas_object_resize(ee->engine.ews.image, w, h); | ||
220 | |||
221 | pixels = evas_object_image_data_get(ee->engine.ews.image, 1); | ||
222 | evas_object_image_data_set(ee->engine.ews.image, pixels); // refcount | ||
223 | stride = evas_object_image_stride_get(ee->engine.ews.image); | ||
224 | |||
225 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
226 | EINA_SAFETY_ON_NULL_RETURN(einfo); | ||
227 | |||
228 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
229 | einfo->info.dest_buffer = pixels; | ||
230 | einfo->info.dest_buffer_row_bytes = stride; | ||
231 | einfo->info.use_color_key = 0; | ||
232 | einfo->info.alpha_threshold = 0; | ||
233 | einfo->info.func.new_update_region = NULL; | ||
234 | einfo->info.func.free_update_region = NULL; | ||
235 | evas_object_image_data_set(ee->engine.ews.image, pixels); | ||
236 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
237 | { | ||
238 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
239 | } | ||
240 | } | ||
241 | |||
242 | static void | ||
243 | _ecore_evas_ews_resize(Ecore_Evas *ee, int w, int h) | ||
244 | { | ||
245 | if (w < 1) w = 1; | ||
246 | if (h < 1) h = 1; | ||
247 | |||
248 | ee->req.w = w; | ||
249 | ee->req.h = h; | ||
250 | |||
251 | if ((w == ee->w) && (h == ee->h)) return; | ||
252 | ee->w = w; | ||
253 | ee->h = h; | ||
254 | _ecore_evas_ews_resize_internal(ee, w, h); | ||
255 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
256 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RESIZE); | ||
257 | } | ||
258 | |||
259 | static void | ||
260 | _ecore_evas_ews_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) | ||
261 | { | ||
262 | _ecore_evas_ews_move(ee, x, y); | ||
263 | _ecore_evas_ews_resize(ee, w, h); | ||
264 | } | ||
265 | |||
266 | static void | ||
267 | _ecore_evas_ews_rotation_set(Ecore_Evas *ee, int rot, int resize) | ||
268 | { | ||
269 | if (ee->rotation == rot) return; | ||
270 | ee->rotation = rot; | ||
271 | |||
272 | ERR("TODO: rot=%d, resize=%d", rot, resize); | ||
273 | |||
274 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
275 | } | ||
276 | |||
277 | static void | ||
278 | _ecore_evas_ews_shaped_set(Ecore_Evas *ee, int val) | ||
279 | { | ||
280 | if (ee->shaped == val) return; | ||
281 | ee->shaped = val; | ||
282 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
283 | } | ||
284 | |||
285 | static void | ||
286 | _ecore_evas_ews_show(Ecore_Evas *ee) | ||
287 | { | ||
288 | ee->should_be_visible = EINA_TRUE; | ||
289 | evas_object_show(ee->engine.ews.image); | ||
290 | if (ee->prop.fullscreen) | ||
291 | evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); | ||
292 | |||
293 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
294 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_SHOW); | ||
295 | } | ||
296 | |||
297 | static void | ||
298 | _ecore_evas_ews_hide(Ecore_Evas *ee) | ||
299 | { | ||
300 | ee->should_be_visible = EINA_FALSE; | ||
301 | evas_object_hide(ee->engine.ews.image); | ||
302 | |||
303 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
304 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_HIDE); | ||
305 | } | ||
306 | |||
307 | static void | ||
308 | _ecore_evas_ews_raise(Ecore_Evas *ee) | ||
309 | { | ||
310 | evas_object_raise(ee->engine.ews.image); | ||
311 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RAISE); | ||
312 | } | ||
313 | |||
314 | static void | ||
315 | _ecore_evas_ews_lower(Ecore_Evas *ee) | ||
316 | { | ||
317 | evas_object_lower(ee->engine.ews.image); | ||
318 | evas_object_lower(_ews_bg); | ||
319 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LOWER); | ||
320 | } | ||
321 | |||
322 | static void | ||
323 | _ecore_evas_ews_activate(Ecore_Evas *ee) | ||
324 | { | ||
325 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ACTIVATE); | ||
326 | } | ||
327 | |||
328 | static void | ||
329 | _ecore_evas_ews_title_set(Ecore_Evas *ee, const char *t) | ||
330 | { | ||
331 | if (ee->prop.title) free(ee->prop.title); | ||
332 | ee->prop.title = NULL; | ||
333 | if (t) ee->prop.title = strdup(t); | ||
334 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
335 | } | ||
336 | |||
337 | static void | ||
338 | _ecore_evas_ews_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
339 | { | ||
340 | if (ee->prop.name) free(ee->prop.name); | ||
341 | if (ee->prop.clas) free(ee->prop.clas); | ||
342 | ee->prop.name = NULL; | ||
343 | ee->prop.clas = NULL; | ||
344 | if (n) ee->prop.name = strdup(n); | ||
345 | if (c) ee->prop.clas = strdup(c); | ||
346 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
347 | } | ||
348 | |||
349 | static void | ||
350 | _ecore_evas_ews_size_min_set(Ecore_Evas *ee, int w, int h) | ||
351 | { | ||
352 | if (w < 0) w = 0; | ||
353 | if (h < 0) h = 0; | ||
354 | if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; | ||
355 | ee->prop.min.w = w; | ||
356 | ee->prop.min.h = h; | ||
357 | evas_object_size_hint_min_set(ee->engine.ews.image, w, h); | ||
358 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
359 | } | ||
360 | |||
361 | static void | ||
362 | _ecore_evas_ews_size_max_set(Ecore_Evas *ee, int w, int h) | ||
363 | { | ||
364 | if (w < 0) w = 0; | ||
365 | if (h < 0) h = 0; | ||
366 | if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; | ||
367 | ee->prop.max.w = w; | ||
368 | ee->prop.max.h = h; | ||
369 | evas_object_size_hint_max_set(ee->engine.ews.image, w, h); | ||
370 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
371 | } | ||
372 | |||
373 | static void | ||
374 | _ecore_evas_ews_size_base_set(Ecore_Evas *ee, int w, int h) | ||
375 | { | ||
376 | if (w < 0) w = 0; | ||
377 | if (h < 0) h = 0; | ||
378 | if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; | ||
379 | ee->prop.base.w = w; | ||
380 | ee->prop.base.h = h; | ||
381 | evas_object_size_hint_request_set(ee->engine.ews.image, w, h); | ||
382 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
383 | } | ||
384 | |||
385 | static void | ||
386 | _ecore_evas_ews_size_step_set(Ecore_Evas *ee, int w, int h) | ||
387 | { | ||
388 | if (w < 1) w = 1; | ||
389 | if (h < 1) h = 1; | ||
390 | if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; | ||
391 | ee->prop.step.w = w; | ||
392 | ee->prop.step.h = h; | ||
393 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
394 | } | ||
395 | |||
396 | static void | ||
397 | _ecore_evas_ews_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
398 | { | ||
399 | Ecore_Evas *ee = data; | ||
400 | ee->prop.cursor.object = NULL; | ||
401 | } | ||
402 | |||
403 | static void | ||
404 | _ecore_evas_ews_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
405 | { | ||
406 | int x, y; | ||
407 | |||
408 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
409 | |||
410 | if (!obj) | ||
411 | { | ||
412 | ee->prop.cursor.object = NULL; | ||
413 | ee->prop.cursor.layer = 0; | ||
414 | ee->prop.cursor.hot.x = 0; | ||
415 | ee->prop.cursor.hot.y = 0; | ||
416 | return; | ||
417 | } | ||
418 | |||
419 | ee->prop.cursor.object = obj; | ||
420 | ee->prop.cursor.layer = layer; | ||
421 | ee->prop.cursor.hot.x = hot_x; | ||
422 | ee->prop.cursor.hot.y = hot_y; | ||
423 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
424 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
425 | evas_object_move(ee->prop.cursor.object, | ||
426 | x - ee->prop.cursor.hot.x, | ||
427 | y - ee->prop.cursor.hot.y); | ||
428 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
429 | if (evas_pointer_inside_get(ee->evas)) | ||
430 | evas_object_show(ee->prop.cursor.object); | ||
431 | |||
432 | evas_object_event_callback_add | ||
433 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_ews_object_cursor_del, ee); | ||
434 | |||
435 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
436 | } | ||
437 | |||
438 | static void | ||
439 | _ecore_evas_ews_layer_set(Ecore_Evas *ee, int layer) | ||
440 | { | ||
441 | if (layer < EVAS_LAYER_MIN + 1) | ||
442 | layer = EVAS_LAYER_MIN + 1; | ||
443 | else if (layer > EVAS_LAYER_MAX) | ||
444 | layer = EVAS_LAYER_MAX; | ||
445 | |||
446 | if (ee->prop.layer == layer) return; | ||
447 | ee->prop.layer = layer; | ||
448 | evas_object_layer_set(ee->engine.ews.image, layer); | ||
449 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LAYER_CHANGE); | ||
450 | } | ||
451 | |||
452 | static void | ||
453 | _ecore_evas_ews_focus_set(Ecore_Evas *ee, int val) | ||
454 | { | ||
455 | evas_object_focus_set(ee->engine.ews.image, val); | ||
456 | ee->prop.focused = val; | ||
457 | if (val) | ||
458 | { | ||
459 | evas_focus_in(ee->evas); | ||
460 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
461 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FOCUS); | ||
462 | } | ||
463 | else | ||
464 | { | ||
465 | evas_focus_out(ee->evas); | ||
466 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
467 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_UNFOCUS); | ||
468 | } | ||
469 | } | ||
470 | |||
471 | static void | ||
472 | _ecore_evas_ews_iconified_set(Ecore_Evas *ee, int val) | ||
473 | { | ||
474 | if (ee->prop.iconified == val) return; | ||
475 | ee->prop.iconified = val; | ||
476 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE); | ||
477 | } | ||
478 | |||
479 | static void | ||
480 | _ecore_evas_ews_borderless_set(Ecore_Evas *ee, int val) | ||
481 | { | ||
482 | if (ee->prop.borderless == val) return; | ||
483 | ee->prop.borderless = val; | ||
484 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
485 | } | ||
486 | |||
487 | static void | ||
488 | _ecore_evas_ews_override_set(Ecore_Evas *ee, int val) | ||
489 | { | ||
490 | if (ee->prop.override == val) return; | ||
491 | if (ee->visible) evas_object_show(ee->engine.ews.image); | ||
492 | if (ee->prop.focused) evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); | ||
493 | ee->prop.override = val; | ||
494 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
495 | } | ||
496 | |||
497 | static void | ||
498 | _ecore_evas_ews_maximized_set(Ecore_Evas *ee, int val) | ||
499 | { | ||
500 | if (ee->prop.maximized == val) return; | ||
501 | ee->prop.maximized = val; | ||
502 | if (val) evas_object_show(ee->engine.ews.image); | ||
503 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE); | ||
504 | } | ||
505 | |||
506 | static void | ||
507 | _ecore_evas_ews_fullscreen_set(Ecore_Evas *ee, int val) | ||
508 | { | ||
509 | if (ee->prop.fullscreen == val) return; | ||
510 | ee->prop.fullscreen = val; | ||
511 | |||
512 | if (!val) | ||
513 | { | ||
514 | evas_object_move(ee->engine.ews.image, ee->x, ee->y); | ||
515 | evas_object_resize(ee->engine.ews.image, ee->w, ee->h); | ||
516 | } | ||
517 | else | ||
518 | { | ||
519 | Evas_Coord w, h; | ||
520 | ecore_evas_geometry_get(_ews_ee, NULL, NULL, &w, &h); | ||
521 | evas_object_move(ee->engine.ews.image, 0, 0); | ||
522 | evas_object_resize(ee->engine.ews.image, w, h); | ||
523 | evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); | ||
524 | } | ||
525 | |||
526 | if (ee->should_be_visible) | ||
527 | evas_object_show(ee->engine.ews.image); | ||
528 | else | ||
529 | evas_object_hide(ee->engine.ews.image); | ||
530 | |||
531 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE); | ||
532 | } | ||
533 | |||
534 | static void | ||
535 | _ecore_evas_ews_avoid_damage_set(Ecore_Evas *ee, int val) | ||
536 | { | ||
537 | if (ee->prop.avoid_damage == val) return; | ||
538 | ee->prop.avoid_damage = val; | ||
539 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
540 | } | ||
541 | |||
542 | static void | ||
543 | _ecore_evas_ews_withdrawn_set(Ecore_Evas *ee, int val) | ||
544 | { | ||
545 | if (ee->prop.withdrawn == val) return; | ||
546 | ee->prop.withdrawn = val; | ||
547 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
548 | } | ||
549 | |||
550 | static void | ||
551 | _ecore_evas_ews_sticky_set(Ecore_Evas *ee, int val) | ||
552 | { | ||
553 | if (ee->prop.sticky == val) return; | ||
554 | ee->prop.sticky = val; | ||
555 | if ((val) && (ee->func.fn_sticky)) ee->func.fn_sticky(ee); | ||
556 | else if ((!val) && (ee->func.fn_unsticky)) ee->func.fn_unsticky(ee); | ||
557 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
558 | } | ||
559 | |||
560 | static void | ||
561 | _ecore_evas_ews_ignore_events_set(Ecore_Evas *ee, int val) | ||
562 | { | ||
563 | if (ee->ignore_events == val) return; | ||
564 | ee->ignore_events = val; | ||
565 | evas_object_pass_events_set(ee->engine.ews.image, val); | ||
566 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
567 | } | ||
568 | |||
569 | static void | ||
570 | _ecore_evas_ews_alpha_set(Ecore_Evas *ee, int val) | ||
571 | { | ||
572 | if (ee->alpha == val) return; | ||
573 | ee->alpha = val; | ||
574 | evas_object_image_alpha_set(ee->engine.ews.image, val); | ||
575 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
576 | } | ||
577 | |||
578 | static void | ||
579 | _ecore_evas_ews_transparent_set(Ecore_Evas *ee, int val) | ||
580 | { | ||
581 | if (ee->transparent == val) return; | ||
582 | ee->transparent = val; | ||
583 | evas_object_image_alpha_set(ee->engine.ews.image, val); | ||
584 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
585 | } | ||
586 | |||
587 | static int | ||
588 | _ecore_evas_ews_render(Ecore_Evas *ee) | ||
589 | { | ||
590 | Eina_List *updates = NULL, *l, *ll; | ||
591 | Ecore_Evas *ee2; | ||
592 | Eina_Rectangle *r; | ||
593 | int w, h, rend = 0; | ||
594 | void *pixels; | ||
595 | |||
596 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
597 | { | ||
598 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
599 | rend |= _ecore_evas_ews_render(ee2); | ||
600 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
601 | } | ||
602 | |||
603 | evas_object_image_size_get(ee->engine.ews.image, &w, &h); | ||
604 | if ((w != ee->w) || (h != ee->h)) | ||
605 | ecore_evas_resize(ee, w, h); | ||
606 | |||
607 | pixels = evas_object_image_data_get(ee->engine.ews.image, 1); | ||
608 | if (pixels) | ||
609 | { | ||
610 | updates = evas_render_updates(ee->evas); | ||
611 | } | ||
612 | evas_object_image_data_set(ee->engine.ews.image, pixels); | ||
613 | |||
614 | EINA_LIST_FOREACH(updates, l, r) | ||
615 | evas_object_image_data_update_add(ee->engine.ews.image, | ||
616 | r->x, r->y, r->w, r->h); | ||
617 | |||
618 | if (updates) | ||
619 | { | ||
620 | evas_render_updates_free(updates); | ||
621 | _ecore_evas_idle_timeout_update(ee); | ||
622 | } | ||
623 | |||
624 | return updates ? 1 : rend; | ||
625 | } | ||
626 | |||
627 | static void | ||
628 | _ecore_evas_ews_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
629 | { | ||
630 | ecore_evas_geometry_get(_ews_ee, x, y, w, h); | ||
631 | } | ||
632 | |||
633 | static const Ecore_Evas_Engine_Func _ecore_ews_engine_func = | ||
634 | { | ||
635 | _ecore_evas_ews_free, | ||
636 | NULL, | ||
637 | NULL, | ||
638 | NULL, | ||
639 | NULL, | ||
640 | NULL, | ||
641 | NULL, | ||
642 | NULL, | ||
643 | NULL, | ||
644 | NULL, | ||
645 | NULL, | ||
646 | NULL, | ||
647 | NULL, | ||
648 | NULL, | ||
649 | NULL, | ||
650 | _ecore_evas_ews_move, | ||
651 | _ecore_evas_ews_managed_move, | ||
652 | _ecore_evas_ews_resize, | ||
653 | _ecore_evas_ews_move_resize, | ||
654 | _ecore_evas_ews_rotation_set, | ||
655 | _ecore_evas_ews_shaped_set, | ||
656 | _ecore_evas_ews_show, | ||
657 | _ecore_evas_ews_hide, | ||
658 | _ecore_evas_ews_raise, | ||
659 | _ecore_evas_ews_lower, | ||
660 | _ecore_evas_ews_activate, | ||
661 | _ecore_evas_ews_title_set, | ||
662 | _ecore_evas_ews_name_class_set, | ||
663 | _ecore_evas_ews_size_min_set, | ||
664 | _ecore_evas_ews_size_max_set, | ||
665 | _ecore_evas_ews_size_base_set, | ||
666 | _ecore_evas_ews_size_step_set, | ||
667 | _ecore_evas_ews_object_cursor_set, | ||
668 | _ecore_evas_ews_layer_set, | ||
669 | _ecore_evas_ews_focus_set, | ||
670 | _ecore_evas_ews_iconified_set, | ||
671 | _ecore_evas_ews_borderless_set, | ||
672 | _ecore_evas_ews_override_set, | ||
673 | _ecore_evas_ews_maximized_set, | ||
674 | _ecore_evas_ews_fullscreen_set, | ||
675 | _ecore_evas_ews_avoid_damage_set, | ||
676 | _ecore_evas_ews_withdrawn_set, | ||
677 | _ecore_evas_ews_sticky_set, | ||
678 | _ecore_evas_ews_ignore_events_set, | ||
679 | _ecore_evas_ews_alpha_set, | ||
680 | _ecore_evas_ews_transparent_set, | ||
681 | _ecore_evas_ews_render, | ||
682 | _ecore_evas_ews_screen_geometry_get | ||
683 | }; | ||
684 | |||
685 | void | ||
686 | _ecore_evas_ews_events_init(void) | ||
687 | { | ||
688 | if (ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE != 0) return; | ||
689 | ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = ecore_event_type_new(); | ||
690 | ECORE_EVAS_EWS_EVENT_ADD = ecore_event_type_new(); | ||
691 | ECORE_EVAS_EWS_EVENT_DEL = ecore_event_type_new(); | ||
692 | ECORE_EVAS_EWS_EVENT_RESIZE = ecore_event_type_new(); | ||
693 | ECORE_EVAS_EWS_EVENT_MOVE = ecore_event_type_new(); | ||
694 | ECORE_EVAS_EWS_EVENT_SHOW = ecore_event_type_new(); | ||
695 | ECORE_EVAS_EWS_EVENT_HIDE = ecore_event_type_new(); | ||
696 | ECORE_EVAS_EWS_EVENT_FOCUS = ecore_event_type_new(); | ||
697 | ECORE_EVAS_EWS_EVENT_UNFOCUS = ecore_event_type_new(); | ||
698 | ECORE_EVAS_EWS_EVENT_RAISE = ecore_event_type_new(); | ||
699 | ECORE_EVAS_EWS_EVENT_LOWER = ecore_event_type_new(); | ||
700 | ECORE_EVAS_EWS_EVENT_ACTIVATE = ecore_event_type_new(); | ||
701 | ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = ecore_event_type_new(); | ||
702 | ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = ecore_event_type_new(); | ||
703 | ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = ecore_event_type_new(); | ||
704 | ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = ecore_event_type_new(); | ||
705 | ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = ecore_event_type_new(); | ||
706 | } | ||
707 | |||
708 | static int | ||
709 | _ecore_evas_ews_init(void) | ||
710 | { | ||
711 | _ecore_evas_init_count++; | ||
712 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
713 | |||
714 | _ecore_evas_ews_env_setup(); | ||
715 | |||
716 | return _ecore_evas_init_count; | ||
717 | } | ||
718 | |||
719 | int | ||
720 | _ecore_evas_ews_shutdown(void) | ||
721 | { | ||
722 | _ecore_evas_init_count--; | ||
723 | if (_ecore_evas_init_count == 0) | ||
724 | { | ||
725 | if (_ews_ee) | ||
726 | { | ||
727 | ecore_evas_free(_ews_ee); | ||
728 | _ews_ee = NULL; | ||
729 | } | ||
730 | if (_ews_children) | ||
731 | { | ||
732 | eina_list_free(_ews_children); | ||
733 | _ews_children = NULL; | ||
734 | } | ||
735 | |||
736 | free(_ews_engine); | ||
737 | _ews_engine = NULL; | ||
738 | free(_ews_options); | ||
739 | _ews_options = NULL; | ||
740 | _ews_defaults_engine = EINA_TRUE; | ||
741 | _ews_defaults_geo = EINA_TRUE; | ||
742 | |||
743 | } | ||
744 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
745 | return _ecore_evas_init_count; | ||
746 | } | ||
747 | |||
748 | static void | ||
749 | _ecore_evas_ews_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) | ||
750 | { | ||
751 | Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; | ||
752 | |||
753 | evas_object_geometry_get(ee->engine.ews.image, &xx, &yy, &ww, &hh); | ||
754 | evas_object_image_fill_get(ee->engine.ews.image, &fx, &fy, &fw, &fh); | ||
755 | |||
756 | if (fw < 1) fw = 1; | ||
757 | if (fh < 1) fh = 1; | ||
758 | |||
759 | if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) | ||
760 | { | ||
761 | *x = (ee->w * (*x - xx)) / fw; | ||
762 | *y = (ee->h * (*y - yy)) / fh; | ||
763 | } | ||
764 | else | ||
765 | { | ||
766 | xx = (*x - xx) - fx; | ||
767 | while (xx < 0) xx += fw; | ||
768 | while (xx > fw) xx -= fw; | ||
769 | *x = (ee->w * xx) / fw; | ||
770 | |||
771 | yy = (*y - yy) - fy; | ||
772 | while (yy < 0) yy += fh; | ||
773 | while (yy > fh) yy -= fh; | ||
774 | *y = (ee->h * yy) / fh; | ||
775 | } | ||
776 | } | ||
777 | |||
778 | static void | ||
779 | _ecore_evas_ews_modifiers_apply(Ecore_Evas *ee, const Evas_Modifier *modifier) | ||
780 | { | ||
781 | Evas *e = ee->evas; | ||
782 | |||
783 | if (evas_key_modifier_is_set(modifier, "Shift")) | ||
784 | evas_key_modifier_on(e, "Shift"); | ||
785 | else evas_key_modifier_off(e, "Shift"); | ||
786 | |||
787 | if (evas_key_modifier_is_set(modifier, "Control")) | ||
788 | evas_key_modifier_on(e, "Control"); | ||
789 | else evas_key_modifier_off(e, "Control"); | ||
790 | |||
791 | if (evas_key_modifier_is_set(modifier, "Alt")) | ||
792 | evas_key_modifier_on(e, "Alt"); | ||
793 | else evas_key_modifier_off(e, "Alt"); | ||
794 | |||
795 | if (evas_key_modifier_is_set(modifier, "Super")) | ||
796 | evas_key_modifier_on(e, "Super"); | ||
797 | else evas_key_modifier_off(e, "Super"); | ||
798 | |||
799 | if (evas_key_modifier_is_set(modifier, "Hyper")) | ||
800 | evas_key_modifier_on(e, "Hyper"); | ||
801 | else evas_key_modifier_off(e, "Hyper"); | ||
802 | |||
803 | if (evas_key_modifier_is_set(modifier, "Scroll_Lock")) | ||
804 | evas_key_lock_on(e, "Scroll_Lock"); | ||
805 | else evas_key_lock_off(e, "Scroll_Lock"); | ||
806 | |||
807 | if (evas_key_modifier_is_set(modifier, "Num_Lock")) | ||
808 | evas_key_lock_on(e, "Num_Lock"); | ||
809 | else evas_key_lock_off(e, "Num_Lock"); | ||
810 | |||
811 | if (evas_key_modifier_is_set(modifier, "Caps_Lock")) | ||
812 | evas_key_lock_on(e, "Caps_Lock"); | ||
813 | else evas_key_lock_off(e, "Caps_Lock"); | ||
814 | |||
815 | if (evas_key_modifier_is_set(modifier, "Shift_Lock")) | ||
816 | evas_key_lock_on(e, "Shift_Lock"); | ||
817 | else evas_key_lock_off(e, "Shift_Lock"); | ||
818 | } | ||
819 | |||
820 | static void | ||
821 | _ecore_evas_ews_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
822 | { | ||
823 | Ecore_Evas *ee = data; | ||
824 | Evas_Event_Mouse_In *ev = event_info; | ||
825 | Evas_Coord x = ev->canvas.x; | ||
826 | Evas_Coord y = ev->canvas.y; | ||
827 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
828 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
829 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
830 | evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); | ||
831 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); | ||
832 | } | ||
833 | |||
834 | static void | ||
835 | _ecore_evas_ews_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
836 | { | ||
837 | Ecore_Evas *ee = data; | ||
838 | Evas_Event_Mouse_Out *ev = event_info; | ||
839 | Evas_Coord x = ev->canvas.x; | ||
840 | Evas_Coord y = ev->canvas.y; | ||
841 | // TODO: consider grab mode in EWS | ||
842 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
843 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
844 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
845 | evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); | ||
846 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
847 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); | ||
848 | } | ||
849 | |||
850 | static void | ||
851 | _ecore_evas_ews_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
852 | { | ||
853 | Ecore_Evas *ee = data; | ||
854 | Evas_Event_Mouse_Down *ev = event_info; | ||
855 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
856 | evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | ||
857 | } | ||
858 | |||
859 | static void | ||
860 | _ecore_evas_ews_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
861 | { | ||
862 | Ecore_Evas *ee = data; | ||
863 | Evas_Event_Mouse_Up *ev = event_info; | ||
864 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
865 | evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | ||
866 | } | ||
867 | |||
868 | static void | ||
869 | _ecore_evas_ews_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
870 | { | ||
871 | Ecore_Evas *ee = data; | ||
872 | Evas_Event_Mouse_Move *ev = event_info; | ||
873 | Evas_Coord x = ev->cur.canvas.x; | ||
874 | Evas_Coord y = ev->cur.canvas.y; | ||
875 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
876 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
877 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); | ||
878 | } | ||
879 | |||
880 | static void | ||
881 | _ecore_evas_ews_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
882 | { | ||
883 | Ecore_Evas *ee = data; | ||
884 | Evas_Event_Mouse_Wheel *ev = event_info; | ||
885 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
886 | evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL); | ||
887 | } | ||
888 | |||
889 | static void | ||
890 | _ecore_evas_ews_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
891 | { | ||
892 | Ecore_Evas *ee = data; | ||
893 | Evas_Event_Multi_Down *ev = event_info; | ||
894 | Evas_Coord x, y, xx, yy; | ||
895 | double xf, yf; | ||
896 | |||
897 | x = ev->canvas.x; | ||
898 | y = ev->canvas.y; | ||
899 | xx = x; | ||
900 | yy = y; | ||
901 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
902 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | ||
903 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | ||
904 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
905 | evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); | ||
906 | } | ||
907 | |||
908 | static void | ||
909 | _ecore_evas_ews_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
910 | { | ||
911 | Ecore_Evas *ee = data; | ||
912 | Evas_Event_Multi_Up *ev = event_info; | ||
913 | Evas_Coord x, y, xx, yy; | ||
914 | double xf, yf; | ||
915 | |||
916 | x = ev->canvas.x; | ||
917 | y = ev->canvas.y; | ||
918 | xx = x; | ||
919 | yy = y; | ||
920 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
921 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | ||
922 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | ||
923 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
924 | evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); | ||
925 | } | ||
926 | |||
927 | static void | ||
928 | _ecore_evas_ews_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
929 | { | ||
930 | Ecore_Evas *ee = data; | ||
931 | Evas_Event_Multi_Move *ev = event_info; | ||
932 | Evas_Coord x, y, xx, yy; | ||
933 | double xf, yf; | ||
934 | |||
935 | x = ev->cur.canvas.x; | ||
936 | y = ev->cur.canvas.y; | ||
937 | xx = x; | ||
938 | yy = y; | ||
939 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
940 | xf = (ev->cur.canvas.xsub - (double)xx) + (double)x; | ||
941 | yf = (ev->cur.canvas.ysub - (double)yy) + (double)y; | ||
942 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
943 | evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL); | ||
944 | } | ||
945 | |||
946 | static void | ||
947 | _ecore_evas_ews_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
948 | { | ||
949 | Ecore_Evas *ee = data; | ||
950 | if (ee->driver) _ecore_evas_free(ee); | ||
951 | } | ||
952 | |||
953 | static void | ||
954 | _ecore_evas_ews_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
955 | { | ||
956 | Ecore_Evas *ee = data; | ||
957 | Evas_Event_Key_Down *ev = event_info; | ||
958 | |||
959 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | ||
960 | evas_key_modifier_on(ee->evas, "Shift"); | ||
961 | else | ||
962 | evas_key_modifier_off(ee->evas, "Shift"); | ||
963 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
964 | evas_key_modifier_on(ee->evas, "Control"); | ||
965 | else | ||
966 | evas_key_modifier_off(ee->evas, "Control"); | ||
967 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
968 | evas_key_modifier_on(ee->evas, "Alt"); | ||
969 | else | ||
970 | evas_key_modifier_off(ee->evas, "Alt"); | ||
971 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
972 | evas_key_modifier_on(ee->evas, "Meta"); | ||
973 | else | ||
974 | evas_key_modifier_off(ee->evas, "Meta"); | ||
975 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
976 | evas_key_modifier_on(ee->evas, "Hyper"); | ||
977 | else | ||
978 | evas_key_modifier_off(ee->evas, "Hyper"); | ||
979 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
980 | evas_key_modifier_on(ee->evas, "Super"); | ||
981 | else | ||
982 | evas_key_modifier_off(ee->evas, "Super"); | ||
983 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
984 | evas_key_lock_on(ee->evas, "Scroll_Lock"); | ||
985 | else | ||
986 | evas_key_lock_off(ee->evas, "Scroll_Lock"); | ||
987 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
988 | evas_key_lock_on(ee->evas, "Num_Lock"); | ||
989 | else | ||
990 | evas_key_lock_off(ee->evas, "Num_Lock"); | ||
991 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
992 | evas_key_lock_on(ee->evas, "Caps_Lock"); | ||
993 | else | ||
994 | evas_key_lock_off(ee->evas, "Caps_Lock"); | ||
995 | evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | ||
996 | } | ||
997 | |||
998 | static void | ||
999 | _ecore_evas_ews_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
1000 | { | ||
1001 | Ecore_Evas *ee = data; | ||
1002 | Evas_Event_Key_Up *ev = event_info; | ||
1003 | |||
1004 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | ||
1005 | evas_key_modifier_on(ee->evas, "Shift"); | ||
1006 | else | ||
1007 | evas_key_modifier_off(ee->evas, "Shift"); | ||
1008 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
1009 | evas_key_modifier_on(ee->evas, "Control"); | ||
1010 | else | ||
1011 | evas_key_modifier_off(ee->evas, "Control"); | ||
1012 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
1013 | evas_key_modifier_on(ee->evas, "Alt"); | ||
1014 | else | ||
1015 | evas_key_modifier_off(ee->evas, "Alt"); | ||
1016 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
1017 | evas_key_modifier_on(ee->evas, "Meta"); | ||
1018 | else | ||
1019 | evas_key_modifier_off(ee->evas, "Meta"); | ||
1020 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
1021 | evas_key_modifier_on(ee->evas, "Hyper"); | ||
1022 | else | ||
1023 | evas_key_modifier_off(ee->evas, "Hyper"); | ||
1024 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
1025 | evas_key_modifier_on(ee->evas, "Super"); | ||
1026 | else | ||
1027 | evas_key_modifier_off(ee->evas, "Super"); | ||
1028 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
1029 | evas_key_lock_on(ee->evas, "Scroll_Lock"); | ||
1030 | else | ||
1031 | evas_key_lock_off(ee->evas, "Scroll_Lock"); | ||
1032 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
1033 | evas_key_lock_on(ee->evas, "Num_Lock"); | ||
1034 | else | ||
1035 | evas_key_lock_off(ee->evas, "Num_Lock"); | ||
1036 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
1037 | evas_key_lock_on(ee->evas, "Caps_Lock"); | ||
1038 | else | ||
1039 | evas_key_lock_off(ee->evas, "Caps_Lock"); | ||
1040 | evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | ||
1041 | } | ||
1042 | |||
1043 | static void | ||
1044 | _ecore_evas_ews_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1045 | { | ||
1046 | Ecore_Evas *ee = data; | ||
1047 | ecore_evas_focus_set(ee, EINA_TRUE); | ||
1048 | } | ||
1049 | |||
1050 | static void | ||
1051 | _ecore_evas_ews_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1052 | { | ||
1053 | Ecore_Evas *ee = data; | ||
1054 | if (ee->deleted) return; | ||
1055 | ecore_evas_focus_set(ee, EINA_FALSE); | ||
1056 | } | ||
1057 | |||
1058 | static void | ||
1059 | _ecore_evas_ews_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1060 | { | ||
1061 | Ecore_Evas *ee = data; | ||
1062 | ecore_evas_show(ee); | ||
1063 | } | ||
1064 | |||
1065 | static void | ||
1066 | _ecore_evas_ews_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1067 | { | ||
1068 | Ecore_Evas *ee = data; | ||
1069 | if (ee->deleted) return; | ||
1070 | ecore_evas_hide(ee); | ||
1071 | } | ||
1072 | #endif | ||
1073 | |||
1074 | EAPI Ecore_Evas * | ||
1075 | ecore_evas_ews_new(int x, int y, int w, int h) | ||
1076 | { | ||
1077 | // basically a copy of ecore_evas_buffer_new() keep in sync... | ||
1078 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1079 | Evas_Object *o; | ||
1080 | Evas_Engine_Info_Buffer *einfo; | ||
1081 | Ecore_Evas *ee; | ||
1082 | int rmethod; | ||
1083 | |||
1084 | if (_ecore_evas_ews_init() < 1) return NULL; | ||
1085 | |||
1086 | if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new(); | ||
1087 | if (!_ews_ee) | ||
1088 | { | ||
1089 | ERR("Could not create EWS backing store"); | ||
1090 | _ecore_evas_ews_shutdown(); | ||
1091 | return NULL; | ||
1092 | } | ||
1093 | |||
1094 | rmethod = evas_render_method_lookup("buffer"); | ||
1095 | if (!rmethod) return NULL; | ||
1096 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
1097 | if (!ee) return NULL; | ||
1098 | |||
1099 | if (w < 1) w = 1; | ||
1100 | if (h < 1) h = 1; | ||
1101 | |||
1102 | o = evas_object_image_add(_ews_ee->evas); | ||
1103 | evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); | ||
1104 | evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); | ||
1105 | evas_object_image_size_set(o, w, h); | ||
1106 | evas_object_image_alpha_set(o, 1); | ||
1107 | |||
1108 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
1109 | |||
1110 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_ews_engine_func; | ||
1111 | |||
1112 | ee->driver = EWS_ENGINE_NAME; | ||
1113 | |||
1114 | ee->x = 0; | ||
1115 | ee->y = 0; | ||
1116 | ee->w = w; | ||
1117 | ee->h = h; | ||
1118 | ee->req.x = ee->x; | ||
1119 | ee->req.y = ee->y; | ||
1120 | ee->req.w = ee->w; | ||
1121 | ee->req.h = ee->h; | ||
1122 | |||
1123 | /* init evas here */ | ||
1124 | ee->evas = evas_new(); | ||
1125 | evas_data_attach_set(ee->evas, ee); | ||
1126 | evas_output_method_set(ee->evas, rmethod); | ||
1127 | evas_output_size_set(ee->evas, w, h); | ||
1128 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
1129 | |||
1130 | evas_object_move(o, x, y); | ||
1131 | evas_object_resize(o, w, h); | ||
1132 | evas_object_image_fill_set(o, 0, 0, w, h); | ||
1133 | |||
1134 | ee->engine.ews.image = o; | ||
1135 | evas_object_data_set(ee->engine.ews.image, "Ecore_Evas", ee); | ||
1136 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1137 | EVAS_CALLBACK_MOUSE_IN, | ||
1138 | _ecore_evas_ews_cb_mouse_in, ee); | ||
1139 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1140 | EVAS_CALLBACK_MOUSE_OUT, | ||
1141 | _ecore_evas_ews_cb_mouse_out, ee); | ||
1142 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1143 | EVAS_CALLBACK_MOUSE_DOWN, | ||
1144 | _ecore_evas_ews_cb_mouse_down, ee); | ||
1145 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1146 | EVAS_CALLBACK_MOUSE_UP, | ||
1147 | _ecore_evas_ews_cb_mouse_up, ee); | ||
1148 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1149 | EVAS_CALLBACK_MOUSE_MOVE, | ||
1150 | _ecore_evas_ews_cb_mouse_move, ee); | ||
1151 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1152 | EVAS_CALLBACK_MOUSE_WHEEL, | ||
1153 | _ecore_evas_ews_cb_mouse_wheel, ee); | ||
1154 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1155 | EVAS_CALLBACK_MULTI_DOWN, | ||
1156 | _ecore_evas_ews_cb_multi_down, ee); | ||
1157 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1158 | EVAS_CALLBACK_MULTI_UP, | ||
1159 | _ecore_evas_ews_cb_multi_up, ee); | ||
1160 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1161 | EVAS_CALLBACK_MULTI_MOVE, | ||
1162 | _ecore_evas_ews_cb_multi_move, ee); | ||
1163 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1164 | EVAS_CALLBACK_FREE, | ||
1165 | _ecore_evas_ews_cb_free, ee); | ||
1166 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1167 | EVAS_CALLBACK_KEY_DOWN, | ||
1168 | _ecore_evas_ews_cb_key_down, ee); | ||
1169 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1170 | EVAS_CALLBACK_KEY_UP, | ||
1171 | _ecore_evas_ews_cb_key_up, ee); | ||
1172 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1173 | EVAS_CALLBACK_FOCUS_IN, | ||
1174 | _ecore_evas_ews_cb_focus_in, ee); | ||
1175 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1176 | EVAS_CALLBACK_FOCUS_OUT, | ||
1177 | _ecore_evas_ews_cb_focus_out, ee); | ||
1178 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1179 | EVAS_CALLBACK_SHOW, | ||
1180 | _ecore_evas_ews_cb_show, ee); | ||
1181 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1182 | EVAS_CALLBACK_HIDE, | ||
1183 | _ecore_evas_ews_cb_hide, ee); | ||
1184 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
1185 | if (einfo) | ||
1186 | { | ||
1187 | void *pixels = evas_object_image_data_get(o, 1); | ||
1188 | evas_object_image_data_set(o, pixels); // refcount | ||
1189 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
1190 | einfo->info.dest_buffer = pixels; | ||
1191 | einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o); | ||
1192 | einfo->info.use_color_key = 0; | ||
1193 | einfo->info.alpha_threshold = 0; | ||
1194 | einfo->info.func.new_update_region = NULL; | ||
1195 | einfo->info.func.free_update_region = NULL; | ||
1196 | evas_object_image_data_set(o, pixels); | ||
1197 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1198 | { | ||
1199 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1200 | ecore_evas_free(ee); | ||
1201 | return NULL; | ||
1202 | } | ||
1203 | } | ||
1204 | else | ||
1205 | { | ||
1206 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1207 | ecore_evas_free(ee); | ||
1208 | return NULL; | ||
1209 | } | ||
1210 | evas_key_modifier_add(ee->evas, "Shift"); | ||
1211 | evas_key_modifier_add(ee->evas, "Control"); | ||
1212 | evas_key_modifier_add(ee->evas, "Alt"); | ||
1213 | evas_key_modifier_add(ee->evas, "Meta"); | ||
1214 | evas_key_modifier_add(ee->evas, "Hyper"); | ||
1215 | evas_key_modifier_add(ee->evas, "Super"); | ||
1216 | evas_key_lock_add(ee->evas, "Caps_Lock"); | ||
1217 | evas_key_lock_add(ee->evas, "Num_Lock"); | ||
1218 | evas_key_lock_add(ee->evas, "Scroll_Lock"); | ||
1219 | |||
1220 | _ews_ee->sub_ecore_evas = eina_list_append(_ews_ee->sub_ecore_evas, ee); | ||
1221 | _ews_children = eina_list_append(_ews_children, ee); | ||
1222 | |||
1223 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ADD); | ||
1224 | |||
1225 | return ee; | ||
1226 | #else | ||
1227 | return NULL; | ||
1228 | (void)x; | ||
1229 | (void)y; | ||
1230 | (void)w; | ||
1231 | (void)h; | ||
1232 | #endif | ||
1233 | } | ||
1234 | |||
1235 | EAPI Evas_Object * | ||
1236 | ecore_evas_ews_backing_store_get(const Ecore_Evas *ee) | ||
1237 | { | ||
1238 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1239 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1240 | { | ||
1241 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1242 | "ecore_evas_ews_backing_store_get"); | ||
1243 | return NULL; | ||
1244 | } | ||
1245 | return ee->engine.ews.image; | ||
1246 | #else | ||
1247 | return NULL; | ||
1248 | (void)ee; | ||
1249 | #endif | ||
1250 | } | ||
1251 | |||
1252 | EAPI void | ||
1253 | ecore_evas_ews_delete_request(Ecore_Evas *ee) | ||
1254 | { | ||
1255 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1256 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1257 | { | ||
1258 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1259 | "ecore_evas_ews_delete_request"); | ||
1260 | return; | ||
1261 | } | ||
1262 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
1263 | else ecore_evas_free(ee); | ||
1264 | #else | ||
1265 | (void)ee; | ||
1266 | #endif | ||
1267 | } | ||
1268 | |||
1269 | |||
1270 | EAPI Eina_Bool | ||
1271 | ecore_evas_ews_engine_set(const char *engine, const char *options) | ||
1272 | { | ||
1273 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1274 | if (_ews_ee) return EINA_FALSE; | ||
1275 | |||
1276 | free(_ews_engine); | ||
1277 | free(_ews_options); | ||
1278 | |||
1279 | _ews_engine = engine ? strdup(engine) : NULL; | ||
1280 | _ews_options = options ? strdup(options) : NULL; | ||
1281 | |||
1282 | if ((engine) && (!_ews_engine)) return EINA_FALSE; | ||
1283 | if ((options) && (!_ews_options)) return EINA_FALSE; | ||
1284 | |||
1285 | _ews_defaults_engine = EINA_FALSE; | ||
1286 | return EINA_TRUE; | ||
1287 | #else | ||
1288 | return EINA_FALSE; | ||
1289 | (void)engine; | ||
1290 | (void)options; | ||
1291 | #endif | ||
1292 | } | ||
1293 | |||
1294 | EAPI Eina_Bool | ||
1295 | ecore_evas_ews_setup(int x, int y, int w, int h) | ||
1296 | { | ||
1297 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1298 | Eina_Bool ret = EINA_TRUE; | ||
1299 | |||
1300 | _ews_defaults_geo = EINA_FALSE; | ||
1301 | _ews_x = x; | ||
1302 | _ews_y = y; | ||
1303 | _ews_w = w; | ||
1304 | _ews_h = h; | ||
1305 | |||
1306 | if (!_ews_ee) return EINA_TRUE; | ||
1307 | |||
1308 | /* move-resize is not as implemented as move + resize */ | ||
1309 | ecore_evas_move(_ews_ee, x, y); | ||
1310 | ecore_evas_size_min_set(_ews_ee, w, h); | ||
1311 | ecore_evas_size_max_set(_ews_ee, w, h); | ||
1312 | ecore_evas_resize(_ews_ee, w, h); | ||
1313 | |||
1314 | ecore_evas_geometry_get(_ews_ee, &x, &y, &w, &h); | ||
1315 | |||
1316 | #define TST(n) if ((n != _ews_##n)) \ | ||
1317 | { \ | ||
1318 | WRN("Asked %d, got %d for "#n, _ews_##n, n); \ | ||
1319 | ret = EINA_FALSE; \ | ||
1320 | } | ||
1321 | TST(x); | ||
1322 | TST(y); | ||
1323 | TST(w); | ||
1324 | TST(h); | ||
1325 | #undef TST | ||
1326 | return ret; | ||
1327 | #else | ||
1328 | return EINA_FALSE; | ||
1329 | (void)x; | ||
1330 | (void)y; | ||
1331 | (void)w; | ||
1332 | (void)h; | ||
1333 | #endif | ||
1334 | } | ||
1335 | |||
1336 | EAPI Ecore_Evas * | ||
1337 | ecore_evas_ews_ecore_evas_get(void) | ||
1338 | { | ||
1339 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1340 | if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new(); | ||
1341 | return _ews_ee; | ||
1342 | #else | ||
1343 | return NULL; | ||
1344 | #endif | ||
1345 | } | ||
1346 | |||
1347 | EAPI Evas * | ||
1348 | ecore_evas_ews_evas_get(void) | ||
1349 | { | ||
1350 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1351 | return ecore_evas_get(ecore_evas_ews_ecore_evas_get()); | ||
1352 | #else | ||
1353 | return NULL; | ||
1354 | #endif | ||
1355 | } | ||
1356 | |||
1357 | EAPI Evas_Object * | ||
1358 | ecore_evas_ews_background_get(void) | ||
1359 | { | ||
1360 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1361 | return _ews_bg; | ||
1362 | #else | ||
1363 | return NULL; | ||
1364 | #endif | ||
1365 | } | ||
1366 | |||
1367 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1368 | static void | ||
1369 | _ecore_evas_ews_background_free(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) | ||
1370 | { | ||
1371 | _ews_bg = NULL; | ||
1372 | ecore_evas_ews_background_set(NULL); | ||
1373 | } | ||
1374 | #endif | ||
1375 | |||
1376 | EAPI void | ||
1377 | ecore_evas_ews_background_set(Evas_Object *o) | ||
1378 | { | ||
1379 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1380 | if ((o) && (o == _ews_bg)) return; | ||
1381 | |||
1382 | if (_ews_bg) | ||
1383 | { | ||
1384 | evas_object_del(_ews_bg); | ||
1385 | _ews_bg = NULL; | ||
1386 | } | ||
1387 | |||
1388 | if ((!o) && (_ews_ee)) | ||
1389 | { | ||
1390 | o = evas_object_rectangle_add(ecore_evas_get(_ews_ee)); | ||
1391 | evas_object_color_set(o, 0, 0, 0, 255); | ||
1392 | } | ||
1393 | |||
1394 | if (_ews_ee) | ||
1395 | { | ||
1396 | Evas_Coord w, h; | ||
1397 | Evas *e = ecore_evas_get(_ews_ee); | ||
1398 | |||
1399 | if (e != evas_object_evas_get(o)) | ||
1400 | { | ||
1401 | ERR("background not in ecore_evas_ews_evas_get() canvas!"); | ||
1402 | return; | ||
1403 | } | ||
1404 | |||
1405 | evas_output_viewport_get(e, NULL, NULL, &w, &h); | ||
1406 | evas_object_move(o, 0, 0); | ||
1407 | evas_object_resize(o, w, h); | ||
1408 | evas_object_layer_set(o, EVAS_LAYER_MIN); | ||
1409 | evas_object_lower(o); | ||
1410 | evas_object_show(o); | ||
1411 | |||
1412 | evas_object_event_callback_add | ||
1413 | (o, EVAS_CALLBACK_FREE, _ecore_evas_ews_background_free, NULL); | ||
1414 | } | ||
1415 | |||
1416 | _ews_bg = o; | ||
1417 | #else | ||
1418 | return; | ||
1419 | (void)o; | ||
1420 | #endif | ||
1421 | } | ||
1422 | |||
1423 | |||
1424 | EAPI const Eina_List * | ||
1425 | ecore_evas_ews_children_get(void) | ||
1426 | { | ||
1427 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1428 | return _ews_children; | ||
1429 | #else | ||
1430 | return NULL; | ||
1431 | #endif | ||
1432 | } | ||
1433 | |||
1434 | EAPI void | ||
1435 | ecore_evas_ews_manager_set(const void *manager) | ||
1436 | { | ||
1437 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1438 | if (_ews_manager == manager) return; | ||
1439 | _ews_manager = manager; | ||
1440 | ecore_event_add(ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE, NULL, NULL, NULL); | ||
1441 | #else | ||
1442 | (void)manager; | ||
1443 | #endif | ||
1444 | } | ||
1445 | |||
1446 | EAPI const void * | ||
1447 | ecore_evas_ews_manager_get(void) | ||
1448 | { | ||
1449 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1450 | return _ews_manager; | ||
1451 | #else | ||
1452 | return NULL; | ||
1453 | #endif | ||
1454 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c new file mode 100644 index 0000000..3ee913e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c | |||
@@ -0,0 +1,659 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <sys/types.h> | ||
6 | #include <dirent.h> | ||
7 | |||
8 | #include <Ecore.h> | ||
9 | #include "ecore_private.h" | ||
10 | #ifdef BUILD_ECORE_EVAS_FB | ||
11 | #include <Ecore_Fb.h> | ||
12 | #include <ecore_fb_private.h> | ||
13 | #endif | ||
14 | |||
15 | #include "ecore_evas_private.h" | ||
16 | #include "Ecore_Evas.h" | ||
17 | |||
18 | #ifdef BUILD_ECORE_EVAS_FB | ||
19 | static int _ecore_evas_init_count = 0; | ||
20 | |||
21 | static char *ecore_evas_default_display = "0"; | ||
22 | static Eina_List *ecore_evas_input_devices = NULL; | ||
23 | static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {NULL, NULL, NULL, NULL}; | ||
24 | |||
25 | static void | ||
26 | _ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y) | ||
27 | { | ||
28 | int fbw, fbh; | ||
29 | |||
30 | ee->mouse.x = x; | ||
31 | ee->mouse.y = y; | ||
32 | ecore_fb_size_get(&fbw, &fbh); | ||
33 | if (ee->prop.cursor.object) | ||
34 | { | ||
35 | evas_object_show(ee->prop.cursor.object); | ||
36 | if (ee->rotation == 0) | ||
37 | evas_object_move(ee->prop.cursor.object, | ||
38 | x - ee->prop.cursor.hot.x, | ||
39 | y - ee->prop.cursor.hot.y); | ||
40 | else if (ee->rotation == 90) | ||
41 | evas_object_move(ee->prop.cursor.object, | ||
42 | (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.x, | ||
43 | x - ee->prop.cursor.hot.y); | ||
44 | else if (ee->rotation == 180) | ||
45 | evas_object_move(ee->prop.cursor.object, | ||
46 | (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.x, | ||
47 | (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.y); | ||
48 | else if (ee->rotation == 270) | ||
49 | evas_object_move(ee->prop.cursor.object, | ||
50 | y - ee->prop.cursor.hot.x, | ||
51 | (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.y); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | static Ecore_Evas *fb_ee = NULL; | ||
56 | |||
57 | static Ecore_Evas * | ||
58 | _ecore_evas_fb_match(void) | ||
59 | { | ||
60 | return fb_ee; | ||
61 | } | ||
62 | |||
63 | static void | ||
64 | _ecore_evas_fb_lose(void *data __UNUSED__) | ||
65 | { | ||
66 | Eina_List *ll; | ||
67 | Ecore_Fb_Input_Device *dev; | ||
68 | |||
69 | if (fb_ee) fb_ee->visible = 0; | ||
70 | |||
71 | EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev) | ||
72 | ecore_fb_input_device_listen(dev, 0); | ||
73 | } | ||
74 | |||
75 | static void | ||
76 | _ecore_evas_fb_gain(void *data __UNUSED__) | ||
77 | { | ||
78 | Ecore_Evas *ee; | ||
79 | Eina_List *ll; | ||
80 | Ecore_Fb_Input_Device *dev; | ||
81 | |||
82 | if (fb_ee) | ||
83 | { | ||
84 | ee = fb_ee; | ||
85 | |||
86 | ee->visible = 1; | ||
87 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
88 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
89 | else | ||
90 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
91 | } | ||
92 | |||
93 | EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev) | ||
94 | ecore_fb_input_device_listen(dev, 1); | ||
95 | } | ||
96 | |||
97 | static Eina_Bool | ||
98 | _ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
99 | { | ||
100 | Ecore_Evas *ee; | ||
101 | Ecore_Event_Mouse_Button *e; | ||
102 | |||
103 | e = event; | ||
104 | ee = _ecore_evas_fb_match(); | ||
105 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
106 | _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); | ||
107 | return ECORE_CALLBACK_PASS_ON; | ||
108 | } | ||
109 | |||
110 | static Eina_Bool | ||
111 | _ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
112 | { | ||
113 | Ecore_Evas *ee; | ||
114 | Ecore_Event_Mouse_Button *e; | ||
115 | |||
116 | e = event; | ||
117 | ee = _ecore_evas_fb_match(); | ||
118 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
119 | _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); | ||
120 | return ECORE_CALLBACK_PASS_ON; | ||
121 | } | ||
122 | |||
123 | static Eina_Bool | ||
124 | _ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
125 | { | ||
126 | Ecore_Evas *ee; | ||
127 | Ecore_Event_Mouse_Move *e; | ||
128 | |||
129 | e = event; | ||
130 | ee = _ecore_evas_fb_match(); | ||
131 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
132 | _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); | ||
133 | return ECORE_CALLBACK_PASS_ON; | ||
134 | } | ||
135 | |||
136 | static Eina_Bool | ||
137 | _ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
138 | { | ||
139 | Ecore_Evas *ee; | ||
140 | Ecore_Event_Mouse_Wheel *e; | ||
141 | |||
142 | e = event; | ||
143 | ee = _ecore_evas_fb_match(); | ||
144 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
145 | _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); | ||
146 | return ECORE_CALLBACK_PASS_ON; | ||
147 | } | ||
148 | |||
149 | static int | ||
150 | _ecore_evas_fb_render(Ecore_Evas *ee) | ||
151 | { | ||
152 | int rend = 0; | ||
153 | |||
154 | if (ee->visible) | ||
155 | { | ||
156 | Eina_List *updates; | ||
157 | |||
158 | Eina_List *ll; | ||
159 | Ecore_Evas *ee2; | ||
160 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
161 | |||
162 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
163 | { | ||
164 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
165 | if (ee2->engine.func->fn_render) | ||
166 | rend |= ee2->engine.func->fn_render(ee2); | ||
167 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
168 | } | ||
169 | |||
170 | updates = evas_render_updates(ee->evas); | ||
171 | if (updates) | ||
172 | { | ||
173 | evas_render_updates_free(updates); | ||
174 | _ecore_evas_idle_timeout_update(ee); | ||
175 | rend = 1; | ||
176 | } | ||
177 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
178 | } | ||
179 | else | ||
180 | evas_norender(ee->evas); | ||
181 | return rend; | ||
182 | } | ||
183 | |||
184 | static int | ||
185 | _ecore_evas_fb_init(Ecore_Evas *ee, int w, int h) | ||
186 | { | ||
187 | Ecore_Fb_Input_Device *device; | ||
188 | Ecore_Fb_Input_Device_Cap caps; | ||
189 | int mouse_handled = 0; | ||
190 | |||
191 | DIR *input_dir; | ||
192 | struct dirent *input_entry; | ||
193 | |||
194 | _ecore_evas_init_count++; | ||
195 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
196 | |||
197 | ecore_event_evas_init(); | ||
198 | |||
199 | /* register all input devices */ | ||
200 | input_dir = opendir("/dev/input/"); | ||
201 | if (!input_dir) return _ecore_evas_init_count; | ||
202 | |||
203 | while ((input_entry = readdir(input_dir))) | ||
204 | { | ||
205 | char device_path[256]; | ||
206 | |||
207 | if (strncmp(input_entry->d_name, "event", 5) != 0) | ||
208 | continue; | ||
209 | |||
210 | snprintf(device_path, 256, "/dev/input/%s", input_entry->d_name); | ||
211 | if (!(device = ecore_fb_input_device_open(device_path))) | ||
212 | continue; | ||
213 | ecore_fb_input_device_window_set(device, ee); | ||
214 | |||
215 | caps = ecore_fb_input_device_cap_get(device); | ||
216 | |||
217 | /* Mouse */ | ||
218 | #ifdef HAVE_TSLIB | ||
219 | if (caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE) | ||
220 | #else | ||
221 | if ((caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE) || (caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)) | ||
222 | #endif | ||
223 | { | ||
224 | ecore_fb_input_device_axis_size_set(device, w, h); | ||
225 | ecore_fb_input_device_listen(device,1); | ||
226 | ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); | ||
227 | if (!mouse_handled) | ||
228 | { | ||
229 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); | ||
230 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL); | ||
231 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL); | ||
232 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _ecore_evas_event_mouse_wheel, NULL); | ||
233 | mouse_handled = 1; | ||
234 | } | ||
235 | } | ||
236 | /* Keyboard */ | ||
237 | else if ((caps & ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS) && !(caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)) | ||
238 | { | ||
239 | ecore_fb_input_device_listen(device,1); | ||
240 | ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); | ||
241 | } | ||
242 | } | ||
243 | closedir(input_dir); | ||
244 | |||
245 | if (!mouse_handled) | ||
246 | { | ||
247 | if (ecore_fb_ts_init()) | ||
248 | { | ||
249 | ecore_fb_ts_event_window_set(ee); | ||
250 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); | ||
251 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL); | ||
252 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL); | ||
253 | mouse_handled = 1; | ||
254 | } | ||
255 | } | ||
256 | return _ecore_evas_init_count; | ||
257 | } | ||
258 | |||
259 | static void | ||
260 | _ecore_evas_fb_free(Ecore_Evas *ee) | ||
261 | { | ||
262 | ecore_evas_input_event_unregister(ee); | ||
263 | if (fb_ee == ee) fb_ee = NULL; | ||
264 | _ecore_evas_fb_shutdown(); | ||
265 | ecore_fb_shutdown(); | ||
266 | } | ||
267 | |||
268 | static void | ||
269 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
270 | { | ||
271 | ee->req.w = w; | ||
272 | ee->req.h = h; | ||
273 | if ((w == ee->w) && (h == ee->h)) return; | ||
274 | ee->w = w; | ||
275 | ee->h = h; | ||
276 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
277 | { | ||
278 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
279 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
280 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
281 | } | ||
282 | else | ||
283 | { | ||
284 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
285 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
286 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
287 | } | ||
288 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
289 | } | ||
290 | |||
291 | static void | ||
292 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
293 | { | ||
294 | ee->req.w = w; | ||
295 | ee->req.h = h; | ||
296 | if ((w == ee->w) && (h == ee->h)) return; | ||
297 | ee->w = w; | ||
298 | ee->h = h; | ||
299 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
300 | { | ||
301 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
302 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
303 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
304 | } | ||
305 | else | ||
306 | { | ||
307 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
308 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
309 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
310 | } | ||
311 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
312 | } | ||
313 | |||
314 | static void | ||
315 | _ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize __UNUSED__) | ||
316 | { | ||
317 | Evas_Engine_Info_FB *einfo; | ||
318 | int rot_dif; | ||
319 | |||
320 | if (ee->rotation == rotation) return; | ||
321 | einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas); | ||
322 | if (!einfo) return; | ||
323 | rot_dif = ee->rotation - rotation; | ||
324 | if (rot_dif < 0) rot_dif = -rot_dif; | ||
325 | if (rot_dif != 180) | ||
326 | { | ||
327 | |||
328 | einfo->info.rotation = rotation; | ||
329 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
330 | { | ||
331 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
332 | } | ||
333 | if (!ee->prop.fullscreen) | ||
334 | { | ||
335 | int tmp; | ||
336 | |||
337 | tmp = ee->w; | ||
338 | ee->w = ee->h; | ||
339 | ee->h = tmp; | ||
340 | ee->req.w = ee->w; | ||
341 | ee->req.h = ee->h; | ||
342 | } | ||
343 | else | ||
344 | { | ||
345 | if ((rotation == 0) || (rotation == 180)) | ||
346 | { | ||
347 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
348 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
349 | } | ||
350 | else | ||
351 | { | ||
352 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
353 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
354 | } | ||
355 | } | ||
356 | ee->rotation = rotation; | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | einfo->info.rotation = rotation; | ||
361 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
362 | { | ||
363 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
364 | } | ||
365 | ee->rotation = rotation; | ||
366 | } | ||
367 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
368 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
369 | else | ||
370 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
371 | _ecore_evas_mouse_move_process_fb(ee, ee->mouse.x, ee->mouse.y); | ||
372 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
373 | } | ||
374 | |||
375 | static void | ||
376 | _ecore_evas_show(Ecore_Evas *ee) | ||
377 | { | ||
378 | if (ee->prop.focused) return; | ||
379 | ee->prop.focused = 1; | ||
380 | evas_focus_in(ee->evas); | ||
381 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
382 | } | ||
383 | |||
384 | static void | ||
385 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
386 | { | ||
387 | Ecore_Evas *ee; | ||
388 | |||
389 | ee = data; | ||
390 | if (ee) | ||
391 | ee->prop.cursor.object = NULL; | ||
392 | } | ||
393 | |||
394 | static void | ||
395 | _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
396 | { | ||
397 | int x, y; | ||
398 | |||
399 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
400 | |||
401 | if (!obj) | ||
402 | { | ||
403 | ee->prop.cursor.object = NULL; | ||
404 | ee->prop.cursor.layer = 0; | ||
405 | ee->prop.cursor.hot.x = 0; | ||
406 | ee->prop.cursor.hot.y = 0; | ||
407 | return; | ||
408 | } | ||
409 | |||
410 | ee->prop.cursor.object = obj; | ||
411 | ee->prop.cursor.layer = layer; | ||
412 | ee->prop.cursor.hot.x = hot_x; | ||
413 | ee->prop.cursor.hot.y = hot_y; | ||
414 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
415 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
416 | evas_object_move(ee->prop.cursor.object, | ||
417 | x - ee->prop.cursor.hot.x, | ||
418 | y - ee->prop.cursor.hot.y); | ||
419 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
420 | if (evas_pointer_inside_get(ee->evas)) | ||
421 | evas_object_show(ee->prop.cursor.object); | ||
422 | |||
423 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
424 | } | ||
425 | |||
426 | static void | ||
427 | _ecore_evas_fullscreen_set(Ecore_Evas *ee, int on) | ||
428 | { | ||
429 | Eina_List *l; | ||
430 | Ecore_Fb_Input_Device *dev; | ||
431 | int resized = 0; | ||
432 | |||
433 | if (((ee->prop.fullscreen) && (on)) || | ||
434 | ((!ee->prop.fullscreen) && (!on))) return; | ||
435 | if (on) | ||
436 | { | ||
437 | int w, h; | ||
438 | |||
439 | ee->engine.fb.real_w = ee->w; | ||
440 | ee->engine.fb.real_h = ee->h; | ||
441 | w = ee->w; | ||
442 | h = ee->h; | ||
443 | ecore_fb_size_get(&w, &h); | ||
444 | if ((w == 0) && (h == 0)) | ||
445 | { | ||
446 | w = ee->w; | ||
447 | h = ee->h; | ||
448 | } | ||
449 | if ((w != ee->w) || (h != ee->h)) resized = 1; | ||
450 | ee->w = w; | ||
451 | ee->h = h; | ||
452 | ee->req.w = ee->w; | ||
453 | ee->req.h = ee->h; | ||
454 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
455 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
456 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
457 | } | ||
458 | else | ||
459 | { | ||
460 | if ((ee->engine.fb.real_w != ee->w) || (ee->engine.fb.real_h != ee->h)) resized = 1; | ||
461 | ee->w = ee->engine.fb.real_w; | ||
462 | ee->h = ee->engine.fb.real_h; | ||
463 | ee->req.w = ee->w; | ||
464 | ee->req.h = ee->h; | ||
465 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
466 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
467 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
468 | } | ||
469 | ee->prop.fullscreen = on; | ||
470 | EINA_LIST_FOREACH(ecore_evas_input_devices, l, dev) | ||
471 | ecore_fb_input_device_axis_size_set(dev, ee->w, ee->h); | ||
472 | /* rescale the input device area */ | ||
473 | if (resized) | ||
474 | { | ||
475 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
476 | } | ||
477 | } | ||
478 | |||
479 | int | ||
480 | _ecore_evas_fb_shutdown(void) | ||
481 | { | ||
482 | _ecore_evas_init_count--; | ||
483 | if (_ecore_evas_init_count == 0) | ||
484 | { | ||
485 | int i; | ||
486 | |||
487 | for (i = 0; i < 4; i++) | ||
488 | { | ||
489 | if (ecore_evas_event_handlers[i]) | ||
490 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
491 | } | ||
492 | ecore_fb_ts_shutdown(); | ||
493 | ecore_event_evas_shutdown(); | ||
494 | } | ||
495 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
496 | return _ecore_evas_init_count; | ||
497 | } | ||
498 | |||
499 | static Ecore_Evas_Engine_Func _ecore_fb_engine_func = | ||
500 | { | ||
501 | _ecore_evas_fb_free, | ||
502 | NULL, | ||
503 | NULL, | ||
504 | NULL, | ||
505 | NULL, | ||
506 | NULL, | ||
507 | NULL, | ||
508 | NULL, | ||
509 | NULL, | ||
510 | NULL, | ||
511 | NULL, | ||
512 | NULL, | ||
513 | NULL, | ||
514 | NULL, | ||
515 | NULL, | ||
516 | NULL, | ||
517 | NULL, | ||
518 | _ecore_evas_resize, | ||
519 | _ecore_evas_move_resize, | ||
520 | _ecore_evas_rotation_set, | ||
521 | NULL, | ||
522 | _ecore_evas_show, | ||
523 | NULL, | ||
524 | NULL, | ||
525 | NULL, | ||
526 | NULL, | ||
527 | NULL, | ||
528 | NULL, | ||
529 | NULL, | ||
530 | NULL, | ||
531 | NULL, | ||
532 | NULL, | ||
533 | _ecore_evas_object_cursor_set, | ||
534 | NULL, | ||
535 | NULL, | ||
536 | NULL, | ||
537 | NULL, | ||
538 | NULL, | ||
539 | NULL, | ||
540 | _ecore_evas_fullscreen_set, | ||
541 | NULL, | ||
542 | NULL, | ||
543 | NULL, | ||
544 | NULL, | ||
545 | NULL, | ||
546 | NULL, //transparent | ||
547 | |||
548 | NULL, // render | ||
549 | NULL // screen_geometry_get | ||
550 | }; | ||
551 | #endif | ||
552 | |||
553 | /** | ||
554 | * To be documented. | ||
555 | * | ||
556 | * FIXME: To be fixed. | ||
557 | */ | ||
558 | #ifdef BUILD_ECORE_EVAS_FB | ||
559 | EAPI Ecore_Evas * | ||
560 | ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h) | ||
561 | { | ||
562 | Evas_Engine_Info_FB *einfo; | ||
563 | Ecore_Evas *ee; | ||
564 | |||
565 | int rmethod; | ||
566 | |||
567 | if (!disp_name) | ||
568 | disp_name = ecore_evas_default_display; | ||
569 | |||
570 | rmethod = evas_render_method_lookup("fb"); | ||
571 | if (!rmethod) return NULL; | ||
572 | |||
573 | if (!ecore_fb_init(disp_name)) return NULL; | ||
574 | ecore_fb_callback_gain_set(_ecore_evas_fb_gain, NULL); | ||
575 | ecore_fb_callback_lose_set(_ecore_evas_fb_lose, NULL); | ||
576 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
577 | if (!ee) return NULL; | ||
578 | |||
579 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
580 | |||
581 | _ecore_evas_fb_init(ee, w, h); | ||
582 | |||
583 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func; | ||
584 | |||
585 | ee->driver = "fb"; | ||
586 | if (disp_name) ee->name = strdup(disp_name); | ||
587 | |||
588 | if (w < 1) w = 1; | ||
589 | if (h < 1) h = 1; | ||
590 | ee->rotation = rotation; | ||
591 | ee->visible = 1; | ||
592 | ee->w = w; | ||
593 | ee->h = h; | ||
594 | ee->req.w = ee->w; | ||
595 | ee->req.h = ee->h; | ||
596 | |||
597 | ee->prop.max.w = 0; | ||
598 | ee->prop.max.h = 0; | ||
599 | ee->prop.layer = 0; | ||
600 | ee->prop.focused = 1; | ||
601 | ee->prop.borderless = 1; | ||
602 | ee->prop.override = 1; | ||
603 | ee->prop.maximized = 1; | ||
604 | ee->prop.fullscreen = 0; | ||
605 | ee->prop.withdrawn = 0; | ||
606 | ee->prop.sticky = 0; | ||
607 | |||
608 | /* init evas here */ | ||
609 | ee->evas = evas_new(); | ||
610 | evas_data_attach_set(ee->evas, ee); | ||
611 | evas_output_method_set(ee->evas, rmethod); | ||
612 | |||
613 | if ((rotation == 90) || (rotation == 270)) | ||
614 | { | ||
615 | evas_output_size_set(ee->evas, h, w); | ||
616 | evas_output_viewport_set(ee->evas, 0, 0, h, w); | ||
617 | } | ||
618 | else | ||
619 | { | ||
620 | evas_output_size_set(ee->evas, w, h); | ||
621 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
622 | } | ||
623 | |||
624 | einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas); | ||
625 | if (einfo) | ||
626 | { | ||
627 | einfo->info.virtual_terminal = 0; | ||
628 | einfo->info.device_number = strtol(disp_name, NULL, 10); | ||
629 | einfo->info.refresh = 0; | ||
630 | einfo->info.rotation = ee->rotation; | ||
631 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
632 | { | ||
633 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
634 | ecore_evas_free(ee); | ||
635 | return NULL; | ||
636 | } | ||
637 | } | ||
638 | else | ||
639 | { | ||
640 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
641 | ecore_evas_free(ee); | ||
642 | return NULL; | ||
643 | } | ||
644 | |||
645 | ecore_evas_input_event_register(ee); | ||
646 | |||
647 | ee->engine.func->fn_render = _ecore_evas_fb_render; | ||
648 | _ecore_evas_register(ee); | ||
649 | fb_ee = ee; | ||
650 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
651 | return ee; | ||
652 | } | ||
653 | #else | ||
654 | EAPI Ecore_Evas * | ||
655 | ecore_evas_fb_new(const char *disp_name __UNUSED__, int rotation __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
656 | { | ||
657 | return NULL; | ||
658 | } | ||
659 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h b/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h new file mode 100644 index 0000000..2c20761 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h | |||
@@ -0,0 +1,433 @@ | |||
1 | #ifndef _ECORE_EVAS_PRIVATE_H | ||
2 | #define _ECORE_EVAS_PRIVATE_H | ||
3 | |||
4 | #ifdef HAVE_CONFIG_H | ||
5 | # include <config.h> | ||
6 | #endif | ||
7 | |||
8 | #include <sys/types.h> | ||
9 | #include <sys/stat.h> | ||
10 | #include <fcntl.h> | ||
11 | |||
12 | #ifdef HAVE_SYS_MMAN_H | ||
13 | # include <sys/mman.h> | ||
14 | #endif | ||
15 | |||
16 | #include <Evas.h> | ||
17 | #include <Ecore.h> | ||
18 | #include <ecore_private.h> | ||
19 | #include <Ecore_Input.h> | ||
20 | #include <Ecore_Input_Evas.h> | ||
21 | |||
22 | #define ECORE_MAGIC_EVAS 0x76543211 | ||
23 | |||
24 | #ifdef BUILD_ECORE_EVAS_X11 | ||
25 | # include <Ecore_X.h> | ||
26 | # include <Ecore_X_Atoms.h> | ||
27 | # ifdef HAVE_ECORE_X_XCB | ||
28 | # include <xcb/xcb.h> | ||
29 | # endif | ||
30 | # ifdef HAVE_ECORE_X_XLIB | ||
31 | # include <X11/Xlib.h> | ||
32 | # include <X11/Xutil.h> | ||
33 | # endif | ||
34 | #endif | ||
35 | |||
36 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
37 | # include <Evas_Engine_Software_X11.h> | ||
38 | #endif | ||
39 | |||
40 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
41 | # include <Evas_Engine_GL_X11.h> | ||
42 | #endif | ||
43 | |||
44 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
45 | # include <Evas_Engine_Software_8_X11.h> | ||
46 | #endif | ||
47 | |||
48 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
49 | # include <Evas_Engine_Software_16_X11.h> | ||
50 | #endif | ||
51 | |||
52 | #ifdef BUILD_ECORE_EVAS_FB | ||
53 | # include <Evas_Engine_FB.h> | ||
54 | #endif | ||
55 | |||
56 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
57 | # include <Evas_Engine_DirectFB.h> | ||
58 | # include "Ecore_DirectFB.h" | ||
59 | #endif | ||
60 | |||
61 | #if defined(BUILD_ECORE_EVAS_SOFTWARE_BUFFER) || defined(BUILD_ECORE_EVAS_EWS) | ||
62 | # include <Evas_Engine_Buffer.h> | ||
63 | #endif | ||
64 | |||
65 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
66 | # include "Ecore_Win32.h" | ||
67 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
68 | # include <Evas_Engine_Software_Gdi.h> | ||
69 | # endif | ||
70 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
71 | # include <Evas_Engine_Software_DDraw.h> | ||
72 | # endif | ||
73 | # ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
74 | # include <Evas_Engine_Direct3D.h> | ||
75 | # endif | ||
76 | # ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
77 | # include <Evas_Engine_GL_Glew.h> | ||
78 | # endif | ||
79 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
80 | # include <Evas_Engine_Software_16_DDraw.h> | ||
81 | # endif | ||
82 | #endif | ||
83 | |||
84 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
85 | # include "Ecore_WinCE.h" | ||
86 | # include <Evas_Engine_Software_16_WinCE.h> | ||
87 | #endif | ||
88 | |||
89 | #ifdef BUILD_ECORE_EVAS_GL_COCOA | ||
90 | # include "Ecore_Cocoa.h" | ||
91 | # include <Evas_Engine_Gl_Cocoa.h> | ||
92 | #endif | ||
93 | |||
94 | /** | ||
95 | Log domain macros and variable | ||
96 | **/ | ||
97 | |||
98 | extern int _ecore_evas_log_dom; | ||
99 | |||
100 | #ifdef ECORE_EVAS_DEFAULT_LOG_COLOR | ||
101 | # undef ECORE_EVAS_DEFAULT_LOG_COLOR | ||
102 | #endif | ||
103 | #define ECORE_EVAS_DEFAULT_LOG_COLOR EINA_COLOR_BLUE | ||
104 | |||
105 | #ifdef ERR | ||
106 | # undef ERR | ||
107 | #endif | ||
108 | #define ERR(...) EINA_LOG_DOM_ERR(_ecore_evas_log_dom, __VA_ARGS__) | ||
109 | #ifdef DBG | ||
110 | # undef DBG | ||
111 | #endif | ||
112 | #define DBG(...) EINA_LOG_DOM_DBG(_ecore_evas_log_dom, __VA_ARGS__) | ||
113 | #ifdef INF | ||
114 | # undef INF | ||
115 | #endif | ||
116 | #define INF(...) EINA_LOG_DOM_INFO(_ecore_evas_log_dom, __VA_ARGS__) | ||
117 | #ifdef WRN | ||
118 | # undef WRN | ||
119 | #endif | ||
120 | #define WRN(...) EINA_LOG_DOM_WARN(_ecore_evas_log_dom, __VA_ARGS__) | ||
121 | #ifdef CRIT | ||
122 | # undef CRIT | ||
123 | #endif | ||
124 | #define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_evas_log_dom, __VA_ARGS__) | ||
125 | |||
126 | |||
127 | #define IDLE_FLUSH_TIME 0.5 | ||
128 | #ifndef _ECORE_EVAS_H | ||
129 | typedef struct _Ecore_Evas Ecore_Evas; | ||
130 | #endif | ||
131 | |||
132 | typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine; | ||
133 | typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func; | ||
134 | |||
135 | struct _Ecore_Evas_Engine_Func | ||
136 | { | ||
137 | void (*fn_free) (Ecore_Evas *ee); | ||
138 | void (*fn_callback_resize_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
139 | void (*fn_callback_move_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
140 | void (*fn_callback_show_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
141 | void (*fn_callback_hide_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
142 | void (*fn_callback_delete_request_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
143 | void (*fn_callback_destroy_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
144 | void (*fn_callback_focus_in_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
145 | void (*fn_callback_focus_out_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
146 | void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
147 | void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
148 | void (*fn_callback_sticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
149 | void (*fn_callback_unsticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
150 | void (*fn_callback_pre_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
151 | void (*fn_callback_post_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); | ||
152 | void (*fn_move) (Ecore_Evas *ee, int x, int y); | ||
153 | void (*fn_managed_move) (Ecore_Evas *ee, int x, int y); | ||
154 | void (*fn_resize) (Ecore_Evas *ee, int w, int h); | ||
155 | void (*fn_move_resize) (Ecore_Evas *ee, int x, int y, int w, int h); | ||
156 | void (*fn_rotation_set) (Ecore_Evas *ee, int rot, int resize); | ||
157 | void (*fn_shaped_set) (Ecore_Evas *ee, int shaped); | ||
158 | void (*fn_show) (Ecore_Evas *ee); | ||
159 | void (*fn_hide) (Ecore_Evas *ee); | ||
160 | void (*fn_raise) (Ecore_Evas *ee); | ||
161 | void (*fn_lower) (Ecore_Evas *ee); | ||
162 | void (*fn_activate) (Ecore_Evas *ee); | ||
163 | void (*fn_title_set) (Ecore_Evas *ee, const char *t); | ||
164 | void (*fn_name_class_set) (Ecore_Evas *ee, const char *n, const char *c); | ||
165 | void (*fn_size_min_set) (Ecore_Evas *ee, int w, int h); | ||
166 | void (*fn_size_max_set) (Ecore_Evas *ee, int w, int h); | ||
167 | void (*fn_size_base_set) (Ecore_Evas *ee, int w, int h); | ||
168 | void (*fn_size_step_set) (Ecore_Evas *ee, int w, int h); | ||
169 | void (*fn_object_cursor_set) (Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); | ||
170 | void (*fn_layer_set) (Ecore_Evas *ee, int layer); | ||
171 | void (*fn_focus_set) (Ecore_Evas *ee, int on); | ||
172 | void (*fn_iconified_set) (Ecore_Evas *ee, int on); | ||
173 | void (*fn_borderless_set) (Ecore_Evas *ee, int on); | ||
174 | void (*fn_override_set) (Ecore_Evas *ee, int on); | ||
175 | void (*fn_maximized_set) (Ecore_Evas *ee, int on); | ||
176 | void (*fn_fullscreen_set) (Ecore_Evas *ee, int on); | ||
177 | void (*fn_avoid_damage_set) (Ecore_Evas *ee, int on); | ||
178 | void (*fn_withdrawn_set) (Ecore_Evas *ee, int withdrawn); | ||
179 | void (*fn_sticky_set) (Ecore_Evas *ee, int sticky); | ||
180 | void (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore); | ||
181 | void (*fn_alpha_set) (Ecore_Evas *ee, int alpha); | ||
182 | void (*fn_transparent_set) (Ecore_Evas *ee, int transparent); | ||
183 | |||
184 | int (*fn_render) (Ecore_Evas *ee); | ||
185 | void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h); | ||
186 | }; | ||
187 | |||
188 | struct _Ecore_Evas_Engine | ||
189 | { | ||
190 | Ecore_Evas_Engine_Func *func; | ||
191 | |||
192 | /* TODO: UGLY! This should be an union or inheritance! */ | ||
193 | #ifdef BUILD_ECORE_EVAS_X11 | ||
194 | struct | ||
195 | { | ||
196 | Ecore_X_Window win_root; | ||
197 | Eina_List *win_extra; | ||
198 | Ecore_X_Pixmap pmap; | ||
199 | Ecore_X_Pixmap mask; | ||
200 | Ecore_X_GC gc; | ||
201 | Ecore_X_XRegion *damages; | ||
202 | Ecore_X_Sync_Counter sync_counter; | ||
203 | Ecore_X_Window leader; | ||
204 | Ecore_X_Sync_Counter netwm_sync_counter; | ||
205 | int netwm_sync_val_hi; | ||
206 | unsigned int netwm_sync_val_lo; | ||
207 | int sync_val; // bigger! this will screw up at 2 billion frames (414 days of continual rendering @ 60fps) | ||
208 | int screen_num; | ||
209 | int px, py, pw, ph; | ||
210 | unsigned char direct_resize : 1; | ||
211 | unsigned char using_bg_pixmap : 1; | ||
212 | unsigned char managed : 1; | ||
213 | unsigned char sync_began : 1; | ||
214 | unsigned char sync_cancel : 1; | ||
215 | unsigned char netwm_sync_set : 1; | ||
216 | unsigned char configure_coming : 1; | ||
217 | struct { | ||
218 | unsigned char modal : 1; | ||
219 | unsigned char sticky : 1; | ||
220 | unsigned char maximized_v : 1; | ||
221 | unsigned char maximized_h : 1; | ||
222 | unsigned char shaded : 1; | ||
223 | unsigned char skip_taskbar : 1; | ||
224 | unsigned char skip_pager : 1; | ||
225 | unsigned char fullscreen : 1; | ||
226 | unsigned char above : 1; | ||
227 | unsigned char below : 1; | ||
228 | } state; | ||
229 | Ecore_X_Window win_shaped_input; | ||
230 | } x; | ||
231 | #endif | ||
232 | #ifdef BUILD_ECORE_EVAS_FB | ||
233 | struct { | ||
234 | int real_w; | ||
235 | int real_h; | ||
236 | } fb; | ||
237 | #endif | ||
238 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
239 | struct { | ||
240 | void *pixels; | ||
241 | Evas_Object *image; | ||
242 | void (*free_func) (void *data, void *pix); | ||
243 | void *(*alloc_func) (void *data, int size); | ||
244 | void *data; | ||
245 | } buffer; | ||
246 | #endif | ||
247 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
248 | struct { | ||
249 | Ecore_DirectFB_Window *window; | ||
250 | } directfb; | ||
251 | #endif | ||
252 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
253 | struct { | ||
254 | Ecore_Win32_Window *parent; | ||
255 | struct { | ||
256 | unsigned char region : 1; | ||
257 | unsigned char fullscreen : 1; | ||
258 | } state; | ||
259 | } win32; | ||
260 | #endif | ||
261 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
262 | struct { | ||
263 | Ecore_WinCE_Window *window; | ||
264 | struct { | ||
265 | unsigned char fullscreen : 1; | ||
266 | } state; | ||
267 | } wince; | ||
268 | #endif | ||
269 | #ifdef BUILD_ECORE_EVAS_EWS | ||
270 | struct { | ||
271 | Evas_Object *image; | ||
272 | } ews; | ||
273 | #endif | ||
274 | |||
275 | Ecore_Timer *idle_flush_timer; | ||
276 | }; | ||
277 | |||
278 | struct _Ecore_Evas | ||
279 | { | ||
280 | EINA_INLIST; | ||
281 | ECORE_MAGIC; | ||
282 | Evas *evas; | ||
283 | const char *driver; | ||
284 | char *name; | ||
285 | int x, y, w, h; | ||
286 | short rotation; | ||
287 | Eina_Bool shaped : 1; | ||
288 | Eina_Bool visible : 1; | ||
289 | Eina_Bool draw_ok : 1; | ||
290 | Eina_Bool should_be_visible : 1; | ||
291 | Eina_Bool alpha : 1; | ||
292 | Eina_Bool transparent : 1; | ||
293 | |||
294 | Eina_Hash *data; | ||
295 | |||
296 | struct { | ||
297 | int x, y, w, h; | ||
298 | } req; | ||
299 | |||
300 | struct { | ||
301 | int x, y; | ||
302 | } mouse; | ||
303 | |||
304 | struct { | ||
305 | int w, h; | ||
306 | } expecting_resize; | ||
307 | |||
308 | struct { | ||
309 | char *title; | ||
310 | char *name; | ||
311 | char *clas; | ||
312 | struct { | ||
313 | int w, h; | ||
314 | } min, | ||
315 | max, | ||
316 | base, | ||
317 | step; | ||
318 | struct { | ||
319 | Evas_Object *object; | ||
320 | int layer; | ||
321 | struct { | ||
322 | int x, y; | ||
323 | } hot; | ||
324 | } cursor; | ||
325 | int layer; | ||
326 | Ecore_Window window; | ||
327 | unsigned char avoid_damage; | ||
328 | char focused : 1; | ||
329 | char iconified : 1; | ||
330 | char borderless : 1; | ||
331 | char override : 1; | ||
332 | char maximized : 1; | ||
333 | char fullscreen : 1; | ||
334 | char withdrawn : 1; | ||
335 | char sticky : 1; | ||
336 | char request_pos : 1; | ||
337 | } prop; | ||
338 | |||
339 | struct { | ||
340 | void (*fn_resize) (Ecore_Evas *ee); | ||
341 | void (*fn_move) (Ecore_Evas *ee); | ||
342 | void (*fn_show) (Ecore_Evas *ee); | ||
343 | void (*fn_hide) (Ecore_Evas *ee); | ||
344 | void (*fn_delete_request) (Ecore_Evas *ee); | ||
345 | void (*fn_destroy) (Ecore_Evas *ee); | ||
346 | void (*fn_focus_in) (Ecore_Evas *ee); | ||
347 | void (*fn_focus_out) (Ecore_Evas *ee); | ||
348 | void (*fn_sticky) (Ecore_Evas *ee); | ||
349 | void (*fn_unsticky) (Ecore_Evas *ee); | ||
350 | void (*fn_mouse_in) (Ecore_Evas *ee); | ||
351 | void (*fn_mouse_out) (Ecore_Evas *ee); | ||
352 | void (*fn_pre_render) (Ecore_Evas *ee); | ||
353 | void (*fn_post_render) (Ecore_Evas *ee); | ||
354 | void (*fn_pre_free) (Ecore_Evas *ee); | ||
355 | } func; | ||
356 | |||
357 | Ecore_Evas_Engine engine; | ||
358 | Eina_List *sub_ecore_evas; | ||
359 | |||
360 | int refcount; | ||
361 | |||
362 | unsigned char ignore_events : 1; | ||
363 | unsigned char manual_render : 1; | ||
364 | unsigned char registered : 1; | ||
365 | unsigned char no_comp_sync : 1; | ||
366 | unsigned char semi_sync : 1; | ||
367 | unsigned char deleted : 1; | ||
368 | }; | ||
369 | |||
370 | void _ecore_evas_ref(Ecore_Evas *ee); | ||
371 | void _ecore_evas_unref(Ecore_Evas *ee); | ||
372 | |||
373 | #ifdef BUILD_ECORE_EVAS_X11 | ||
374 | int _ecore_evas_x_shutdown(void); | ||
375 | #endif | ||
376 | #ifdef BUILD_ECORE_EVAS_FB | ||
377 | int _ecore_evas_fb_shutdown(void); | ||
378 | #endif | ||
379 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
380 | int _ecore_evas_buffer_shutdown(void); | ||
381 | int _ecore_evas_buffer_render(Ecore_Evas *ee); | ||
382 | #endif | ||
383 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
384 | int _ecore_evas_directfb_shutdown(void); | ||
385 | #endif | ||
386 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
387 | int _ecore_evas_win32_shutdown(void); | ||
388 | #endif | ||
389 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
390 | int _ecore_evas_wince_shutdown(void); | ||
391 | #endif | ||
392 | #ifdef BUILD_ECORE_EVAS_EWS | ||
393 | void _ecore_evas_ews_events_init(void); | ||
394 | int _ecore_evas_ews_shutdown(void); | ||
395 | #endif | ||
396 | |||
397 | void _ecore_evas_fps_debug_init(void); | ||
398 | void _ecore_evas_fps_debug_shutdown(void); | ||
399 | void _ecore_evas_fps_debug_rendertime_add(double t); | ||
400 | void _ecore_evas_register(Ecore_Evas *ee); | ||
401 | void _ecore_evas_free(Ecore_Evas *ee); | ||
402 | void _ecore_evas_idle_timeout_update(Ecore_Evas *ee); | ||
403 | void _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp); | ||
404 | void _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, | ||
405 | int x, int y, | ||
406 | double radius, | ||
407 | double radius_x, double radius_y, | ||
408 | double pressure, | ||
409 | double angle, | ||
410 | double mx, double my, | ||
411 | unsigned int timestamp); | ||
412 | void _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, | ||
413 | int x, int y, | ||
414 | double radius, | ||
415 | double radius_x, double radius_y, | ||
416 | double pressure, | ||
417 | double angle, | ||
418 | double mx, double my, | ||
419 | Evas_Button_Flags flags, | ||
420 | unsigned int timestamp); | ||
421 | void _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, | ||
422 | int x, int y, | ||
423 | double radius, | ||
424 | double radius_x, double radius_y, | ||
425 | double pressure, | ||
426 | double angle, | ||
427 | double mx, double my, | ||
428 | Evas_Button_Flags flags, | ||
429 | unsigned int timestamp); | ||
430 | |||
431 | extern Eina_Bool _ecore_evas_app_comp_sync; | ||
432 | |||
433 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c new file mode 100644 index 0000000..0849c79 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c | |||
@@ -0,0 +1,476 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <Ecore.h> | ||
6 | #include <Ecore_Input.h> | ||
7 | #include <Ecore_Input_Evas.h> | ||
8 | |||
9 | #include "ecore_evas_private.h" | ||
10 | #include "Ecore_Evas.h" | ||
11 | |||
12 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
13 | #include <Ecore_Psl1ght.h> | ||
14 | #include <Evas_Engine_PSL1GHT.h> | ||
15 | |||
16 | static int _ecore_evas_init_count = 0; | ||
17 | |||
18 | static Ecore_Evas *psl1ght_ee = NULL; | ||
19 | static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { | ||
20 | NULL, NULL, NULL, NULL | ||
21 | }; | ||
22 | |||
23 | static const char *ecore_evas_psl1ght_default = "EFL PSL1GHT"; | ||
24 | static int _ecore_evas_fps_debug = 0; | ||
25 | static Ecore_Poller *ecore_evas_event; | ||
26 | |||
27 | static unsigned int | ||
28 | _ecore_evas_time_get() | ||
29 | { | ||
30 | return (unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff; | ||
31 | } | ||
32 | |||
33 | static Ecore_Evas * | ||
34 | _ecore_evas_psl1ght_match(void) | ||
35 | { | ||
36 | return psl1ght_ee; | ||
37 | } | ||
38 | |||
39 | static Eina_Bool | ||
40 | _ecore_evas_psl1ght_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
41 | { | ||
42 | Ecore_Evas *ee; | ||
43 | |||
44 | ee = _ecore_evas_psl1ght_match(); | ||
45 | |||
46 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
47 | /* pass on event */ | ||
48 | ee->prop.focused = 1; | ||
49 | evas_focus_in(ee->evas); | ||
50 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
51 | |||
52 | return ECORE_CALLBACK_PASS_ON; | ||
53 | } | ||
54 | |||
55 | static Eina_Bool | ||
56 | _ecore_evas_psl1ght_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
57 | { | ||
58 | Ecore_Evas *ee; | ||
59 | |||
60 | ee = _ecore_evas_psl1ght_match(); | ||
61 | |||
62 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
63 | /* pass on event */ | ||
64 | evas_focus_out(ee->evas); | ||
65 | ee->prop.focused = 0; | ||
66 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
67 | |||
68 | return ECORE_CALLBACK_PASS_ON; | ||
69 | } | ||
70 | |||
71 | static Eina_Bool | ||
72 | _ecore_evas_psl1ght_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
73 | { | ||
74 | Ecore_Evas *ee; | ||
75 | int w; | ||
76 | int h; | ||
77 | |||
78 | ee = _ecore_evas_psl1ght_match(); | ||
79 | |||
80 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
81 | evas_output_size_get(ee->evas, &w, &h); | ||
82 | evas_damage_rectangle_add(ee->evas, 0, 0, w, h); | ||
83 | |||
84 | return ECORE_CALLBACK_PASS_ON; | ||
85 | } | ||
86 | |||
87 | static Eina_Bool | ||
88 | _ecore_evas_psl1ght_event_key_modifiers(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
89 | { | ||
90 | Ecore_Evas *ee; | ||
91 | Ecore_Psl1ght_Event_Key_Modifiers *e = event; | ||
92 | |||
93 | ee = _ecore_evas_psl1ght_match(); | ||
94 | |||
95 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
96 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | ||
97 | |||
98 | return ECORE_CALLBACK_PASS_ON; | ||
99 | } | ||
100 | |||
101 | static int | ||
102 | _ecore_evas_render(Ecore_Evas *ee) | ||
103 | { | ||
104 | Eina_List *updates; | ||
105 | |||
106 | updates = evas_render_updates(ee->evas); | ||
107 | if (updates) | ||
108 | { | ||
109 | evas_render_updates_free(updates); | ||
110 | _ecore_evas_idle_timeout_update(ee); | ||
111 | } | ||
112 | return updates ? 1 : 0; | ||
113 | } | ||
114 | |||
115 | static int | ||
116 | _ecore_evas_psl1ght_render(Ecore_Evas *ee) | ||
117 | { | ||
118 | int rend = 0; | ||
119 | |||
120 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
121 | Eina_List *ll; | ||
122 | Ecore_Evas *ee2; | ||
123 | |||
124 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
125 | { | ||
126 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
127 | rend |= _ecore_evas_buffer_render(ee2); | ||
128 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
129 | } | ||
130 | #endif | ||
131 | |||
132 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
133 | |||
134 | if (ee->prop.avoid_damage) rend = _ecore_evas_render(ee); | ||
135 | else if ((ee->visible) || | ||
136 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
137 | ((ee->should_be_visible) && (ee->prop.override))) | ||
138 | rend |= _ecore_evas_render(ee); | ||
139 | else | ||
140 | evas_norender(ee->evas); | ||
141 | |||
142 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
143 | return rend; | ||
144 | } | ||
145 | |||
146 | static Eina_Bool | ||
147 | _ecore_evas_psl1ght_event(void *data __UNUSED__) | ||
148 | { | ||
149 | ecore_psl1ght_poll_events(); | ||
150 | return ECORE_CALLBACK_RENEW; | ||
151 | } | ||
152 | |||
153 | static int | ||
154 | _ecore_evas_psl1ght_init(int w __UNUSED__, int h __UNUSED__) | ||
155 | { | ||
156 | _ecore_evas_init_count++; | ||
157 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
158 | |||
159 | _ecore_evas_fps_debug = 1; | ||
160 | |||
161 | // this is pretty bad: poller? and set poll time? pol time is meant to be | ||
162 | // adjustable for things like polling battery state, or amoutn of spare | ||
163 | // memory etc. | ||
164 | // | ||
165 | ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_psl1ght_event, NULL); | ||
166 | ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); | ||
167 | |||
168 | if (_ecore_evas_fps_debug) | ||
169 | _ecore_evas_fps_debug_init(); | ||
170 | |||
171 | ecore_event_evas_init(); | ||
172 | |||
173 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, _ecore_evas_psl1ght_event_got_focus, NULL); | ||
174 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, _ecore_evas_psl1ght_event_lost_focus, NULL); | ||
175 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE, _ecore_evas_psl1ght_event_video_expose, NULL); | ||
176 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, _ecore_evas_psl1ght_event_key_modifiers, NULL); | ||
177 | |||
178 | return _ecore_evas_init_count; | ||
179 | } | ||
180 | |||
181 | static int | ||
182 | _ecore_evas_psl1ght_shutdown(void) | ||
183 | { | ||
184 | _ecore_evas_init_count--; | ||
185 | if (_ecore_evas_init_count == 0) | ||
186 | { | ||
187 | unsigned int i; | ||
188 | |||
189 | for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler *); i++) | ||
190 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
191 | ecore_event_evas_shutdown(); | ||
192 | ecore_poller_del(ecore_evas_event); | ||
193 | ecore_evas_event = NULL; | ||
194 | if (_ecore_evas_fps_debug) | ||
195 | _ecore_evas_fps_debug_shutdown(); | ||
196 | } | ||
197 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
198 | return _ecore_evas_init_count; | ||
199 | } | ||
200 | |||
201 | static void | ||
202 | _ecore_evas_psl1ght_free(Ecore_Evas *ee) | ||
203 | { | ||
204 | if (psl1ght_ee == ee) psl1ght_ee = NULL; | ||
205 | |||
206 | ecore_event_window_unregister(0); | ||
207 | _ecore_evas_psl1ght_shutdown(); | ||
208 | ecore_psl1ght_shutdown(); | ||
209 | } | ||
210 | |||
211 | static void | ||
212 | _ecore_evas_screen_resized(Ecore_Evas *ee) | ||
213 | { | ||
214 | int w, h; | ||
215 | |||
216 | /* Do not resize if the window is not fullscreen */ | ||
217 | if (ee->prop.fullscreen == 0) return; | ||
218 | |||
219 | ecore_psl1ght_screen_resolution_get (&w, &h); | ||
220 | |||
221 | if (w != ee->w || h != ee->h) | ||
222 | { | ||
223 | ee->req.w = ee->w = w; | ||
224 | ee->req.h = ee->h = h; | ||
225 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
226 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
227 | ecore_psl1ght_resolution_set (w, h); | ||
228 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
229 | |||
230 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
231 | _ecore_evas_time_get()); | ||
232 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
233 | } | ||
234 | } | ||
235 | |||
236 | static void | ||
237 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
238 | { | ||
239 | if ((w == ee->w) && (h == ee->h)) return; | ||
240 | ee->w = w; | ||
241 | ee->h = h; | ||
242 | |||
243 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
244 | |||
245 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
246 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
247 | |||
248 | ecore_psl1ght_resolution_set (w, h); | ||
249 | |||
250 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
251 | |||
252 | _ecore_evas_screen_resized (ee); | ||
253 | } | ||
254 | |||
255 | static void | ||
256 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
257 | { | ||
258 | _ecore_evas_resize (ee, w, h); | ||
259 | } | ||
260 | |||
261 | static void | ||
262 | _ecore_evas_show(Ecore_Evas *ee) | ||
263 | { | ||
264 | if (ee->prop.focused) return; | ||
265 | ee->prop.focused = 1; | ||
266 | evas_focus_in(ee->evas); | ||
267 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
268 | } | ||
269 | |||
270 | static void | ||
271 | _ecore_evas_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
272 | { | ||
273 | if (x) *x = 0; | ||
274 | if (y) *y = 0; | ||
275 | ecore_psl1ght_screen_resolution_get (w, h); | ||
276 | } | ||
277 | |||
278 | static void | ||
279 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
280 | { | ||
281 | Ecore_Evas *ee; | ||
282 | |||
283 | ee = data; | ||
284 | if (ee) | ||
285 | ee->prop.cursor.object = NULL; | ||
286 | } | ||
287 | |||
288 | static void | ||
289 | _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
290 | { | ||
291 | int x, y; | ||
292 | |||
293 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
294 | |||
295 | if (!obj) | ||
296 | { | ||
297 | ee->prop.cursor.object = NULL; | ||
298 | ee->prop.cursor.layer = 0; | ||
299 | ee->prop.cursor.hot.x = 0; | ||
300 | ee->prop.cursor.hot.y = 0; | ||
301 | return; | ||
302 | } | ||
303 | |||
304 | ee->prop.cursor.object = obj; | ||
305 | ee->prop.cursor.layer = layer; | ||
306 | ee->prop.cursor.hot.x = hot_x; | ||
307 | ee->prop.cursor.hot.y = hot_y; | ||
308 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
309 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
310 | evas_object_move(ee->prop.cursor.object, | ||
311 | x - ee->prop.cursor.hot.x, | ||
312 | y - ee->prop.cursor.hot.y); | ||
313 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
314 | if (evas_pointer_inside_get(ee->evas)) | ||
315 | evas_object_show(ee->prop.cursor.object); | ||
316 | |||
317 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
318 | } | ||
319 | |||
320 | static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = | ||
321 | { | ||
322 | _ecore_evas_psl1ght_free, | ||
323 | NULL, | ||
324 | NULL, | ||
325 | NULL, | ||
326 | NULL, | ||
327 | NULL, | ||
328 | NULL, | ||
329 | NULL, | ||
330 | NULL, | ||
331 | NULL, | ||
332 | NULL, | ||
333 | NULL, | ||
334 | NULL, | ||
335 | NULL, | ||
336 | NULL, | ||
337 | NULL, | ||
338 | NULL, | ||
339 | _ecore_evas_resize, | ||
340 | _ecore_evas_move_resize, | ||
341 | NULL, | ||
342 | NULL, | ||
343 | _ecore_evas_show, | ||
344 | NULL, | ||
345 | NULL, | ||
346 | NULL, | ||
347 | NULL, | ||
348 | NULL, | ||
349 | NULL, | ||
350 | NULL, | ||
351 | NULL, | ||
352 | NULL, | ||
353 | NULL, | ||
354 | _ecore_evas_object_cursor_set, | ||
355 | NULL, | ||
356 | NULL, | ||
357 | NULL, | ||
358 | NULL, | ||
359 | NULL, | ||
360 | NULL, | ||
361 | NULL, | ||
362 | NULL, | ||
363 | NULL, | ||
364 | NULL, | ||
365 | NULL, | ||
366 | NULL, | ||
367 | NULL, //transparent | ||
368 | |||
369 | NULL, // render | ||
370 | _ecore_evas_screen_geometry_get // screen_geometry_get | ||
371 | }; | ||
372 | |||
373 | EAPI Ecore_Evas * | ||
374 | ecore_evas_psl1ght_new(const char *name, int w, int h) | ||
375 | { | ||
376 | void *einfo; | ||
377 | Ecore_Evas *ee; | ||
378 | |||
379 | if (!name) | ||
380 | name = ecore_evas_psl1ght_default; | ||
381 | |||
382 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
383 | if (!ee) return NULL; | ||
384 | |||
385 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
386 | |||
387 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_psl1ght_engine_func; | ||
388 | |||
389 | ee->driver = "psl1ght"; | ||
390 | if (name) ee->name = strdup(name); | ||
391 | |||
392 | if (w < 1) w = 1; | ||
393 | if (h < 1) h = 1; | ||
394 | ee->visible = 1; | ||
395 | ee->w = w; | ||
396 | ee->h = h; | ||
397 | |||
398 | ee->prop.max.w = 0; | ||
399 | ee->prop.max.h = 0; | ||
400 | ee->prop.layer = 0; | ||
401 | ee->prop.focused = 1; | ||
402 | ee->prop.borderless = 1; | ||
403 | ee->prop.override = 1; | ||
404 | ee->prop.maximized = 1; | ||
405 | ee->prop.fullscreen = 0; | ||
406 | ee->prop.withdrawn = 0; | ||
407 | ee->prop.sticky = 0; | ||
408 | ee->prop.window = 0; | ||
409 | |||
410 | /* init evas here */ | ||
411 | ee->evas = evas_new(); | ||
412 | evas_data_attach_set(ee->evas, ee); | ||
413 | evas_output_method_set(ee->evas, evas_render_method_lookup("psl1ght")); | ||
414 | |||
415 | evas_output_size_set(ee->evas, w, h); | ||
416 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
417 | |||
418 | einfo = evas_engine_info_get(ee->evas); | ||
419 | if (einfo) | ||
420 | { | ||
421 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
422 | { | ||
423 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
424 | ecore_evas_free(ee); | ||
425 | return NULL; | ||
426 | } | ||
427 | } | ||
428 | else | ||
429 | { | ||
430 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
431 | ecore_evas_free(ee); | ||
432 | return NULL; | ||
433 | } | ||
434 | |||
435 | if (!ecore_psl1ght_init(name)) | ||
436 | { | ||
437 | evas_free(ee->evas); | ||
438 | if (ee->name) free(ee->name); | ||
439 | free(ee); | ||
440 | return NULL; | ||
441 | } | ||
442 | ecore_psl1ght_resolution_set (w, h); | ||
443 | |||
444 | _ecore_evas_psl1ght_init(w, h); | ||
445 | |||
446 | ecore_event_window_register(0, ee, ee->evas, | ||
447 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
448 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
449 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
450 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
451 | |||
452 | ee->engine.func->fn_render = _ecore_evas_psl1ght_render; | ||
453 | _ecore_evas_register(ee); | ||
454 | |||
455 | psl1ght_ee = ee; | ||
456 | |||
457 | _ecore_evas_screen_resized (ee); | ||
458 | |||
459 | if (getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH")) | ||
460 | ecore_evas_cursor_set(ee, getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"), EVAS_LAYER_MAX, 0, 0); | ||
461 | |||
462 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
463 | |||
464 | return ee; | ||
465 | } | ||
466 | |||
467 | #else /* BUILD_ECORE_EVAS_PSL1GHT */ | ||
468 | |||
469 | EAPI Ecore_Evas * | ||
470 | ecore_evas_psl1ght_new(const char *name __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
471 | { | ||
472 | ERR("OUTCH !"); | ||
473 | return NULL; | ||
474 | } | ||
475 | |||
476 | #endif /* BUILD_ECORE_EVAS_PSL1GHT */ | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c new file mode 100644 index 0000000..b333d96 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c | |||
@@ -0,0 +1,542 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <Ecore.h> | ||
6 | #include <Ecore_Input.h> | ||
7 | #include <Ecore_Input_Evas.h> | ||
8 | #if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) | ||
9 | # include <Ecore_Sdl.h> | ||
10 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
11 | # include <Evas_Engine_SDL.h> | ||
12 | # endif | ||
13 | # ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
14 | # include <Evas_Engine_GL_SDL.h> | ||
15 | # endif | ||
16 | #endif | ||
17 | |||
18 | #include "ecore_evas_private.h" | ||
19 | #include "Ecore_Evas.h" | ||
20 | |||
21 | // fixme: 1 sdl window only at a time? seems wrong | ||
22 | |||
23 | #if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) | ||
24 | |||
25 | /* static char *ecore_evas_default_display = "0"; */ | ||
26 | /* static Ecore_List *ecore_evas_input_devices = NULL; */ | ||
27 | |||
28 | static int _ecore_evas_init_count = 0; | ||
29 | |||
30 | static Ecore_Evas *sdl_ee = NULL; | ||
31 | static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { | ||
32 | NULL, NULL, NULL, NULL | ||
33 | }; | ||
34 | |||
35 | static const char *ecore_evas_sdl_default = "EFL SDL"; | ||
36 | static int _ecore_evas_fps_debug = 0; | ||
37 | static Ecore_Poller *ecore_evas_event; | ||
38 | |||
39 | static Ecore_Evas * | ||
40 | _ecore_evas_sdl_match(void) | ||
41 | { | ||
42 | return sdl_ee; | ||
43 | } | ||
44 | |||
45 | static Eina_Bool | ||
46 | _ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
47 | { | ||
48 | Ecore_Evas *ee; | ||
49 | |||
50 | ee = _ecore_evas_sdl_match(); | ||
51 | |||
52 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
53 | /* pass on event */ | ||
54 | ee->prop.focused = 1; | ||
55 | evas_focus_in(ee->evas); | ||
56 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
57 | return ECORE_CALLBACK_PASS_ON; | ||
58 | } | ||
59 | |||
60 | static Eina_Bool | ||
61 | _ecore_evas_sdl_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
62 | { | ||
63 | Ecore_Evas *ee; | ||
64 | |||
65 | ee = _ecore_evas_sdl_match(); | ||
66 | |||
67 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
68 | /* pass on event */ | ||
69 | ee->prop.focused = 0; | ||
70 | evas_focus_out(ee->evas); | ||
71 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
72 | return ECORE_CALLBACK_PASS_ON; | ||
73 | } | ||
74 | |||
75 | static Eina_Bool | ||
76 | _ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
77 | { | ||
78 | Ecore_Sdl_Event_Video_Resize *e; | ||
79 | Ecore_Evas *ee; | ||
80 | |||
81 | e = event; | ||
82 | ee = _ecore_evas_sdl_match(); | ||
83 | |||
84 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
85 | evas_output_size_set(ee->evas, e->w, e->h); | ||
86 | |||
87 | return ECORE_CALLBACK_PASS_ON; | ||
88 | } | ||
89 | |||
90 | static Eina_Bool | ||
91 | _ecore_evas_sdl_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
92 | { | ||
93 | Ecore_Evas *ee; | ||
94 | int w; | ||
95 | int h; | ||
96 | |||
97 | ee = _ecore_evas_sdl_match(); | ||
98 | |||
99 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
100 | evas_output_size_get(ee->evas, &w, &h); | ||
101 | evas_damage_rectangle_add(ee->evas, 0, 0, w, h); | ||
102 | |||
103 | return ECORE_CALLBACK_PASS_ON; | ||
104 | } | ||
105 | |||
106 | static int | ||
107 | _ecore_evas_render(Ecore_Evas *ee) | ||
108 | { | ||
109 | Eina_List *updates; | ||
110 | |||
111 | updates = evas_render_updates(ee->evas); | ||
112 | if (updates) | ||
113 | { | ||
114 | evas_render_updates_free(updates); | ||
115 | _ecore_evas_idle_timeout_update(ee); | ||
116 | } | ||
117 | return updates ? 1 : 0; | ||
118 | } | ||
119 | |||
120 | static int | ||
121 | _ecore_evas_sdl_render(Ecore_Evas *ee) | ||
122 | { | ||
123 | int rend = 0; | ||
124 | Eina_List *ll; | ||
125 | Ecore_Evas *ee2; | ||
126 | |||
127 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
128 | { | ||
129 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
130 | if (ee2->engine.func->fn_render) | ||
131 | rend |= ee2->engine.func->fn_render(ee2); | ||
132 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
133 | } | ||
134 | |||
135 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
136 | |||
137 | if (ee->prop.avoid_damage) rend = _ecore_evas_render(ee); | ||
138 | else if ((ee->visible) || | ||
139 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
140 | ((ee->should_be_visible) && (ee->prop.override))) | ||
141 | rend |= _ecore_evas_render(ee); | ||
142 | else | ||
143 | evas_norender(ee->evas); | ||
144 | |||
145 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
146 | return rend; | ||
147 | } | ||
148 | |||
149 | static Eina_Bool | ||
150 | _ecore_evas_sdl_event(void *data __UNUSED__) | ||
151 | { | ||
152 | ecore_sdl_feed_events(); | ||
153 | return ECORE_CALLBACK_RENEW; | ||
154 | } | ||
155 | |||
156 | static int | ||
157 | _ecore_evas_sdl_init(int w __UNUSED__, int h __UNUSED__) | ||
158 | { | ||
159 | _ecore_evas_init_count++; | ||
160 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
161 | |||
162 | #ifndef _WIN32 | ||
163 | if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; | ||
164 | #endif /* _WIN32 */ | ||
165 | // this is pretty bad: poller? and set poll time? pol time is meant to be | ||
166 | // adjustable for things like polling battery state, or amoutn of spare | ||
167 | // memory etc. | ||
168 | // | ||
169 | ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_sdl_event, NULL); | ||
170 | ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); | ||
171 | #ifndef _WIN32 | ||
172 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); | ||
173 | #endif /* _WIN32 */ | ||
174 | |||
175 | ecore_event_evas_init(); | ||
176 | |||
177 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_SDL_EVENT_GOT_FOCUS, _ecore_evas_sdl_event_got_focus, NULL); | ||
178 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_SDL_EVENT_LOST_FOCUS, _ecore_evas_sdl_event_lost_focus, NULL); | ||
179 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_SDL_EVENT_RESIZE, _ecore_evas_sdl_event_video_resize, NULL); | ||
180 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_SDL_EVENT_EXPOSE, _ecore_evas_sdl_event_video_expose, NULL); | ||
181 | |||
182 | return _ecore_evas_init_count; | ||
183 | } | ||
184 | |||
185 | static int | ||
186 | _ecore_evas_sdl_shutdown(void) | ||
187 | { | ||
188 | _ecore_evas_init_count--; | ||
189 | if (_ecore_evas_init_count == 0) | ||
190 | { | ||
191 | int i; | ||
192 | |||
193 | for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) | ||
194 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
195 | ecore_event_evas_shutdown(); | ||
196 | ecore_poller_del(ecore_evas_event); | ||
197 | ecore_evas_event = NULL; | ||
198 | #ifndef _WIN32 | ||
199 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); | ||
200 | #endif /* _WIN32 */ | ||
201 | } | ||
202 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
203 | return _ecore_evas_init_count; | ||
204 | } | ||
205 | |||
206 | static void | ||
207 | _ecore_evas_sdl_free(Ecore_Evas *ee) | ||
208 | { | ||
209 | if (sdl_ee == ee) sdl_ee = NULL; | ||
210 | |||
211 | ecore_event_window_unregister(0); | ||
212 | _ecore_evas_sdl_shutdown(); | ||
213 | ecore_sdl_shutdown(); | ||
214 | } | ||
215 | |||
216 | static void | ||
217 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
218 | { | ||
219 | if ((w == ee->w) && (h == ee->h)) return; | ||
220 | ee->w = w; | ||
221 | ee->h = h; | ||
222 | |||
223 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
224 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
225 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
226 | |||
227 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
228 | } | ||
229 | |||
230 | static void | ||
231 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
232 | { | ||
233 | if ((w == ee->w) && (h == ee->h)) return; | ||
234 | ee->w = w; | ||
235 | ee->h = h; | ||
236 | |||
237 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
238 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
239 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
240 | |||
241 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
242 | } | ||
243 | |||
244 | static void | ||
245 | _ecore_evas_show(Ecore_Evas *ee) | ||
246 | { | ||
247 | if (ee->prop.focused) return; | ||
248 | ee->prop.focused = 1; | ||
249 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
250 | } | ||
251 | |||
252 | static void | ||
253 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
254 | { | ||
255 | Ecore_Evas *ee; | ||
256 | |||
257 | ee = data; | ||
258 | if (ee) ee->prop.cursor.object = NULL; | ||
259 | } | ||
260 | |||
261 | static void | ||
262 | _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
263 | { | ||
264 | int x, y; | ||
265 | |||
266 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
267 | |||
268 | if (!obj) | ||
269 | { | ||
270 | ee->prop.cursor.object = NULL; | ||
271 | ee->prop.cursor.layer = 0; | ||
272 | ee->prop.cursor.hot.x = 0; | ||
273 | ee->prop.cursor.hot.y = 0; | ||
274 | return; | ||
275 | } | ||
276 | |||
277 | ee->prop.cursor.object = obj; | ||
278 | ee->prop.cursor.layer = layer; | ||
279 | ee->prop.cursor.hot.x = hot_x; | ||
280 | ee->prop.cursor.hot.y = hot_y; | ||
281 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
282 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
283 | evas_object_move(ee->prop.cursor.object, | ||
284 | x - ee->prop.cursor.hot.x, | ||
285 | y - ee->prop.cursor.hot.y); | ||
286 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
287 | if (evas_pointer_inside_get(ee->evas)) | ||
288 | evas_object_show(ee->prop.cursor.object); | ||
289 | |||
290 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
291 | } | ||
292 | |||
293 | static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = | ||
294 | { | ||
295 | _ecore_evas_sdl_free, | ||
296 | NULL, | ||
297 | NULL, | ||
298 | NULL, | ||
299 | NULL, | ||
300 | NULL, | ||
301 | NULL, | ||
302 | NULL, | ||
303 | NULL, | ||
304 | NULL, | ||
305 | NULL, | ||
306 | NULL, | ||
307 | NULL, | ||
308 | NULL, | ||
309 | NULL, | ||
310 | NULL, | ||
311 | NULL, | ||
312 | _ecore_evas_resize, | ||
313 | _ecore_evas_move_resize, | ||
314 | NULL, | ||
315 | NULL, | ||
316 | _ecore_evas_show, | ||
317 | NULL, | ||
318 | NULL, | ||
319 | NULL, | ||
320 | NULL, | ||
321 | NULL, | ||
322 | NULL, | ||
323 | NULL, | ||
324 | NULL, | ||
325 | NULL, | ||
326 | NULL, | ||
327 | _ecore_evas_object_cursor_set, | ||
328 | NULL, | ||
329 | NULL, | ||
330 | NULL, | ||
331 | NULL, | ||
332 | NULL, | ||
333 | NULL, | ||
334 | NULL, | ||
335 | NULL, | ||
336 | NULL, | ||
337 | NULL, | ||
338 | NULL, | ||
339 | NULL, | ||
340 | NULL, //transparent | ||
341 | |||
342 | NULL, // render | ||
343 | NULL // screen_geometry_get | ||
344 | }; | ||
345 | |||
346 | static Ecore_Evas* | ||
347 | _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) | ||
348 | { | ||
349 | void *einfo; | ||
350 | Ecore_Evas *ee; | ||
351 | |||
352 | if (!name) | ||
353 | name = ecore_evas_sdl_default; | ||
354 | |||
355 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
356 | if (!ee) return NULL; | ||
357 | |||
358 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
359 | |||
360 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_sdl_engine_func; | ||
361 | |||
362 | ee->driver = "sdl"; | ||
363 | if (name) ee->name = strdup(name); | ||
364 | |||
365 | if (w < 1) w = 1; | ||
366 | if (h < 1) h = 1; | ||
367 | ee->visible = 1; | ||
368 | ee->w = w; | ||
369 | ee->h = h; | ||
370 | |||
371 | ee->prop.max.w = 0; | ||
372 | ee->prop.max.h = 0; | ||
373 | ee->prop.layer = 0; | ||
374 | ee->prop.focused = 1; | ||
375 | ee->prop.borderless = 1; | ||
376 | ee->prop.override = 1; | ||
377 | ee->prop.maximized = 1; | ||
378 | ee->prop.fullscreen = fullscreen; | ||
379 | ee->prop.withdrawn = 0; | ||
380 | ee->prop.sticky = 0; | ||
381 | ee->prop.window = 0; | ||
382 | |||
383 | /* init evas here */ | ||
384 | ee->evas = evas_new(); | ||
385 | evas_data_attach_set(ee->evas, ee); | ||
386 | evas_output_method_set(ee->evas, rmethod); | ||
387 | |||
388 | evas_output_size_set(ee->evas, w, h); | ||
389 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
390 | |||
391 | if (rmethod == evas_render_method_lookup("software_sdl") || | ||
392 | rmethod == evas_render_method_lookup("software_16_sdl") ) | ||
393 | { | ||
394 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
395 | einfo = evas_engine_info_get(ee->evas); | ||
396 | if (einfo) | ||
397 | { | ||
398 | ((Evas_Engine_Info_SDL *)einfo)->info.rotation = 0; | ||
399 | ((Evas_Engine_Info_SDL *)einfo)->info.fullscreen = fullscreen; | ||
400 | ((Evas_Engine_Info_SDL *)einfo)->info.hwsurface = hwsurface; | ||
401 | ((Evas_Engine_Info_SDL *)einfo)->info.noframe = noframe; | ||
402 | ((Evas_Engine_Info_SDL *)einfo)->info.alpha = alpha; | ||
403 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
404 | { | ||
405 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
406 | ecore_evas_free(ee); | ||
407 | return NULL; | ||
408 | } | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
413 | ecore_evas_free(ee); | ||
414 | return NULL; | ||
415 | } | ||
416 | #endif | ||
417 | } | ||
418 | else if (rmethod == evas_render_method_lookup("gl_sdl")) | ||
419 | { | ||
420 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
421 | einfo = evas_engine_info_get(ee->evas); | ||
422 | if (einfo) | ||
423 | { | ||
424 | ((Evas_Engine_Info_GL_SDL *)einfo)->flags.fullscreen = fullscreen; | ||
425 | ((Evas_Engine_Info_GL_SDL *)einfo)->flags.noframe = noframe; | ||
426 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
427 | { | ||
428 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
429 | ecore_evas_free(ee); | ||
430 | return NULL; | ||
431 | } | ||
432 | } | ||
433 | else | ||
434 | { | ||
435 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
436 | ecore_evas_free(ee); | ||
437 | return NULL; | ||
438 | } | ||
439 | #endif | ||
440 | } | ||
441 | else | ||
442 | { | ||
443 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
444 | ecore_evas_free(ee); | ||
445 | return NULL; | ||
446 | } | ||
447 | |||
448 | if (!ecore_sdl_init(name)) | ||
449 | { | ||
450 | evas_free(ee->evas); | ||
451 | if (ee->name) free(ee->name); | ||
452 | free(ee); | ||
453 | return NULL; | ||
454 | } | ||
455 | |||
456 | _ecore_evas_sdl_init(w, h); | ||
457 | |||
458 | ecore_event_window_register(0, ee, ee->evas, | ||
459 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
460 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
461 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
462 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
463 | |||
464 | SDL_ShowCursor(SDL_DISABLE); | ||
465 | |||
466 | ee->engine.func->fn_render = _ecore_evas_sdl_render; | ||
467 | _ecore_evas_register(ee); | ||
468 | |||
469 | sdl_ee = ee; | ||
470 | return ee; | ||
471 | } | ||
472 | #endif | ||
473 | |||
474 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
475 | EAPI Ecore_Evas* | ||
476 | ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) | ||
477 | { | ||
478 | Ecore_Evas *ee; | ||
479 | int rmethod; | ||
480 | |||
481 | rmethod = evas_render_method_lookup("software_sdl"); | ||
482 | if (!rmethod) return NULL; | ||
483 | |||
484 | ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha); | ||
485 | ee->driver = "sdl"; | ||
486 | return ee; | ||
487 | } | ||
488 | #else | ||
489 | EAPI Ecore_Evas* | ||
490 | ecore_evas_sdl_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int hwsurface __UNUSED__, int noframe __UNUSED__, int alpha __UNUSED__) | ||
491 | { | ||
492 | ERR("OUTCH !"); | ||
493 | return NULL; | ||
494 | } | ||
495 | #endif | ||
496 | |||
497 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
498 | EAPI Ecore_Evas* | ||
499 | ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) | ||
500 | { | ||
501 | Ecore_Evas *ee; | ||
502 | int rmethod; | ||
503 | |||
504 | rmethod = evas_render_method_lookup("software_16_sdl"); | ||
505 | if (!rmethod) return NULL; | ||
506 | |||
507 | ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha); | ||
508 | ee->driver = "software_16_sdl"; | ||
509 | return ee; | ||
510 | } | ||
511 | #else | ||
512 | EAPI Ecore_Evas* | ||
513 | ecore_evas_sdl16_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int hwsurface __UNUSED__, int noframe __UNUSED__, int alpha __UNUSED__) | ||
514 | { | ||
515 | ERR("OUTCH !"); | ||
516 | return NULL; | ||
517 | } | ||
518 | #endif | ||
519 | |||
520 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
521 | EAPI Ecore_Evas* | ||
522 | ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe) | ||
523 | { | ||
524 | Ecore_Evas *ee; | ||
525 | int rmethod; | ||
526 | |||
527 | rmethod = evas_render_method_lookup("gl_sdl"); | ||
528 | if (!rmethod) return NULL; | ||
529 | |||
530 | ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, 0, noframe, 0); | ||
531 | ee->driver = "gl_sdl"; | ||
532 | return ee; | ||
533 | } | ||
534 | #else | ||
535 | EAPI Ecore_Evas* | ||
536 | ecore_evas_gl_sdl_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int noframe __UNUSED__) | ||
537 | { | ||
538 | ERR("OUTCH !"); | ||
539 | return NULL; | ||
540 | } | ||
541 | #endif | ||
542 | |||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c new file mode 100644 index 0000000..95b6d22 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c | |||
@@ -0,0 +1,437 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <string.h> | ||
6 | |||
7 | #include <Ecore.h> | ||
8 | #include "ecore_private.h" | ||
9 | |||
10 | #include "ecore_evas_private.h" | ||
11 | #include "Ecore_Evas.h" | ||
12 | |||
13 | static const char ASSOCIATE_KEY[] = "__Ecore_Evas_Associate"; | ||
14 | |||
15 | static void _ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags); | ||
16 | static void _ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj); | ||
17 | |||
18 | |||
19 | static Evas_Object * | ||
20 | _ecore_evas_associate_get(const Ecore_Evas *ee) | ||
21 | { | ||
22 | return ecore_evas_data_get(ee, ASSOCIATE_KEY); | ||
23 | } | ||
24 | |||
25 | static void | ||
26 | _ecore_evas_associate_set(Ecore_Evas *ee, Evas_Object *obj) | ||
27 | { | ||
28 | ecore_evas_data_set(ee, ASSOCIATE_KEY, obj); | ||
29 | } | ||
30 | |||
31 | static void | ||
32 | _ecore_evas_associate_del(Ecore_Evas *ee) | ||
33 | { | ||
34 | ecore_evas_data_set(ee, ASSOCIATE_KEY, NULL); | ||
35 | } | ||
36 | |||
37 | static Ecore_Evas * | ||
38 | _evas_object_associate_get(const Evas_Object *obj) | ||
39 | { | ||
40 | return evas_object_data_get(obj, ASSOCIATE_KEY); | ||
41 | } | ||
42 | |||
43 | static void | ||
44 | _evas_object_associate_set(Evas_Object *obj, Ecore_Evas *ee) | ||
45 | { | ||
46 | evas_object_data_set(obj, ASSOCIATE_KEY, ee); | ||
47 | } | ||
48 | |||
49 | static void | ||
50 | _evas_object_associate_del(Evas_Object *obj) | ||
51 | { | ||
52 | evas_object_data_del(obj, ASSOCIATE_KEY); | ||
53 | } | ||
54 | |||
55 | /** Associated Events: ******************************************************/ | ||
56 | |||
57 | /* Interceptors Callbacks */ | ||
58 | |||
59 | static void | ||
60 | _ecore_evas_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y) | ||
61 | { | ||
62 | Ecore_Evas *ee = data; | ||
63 | // FIXME: account for frame | ||
64 | ecore_evas_move(ee, x, y); | ||
65 | if (ecore_evas_override_get(ee)) evas_object_move(obj, x, y); | ||
66 | } | ||
67 | |||
68 | static void | ||
69 | _ecore_evas_obj_intercept_raise(void *data, Evas_Object *obj __UNUSED__) | ||
70 | { | ||
71 | Ecore_Evas *ee = data; | ||
72 | ecore_evas_raise(ee); | ||
73 | } | ||
74 | |||
75 | static void | ||
76 | _ecore_evas_obj_intercept_lower(void *data, Evas_Object *obj __UNUSED__) | ||
77 | { | ||
78 | Ecore_Evas *ee = data; | ||
79 | ecore_evas_lower(ee); | ||
80 | } | ||
81 | |||
82 | static void | ||
83 | _ecore_evas_obj_intercept_stack_above(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *above __UNUSED__) | ||
84 | { | ||
85 | INF("TODO: %s", __FUNCTION__); | ||
86 | } | ||
87 | |||
88 | static void | ||
89 | _ecore_evas_obj_intercept_stack_below(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *below __UNUSED__) | ||
90 | { | ||
91 | INF("TODO: %s", __FUNCTION__); | ||
92 | } | ||
93 | |||
94 | static void | ||
95 | _ecore_evas_obj_intercept_layer_set(void *data, Evas_Object *obj __UNUSED__, int l) | ||
96 | { | ||
97 | Ecore_Evas *ee = data; | ||
98 | ecore_evas_layer_set(ee, l); | ||
99 | } | ||
100 | |||
101 | /* Event Callbacks */ | ||
102 | |||
103 | static void | ||
104 | _ecore_evas_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
105 | { | ||
106 | Ecore_Evas *ee = data; | ||
107 | ecore_evas_show(ee); | ||
108 | } | ||
109 | |||
110 | static void | ||
111 | _ecore_evas_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
112 | { | ||
113 | Ecore_Evas *ee = data; | ||
114 | ecore_evas_hide(ee); | ||
115 | } | ||
116 | |||
117 | static void | ||
118 | _ecore_evas_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) | ||
119 | { | ||
120 | Ecore_Evas *ee = data; | ||
121 | Evas_Coord ow, oh, w, h; | ||
122 | |||
123 | evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); | ||
124 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
125 | /*if ((w != ow) || (h != oh))*/ /* avoid recursion on ecore_evas_resize side */ | ||
126 | ecore_evas_resize(ee, ow, oh); | ||
127 | } | ||
128 | |||
129 | static void | ||
130 | _ecore_evas_obj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) | ||
131 | { | ||
132 | Ecore_Evas *ee = data; | ||
133 | Evas_Coord w, h; | ||
134 | |||
135 | evas_object_size_hint_min_get(obj, &w, &h); | ||
136 | ecore_evas_size_min_set(ee, w, h); | ||
137 | |||
138 | evas_object_size_hint_max_get(obj, &w, &h); | ||
139 | if (w < 1) w = -1; | ||
140 | if (h < 1) h = -1; | ||
141 | ecore_evas_size_max_set(ee, w, h); | ||
142 | } | ||
143 | |||
144 | static void | ||
145 | _ecore_evas_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) | ||
146 | { | ||
147 | Ecore_Evas *ee = data; | ||
148 | _ecore_evas_object_dissociate(ee, obj); | ||
149 | ecore_evas_free(ee); | ||
150 | } | ||
151 | |||
152 | static void | ||
153 | _ecore_evas_obj_callback_del_dissociate(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) | ||
154 | { | ||
155 | Ecore_Evas *ee = data; | ||
156 | _ecore_evas_object_dissociate(ee, obj); | ||
157 | } | ||
158 | |||
159 | static void | ||
160 | _ecore_evas_delete_request(Ecore_Evas *ee) | ||
161 | { | ||
162 | Evas_Object *obj = _ecore_evas_associate_get(ee); | ||
163 | _ecore_evas_object_dissociate(ee, obj); | ||
164 | evas_object_del(obj); | ||
165 | ecore_evas_free(ee); | ||
166 | } | ||
167 | |||
168 | static void | ||
169 | _ecore_evas_destroy(Ecore_Evas *ee) | ||
170 | { | ||
171 | Evas_Object *obj = _ecore_evas_associate_get(ee); | ||
172 | if (!obj) | ||
173 | return; | ||
174 | _ecore_evas_object_dissociate(ee, obj); | ||
175 | evas_object_del(obj); | ||
176 | } | ||
177 | |||
178 | static void | ||
179 | _ecore_evas_resize(Ecore_Evas *ee) | ||
180 | { | ||
181 | Evas_Object *obj = _ecore_evas_associate_get(ee); | ||
182 | Evas_Coord w, h; | ||
183 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
184 | evas_object_resize(obj, w, h); | ||
185 | } | ||
186 | |||
187 | static void | ||
188 | _ecore_evas_pre_free(Ecore_Evas *ee) | ||
189 | { | ||
190 | Evas_Object *obj = _ecore_evas_associate_get(ee); | ||
191 | if (!obj) | ||
192 | return; | ||
193 | _ecore_evas_object_dissociate(ee, obj); | ||
194 | evas_object_del(obj); | ||
195 | } | ||
196 | |||
197 | static int | ||
198 | _ecore_evas_object_evas_check(const char *function, const Ecore_Evas *ee, const Evas_Object *obj) | ||
199 | { | ||
200 | const char *name, *type; | ||
201 | Evas *e; | ||
202 | |||
203 | e = evas_object_evas_get(obj); | ||
204 | if (e == ee->evas) | ||
205 | return 1; | ||
206 | |||
207 | name = evas_object_name_get(obj); | ||
208 | type = evas_object_type_get(obj); | ||
209 | |||
210 | ERR("ERROR: %s(): object %p (name=\"%s\", type=\"%s\") evas " | ||
211 | "is not the same as this Ecore_Evas evas: %p != %p", | ||
212 | function, obj, | ||
213 | name ? name : "", type ? type : "", e, ee->evas); | ||
214 | fflush(stderr); | ||
215 | if (getenv("ECORE_ERROR_ABORT")) abort(); | ||
216 | |||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | EAPI Eina_Bool | ||
221 | ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags) | ||
222 | { | ||
223 | Ecore_Evas *old_ee; | ||
224 | Evas_Object *old_obj; | ||
225 | |||
226 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
227 | { | ||
228 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); | ||
229 | return EINA_FALSE; | ||
230 | } | ||
231 | |||
232 | CHECK_PARAM_POINTER_RETURN("obj", obj, EINA_FALSE); | ||
233 | if (!_ecore_evas_object_evas_check(__FUNCTION__, ee, obj)) | ||
234 | return EINA_FALSE; | ||
235 | |||
236 | old_ee = _evas_object_associate_get(obj);; | ||
237 | if (old_ee) | ||
238 | ecore_evas_object_dissociate(old_ee, obj); | ||
239 | |||
240 | old_obj = _ecore_evas_associate_get(ee); | ||
241 | if (old_obj) | ||
242 | ecore_evas_object_dissociate(ee, old_obj); | ||
243 | |||
244 | _ecore_evas_object_associate(ee, obj, flags); | ||
245 | return EINA_TRUE; | ||
246 | } | ||
247 | |||
248 | EAPI Eina_Bool | ||
249 | ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj) | ||
250 | { | ||
251 | Ecore_Evas *old_ee; | ||
252 | Evas_Object *old_obj; | ||
253 | |||
254 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
255 | { | ||
256 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); | ||
257 | return EINA_FALSE; | ||
258 | } | ||
259 | |||
260 | CHECK_PARAM_POINTER_RETURN("obj", obj, EINA_FALSE); | ||
261 | old_ee = _evas_object_associate_get(obj); | ||
262 | if (ee != old_ee) { | ||
263 | ERR("ERROR: trying to dissociate object that is not using " | ||
264 | "this Ecore_Evas: %p != %p", ee, old_ee); | ||
265 | return EINA_FALSE; | ||
266 | } | ||
267 | |||
268 | old_obj = _ecore_evas_associate_get(ee); | ||
269 | if (old_obj != obj) { | ||
270 | ERR("ERROR: trying to dissociate object that is not being " | ||
271 | "used by this Ecore_Evas: %p != %p", old_obj, obj); | ||
272 | return EINA_FALSE; | ||
273 | } | ||
274 | |||
275 | _ecore_evas_object_dissociate(ee, obj); | ||
276 | |||
277 | return EINA_TRUE; | ||
278 | } | ||
279 | |||
280 | EAPI Evas_Object * | ||
281 | ecore_evas_object_associate_get(const Ecore_Evas *ee) | ||
282 | { | ||
283 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
284 | { | ||
285 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); | ||
286 | return NULL; | ||
287 | } | ||
288 | return _ecore_evas_associate_get(ee); | ||
289 | } | ||
290 | |||
291 | static void | ||
292 | _ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags) | ||
293 | { | ||
294 | evas_object_event_callback_add | ||
295 | (obj, EVAS_CALLBACK_SHOW, | ||
296 | _ecore_evas_obj_callback_show, ee); | ||
297 | evas_object_event_callback_add | ||
298 | (obj, EVAS_CALLBACK_HIDE, | ||
299 | _ecore_evas_obj_callback_hide, ee); | ||
300 | evas_object_event_callback_add | ||
301 | (obj, EVAS_CALLBACK_RESIZE, | ||
302 | _ecore_evas_obj_callback_resize, ee); | ||
303 | evas_object_event_callback_add | ||
304 | (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, | ||
305 | _ecore_evas_obj_callback_changed_size_hints, ee); | ||
306 | if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_DEL) | ||
307 | evas_object_event_callback_add | ||
308 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del, ee); | ||
309 | else | ||
310 | evas_object_event_callback_add | ||
311 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del_dissociate, ee); | ||
312 | |||
313 | evas_object_intercept_move_callback_add | ||
314 | (obj, _ecore_evas_obj_intercept_move, ee); | ||
315 | |||
316 | if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_STACK) | ||
317 | { | ||
318 | evas_object_intercept_raise_callback_add | ||
319 | (obj, _ecore_evas_obj_intercept_raise, ee); | ||
320 | evas_object_intercept_lower_callback_add | ||
321 | (obj, _ecore_evas_obj_intercept_lower, ee); | ||
322 | evas_object_intercept_stack_above_callback_add | ||
323 | (obj, _ecore_evas_obj_intercept_stack_above, ee); | ||
324 | evas_object_intercept_stack_below_callback_add | ||
325 | (obj, _ecore_evas_obj_intercept_stack_below, ee); | ||
326 | } | ||
327 | |||
328 | if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_LAYER) | ||
329 | evas_object_intercept_layer_set_callback_add | ||
330 | (obj, _ecore_evas_obj_intercept_layer_set, ee); | ||
331 | |||
332 | if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_DEL) | ||
333 | { | ||
334 | ecore_evas_callback_delete_request_set(ee, _ecore_evas_delete_request); | ||
335 | ecore_evas_callback_destroy_set(ee, _ecore_evas_destroy); | ||
336 | } | ||
337 | ecore_evas_callback_pre_free_set(ee, _ecore_evas_pre_free); | ||
338 | ecore_evas_callback_resize_set(ee, _ecore_evas_resize); | ||
339 | |||
340 | _evas_object_associate_set(obj, ee); | ||
341 | _ecore_evas_associate_set(ee, obj); | ||
342 | } | ||
343 | |||
344 | static void | ||
345 | _ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj) | ||
346 | { | ||
347 | evas_object_event_callback_del_full | ||
348 | (obj, EVAS_CALLBACK_SHOW, | ||
349 | _ecore_evas_obj_callback_show, ee); | ||
350 | evas_object_event_callback_del_full | ||
351 | (obj, EVAS_CALLBACK_HIDE, | ||
352 | _ecore_evas_obj_callback_hide, ee); | ||
353 | evas_object_event_callback_del_full | ||
354 | (obj, EVAS_CALLBACK_RESIZE, | ||
355 | _ecore_evas_obj_callback_resize, ee); | ||
356 | evas_object_event_callback_del_full | ||
357 | (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, | ||
358 | _ecore_evas_obj_callback_changed_size_hints, ee); | ||
359 | evas_object_event_callback_del_full | ||
360 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del, ee); | ||
361 | evas_object_event_callback_del_full | ||
362 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del_dissociate, ee); | ||
363 | |||
364 | evas_object_intercept_move_callback_del | ||
365 | (obj, _ecore_evas_obj_intercept_move); | ||
366 | |||
367 | evas_object_intercept_raise_callback_del | ||
368 | (obj, _ecore_evas_obj_intercept_raise); | ||
369 | evas_object_intercept_lower_callback_del | ||
370 | (obj, _ecore_evas_obj_intercept_lower); | ||
371 | evas_object_intercept_stack_above_callback_del | ||
372 | (obj, _ecore_evas_obj_intercept_stack_above); | ||
373 | evas_object_intercept_stack_below_callback_del | ||
374 | (obj, _ecore_evas_obj_intercept_stack_below); | ||
375 | |||
376 | evas_object_intercept_layer_set_callback_del | ||
377 | (obj, _ecore_evas_obj_intercept_layer_set); | ||
378 | |||
379 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
380 | { | ||
381 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); | ||
382 | } | ||
383 | else | ||
384 | { | ||
385 | if (ee->func.fn_delete_request == _ecore_evas_delete_request) | ||
386 | ecore_evas_callback_delete_request_set(ee, NULL); | ||
387 | if (ee->func.fn_destroy == _ecore_evas_destroy) | ||
388 | ecore_evas_callback_destroy_set(ee, NULL); | ||
389 | if (ee->func.fn_resize == _ecore_evas_resize) | ||
390 | ecore_evas_callback_resize_set(ee, NULL); | ||
391 | if (ee->func.fn_pre_free == _ecore_evas_pre_free) | ||
392 | ecore_evas_callback_pre_free_set(ee, NULL); | ||
393 | |||
394 | _ecore_evas_associate_del(ee); | ||
395 | } | ||
396 | |||
397 | _evas_object_associate_del(obj); | ||
398 | } | ||
399 | |||
400 | /** | ||
401 | * Helper ecore_getopt callback to list available Ecore_Evas engines. | ||
402 | * | ||
403 | * This will list all available engines except buffer, this is useful | ||
404 | * for applications to let user choose how they should create windows | ||
405 | * with ecore_evas_new(). | ||
406 | * | ||
407 | * @c callback_data value is used as @c FILE* and says where to output | ||
408 | * messages, by default it is @c stdout. You can specify this value | ||
409 | * with ECORE_GETOPT_CALLBACK_FULL() or ECORE_GETOPT_CALLBACK_ARGS(). | ||
410 | * | ||
411 | * If there is a boolean storage provided, then it is marked with 1 | ||
412 | * when this option is executed. | ||
413 | */ | ||
414 | unsigned char | ||
415 | ecore_getopt_callback_ecore_evas_list_engines(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc __UNUSED__, const char *str __UNUSED__, void *data, Ecore_Getopt_Value *storage) | ||
416 | { | ||
417 | Eina_List *lst, *n; | ||
418 | const char *engine; | ||
419 | FILE *fp = data; | ||
420 | |||
421 | if (!fp) | ||
422 | fp = stdout; | ||
423 | |||
424 | lst = ecore_evas_engines_get(); | ||
425 | |||
426 | fputs("supported engines:\n", fp); | ||
427 | EINA_LIST_FOREACH(lst, n, engine) | ||
428 | if (strcmp(engine, "buffer") != 0) | ||
429 | fprintf(fp, "\t%s\n", engine); | ||
430 | |||
431 | ecore_evas_engines_free(lst); | ||
432 | |||
433 | if (storage->boolp) | ||
434 | *storage->boolp = 1; | ||
435 | |||
436 | return 1; | ||
437 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c new file mode 100644 index 0000000..2ca7cb0 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c | |||
@@ -0,0 +1,1451 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> /* for NULL */ | ||
6 | |||
7 | #include <Ecore.h> | ||
8 | #include "ecore_private.h" | ||
9 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
10 | # define WIN32_LEAN_AND_MEAN | ||
11 | # include <windows.h> | ||
12 | # undef WIN32_LEAN_AND_MEAN | ||
13 | # include <Ecore_Win32.h> | ||
14 | # include <ecore_win32_private.h> | ||
15 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
16 | |||
17 | #include "ecore_evas_private.h" | ||
18 | #include "Ecore_Evas.h" | ||
19 | |||
20 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
21 | |||
22 | #define ECORE_EVAS_EVENT_COUNT 10 | ||
23 | |||
24 | static int _ecore_evas_init_count = 0; | ||
25 | |||
26 | static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT]; | ||
27 | |||
28 | static Eina_Bool _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
29 | |||
30 | static Eina_Bool _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
31 | |||
32 | static Eina_Bool _ecore_evas_win32_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
33 | |||
34 | static Eina_Bool _ecore_evas_win32_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
35 | |||
36 | static Eina_Bool _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
37 | |||
38 | static Eina_Bool _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
39 | |||
40 | static Eina_Bool _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
41 | |||
42 | static Eina_Bool _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
43 | |||
44 | static Eina_Bool _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
45 | |||
46 | static Eina_Bool _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
47 | |||
48 | /* Private functions */ | ||
49 | |||
50 | static int | ||
51 | _ecore_evas_win32_render(Ecore_Evas *ee) | ||
52 | { | ||
53 | int rend = 0; | ||
54 | Eina_List *updates = NULL; | ||
55 | Eina_List *ll; | ||
56 | Ecore_Evas *ee2; | ||
57 | |||
58 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
59 | { | ||
60 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
61 | if (ee2->engine.func->fn_render) | ||
62 | rend |= ee2->engine.func->fn_render(ee2); | ||
63 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
64 | } | ||
65 | |||
66 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
67 | if (ee->prop.avoid_damage) | ||
68 | { | ||
69 | updates = evas_render_updates(ee->evas); | ||
70 | if (updates) evas_render_updates_free(updates); | ||
71 | } | ||
72 | else if ((ee->visible) || | ||
73 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
74 | ((ee->should_be_visible) && (ee->prop.override))) | ||
75 | { | ||
76 | if (ee->shaped) | ||
77 | { | ||
78 | updates = evas_render_updates(ee->evas); | ||
79 | if (updates) evas_render_updates_free(updates); | ||
80 | } | ||
81 | else | ||
82 | { | ||
83 | updates = evas_render_updates(ee->evas); | ||
84 | if (updates) evas_render_updates_free(updates); | ||
85 | } | ||
86 | } | ||
87 | else | ||
88 | evas_norender(ee->evas); | ||
89 | if (updates) rend = 1; | ||
90 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
91 | return rend; | ||
92 | } | ||
93 | |||
94 | static int | ||
95 | _ecore_evas_win32_init(void) | ||
96 | { | ||
97 | _ecore_evas_init_count++; | ||
98 | if (_ecore_evas_init_count > 1) | ||
99 | return _ecore_evas_init_count; | ||
100 | |||
101 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_IN, _ecore_evas_win32_event_mouse_in, NULL); | ||
102 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_OUT, _ecore_evas_win32_event_mouse_out, NULL); | ||
103 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, _ecore_evas_win32_event_window_focus_in, NULL); | ||
104 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_win32_event_window_focus_out, NULL); | ||
105 | ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, _ecore_evas_win32_event_window_damage, NULL); | ||
106 | ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, _ecore_evas_win32_event_window_destroy, NULL); | ||
107 | ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_SHOW, _ecore_evas_win32_event_window_show, NULL); | ||
108 | ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_HIDE, _ecore_evas_win32_event_window_hide, NULL); | ||
109 | ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, _ecore_evas_win32_event_window_configure, NULL); | ||
110 | ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_win32_event_window_delete_request, NULL); | ||
111 | |||
112 | ecore_event_evas_init(); | ||
113 | return _ecore_evas_init_count; | ||
114 | } | ||
115 | |||
116 | int | ||
117 | _ecore_evas_win32_shutdown(void) | ||
118 | { | ||
119 | _ecore_evas_init_count--; | ||
120 | if (_ecore_evas_init_count == 0) | ||
121 | { | ||
122 | int i; | ||
123 | |||
124 | for (i = 0; i < ECORE_EVAS_EVENT_COUNT; i++) | ||
125 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
126 | ecore_event_evas_shutdown(); | ||
127 | } | ||
128 | |||
129 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
130 | |||
131 | return _ecore_evas_init_count; | ||
132 | } | ||
133 | |||
134 | static Eina_Bool | ||
135 | _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
136 | { | ||
137 | Ecore_Evas *ee; | ||
138 | Ecore_Win32_Event_Mouse_In *e; | ||
139 | |||
140 | INF("mouse in"); | ||
141 | |||
142 | e = event; | ||
143 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
144 | if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ | ||
145 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
146 | |||
147 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
148 | /* FIXME to do */ | ||
149 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ | ||
150 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | ||
151 | evas_focus_in(ee->evas); | ||
152 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
153 | |||
154 | return 1; | ||
155 | } | ||
156 | |||
157 | static Eina_Bool | ||
158 | _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
159 | { | ||
160 | Ecore_Evas *ee; | ||
161 | Ecore_Win32_Event_Mouse_Out *e; | ||
162 | |||
163 | INF("mouse out"); | ||
164 | |||
165 | e = event; | ||
166 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
167 | if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ | ||
168 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
169 | |||
170 | /* FIXME to do */ | ||
171 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ | ||
172 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
173 | |||
174 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
175 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
176 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
177 | |||
178 | return 1; | ||
179 | } | ||
180 | |||
181 | static Eina_Bool | ||
182 | _ecore_evas_win32_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
183 | { | ||
184 | Ecore_Evas *ee; | ||
185 | Ecore_Win32_Event_Window_Focus_In *e; | ||
186 | |||
187 | e = event; | ||
188 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
189 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
190 | if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
191 | |||
192 | ee->prop.focused = 1; | ||
193 | evas_focus_in(ee->evas); | ||
194 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
195 | return ECORE_CALLBACK_PASS_ON; | ||
196 | } | ||
197 | |||
198 | static Eina_Bool | ||
199 | _ecore_evas_win32_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
200 | { | ||
201 | Ecore_Evas *ee; | ||
202 | Ecore_Win32_Event_Window_Focus_Out *e; | ||
203 | |||
204 | e = event; | ||
205 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
206 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
207 | if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
208 | |||
209 | evas_focus_out(ee->evas); | ||
210 | ee->prop.focused = 0; | ||
211 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
212 | return ECORE_CALLBACK_PASS_ON; | ||
213 | } | ||
214 | |||
215 | static Eina_Bool | ||
216 | _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
217 | { | ||
218 | Ecore_Evas *ee; | ||
219 | Ecore_Win32_Event_Window_Damage *e; | ||
220 | |||
221 | INF("window damage"); | ||
222 | |||
223 | e = event; | ||
224 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
225 | if (!ee) return 1; /* pass on event */ | ||
226 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
227 | |||
228 | if (ee->prop.avoid_damage) | ||
229 | { | ||
230 | #ifdef _MSC_VER | ||
231 | # pragma message ("[ECORE] [WIN32] No Region code") | ||
232 | #else | ||
233 | # warning [ECORE] [WIN32] No Region code | ||
234 | #endif /* ! _MSC_VER */ | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | if (ee->rotation == 0) | ||
239 | evas_damage_rectangle_add(ee->evas, | ||
240 | e->x, | ||
241 | e->y, | ||
242 | e->width, | ||
243 | e->height); | ||
244 | else if (ee->rotation == 90) | ||
245 | evas_damage_rectangle_add(ee->evas, | ||
246 | ee->h - e->y - e->height, | ||
247 | e->x, | ||
248 | e->height, | ||
249 | e->width); | ||
250 | else if (ee->rotation == 180) | ||
251 | evas_damage_rectangle_add(ee->evas, | ||
252 | ee->w - e->x - e->width, | ||
253 | ee->h - e->y - e->height, | ||
254 | e->width, | ||
255 | e->height); | ||
256 | else if (ee->rotation == 270) | ||
257 | evas_damage_rectangle_add(ee->evas, | ||
258 | e->y, | ||
259 | ee->w - e->x - e->width, | ||
260 | e->height, | ||
261 | e->width); | ||
262 | } | ||
263 | |||
264 | return 1; | ||
265 | } | ||
266 | |||
267 | static Eina_Bool | ||
268 | _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
269 | { | ||
270 | Ecore_Evas *ee; | ||
271 | Ecore_Win32_Event_Window_Destroy *e; | ||
272 | |||
273 | INF("window destroy"); | ||
274 | |||
275 | e = event; | ||
276 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
277 | if (!ee) return 1; /* pass on event */ | ||
278 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
279 | if (ee->func.fn_destroy) ee->func.fn_destroy(ee); | ||
280 | ecore_evas_free(ee); | ||
281 | |||
282 | return 1; | ||
283 | } | ||
284 | |||
285 | static Eina_Bool | ||
286 | _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
287 | { | ||
288 | Ecore_Evas *ee; | ||
289 | Ecore_Win32_Event_Window_Show *e; | ||
290 | |||
291 | INF("window show"); | ||
292 | |||
293 | e = event; | ||
294 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
295 | if (!ee) return 1; /* pass on event */ | ||
296 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
297 | if (ee->visible) return 0; /* dont pass it on */ | ||
298 | ee->visible = 1; | ||
299 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
300 | |||
301 | return 1; | ||
302 | } | ||
303 | |||
304 | static Eina_Bool | ||
305 | _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
306 | { | ||
307 | Ecore_Evas *ee; | ||
308 | Ecore_Win32_Event_Window_Hide *e; | ||
309 | |||
310 | INF("window hide"); | ||
311 | |||
312 | e = event; | ||
313 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
314 | if (!ee) return 1; /* pass on event */ | ||
315 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
316 | if (!ee->visible) return 0; /* dont pass it on */ | ||
317 | ee->visible = 0; | ||
318 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
319 | |||
320 | return 1; | ||
321 | } | ||
322 | |||
323 | static Eina_Bool | ||
324 | _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
325 | { | ||
326 | Ecore_Evas *ee; | ||
327 | Ecore_Win32_Event_Window_Configure *e; | ||
328 | |||
329 | INF("window configure"); | ||
330 | |||
331 | e = event; | ||
332 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
333 | if (!ee) return 1; /* pass on event */ | ||
334 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
335 | |||
336 | if ((ee->x != e->x) || (ee->y != e->y)) | ||
337 | { | ||
338 | ee->x = e->x; | ||
339 | ee->y = e->y; | ||
340 | ee->req.x = ee->x; | ||
341 | ee->req.y = ee->y; | ||
342 | |||
343 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
344 | } | ||
345 | |||
346 | if ((ee->w != e->width) || (ee->h != e->height)) | ||
347 | { | ||
348 | ee->w = e->width; | ||
349 | ee->h = e->height; | ||
350 | ee->req.w = ee->w; | ||
351 | ee->req.h = ee->h; | ||
352 | |||
353 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
354 | { | ||
355 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
356 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
361 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
362 | } | ||
363 | if (ee->prop.avoid_damage) | ||
364 | { | ||
365 | int pdam; | ||
366 | |||
367 | pdam = ecore_evas_avoid_damage_get(ee); | ||
368 | ecore_evas_avoid_damage_set(ee, 0); | ||
369 | ecore_evas_avoid_damage_set(ee, pdam); | ||
370 | } | ||
371 | /* if (ee->shaped) */ | ||
372 | /* _ecore_evas_win32_region_border_resize(ee); */ | ||
373 | if ((ee->expecting_resize.w > 0) && | ||
374 | (ee->expecting_resize.h > 0)) | ||
375 | { | ||
376 | if ((ee->expecting_resize.w == ee->w) && | ||
377 | (ee->expecting_resize.h == ee->h)) | ||
378 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
379 | ecore_win32_current_time_get()); | ||
380 | ee->expecting_resize.w = 0; | ||
381 | ee->expecting_resize.h = 0; | ||
382 | } | ||
383 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
384 | } | ||
385 | |||
386 | return 1; | ||
387 | } | ||
388 | |||
389 | static Eina_Bool | ||
390 | _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
391 | { | ||
392 | Ecore_Evas *ee; | ||
393 | Ecore_Win32_Event_Window_Delete_Request *e; | ||
394 | |||
395 | INF("window delete request"); | ||
396 | |||
397 | e = event; | ||
398 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
399 | if (!ee) return 1; /* pass on event */ | ||
400 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
401 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
402 | |||
403 | INF(" * ee event delete\n"); | ||
404 | return 1; | ||
405 | } | ||
406 | |||
407 | |||
408 | /* Ecore_Evas interface */ | ||
409 | |||
410 | static void | ||
411 | _ecore_evas_win32_free(Ecore_Evas *ee) | ||
412 | { | ||
413 | INF("ecore evas free"); | ||
414 | |||
415 | ecore_win32_window_free((struct _Ecore_Win32_Window *)ee->prop.window); | ||
416 | ecore_event_window_unregister(ee->prop.window); | ||
417 | _ecore_evas_win32_shutdown(); | ||
418 | ecore_win32_shutdown(); | ||
419 | } | ||
420 | |||
421 | static void | ||
422 | _ecore_evas_win32_callback_delete_request_set(Ecore_Evas *ee, | ||
423 | void (*func) (Ecore_Evas *ee)) | ||
424 | { | ||
425 | ee->func.fn_delete_request = func; | ||
426 | } | ||
427 | |||
428 | static void | ||
429 | _ecore_evas_win32_move(Ecore_Evas *ee, int x, int y) | ||
430 | { | ||
431 | INF("ecore evas move (%dx%d)", x, y); | ||
432 | ee->req.x = x; | ||
433 | ee->req.y = y; | ||
434 | |||
435 | if ((x != ee->x) || (y != ee->y)) | ||
436 | { | ||
437 | ee->x = x; | ||
438 | ee->y = y; | ||
439 | ecore_win32_window_move((struct _Ecore_Win32_Window *)ee->prop.window, | ||
440 | x, y); | ||
441 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
442 | } | ||
443 | } | ||
444 | |||
445 | static void | ||
446 | _ecore_evas_win32_resize(Ecore_Evas *ee, int width, int height) | ||
447 | { | ||
448 | INF("ecore evas resize (%dx%d)", width, height); | ||
449 | ee->req.w = width; | ||
450 | ee->req.h = height; | ||
451 | |||
452 | if ((ee->w != width) || (ee->h != height)) | ||
453 | { | ||
454 | ee->w = width; | ||
455 | ee->h = height; | ||
456 | ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window, | ||
457 | width, height); | ||
458 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
459 | { | ||
460 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
461 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
462 | } | ||
463 | else | ||
464 | { | ||
465 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
466 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
467 | } | ||
468 | if (ee->prop.avoid_damage) | ||
469 | { | ||
470 | int pdam; | ||
471 | |||
472 | pdam = ecore_evas_avoid_damage_get(ee); | ||
473 | ecore_evas_avoid_damage_set(ee, 0); | ||
474 | ecore_evas_avoid_damage_set(ee, pdam); | ||
475 | } | ||
476 | /* if ((ee->shaped) || (ee->alpha)) */ | ||
477 | /* _ecore_evas_win32_region_border_resize(ee); */ | ||
478 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
479 | } | ||
480 | } | ||
481 | |||
482 | static void | ||
483 | _ecore_evas_win32_move_resize(Ecore_Evas *ee, int x, int y, int width, int height) | ||
484 | { | ||
485 | INF("ecore evas resize (%dx%d %dx%d)", x, y, width, height); | ||
486 | ee->req.x = x; | ||
487 | ee->req.y = y; | ||
488 | ee->req.w = width; | ||
489 | ee->req.h = height; | ||
490 | |||
491 | if ((ee->w != width) || (ee->h != height) || (x != ee->x) || (y != ee->y)) | ||
492 | { | ||
493 | int change_size = 0; | ||
494 | int change_pos = 0; | ||
495 | |||
496 | if ((ee->w != width) || (ee->h != height)) change_size = 1; | ||
497 | if ((x != ee->x) || (y != ee->y)) change_pos = 1; | ||
498 | |||
499 | ee->x = x; | ||
500 | ee->y = y; | ||
501 | ee->w = width; | ||
502 | ee->h = height; | ||
503 | ecore_win32_window_move_resize((struct _Ecore_Win32_Window *)ee->prop.window, | ||
504 | x, y, width, height); | ||
505 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
506 | { | ||
507 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
508 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
509 | } | ||
510 | else | ||
511 | { | ||
512 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
513 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
514 | } | ||
515 | if (ee->prop.avoid_damage) | ||
516 | { | ||
517 | int pdam; | ||
518 | |||
519 | pdam = ecore_evas_avoid_damage_get(ee); | ||
520 | ecore_evas_avoid_damage_set(ee, 0); | ||
521 | ecore_evas_avoid_damage_set(ee, pdam); | ||
522 | } | ||
523 | /* if ((ee->shaped) || (ee->alpha)) */ | ||
524 | /* _ecore_evas_win32_region_border_resize(ee); */ | ||
525 | if (change_pos) | ||
526 | { | ||
527 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
528 | } | ||
529 | if (change_size) | ||
530 | { | ||
531 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
532 | } | ||
533 | } | ||
534 | } | ||
535 | |||
536 | static void | ||
537 | _ecore_evas_win32_rotation_set_internal(Ecore_Evas *ee, int rotation) | ||
538 | { | ||
539 | int rot_dif; | ||
540 | |||
541 | rot_dif = ee->rotation - rotation; | ||
542 | if (rot_dif < 0) rot_dif = -rot_dif; | ||
543 | |||
544 | if (rot_dif != 180) | ||
545 | { | ||
546 | int minw, minh, maxw, maxh, basew, baseh, stepw, steph; | ||
547 | |||
548 | if (!ee->prop.fullscreen) | ||
549 | { | ||
550 | ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window, | ||
551 | ee->h, ee->w); | ||
552 | ee->expecting_resize.w = ee->h; | ||
553 | ee->expecting_resize.h = ee->w; | ||
554 | } | ||
555 | else | ||
556 | { | ||
557 | int w, h; | ||
558 | |||
559 | ecore_win32_window_size_get((struct _Ecore_Win32_Window *)ee->prop.window, | ||
560 | &w, &h); | ||
561 | ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window, | ||
562 | h, w); | ||
563 | if ((rotation == 0) || (rotation == 180)) | ||
564 | { | ||
565 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
566 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
567 | } | ||
568 | else | ||
569 | { | ||
570 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
571 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
572 | } | ||
573 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
574 | } | ||
575 | ecore_evas_size_min_get(ee, &minw, &minh); | ||
576 | ecore_evas_size_max_get(ee, &maxw, &maxh); | ||
577 | ecore_evas_size_base_get(ee, &basew, &baseh); | ||
578 | ecore_evas_size_step_get(ee, &stepw, &steph); | ||
579 | ee->rotation = rotation; | ||
580 | ecore_evas_size_min_set(ee, minh, minw); | ||
581 | ecore_evas_size_max_set(ee, maxh, maxw); | ||
582 | ecore_evas_size_base_set(ee, baseh, basew); | ||
583 | ecore_evas_size_step_set(ee, steph, stepw); | ||
584 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
585 | ecore_win32_current_time_get()); | ||
586 | } | ||
587 | else | ||
588 | { | ||
589 | ee->rotation = rotation; | ||
590 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
591 | ecore_win32_current_time_get()); | ||
592 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
593 | } | ||
594 | |||
595 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
596 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
597 | else | ||
598 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
599 | } | ||
600 | |||
601 | static void | ||
602 | _ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation, int resize) | ||
603 | { | ||
604 | INF("ecore evas rotation: %s", rotation ? "yes" : "no"); | ||
605 | |||
606 | if (ee->rotation == rotation) return; | ||
607 | |||
608 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
609 | if (!strcmp(ee->driver, "software_gdi")) | ||
610 | { | ||
611 | Evas_Engine_Info_Software_Gdi *einfo; | ||
612 | |||
613 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
614 | if (!einfo) return; | ||
615 | einfo->info.rotation = rotation; | ||
616 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
617 | { | ||
618 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
619 | } | ||
620 | _ecore_evas_win32_rotation_set_internal(ee, rotation); | ||
621 | } | ||
622 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
623 | |||
624 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
625 | if (!strcmp(ee->driver, "software_ddraw")) | ||
626 | { | ||
627 | Evas_Engine_Info_Software_DDraw *einfo; | ||
628 | |||
629 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas); | ||
630 | if (!einfo) return; | ||
631 | einfo->info.rotation = rotation; | ||
632 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
633 | { | ||
634 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
635 | } | ||
636 | _ecore_evas_win32_rotation_set_internal(ee, rotation); | ||
637 | } | ||
638 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
639 | } | ||
640 | |||
641 | static void | ||
642 | _ecore_evas_win32_shaped_set(Ecore_Evas *ee, int shaped) | ||
643 | { | ||
644 | if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped))) | ||
645 | return; | ||
646 | |||
647 | if (!strcmp(ee->driver, "software_ddraw")) return; | ||
648 | |||
649 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
650 | if (!strcmp(ee->driver, "software_gdi")) | ||
651 | { | ||
652 | Evas_Engine_Info_Software_Gdi *einfo; | ||
653 | |||
654 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
655 | ee->shaped = shaped; | ||
656 | if (einfo) | ||
657 | { | ||
658 | ee->engine.win32.state.region = ee->shaped; | ||
659 | einfo->info.region = ee->engine.win32.state.region; | ||
660 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
661 | { | ||
662 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
663 | } | ||
664 | if (ee->shaped) | ||
665 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
666 | } | ||
667 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
668 | } | ||
669 | } | ||
670 | |||
671 | static void | ||
672 | _ecore_evas_win32_show(Ecore_Evas *ee) | ||
673 | { | ||
674 | INF("ecore evas show"); | ||
675 | |||
676 | ee->should_be_visible = 1; | ||
677 | if (ee->prop.avoid_damage) | ||
678 | _ecore_evas_win32_render(ee); | ||
679 | ecore_win32_window_show((struct _Ecore_Win32_Window *)ee->prop.window); | ||
680 | /* if (ee->prop.fullscreen) */ | ||
681 | /* ecore_win32_window_focus(ee->prop.window); */ | ||
682 | } | ||
683 | |||
684 | static void | ||
685 | _ecore_evas_win32_hide(Ecore_Evas *ee) | ||
686 | { | ||
687 | INF("ecore evas hide"); | ||
688 | |||
689 | ecore_win32_window_hide((struct _Ecore_Win32_Window *)ee->prop.window); | ||
690 | ee->should_be_visible = 0; | ||
691 | } | ||
692 | |||
693 | static void | ||
694 | _ecore_evas_win32_raise(Ecore_Evas *ee) | ||
695 | { | ||
696 | INF("ecore evas raise"); | ||
697 | |||
698 | if (!ee->prop.fullscreen) | ||
699 | ecore_win32_window_raise((struct _Ecore_Win32_Window *)ee->prop.window); | ||
700 | else | ||
701 | ecore_win32_window_raise((struct _Ecore_Win32_Window *)ee->prop.window); | ||
702 | } | ||
703 | |||
704 | static void | ||
705 | _ecore_evas_win32_lower(Ecore_Evas *ee) | ||
706 | { | ||
707 | INF("ecore evas lower"); | ||
708 | |||
709 | if (!ee->prop.fullscreen) | ||
710 | ecore_win32_window_lower((struct _Ecore_Win32_Window *)ee->prop.window); | ||
711 | else | ||
712 | ecore_win32_window_lower((struct _Ecore_Win32_Window *)ee->prop.window); | ||
713 | } | ||
714 | |||
715 | static void | ||
716 | _ecore_evas_win32_activate(Ecore_Evas *ee) | ||
717 | { | ||
718 | INF("ecore evas activate"); | ||
719 | |||
720 | ecore_win32_window_focus_set((struct _Ecore_Win32_Window *)ee->prop.window); | ||
721 | } | ||
722 | |||
723 | static void | ||
724 | _ecore_evas_win32_title_set(Ecore_Evas *ee, const char *title) | ||
725 | { | ||
726 | INF("ecore evas title set"); | ||
727 | |||
728 | if (ee->prop.title) free(ee->prop.title); | ||
729 | ee->prop.title = NULL; | ||
730 | if (title) ee->prop.title = strdup(title); | ||
731 | ecore_win32_window_title_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
732 | ee->prop.title); | ||
733 | } | ||
734 | |||
735 | static void | ||
736 | _ecore_evas_win32_size_min_set(Ecore_Evas *ee, int width, int height) | ||
737 | { | ||
738 | if (width < 0) width = 0; | ||
739 | if (height < 0) height = 0; | ||
740 | if ((ee->prop.min.w == width) && (ee->prop.min.h == height)) return; | ||
741 | ee->prop.min.w = width; | ||
742 | ee->prop.min.h = height; | ||
743 | ecore_win32_window_size_min_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
744 | width, height); | ||
745 | } | ||
746 | |||
747 | static void | ||
748 | _ecore_evas_win32_size_max_set(Ecore_Evas *ee, int width, int height) | ||
749 | { | ||
750 | if (width < 0) width = 0; | ||
751 | if (height < 0) height = 0; | ||
752 | if ((ee->prop.max.w == width) && (ee->prop.max.h == height)) return; | ||
753 | ee->prop.max.w = width; | ||
754 | ee->prop.max.h = height; | ||
755 | ecore_win32_window_size_max_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
756 | width, height); | ||
757 | } | ||
758 | |||
759 | static void | ||
760 | _ecore_evas_win32_size_base_set(Ecore_Evas *ee, int width, int height) | ||
761 | { | ||
762 | if (width < 0) width = 0; | ||
763 | if (height < 0) height = 0; | ||
764 | if ((ee->prop.base.w == width) && (ee->prop.base.h == height)) return; | ||
765 | ee->prop.base.w = width; | ||
766 | ee->prop.base.h = height; | ||
767 | ecore_win32_window_size_base_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
768 | width, height); | ||
769 | } | ||
770 | |||
771 | static void | ||
772 | _ecore_evas_win32_size_step_set(Ecore_Evas *ee, int width, int height) | ||
773 | { | ||
774 | if (width < 1) width = 1; | ||
775 | if (height < 1) height = 1; | ||
776 | if ((ee->prop.step.w == width) && (ee->prop.step.h == height)) return; | ||
777 | ee->prop.step.w = width; | ||
778 | ee->prop.step.h = height; | ||
779 | ecore_win32_window_size_step_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
780 | width, height); | ||
781 | } | ||
782 | |||
783 | static void | ||
784 | _ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
785 | { | ||
786 | #if 0 | ||
787 | int x, y; | ||
788 | |||
789 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
790 | |||
791 | if (obj == NULL) | ||
792 | { | ||
793 | ee->prop.cursor.object = NULL; | ||
794 | ee->prop.cursor.layer = 0; | ||
795 | ee->prop.cursor.hot.x = 0; | ||
796 | ee->prop.cursor.hot.y = 0; | ||
797 | ecore_win32_window_cursor_show(ee->prop.window, 1); | ||
798 | return; | ||
799 | } | ||
800 | |||
801 | ee->prop.cursor.object = obj; | ||
802 | ee->prop.cursor.layer = layer; | ||
803 | ee->prop.cursor.hot.x = hot_x; | ||
804 | ee->prop.cursor.hot.y = hot_y; | ||
805 | |||
806 | ecore_win32_window_cursor_show(ee->prop.window, 0); | ||
807 | |||
808 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
809 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
810 | evas_object_move(ee->prop.cursor.object, | ||
811 | x - ee->prop.cursor.hot.x, | ||
812 | y - ee->prop.cursor.hot.y); | ||
813 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
814 | if (evas_pointer_inside_get(ee->evas)) | ||
815 | evas_object_show(ee->prop.cursor.object); | ||
816 | #endif | ||
817 | } | ||
818 | |||
819 | static void | ||
820 | _ecore_evas_win32_focus_set(Ecore_Evas *ee, int on __UNUSED__) | ||
821 | { | ||
822 | ecore_win32_window_focus_set((struct _Ecore_Win32_Window *)ee->prop.window); | ||
823 | } | ||
824 | |||
825 | static void | ||
826 | _ecore_evas_win32_iconified_set(Ecore_Evas *ee, int on) | ||
827 | { | ||
828 | /* if (((ee->prop.borderless) && (on)) || */ | ||
829 | /* ((!ee->prop.borderless) && (!on))) return; */ | ||
830 | ee->prop.iconified = on; | ||
831 | ecore_win32_window_iconified_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
832 | ee->prop.iconified); | ||
833 | } | ||
834 | |||
835 | static void | ||
836 | _ecore_evas_win32_borderless_set(Ecore_Evas *ee, int on) | ||
837 | { | ||
838 | if (((ee->prop.borderless) && (on)) || | ||
839 | ((!ee->prop.borderless) && (!on))) return; | ||
840 | ee->prop.borderless = on; | ||
841 | ecore_win32_window_borderless_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
842 | ee->prop.borderless); | ||
843 | |||
844 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
845 | if (!strcmp(ee->driver, "software_gdi")) | ||
846 | { | ||
847 | Evas_Engine_Info_Software_Gdi *einfo; | ||
848 | |||
849 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
850 | if (einfo) | ||
851 | { | ||
852 | einfo->info.borderless = ee->prop.borderless; | ||
853 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
854 | { | ||
855 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
856 | } | ||
857 | if (ee->prop.borderless) | ||
858 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
859 | } | ||
860 | } | ||
861 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
862 | } | ||
863 | |||
864 | static void | ||
865 | _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) | ||
866 | { | ||
867 | struct _Ecore_Win32_Window *window; | ||
868 | |||
869 | INF("ecore evas fullscreen set"); | ||
870 | |||
871 | if ((ee->engine.win32.state.fullscreen && on) || | ||
872 | (!ee->engine.win32.state.fullscreen && !on)) | ||
873 | return; | ||
874 | |||
875 | ee->engine.win32.state.fullscreen = on; | ||
876 | ee->prop.fullscreen = on; | ||
877 | |||
878 | window = (struct _Ecore_Win32_Window *)ee->prop.window; | ||
879 | |||
880 | if (on != 0) | ||
881 | { | ||
882 | ecore_win32_window_shape_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
883 | 0, 0, NULL); | ||
884 | ecore_win32_window_fullscreen_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
885 | on); | ||
886 | } | ||
887 | else | ||
888 | { | ||
889 | ecore_win32_window_fullscreen_set(window, on); | ||
890 | ecore_win32_window_shape_set(window, | ||
891 | window->shape.width, | ||
892 | window->shape.height, | ||
893 | window->shape.mask); | ||
894 | } | ||
895 | |||
896 | /* Nothing to be done for the GDI backend at the evas level */ | ||
897 | |||
898 | #ifdef BUILD_ECORE_EVAS_SOFTWRE_DDRAW | ||
899 | if (strcmp(ee->driver, "software_ddraw") == 0) | ||
900 | { | ||
901 | Evas_Engine_Info_Software_DDraw *einfo; | ||
902 | |||
903 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee)); | ||
904 | if (einfo) | ||
905 | { | ||
906 | einfo->info.fullscreen = !!on; | ||
907 | /* einfo->info.layered = window->shape.layered; */ | ||
908 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
909 | { | ||
910 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
911 | } | ||
912 | } | ||
913 | } | ||
914 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
915 | |||
916 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
917 | if (strcmp(ee->driver, "direct3d") == 0) | ||
918 | { | ||
919 | Evas_Engine_Info_Direct3D *einfo; | ||
920 | |||
921 | einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ecore_evas_get(ee)); | ||
922 | if (einfo) | ||
923 | { | ||
924 | einfo->info.fullscreen = !!on; | ||
925 | einfo->info.layered = window->shape.layered; | ||
926 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
927 | { | ||
928 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
929 | } | ||
930 | } | ||
931 | } | ||
932 | #endif /* BUILD_ECORE_EVAS_DIRECT3D */ | ||
933 | } | ||
934 | |||
935 | |||
936 | static Ecore_Evas_Engine_Func _ecore_win32_engine_func = | ||
937 | { | ||
938 | _ecore_evas_win32_free, | ||
939 | NULL, | ||
940 | NULL, | ||
941 | NULL, | ||
942 | NULL, | ||
943 | _ecore_evas_win32_callback_delete_request_set, | ||
944 | NULL, | ||
945 | NULL, | ||
946 | NULL, | ||
947 | NULL, | ||
948 | NULL, | ||
949 | NULL, | ||
950 | NULL, | ||
951 | NULL, | ||
952 | NULL, | ||
953 | _ecore_evas_win32_move, | ||
954 | NULL, | ||
955 | _ecore_evas_win32_resize, | ||
956 | _ecore_evas_win32_move_resize, | ||
957 | _ecore_evas_win32_rotation_set, | ||
958 | _ecore_evas_win32_shaped_set, | ||
959 | _ecore_evas_win32_show, | ||
960 | _ecore_evas_win32_hide, | ||
961 | _ecore_evas_win32_raise, | ||
962 | _ecore_evas_win32_lower, | ||
963 | _ecore_evas_win32_activate, | ||
964 | _ecore_evas_win32_title_set, | ||
965 | NULL, /* _ecore_evas_x_name_class_set */ | ||
966 | _ecore_evas_win32_size_min_set, | ||
967 | _ecore_evas_win32_size_max_set, | ||
968 | _ecore_evas_win32_size_base_set, | ||
969 | _ecore_evas_win32_size_step_set, | ||
970 | _ecore_evas_win32_cursor_set, | ||
971 | NULL, /* _ecore_evas_x_layer_set */ | ||
972 | _ecore_evas_win32_focus_set, | ||
973 | _ecore_evas_win32_iconified_set, | ||
974 | _ecore_evas_win32_borderless_set, | ||
975 | NULL, /* _ecore_evas_x_override_set */ | ||
976 | NULL, | ||
977 | _ecore_evas_win32_fullscreen_set, | ||
978 | NULL, /* _ecore_evas_x_avoid_damage_set */ | ||
979 | NULL, /* _ecore_evas_x_withdrawn_set */ | ||
980 | NULL, /* _ecore_evas_x_sticky_set */ | ||
981 | NULL, /* _ecore_evas_x_ignore_events_set */ | ||
982 | NULL, /* _ecore_evas_x_alpha_set */ | ||
983 | NULL, //transparent | ||
984 | |||
985 | NULL, // render | ||
986 | NULL //screen_geometry_get | ||
987 | }; | ||
988 | |||
989 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
990 | |||
991 | /* API */ | ||
992 | |||
993 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
994 | static int | ||
995 | _ecore_evas_engine_software_gdi_init(Ecore_Evas *ee) | ||
996 | { | ||
997 | Evas_Engine_Info_Software_Gdi *einfo; | ||
998 | const char *driver; | ||
999 | int rmethod; | ||
1000 | |||
1001 | driver = "software_gdi"; | ||
1002 | |||
1003 | rmethod = evas_render_method_lookup(driver); | ||
1004 | if (!rmethod) | ||
1005 | return 0; | ||
1006 | |||
1007 | ee->driver = driver; | ||
1008 | evas_output_method_set(ee->evas, rmethod); | ||
1009 | |||
1010 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
1011 | if (einfo) | ||
1012 | { | ||
1013 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1014 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1015 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1016 | einfo->info.rotation = 0; | ||
1017 | einfo->info.borderless = 0; | ||
1018 | einfo->info.fullscreen = 0; | ||
1019 | einfo->info.region = 0; | ||
1020 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1021 | { | ||
1022 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1023 | return 0; | ||
1024 | } | ||
1025 | } | ||
1026 | else | ||
1027 | { | ||
1028 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1029 | return 0; | ||
1030 | } | ||
1031 | |||
1032 | return 1; | ||
1033 | } | ||
1034 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
1035 | |||
1036 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
1037 | static int | ||
1038 | _ecore_evas_engine_software_ddraw_init(Ecore_Evas *ee) | ||
1039 | { | ||
1040 | Evas_Engine_Info_Software_DDraw *einfo; | ||
1041 | const char *driver; | ||
1042 | int rmethod; | ||
1043 | |||
1044 | driver = "software_ddraw"; | ||
1045 | |||
1046 | rmethod = evas_render_method_lookup(driver); | ||
1047 | if (!rmethod) | ||
1048 | return 0; | ||
1049 | |||
1050 | ee->driver = driver; | ||
1051 | evas_output_method_set(ee->evas, rmethod); | ||
1052 | |||
1053 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas); | ||
1054 | if (einfo) | ||
1055 | { | ||
1056 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1057 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1058 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1059 | einfo->info.rotation = 0; | ||
1060 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1061 | { | ||
1062 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1063 | return 0; | ||
1064 | } | ||
1065 | } | ||
1066 | else | ||
1067 | { | ||
1068 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1069 | return 0; | ||
1070 | } | ||
1071 | |||
1072 | return 1; | ||
1073 | } | ||
1074 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
1075 | |||
1076 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
1077 | static int | ||
1078 | _ecore_evas_engine_direct3d_init(Ecore_Evas *ee) | ||
1079 | { | ||
1080 | Evas_Engine_Info_Direct3D *einfo; | ||
1081 | const char *driver; | ||
1082 | int rmethod; | ||
1083 | |||
1084 | driver = "direct3d"; | ||
1085 | |||
1086 | rmethod = evas_render_method_lookup(driver); | ||
1087 | if (!rmethod) | ||
1088 | return 0; | ||
1089 | |||
1090 | ee->driver = driver; | ||
1091 | evas_output_method_set(ee->evas, rmethod); | ||
1092 | |||
1093 | einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ee->evas); | ||
1094 | if (einfo) | ||
1095 | { | ||
1096 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1097 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1098 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1099 | einfo->info.rotation = 0; | ||
1100 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1101 | { | ||
1102 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1103 | return 0; | ||
1104 | } | ||
1105 | } | ||
1106 | else | ||
1107 | { | ||
1108 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1109 | return 0; | ||
1110 | } | ||
1111 | |||
1112 | return 1; | ||
1113 | } | ||
1114 | #endif /* BUILD_ECORE_EVAS_DIRECT3D */ | ||
1115 | |||
1116 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
1117 | static int | ||
1118 | _ecore_evas_engine_opengl_glew_init(Ecore_Evas *ee) | ||
1119 | { | ||
1120 | Evas_Engine_Info_GL_Glew *einfo; | ||
1121 | const char *driver; | ||
1122 | int rmethod; | ||
1123 | |||
1124 | driver = "gl_glew"; | ||
1125 | |||
1126 | rmethod = evas_render_method_lookup(driver); | ||
1127 | if (!rmethod) | ||
1128 | return 0; | ||
1129 | |||
1130 | ee->driver = driver; | ||
1131 | evas_output_method_set(ee->evas, rmethod); | ||
1132 | |||
1133 | einfo = (Evas_Engine_Info_GL_Glew *)evas_engine_info_get(ee->evas); | ||
1134 | if (einfo) | ||
1135 | { | ||
1136 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1137 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1138 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1139 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1140 | { | ||
1141 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1142 | return 0; | ||
1143 | } | ||
1144 | } | ||
1145 | else | ||
1146 | { | ||
1147 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1148 | return 0; | ||
1149 | } | ||
1150 | |||
1151 | return 1; | ||
1152 | } | ||
1153 | #endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ | ||
1154 | |||
1155 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
1156 | static int | ||
1157 | _ecore_evas_engine_software_16_ddraw_init(Ecore_Evas *ee) | ||
1158 | { | ||
1159 | Evas_Engine_Info_Software_DDraw *einfo; | ||
1160 | const char *driver; | ||
1161 | int rmethod; | ||
1162 | |||
1163 | driver = "software_16_ddraw"; | ||
1164 | |||
1165 | rmethod = evas_render_method_lookup(driver); | ||
1166 | if (!rmethod) | ||
1167 | return 0; | ||
1168 | |||
1169 | ee->driver = driver; | ||
1170 | evas_output_method_set(ee->evas, rmethod); | ||
1171 | |||
1172 | if (ecore_win32_screen_depth_get() != 16) | ||
1173 | return 0; | ||
1174 | |||
1175 | einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(ee->evas); | ||
1176 | if (einfo) | ||
1177 | { | ||
1178 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1179 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1180 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1181 | einfo->info.rotation = 0; | ||
1182 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1183 | { | ||
1184 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1185 | return 0; | ||
1186 | } | ||
1187 | } | ||
1188 | else | ||
1189 | { | ||
1190 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1191 | return 0; | ||
1192 | } | ||
1193 | |||
1194 | return 1; | ||
1195 | } | ||
1196 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ | ||
1197 | |||
1198 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
1199 | static Ecore_Evas * | ||
1200 | _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee), | ||
1201 | Ecore_Win32_Window *parent, | ||
1202 | int x, | ||
1203 | int y, | ||
1204 | int width, | ||
1205 | int height) | ||
1206 | { | ||
1207 | Ecore_Evas *ee; | ||
1208 | |||
1209 | if (!ecore_win32_init()) | ||
1210 | return NULL; | ||
1211 | |||
1212 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
1213 | if (!ee) | ||
1214 | return NULL; | ||
1215 | |||
1216 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
1217 | |||
1218 | _ecore_evas_win32_init(); | ||
1219 | |||
1220 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_win32_engine_func; | ||
1221 | |||
1222 | if (width < 1) width = 1; | ||
1223 | if (height < 1) height = 1; | ||
1224 | ee->x = x; | ||
1225 | ee->y = y; | ||
1226 | ee->w = width; | ||
1227 | ee->h = height; | ||
1228 | ee->req.x = ee->x; | ||
1229 | ee->req.y = ee->y; | ||
1230 | ee->req.w = ee->w; | ||
1231 | ee->req.h = ee->h; | ||
1232 | |||
1233 | ee->prop.max.w = 32767; | ||
1234 | ee->prop.max.h = 32767; | ||
1235 | ee->prop.layer = 4; | ||
1236 | ee->prop.request_pos = 0; | ||
1237 | ee->prop.sticky = 0; | ||
1238 | /* FIXME: sticky to add */ | ||
1239 | ee->prop.window = 0; | ||
1240 | |||
1241 | /* init evas here */ | ||
1242 | ee->evas = evas_new(); | ||
1243 | evas_data_attach_set(ee->evas, ee); | ||
1244 | evas_output_size_set(ee->evas, width, height); | ||
1245 | evas_output_viewport_set(ee->evas, 0, 0, width, height); | ||
1246 | |||
1247 | ee->engine.win32.parent = parent; | ||
1248 | ee->prop.window = (Ecore_Window)ecore_win32_window_new(parent, x, y, width, height); | ||
1249 | if (!ee->prop.window) | ||
1250 | { | ||
1251 | _ecore_evas_win32_shutdown(); | ||
1252 | free(ee); | ||
1253 | return NULL; | ||
1254 | } | ||
1255 | |||
1256 | if (!_ecore_evas_engine_init(ee)) | ||
1257 | { | ||
1258 | _ecore_evas_win32_shutdown(); | ||
1259 | free(ee); | ||
1260 | return NULL; | ||
1261 | } | ||
1262 | |||
1263 | ee->engine.func->fn_render = _ecore_evas_win32_render; | ||
1264 | _ecore_evas_register(ee); | ||
1265 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
1266 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
1267 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
1268 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
1269 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
1270 | |||
1271 | return ee; | ||
1272 | } | ||
1273 | |||
1274 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
1275 | |||
1276 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
1277 | |||
1278 | EAPI Ecore_Evas * | ||
1279 | ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, | ||
1280 | int x, | ||
1281 | int y, | ||
1282 | int width, | ||
1283 | int height) | ||
1284 | { | ||
1285 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_gdi_init, | ||
1286 | parent, | ||
1287 | x, | ||
1288 | y, | ||
1289 | width, | ||
1290 | height); | ||
1291 | } | ||
1292 | |||
1293 | #else | ||
1294 | |||
1295 | EAPI Ecore_Evas * | ||
1296 | ecore_evas_software_gdi_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1297 | int x __UNUSED__, | ||
1298 | int y __UNUSED__, | ||
1299 | int width __UNUSED__, | ||
1300 | int height __UNUSED__) | ||
1301 | { | ||
1302 | return NULL; | ||
1303 | } | ||
1304 | |||
1305 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
1306 | |||
1307 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
1308 | |||
1309 | EAPI Ecore_Evas * | ||
1310 | ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, | ||
1311 | int x, | ||
1312 | int y, | ||
1313 | int width, | ||
1314 | int height) | ||
1315 | { | ||
1316 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_ddraw_init, | ||
1317 | parent, | ||
1318 | x, | ||
1319 | y, | ||
1320 | width, | ||
1321 | height); | ||
1322 | } | ||
1323 | |||
1324 | #else | ||
1325 | |||
1326 | EAPI Ecore_Evas * | ||
1327 | ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1328 | int x __UNUSED__, | ||
1329 | int y __UNUSED__, | ||
1330 | int width __UNUSED__, | ||
1331 | int height __UNUSED__) | ||
1332 | { | ||
1333 | return NULL; | ||
1334 | } | ||
1335 | |||
1336 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
1337 | |||
1338 | |||
1339 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
1340 | |||
1341 | EAPI Ecore_Evas * | ||
1342 | ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent, | ||
1343 | int x, | ||
1344 | int y, | ||
1345 | int width, | ||
1346 | int height) | ||
1347 | { | ||
1348 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_16_ddraw_init, | ||
1349 | parent, | ||
1350 | x, | ||
1351 | y, | ||
1352 | width, | ||
1353 | height); | ||
1354 | } | ||
1355 | |||
1356 | #else | ||
1357 | |||
1358 | EAPI Ecore_Evas * | ||
1359 | ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1360 | int x __UNUSED__, | ||
1361 | int y __UNUSED__, | ||
1362 | int width __UNUSED__, | ||
1363 | int height __UNUSED__) | ||
1364 | { | ||
1365 | return NULL; | ||
1366 | } | ||
1367 | |||
1368 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ | ||
1369 | |||
1370 | |||
1371 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
1372 | |||
1373 | EAPI Ecore_Evas * | ||
1374 | ecore_evas_direct3d_new(Ecore_Win32_Window *parent, | ||
1375 | int x, | ||
1376 | int y, | ||
1377 | int width, | ||
1378 | int height) | ||
1379 | { | ||
1380 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_direct3d_init, | ||
1381 | parent, | ||
1382 | x, | ||
1383 | y, | ||
1384 | width, | ||
1385 | height); | ||
1386 | } | ||
1387 | |||
1388 | #else | ||
1389 | |||
1390 | EAPI Ecore_Evas * | ||
1391 | ecore_evas_direct3d_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1392 | int x __UNUSED__, | ||
1393 | int y __UNUSED__, | ||
1394 | int width __UNUSED__, | ||
1395 | int height __UNUSED__) | ||
1396 | { | ||
1397 | return NULL; | ||
1398 | } | ||
1399 | |||
1400 | #endif /* ! BUILD_ECORE_EVAS_DIRECT3D */ | ||
1401 | |||
1402 | |||
1403 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
1404 | |||
1405 | EAPI Ecore_Evas * | ||
1406 | ecore_evas_gl_glew_new(Ecore_Win32_Window *parent, | ||
1407 | int x, | ||
1408 | int y, | ||
1409 | int width, | ||
1410 | int height) | ||
1411 | { | ||
1412 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_opengl_glew_init, | ||
1413 | parent, | ||
1414 | x, | ||
1415 | y, | ||
1416 | width, | ||
1417 | height); | ||
1418 | } | ||
1419 | |||
1420 | #else | ||
1421 | |||
1422 | EAPI Ecore_Evas * | ||
1423 | ecore_evas_gl_glew_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1424 | int x __UNUSED__, | ||
1425 | int y __UNUSED__, | ||
1426 | int width __UNUSED__, | ||
1427 | int height __UNUSED__) | ||
1428 | { | ||
1429 | return NULL; | ||
1430 | } | ||
1431 | |||
1432 | #endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ | ||
1433 | |||
1434 | |||
1435 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
1436 | |||
1437 | EAPI Ecore_Win32_Window * | ||
1438 | ecore_evas_win32_window_get(const Ecore_Evas *ee) | ||
1439 | { | ||
1440 | return (Ecore_Win32_Window *) ecore_evas_window_get(ee); | ||
1441 | } | ||
1442 | |||
1443 | #else | ||
1444 | |||
1445 | EAPI Ecore_Win32_Window * | ||
1446 | ecore_evas_win32_window_get(const Ecore_Evas *ee __UNUSED__) | ||
1447 | { | ||
1448 | return NULL; | ||
1449 | } | ||
1450 | |||
1451 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c new file mode 100644 index 0000000..e102cb7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c | |||
@@ -0,0 +1,985 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> /* for NULL */ | ||
6 | |||
7 | #include <Ecore.h> | ||
8 | #include "ecore_private.h" | ||
9 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
10 | # define WIN32_LEAN_AND_MEAN | ||
11 | # include <windows.h> | ||
12 | # undef WIN32_LEAN_AND_MEAN | ||
13 | # include <Ecore_WinCE.h> | ||
14 | # include <ecore_wince_private.h> | ||
15 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */ | ||
16 | |||
17 | #include "ecore_evas_private.h" | ||
18 | #include "Ecore_Evas.h" | ||
19 | |||
20 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
21 | |||
22 | #define ECORE_EVAS_EVENT_COUNT 9 | ||
23 | |||
24 | static int _ecore_evas_init_count = 0; | ||
25 | |||
26 | static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT]; | ||
27 | |||
28 | static Eina_Bool _ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
29 | |||
30 | static Eina_Bool _ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
31 | |||
32 | static Eina_Bool _ecore_evas_wince_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
33 | |||
34 | static Eina_Bool _ecore_evas_wince_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
35 | |||
36 | static Eina_Bool _ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
37 | |||
38 | static Eina_Bool _ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
39 | |||
40 | static Eina_Bool _ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
41 | |||
42 | static Eina_Bool _ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
43 | |||
44 | static Eina_Bool _ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
45 | |||
46 | /* Private functions */ | ||
47 | |||
48 | static int | ||
49 | _ecore_evas_wince_render(Ecore_Evas *ee) | ||
50 | { | ||
51 | int rend = 0; | ||
52 | Eina_List *updates = NULL; | ||
53 | Eina_List *ll; | ||
54 | Ecore_Evas *ee2; | ||
55 | |||
56 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
57 | { | ||
58 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
59 | if (ee2->engine.func->fn_render) | ||
60 | rend |= ee2->engine.func->fn_render(ee2); | ||
61 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
62 | } | ||
63 | |||
64 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
65 | if (ee->prop.avoid_damage) | ||
66 | { | ||
67 | updates = evas_render_updates(ee->evas); | ||
68 | if (updates) evas_render_updates_free(updates); | ||
69 | } | ||
70 | else if ((ee->visible) || | ||
71 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
72 | ((ee->should_be_visible) && (ee->prop.override))) | ||
73 | { | ||
74 | if (ee->shaped) | ||
75 | { | ||
76 | updates = evas_render_updates(ee->evas); | ||
77 | if (updates) evas_render_updates_free(updates); | ||
78 | } | ||
79 | else | ||
80 | { | ||
81 | updates = evas_render_updates(ee->evas); | ||
82 | if (updates) evas_render_updates_free(updates); | ||
83 | } | ||
84 | } | ||
85 | else | ||
86 | evas_norender(ee->evas); | ||
87 | if (updates) rend = 1; | ||
88 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
89 | return rend; | ||
90 | } | ||
91 | |||
92 | static int | ||
93 | _ecore_evas_wince_init(void) | ||
94 | { | ||
95 | _ecore_evas_init_count++; | ||
96 | if (_ecore_evas_init_count > 1) | ||
97 | return _ecore_evas_init_count; | ||
98 | |||
99 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_IN, _ecore_evas_wince_event_mouse_in, NULL); | ||
100 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_OUT, _ecore_evas_wince_event_mouse_out, NULL); | ||
101 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_IN, _ecore_evas_wince_event_window_focus_in, NULL); | ||
102 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_wince_event_window_focus_out, NULL); | ||
103 | ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DAMAGE, _ecore_evas_wince_event_window_damage, NULL); | ||
104 | ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DESTROY, _ecore_evas_wince_event_window_destroy, NULL); | ||
105 | ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_SHOW, _ecore_evas_wince_event_window_show, NULL); | ||
106 | ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_HIDE, _ecore_evas_wince_event_window_hide, NULL); | ||
107 | ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_wince_event_window_delete_request, NULL); | ||
108 | |||
109 | ecore_event_evas_init(); | ||
110 | return _ecore_evas_init_count; | ||
111 | } | ||
112 | |||
113 | int | ||
114 | _ecore_evas_wince_shutdown(void) | ||
115 | { | ||
116 | _ecore_evas_init_count--; | ||
117 | if (_ecore_evas_init_count == 0) | ||
118 | { | ||
119 | int i; | ||
120 | |||
121 | for (i = 0; i < ECORE_EVAS_EVENT_COUNT; i++) | ||
122 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
123 | ecore_event_evas_shutdown(); | ||
124 | } | ||
125 | |||
126 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
127 | |||
128 | return _ecore_evas_init_count; | ||
129 | } | ||
130 | |||
131 | static Eina_Bool | ||
132 | _ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
133 | { | ||
134 | Ecore_Evas *ee; | ||
135 | Ecore_WinCE_Event_Mouse_In *e; | ||
136 | |||
137 | INF("mouse in"); | ||
138 | |||
139 | e = event; | ||
140 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
141 | if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ | ||
142 | if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; | ||
143 | |||
144 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
145 | /* FIXME to do */ | ||
146 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ | ||
147 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | ||
148 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
149 | |||
150 | return 1; | ||
151 | } | ||
152 | |||
153 | static Eina_Bool | ||
154 | _ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
155 | { | ||
156 | Ecore_Evas *ee; | ||
157 | Ecore_WinCE_Event_Mouse_Out *e; | ||
158 | |||
159 | INF("mouse out"); | ||
160 | |||
161 | e = event; | ||
162 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
163 | if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ | ||
164 | if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; | ||
165 | |||
166 | /* FIXME to do */ | ||
167 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ | ||
168 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
169 | |||
170 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
171 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
172 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
173 | |||
174 | return 1; | ||
175 | } | ||
176 | |||
177 | static Eina_Bool | ||
178 | _ecore_evas_wince_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
179 | { | ||
180 | Ecore_Evas *ee; | ||
181 | Ecore_WinCE_Event_Window_Focus_In *e; | ||
182 | |||
183 | e = event; | ||
184 | ee = ecore_event_window_match(e->window); | ||
185 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
186 | if (e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
187 | |||
188 | ee->prop.focused = 1; | ||
189 | evas_focus_in(ee->evas); | ||
190 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
191 | return ECORE_CALLBACK_PASS_ON; | ||
192 | } | ||
193 | |||
194 | static Eina_Bool | ||
195 | _ecore_evas_wince_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
196 | { | ||
197 | Ecore_Evas *ee; | ||
198 | Ecore_WinCE_Event_Window_Focus_Out *e; | ||
199 | |||
200 | e = event; | ||
201 | ee = ecore_event_window_match(e->window); | ||
202 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
203 | if (e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
204 | |||
205 | evas_focus_out(ee->evas); | ||
206 | ee->prop.focused = 0; | ||
207 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
208 | return ECORE_CALLBACK_PASS_ON; | ||
209 | } | ||
210 | |||
211 | static Eina_Bool | ||
212 | _ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
213 | { | ||
214 | Ecore_Evas *ee; | ||
215 | Ecore_WinCE_Event_Window_Damage *e; | ||
216 | |||
217 | INF("window damage"); | ||
218 | |||
219 | e = event; | ||
220 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
221 | if (!ee) return 1; /* pass on event */ | ||
222 | if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; | ||
223 | |||
224 | if (ee->prop.avoid_damage) | ||
225 | { | ||
226 | #warning [ECORE] [WINCE] No Region code | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | if (ee->rotation == 0) | ||
231 | evas_damage_rectangle_add(ee->evas, | ||
232 | e->x, | ||
233 | e->y, | ||
234 | e->width, | ||
235 | e->height); | ||
236 | else if (ee->rotation == 90) | ||
237 | evas_damage_rectangle_add(ee->evas, | ||
238 | ee->h - e->y - e->height, | ||
239 | e->x, | ||
240 | e->height, | ||
241 | e->width); | ||
242 | else if (ee->rotation == 180) | ||
243 | evas_damage_rectangle_add(ee->evas, | ||
244 | ee->w - e->x - e->width, | ||
245 | ee->h - e->y - e->height, | ||
246 | e->width, | ||
247 | e->height); | ||
248 | else if (ee->rotation == 270) | ||
249 | evas_damage_rectangle_add(ee->evas, | ||
250 | e->y, | ||
251 | ee->w - e->x - e->width, | ||
252 | e->height, | ||
253 | e->width); | ||
254 | } | ||
255 | |||
256 | return 1; | ||
257 | } | ||
258 | |||
259 | static Eina_Bool | ||
260 | _ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
261 | { | ||
262 | Ecore_Evas *ee; | ||
263 | Ecore_WinCE_Event_Window_Destroy *e; | ||
264 | |||
265 | INF("window destroy"); | ||
266 | |||
267 | e = event; | ||
268 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
269 | if (!ee) return 1; /* pass on event */ | ||
270 | if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; | ||
271 | if (ee->func.fn_destroy) ee->func.fn_destroy(ee); | ||
272 | ecore_evas_free(ee); | ||
273 | |||
274 | return 1; | ||
275 | } | ||
276 | |||
277 | static Eina_Bool | ||
278 | _ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
279 | { | ||
280 | Ecore_Evas *ee; | ||
281 | Ecore_WinCE_Event_Window_Show *e; | ||
282 | |||
283 | INF("window show"); | ||
284 | |||
285 | e = event; | ||
286 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
287 | if (!ee) return 1; /* pass on event */ | ||
288 | if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; | ||
289 | if (ee->visible) return 0; /* dont pass it on */ | ||
290 | ee->visible = 1; | ||
291 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
292 | |||
293 | return 1; | ||
294 | } | ||
295 | |||
296 | static Eina_Bool | ||
297 | _ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
298 | { | ||
299 | Ecore_Evas *ee; | ||
300 | Ecore_WinCE_Event_Window_Hide *e; | ||
301 | |||
302 | INF("window hide"); | ||
303 | |||
304 | e = event; | ||
305 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
306 | if (!ee) return 1; /* pass on event */ | ||
307 | if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; | ||
308 | if (!ee->visible) return 0; /* dont pass it on */ | ||
309 | ee->visible = 0; | ||
310 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
311 | |||
312 | return 1; | ||
313 | } | ||
314 | |||
315 | static Eina_Bool | ||
316 | _ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
317 | { | ||
318 | Ecore_Evas *ee; | ||
319 | Ecore_WinCE_Event_Window_Delete_Request *e; | ||
320 | |||
321 | INF("window delete request"); | ||
322 | |||
323 | e = event; | ||
324 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
325 | if (!ee) return 1; /* pass on event */ | ||
326 | if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; | ||
327 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
328 | |||
329 | return 1; | ||
330 | } | ||
331 | |||
332 | |||
333 | /* Ecore_Evas interface */ | ||
334 | |||
335 | static void | ||
336 | _ecore_evas_wince_free(Ecore_Evas *ee) | ||
337 | { | ||
338 | INF("ecore evas free"); | ||
339 | |||
340 | ecore_wince_window_free((Ecore_WinCE_Window *)ee->prop.window); | ||
341 | ecore_event_window_unregister(ee->prop.window); | ||
342 | _ecore_evas_wince_shutdown(); | ||
343 | ecore_wince_shutdown(); | ||
344 | } | ||
345 | |||
346 | static void | ||
347 | _ecore_evas_wince_callback_delete_request_set(Ecore_Evas *ee, | ||
348 | void (*func) (Ecore_Evas *ee)) | ||
349 | { | ||
350 | ee->func.fn_delete_request = func; | ||
351 | } | ||
352 | |||
353 | static void | ||
354 | _ecore_evas_wince_move(Ecore_Evas *ee, int x, int y) | ||
355 | { | ||
356 | INF("ecore evas move (%dx%d)", x, y); | ||
357 | ee->req.x = x; | ||
358 | ee->req.y = y; | ||
359 | |||
360 | if ((x != ee->x) || (y != ee->y)) | ||
361 | { | ||
362 | ee->x = x; | ||
363 | ee->y = y; | ||
364 | ecore_wince_window_move((Ecore_WinCE_Window *)ee->prop.window, x, y); | ||
365 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
366 | } | ||
367 | } | ||
368 | |||
369 | static void | ||
370 | _ecore_evas_wince_resize(Ecore_Evas *ee, int width, int height) | ||
371 | { | ||
372 | INF("ecore evas resize (%dx%d)", width, height); | ||
373 | ee->req.w = width; | ||
374 | ee->req.h = height; | ||
375 | |||
376 | if ((ee->w != width) || (ee->h != height)) | ||
377 | { | ||
378 | ee->w = width; | ||
379 | ee->h = height; | ||
380 | ecore_wince_window_resize((Ecore_WinCE_Window *)ee->prop.window, width, height); | ||
381 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
382 | { | ||
383 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
384 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
385 | } | ||
386 | else | ||
387 | { | ||
388 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
389 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
390 | } | ||
391 | /* FIXME: damage and shape */ | ||
392 | |||
393 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
394 | } | ||
395 | } | ||
396 | |||
397 | static void | ||
398 | _ecore_evas_wince_move_resize(Ecore_Evas *ee, int x, int y, int width, int height) | ||
399 | { | ||
400 | INF("ecore evas resize (%dx%d %dx%d)", x, y, width, height); | ||
401 | ee->req.x = x; | ||
402 | ee->req.y = y; | ||
403 | ee->req.w = width; | ||
404 | ee->req.h = height; | ||
405 | |||
406 | if ((ee->w != width) || (ee->h != height) || (x != ee->x) || (y != ee->y)) | ||
407 | { | ||
408 | int change_size = 0; | ||
409 | int change_pos = 0; | ||
410 | |||
411 | if ((ee->w != width) || (ee->h != height)) change_size = 1; | ||
412 | if ((x != ee->x) || (y != ee->y)) change_pos = 1; | ||
413 | |||
414 | ee->x = x; | ||
415 | ee->y = y; | ||
416 | ee->w = width; | ||
417 | ee->h = height; | ||
418 | ecore_wince_window_move_resize((Ecore_WinCE_Window *)ee->prop.window, x, y, width, height); | ||
419 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
420 | { | ||
421 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
422 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
423 | } | ||
424 | else | ||
425 | { | ||
426 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
427 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
428 | } | ||
429 | /* FIXME: damage and shape */ | ||
430 | if (change_pos) | ||
431 | { | ||
432 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
433 | } | ||
434 | if (change_size) | ||
435 | { | ||
436 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
437 | } | ||
438 | } | ||
439 | } | ||
440 | |||
441 | /* static void */ | ||
442 | /* _ecore_evas_wince_rotation_set(Ecore_Evas *ee, int rotation) */ | ||
443 | /* { */ | ||
444 | /* int rot_dif; */ | ||
445 | |||
446 | /* if (ee->rotation == rotation) return; */ | ||
447 | /* rot_dif = ee->rotation - rotation; */ | ||
448 | /* if (rot_dif < 0) rot_dif = -rot_dif; */ | ||
449 | /* if (!strcmp(ee->driver, "software_ddraw")) */ | ||
450 | /* { */ | ||
451 | /* Evas_Engine_Info_Software_16_WinCE *einfo; */ | ||
452 | |||
453 | /* einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas); */ | ||
454 | /* if (!einfo) return; */ | ||
455 | /* if (rot_dif != 180) */ | ||
456 | /* { */ | ||
457 | /* int minw, minh, maxw, maxh, basew, baseh, stepw, steph; */ | ||
458 | |||
459 | /* einfo->info.rotation = rotation; */ | ||
460 | /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */ | ||
461 | /* if (!ee->prop.fullscreen) */ | ||
462 | /* { */ | ||
463 | /* ecore_wince_window_resize(ee->prop.window, ee->h, ee->w); */ | ||
464 | /* ee->expecting_resize.w = ee->h; */ | ||
465 | /* ee->expecting_resize.h = ee->w; */ | ||
466 | /* } */ | ||
467 | /* else */ | ||
468 | /* { */ | ||
469 | /* int w, h; */ | ||
470 | |||
471 | /* ecore_wince_window_size_get(ee->prop.window, &w, &h); */ | ||
472 | /* ecore_wince_window_resize(ee->prop.window, h, w); */ | ||
473 | /* if ((rotation == 0) || (rotation == 180)) */ | ||
474 | /* { */ | ||
475 | /* evas_output_size_set(ee->evas, ee->w, ee->h); */ | ||
476 | /* evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); */ | ||
477 | /* } */ | ||
478 | /* else */ | ||
479 | /* { */ | ||
480 | /* evas_output_size_set(ee->evas, ee->h, ee->w); */ | ||
481 | /* evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); */ | ||
482 | /* } */ | ||
483 | /* if (ee->func.fn_resize) ee->func.fn_resize(ee); */ | ||
484 | /* } */ | ||
485 | /* ecore_evas_size_min_get(ee, &minw, &minh); */ | ||
486 | /* ecore_evas_size_max_get(ee, &maxw, &maxh); */ | ||
487 | /* ecore_evas_size_base_get(ee, &basew, &baseh); */ | ||
488 | /* ecore_evas_size_step_get(ee, &stepw, &steph); */ | ||
489 | /* ee->rotation = rotation; */ | ||
490 | /* ecore_evas_size_min_set(ee, minh, minw); */ | ||
491 | /* ecore_evas_size_max_set(ee, maxh, maxw); */ | ||
492 | /* ecore_evas_size_base_set(ee, baseh, basew); */ | ||
493 | /* ecore_evas_size_step_set(ee, steph, stepw); */ | ||
494 | /* _ecore_evas_wince_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, */ | ||
495 | /* ecore_wince_current_time_get()); */ | ||
496 | /* } */ | ||
497 | /* else */ | ||
498 | /* { */ | ||
499 | /* einfo->info.rotation = rotation; */ | ||
500 | /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */ | ||
501 | /* ee->rotation = rotation; */ | ||
502 | /* _ecore_evas_wince_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, */ | ||
503 | /* ecore_wince_current_time_get()); */ | ||
504 | /* if (ee->func.fn_resize) ee->func.fn_resize(ee); */ | ||
505 | /* } */ | ||
506 | /* if ((ee->rotation == 90) || (ee->rotation == 270)) */ | ||
507 | /* evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); */ | ||
508 | /* else */ | ||
509 | /* evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); */ | ||
510 | /* } */ | ||
511 | /* } */ | ||
512 | |||
513 | static void | ||
514 | _ecore_evas_wince_show(Ecore_Evas *ee) | ||
515 | { | ||
516 | INF("ecore evas show"); | ||
517 | |||
518 | ee->should_be_visible = 1; | ||
519 | if (ee->prop.avoid_damage) | ||
520 | _ecore_evas_wince_render(ee); | ||
521 | ecore_wince_window_show((Ecore_WinCE_Window *)ee->prop.window); | ||
522 | /* if (ee->prop.fullscreen) */ | ||
523 | /* ecore_wince_window_focus(ee->prop.window); */ | ||
524 | } | ||
525 | |||
526 | static void | ||
527 | _ecore_evas_wince_hide(Ecore_Evas *ee) | ||
528 | { | ||
529 | INF("ecore evas hide"); | ||
530 | |||
531 | ecore_wince_window_hide((Ecore_WinCE_Window *)ee->prop.window); | ||
532 | ee->should_be_visible = 0; | ||
533 | } | ||
534 | |||
535 | /* static void */ | ||
536 | /* _ecore_evas_wince_raise(Ecore_Evas *ee) */ | ||
537 | /* { */ | ||
538 | /* if (!ee->prop.fullscreen) */ | ||
539 | /* ecore_wince_window_raise(ee->prop.window); */ | ||
540 | /* else */ | ||
541 | /* ecore_wince_window_raise(ee->prop.window); */ | ||
542 | /* } */ | ||
543 | |||
544 | /* static void */ | ||
545 | /* _ecore_evas_wince_lower(Ecore_Evas *ee) */ | ||
546 | /* { */ | ||
547 | /* if (!ee->prop.fullscreen) */ | ||
548 | /* ecore_wince_window_lower(ee->prop.window); */ | ||
549 | /* else */ | ||
550 | /* ecore_wince_window_lower(ee->prop.window); */ | ||
551 | /* } */ | ||
552 | |||
553 | static void | ||
554 | _ecore_evas_wince_title_set(Ecore_Evas *ee, const char *title) | ||
555 | { | ||
556 | INF("ecore evas title set"); | ||
557 | |||
558 | if (ee->prop.title) free(ee->prop.title); | ||
559 | ee->prop.title = NULL; | ||
560 | if (title) ee->prop.title = strdup(title); | ||
561 | ecore_wince_window_title_set((Ecore_WinCE_Window *)ee->prop.window, ee->prop.title); | ||
562 | } | ||
563 | |||
564 | /* static void */ | ||
565 | /* _ecore_evas_wince_size_min_set(Ecore_Evas *ee, int width, int height) */ | ||
566 | /* { */ | ||
567 | /* if (width < 0) width = 0; */ | ||
568 | /* if (height < 0) height = 0; */ | ||
569 | /* if ((ee->prop.min.w == width) && (ee->prop.min.h == height)) return; */ | ||
570 | /* ee->prop.min.w = width; */ | ||
571 | /* ee->prop.min.h = height; */ | ||
572 | /* ecore_wince_window_size_min_set(ee->prop.window, width, height); */ | ||
573 | /* } */ | ||
574 | |||
575 | /* static void */ | ||
576 | /* _ecore_evas_wince_size_max_set(Ecore_Evas *ee, int width, int height) */ | ||
577 | /* { */ | ||
578 | /* if (width < 0) width = 0; */ | ||
579 | /* if (height < 0) height = 0; */ | ||
580 | /* if ((ee->prop.max.w == width) && (ee->prop.max.h == height)) return; */ | ||
581 | /* ee->prop.max.w = width; */ | ||
582 | /* ee->prop.max.h = height; */ | ||
583 | /* ecore_wince_window_size_max_set(ee->prop.window, width, height); */ | ||
584 | /* } */ | ||
585 | |||
586 | /* static void */ | ||
587 | /* _ecore_evas_wince_size_base_set(Ecore_Evas *ee, int width, int height) */ | ||
588 | /* { */ | ||
589 | /* if (width < 0) width = 0; */ | ||
590 | /* if (height < 0) height = 0; */ | ||
591 | /* if ((ee->prop.base.w == width) && (ee->prop.base.h == height)) return; */ | ||
592 | /* ee->prop.base.w = width; */ | ||
593 | /* ee->prop.base.h = height; */ | ||
594 | /* ecore_wince_window_size_base_set(ee->prop.window, width, height); */ | ||
595 | /* } */ | ||
596 | |||
597 | /* static void */ | ||
598 | /* _ecore_evas_wince_size_step_set(Ecore_Evas *ee, int width, int height) */ | ||
599 | /* { */ | ||
600 | /* if (width < 1) width = 1; */ | ||
601 | /* if (height < 1) height = 1; */ | ||
602 | /* if ((ee->prop.step.w == width) && (ee->prop.step.h == height)) return; */ | ||
603 | /* ee->prop.step.w = width; */ | ||
604 | /* ee->prop.step.h = height; */ | ||
605 | /* ecore_wince_window_size_step_set(ee->prop.window, width, height); */ | ||
606 | /* } */ | ||
607 | |||
608 | static void | ||
609 | _ecore_evas_wince_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
610 | { | ||
611 | #if 0 | ||
612 | int x, y; | ||
613 | |||
614 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
615 | |||
616 | if (obj == NULL) | ||
617 | { | ||
618 | ee->prop.cursor.object = NULL; | ||
619 | ee->prop.cursor.layer = 0; | ||
620 | ee->prop.cursor.hot.x = 0; | ||
621 | ee->prop.cursor.hot.y = 0; | ||
622 | ecore_wince_window_cursor_show(ee->prop.window, 1); | ||
623 | return; | ||
624 | } | ||
625 | |||
626 | ee->prop.cursor.object = obj; | ||
627 | ee->prop.cursor.layer = layer; | ||
628 | ee->prop.cursor.hot.x = hot_x; | ||
629 | ee->prop.cursor.hot.y = hot_y; | ||
630 | |||
631 | ecore_wince_window_cursor_show(ee->prop.window, 0); | ||
632 | |||
633 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
634 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
635 | evas_object_move(ee->prop.cursor.object, | ||
636 | x - ee->prop.cursor.hot.x, | ||
637 | y - ee->prop.cursor.hot.y); | ||
638 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
639 | if (evas_pointer_inside_get(ee->evas)) | ||
640 | evas_object_show(ee->prop.cursor.object); | ||
641 | #endif | ||
642 | } | ||
643 | |||
644 | /* static void */ | ||
645 | /* _ecore_evas_wince_focus_set(Ecore_Evas *ee, int on __UNUSED__) */ | ||
646 | /* { */ | ||
647 | /* ecore_wince_window_focus_set(ee->prop.window); */ | ||
648 | /* } */ | ||
649 | |||
650 | /* static void */ | ||
651 | /* _ecore_evas_wince_iconified_set(Ecore_Evas *ee, int on) */ | ||
652 | /* { */ | ||
653 | /* /\* if (((ee->prop.borderless) && (on)) || *\/ */ | ||
654 | /* /\* ((!ee->prop.borderless) && (!on))) return; *\/ */ | ||
655 | /* ee->prop.iconified = on; */ | ||
656 | /* ecore_wince_window_iconified_set(ee->prop.window, ee->prop.iconified); */ | ||
657 | /* } */ | ||
658 | |||
659 | /* static void */ | ||
660 | /* _ecore_evas_wince_borderless_set(Ecore_Evas *ee, int on) */ | ||
661 | /* { */ | ||
662 | /* if (((ee->prop.borderless) && (on)) || */ | ||
663 | /* ((!ee->prop.borderless) && (!on))) return; */ | ||
664 | /* ee->prop.borderless = on; */ | ||
665 | /* ecore_wince_window_borderless_set(ee->prop.window, ee->prop.borderless); */ | ||
666 | /* } */ | ||
667 | |||
668 | static void | ||
669 | _ecore_evas_wince_fullscreen_set(Ecore_Evas *ee, int on) | ||
670 | { | ||
671 | Evas_Engine_Info_Software_16_WinCE *einfo; | ||
672 | struct _Ecore_WinCE_Window *window; | ||
673 | |||
674 | INF("ecore evas fullscreen set"); | ||
675 | |||
676 | if ((ee->engine.wince.state.fullscreen && on) || | ||
677 | (!ee->engine.wince.state.fullscreen && !on)) | ||
678 | return; | ||
679 | |||
680 | ee->engine.wince.state.fullscreen = on; | ||
681 | ee->prop.fullscreen = on; | ||
682 | |||
683 | window = (struct _Ecore_WinCE_Window *)ee->prop.window; | ||
684 | |||
685 | if (on != 0) | ||
686 | { | ||
687 | /* ecore_win32_window_shape_set(ee->engine.win32.window, 0, 0, NULL); */ | ||
688 | ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, on); | ||
689 | ee->w = GetSystemMetrics(SM_CXSCREEN); | ||
690 | ee->h = GetSystemMetrics(SM_CYSCREEN); | ||
691 | ee->req.w = ee->w; | ||
692 | ee->req.h = ee->h; | ||
693 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
694 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
695 | } | ||
696 | else | ||
697 | { | ||
698 | int w; | ||
699 | int h; | ||
700 | |||
701 | ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, on); | ||
702 | ecore_wince_window_size_get((Ecore_WinCE_Window *)ee->prop.window, &w, &h); | ||
703 | ee->w = w; | ||
704 | ee->h = h; | ||
705 | ee->req.w = ee->w; | ||
706 | ee->req.h = ee->h; | ||
707 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
708 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
709 | /* ecore_win32_window_shape_set(window, */ | ||
710 | /* window->shape.width, */ | ||
711 | /* window->shape.height, */ | ||
712 | /* window->shape.mask); */ | ||
713 | } | ||
714 | |||
715 | einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ecore_evas_get(ee)); | ||
716 | if (einfo) | ||
717 | { | ||
718 | einfo->info.fullscreen = !!on; | ||
719 | /* einfo->info.layered = window->shape.layered; */ | ||
720 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
721 | { | ||
722 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
723 | } | ||
724 | } | ||
725 | } | ||
726 | |||
727 | static Ecore_Evas_Engine_Func _ecore_wince_engine_func = | ||
728 | { | ||
729 | _ecore_evas_wince_free, | ||
730 | NULL, | ||
731 | NULL, | ||
732 | NULL, | ||
733 | NULL, | ||
734 | _ecore_evas_wince_callback_delete_request_set, | ||
735 | NULL, | ||
736 | NULL, | ||
737 | NULL, | ||
738 | NULL, | ||
739 | NULL, | ||
740 | NULL, | ||
741 | NULL, | ||
742 | NULL, | ||
743 | NULL, | ||
744 | _ecore_evas_wince_move, | ||
745 | NULL, | ||
746 | _ecore_evas_wince_resize, | ||
747 | _ecore_evas_wince_move_resize, | ||
748 | NULL, //_ecore_evas_wince_rotation_set, | ||
749 | NULL, /* _ecore_evas_x_shaped_set */ | ||
750 | _ecore_evas_wince_show, | ||
751 | _ecore_evas_wince_hide, | ||
752 | NULL, //_ecore_evas_wince_raise, | ||
753 | NULL, //_ecore_evas_wince_lower, | ||
754 | NULL, //_ecore_evas_wince_activate, | ||
755 | _ecore_evas_wince_title_set, | ||
756 | NULL, /* _ecore_evas_x_name_class_set */ | ||
757 | NULL, //_ecore_evas_wince_size_min_set, | ||
758 | NULL, //_ecore_evas_wince_size_max_set, | ||
759 | NULL, //_ecore_evas_wince_size_base_set, | ||
760 | NULL, //_ecore_evas_wince_size_step_set, | ||
761 | _ecore_evas_wince_cursor_set, | ||
762 | NULL, /* _ecore_evas_x_layer_set */ | ||
763 | NULL, //_ecore_evas_wince_focus_set, | ||
764 | NULL, //_ecore_evas_wince_iconified_set, | ||
765 | NULL, //_ecore_evas_wince_borderless_set, | ||
766 | NULL, /* _ecore_evas_x_override_set */ | ||
767 | NULL, | ||
768 | _ecore_evas_wince_fullscreen_set, | ||
769 | NULL, /* _ecore_evas_x_avoid_damage_set */ | ||
770 | NULL, /* _ecore_evas_x_withdrawn_set */ | ||
771 | NULL, /* _ecore_evas_x_sticky_set */ | ||
772 | NULL, /* _ecore_evas_x_ignore_events_set */ | ||
773 | NULL, /* _ecore_evas_x_alpha_set */ | ||
774 | NULL, //transparent | ||
775 | |||
776 | NULL, // render | ||
777 | NULL // screen_geometry_get | ||
778 | }; | ||
779 | |||
780 | /* API */ | ||
781 | |||
782 | static Ecore_Evas * | ||
783 | ecore_evas_software_wince_new_internal(int backend, | ||
784 | Ecore_WinCE_Window *parent, | ||
785 | int x, | ||
786 | int y, | ||
787 | int width, | ||
788 | int height, | ||
789 | int fullscreen) | ||
790 | { | ||
791 | Evas_Engine_Info_Software_16_WinCE *einfo; | ||
792 | Ecore_Evas *ee; | ||
793 | int rmethod; | ||
794 | |||
795 | rmethod = evas_render_method_lookup("software_16_wince"); | ||
796 | if (!rmethod) | ||
797 | return NULL; | ||
798 | |||
799 | if (!ecore_wince_init()) | ||
800 | return NULL; | ||
801 | |||
802 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
803 | if (!ee) | ||
804 | { | ||
805 | ecore_wince_shutdown(); | ||
806 | return NULL; | ||
807 | } | ||
808 | |||
809 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
810 | |||
811 | if (!_ecore_evas_wince_init()) | ||
812 | { | ||
813 | free(ee); | ||
814 | ecore_wince_shutdown(); | ||
815 | return NULL; | ||
816 | } | ||
817 | |||
818 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wince_engine_func; | ||
819 | |||
820 | ee->driver = "software_16_wince"; | ||
821 | |||
822 | if (width < 1) width = 1; | ||
823 | if (height < 1) height = 1; | ||
824 | ee->x = x; | ||
825 | ee->y = y; | ||
826 | ee->w = width; | ||
827 | ee->h = height; | ||
828 | ee->req.x = ee->x; | ||
829 | ee->req.y = ee->y; | ||
830 | ee->req.w = ee->w; | ||
831 | ee->req.h = ee->h; | ||
832 | |||
833 | ee->prop.max.w = 32767; | ||
834 | ee->prop.max.h = 32767; | ||
835 | ee->prop.layer = 4; | ||
836 | ee->prop.request_pos = 0; | ||
837 | ee->prop.sticky = 0; | ||
838 | /* FIXME: sticky to add */ | ||
839 | |||
840 | ee->prop.window = (Ecore_Window)ecore_wince_window_new((Ecore_WinCE_Window *)parent, x, y, width, height); | ||
841 | if (!ee->prop.window) | ||
842 | { | ||
843 | _ecore_evas_wince_shutdown(); | ||
844 | free(ee); | ||
845 | ecore_wince_shutdown(); | ||
846 | return NULL; | ||
847 | } | ||
848 | |||
849 | ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, fullscreen); | ||
850 | |||
851 | /* init evas here */ | ||
852 | ee->evas = evas_new(); | ||
853 | evas_data_attach_set(ee->evas, ee); | ||
854 | evas_output_method_set(ee->evas, rmethod); | ||
855 | evas_output_size_set(ee->evas, width, height); | ||
856 | evas_output_viewport_set(ee->evas, 0, 0, width, height); | ||
857 | |||
858 | einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas); | ||
859 | if (einfo) | ||
860 | { | ||
861 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
862 | einfo->info.window = ((struct _Ecore_WinCE_Window *)ee->prop.window)->window; | ||
863 | einfo->info.width = width; | ||
864 | einfo->info.height = height; | ||
865 | einfo->info.backend = backend; | ||
866 | einfo->info.rotation = 0; | ||
867 | einfo->info.fullscreen = fullscreen; | ||
868 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
869 | { | ||
870 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
871 | _ecore_evas_wince_shutdown(); | ||
872 | free(ee); | ||
873 | ecore_wince_shutdown(); | ||
874 | return NULL; | ||
875 | } | ||
876 | |||
877 | ecore_wince_window_backend_set((Ecore_WinCE_Window *)ee->prop.window, backend); | ||
878 | ecore_wince_window_suspend_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.suspend); | ||
879 | ecore_wince_window_resume_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.resume); | ||
880 | } | ||
881 | else | ||
882 | { | ||
883 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
884 | _ecore_evas_wince_shutdown(); | ||
885 | free(ee); | ||
886 | ecore_wince_shutdown(); | ||
887 | return NULL; | ||
888 | } | ||
889 | |||
890 | ee->engine.func->fn_render = _ecore_evas_wince_render; | ||
891 | _ecore_evas_register(ee); | ||
892 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
893 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
894 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
895 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
896 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
897 | evas_focus_in(ee->evas); | ||
898 | |||
899 | return ee; | ||
900 | } | ||
901 | |||
902 | #else | ||
903 | |||
904 | static Ecore_Evas * | ||
905 | ecore_evas_software_wince_new_internal(int backend __UNUSED__, | ||
906 | Ecore_WinCE_Window *parent __UNUSED__, | ||
907 | int x __UNUSED__, | ||
908 | int y __UNUSED__, | ||
909 | int width __UNUSED__, | ||
910 | int height __UNUSED__, | ||
911 | int fullscreen __UNUSED__) | ||
912 | { | ||
913 | return NULL; | ||
914 | } | ||
915 | |||
916 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */ | ||
917 | |||
918 | |||
919 | EAPI Ecore_Evas * | ||
920 | ecore_evas_software_wince_new(Ecore_WinCE_Window *parent, | ||
921 | int x, | ||
922 | int y, | ||
923 | int width, | ||
924 | int height) | ||
925 | { | ||
926 | return ecore_evas_software_wince_new_internal(0, parent, x, y, width, height, 1); | ||
927 | } | ||
928 | |||
929 | EAPI Ecore_Evas * | ||
930 | ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent, | ||
931 | int x, | ||
932 | int y, | ||
933 | int width, | ||
934 | int height) | ||
935 | { | ||
936 | return ecore_evas_software_wince_new_internal(1, parent, x, y, width, height, 1); | ||
937 | } | ||
938 | |||
939 | EAPI Ecore_Evas * | ||
940 | ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent, | ||
941 | int x, | ||
942 | int y, | ||
943 | int width, | ||
944 | int height) | ||
945 | { | ||
946 | return ecore_evas_software_wince_new_internal(2, parent, x, y, width, height, 1); | ||
947 | } | ||
948 | |||
949 | EAPI Ecore_Evas * | ||
950 | ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent, | ||
951 | int x, | ||
952 | int y, | ||
953 | int width, | ||
954 | int height) | ||
955 | { | ||
956 | return ecore_evas_software_wince_new_internal(3, parent, x, y, width, height, 1); | ||
957 | } | ||
958 | |||
959 | EAPI Ecore_Evas * | ||
960 | ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent, | ||
961 | int x, | ||
962 | int y, | ||
963 | int width, | ||
964 | int height) | ||
965 | { | ||
966 | return ecore_evas_software_wince_new_internal(4, parent, x, y, width, height, 0); | ||
967 | } | ||
968 | |||
969 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
970 | |||
971 | EAPI Ecore_WinCE_Window * | ||
972 | ecore_evas_software_wince_window_get(const Ecore_Evas *ee) | ||
973 | { | ||
974 | return (Ecore_WinCE_Window *) ecore_evas_window_get(ee); | ||
975 | } | ||
976 | |||
977 | #else | ||
978 | |||
979 | EAPI Ecore_WinCE_Window * | ||
980 | ecore_evas_software_wince_window_get(const Ecore_Evas *ee __UNUSED__) | ||
981 | { | ||
982 | return NULL; | ||
983 | } | ||
984 | |||
985 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */ | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c new file mode 100644 index 0000000..d9ccd6e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c | |||
@@ -0,0 +1,4289 @@ | |||
1 | #include <string.h> | ||
2 | #include "ecore_evas_private.h" | ||
3 | #include "Ecore_Evas.h" | ||
4 | |||
5 | #ifdef BUILD_ECORE_EVAS_X11 | ||
6 | static int _ecore_evas_init_count = 0; | ||
7 | |||
8 | static Ecore_Event_Handler *ecore_evas_event_handlers[13]; | ||
9 | |||
10 | static int leader_ref = 0; | ||
11 | static Ecore_X_Window leader_win = 0; | ||
12 | |||
13 | static void | ||
14 | _ecore_evas_x_group_leader_set(Ecore_Evas *ee) | ||
15 | { | ||
16 | leader_ref++; | ||
17 | if (leader_ref == 1) | ||
18 | { | ||
19 | char *id = NULL; | ||
20 | |||
21 | leader_win = | ||
22 | ecore_x_window_override_new(ee->engine.x.win_root, 1234, 5678, 1, 2); | ||
23 | ecore_x_window_defaults_set(leader_win); | ||
24 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
25 | ecore_x_netwm_startup_id_set(leader_win,id); | ||
26 | ecore_x_icccm_client_leader_set(leader_win, leader_win); | ||
27 | } | ||
28 | ee->engine.x.leader = leader_win; | ||
29 | ecore_x_icccm_client_leader_set(ee->prop.window, leader_win); | ||
30 | } | ||
31 | |||
32 | static void | ||
33 | _ecore_evas_x_group_leader_unset(Ecore_Evas *ee) | ||
34 | { | ||
35 | ecore_x_window_prop_property_del(ee->prop.window, | ||
36 | ECORE_X_ATOM_WM_CLIENT_LEADER); | ||
37 | if (ee->engine.x.leader == leader_win) | ||
38 | { | ||
39 | leader_ref--; | ||
40 | if (leader_ref <= 0) | ||
41 | { | ||
42 | ecore_x_window_free(leader_win); | ||
43 | leader_win = 0; | ||
44 | } | ||
45 | ee->engine.x.leader = 0; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | static void | ||
50 | _ecore_evas_x_group_leader_update(Ecore_Evas *ee) | ||
51 | { | ||
52 | if (ee->engine.x.leader) | ||
53 | ecore_x_icccm_client_leader_set(ee->prop.window, ee->engine.x.leader); | ||
54 | } | ||
55 | |||
56 | static void | ||
57 | _ecore_evas_x_protocols_set(Ecore_Evas *ee) | ||
58 | { | ||
59 | Ecore_X_Atom protos[3]; | ||
60 | unsigned int num = 0, tmp = 0; | ||
61 | |||
62 | if (ee->func.fn_delete_request) | ||
63 | protos[num++] = ECORE_X_ATOM_WM_DELETE_WINDOW; | ||
64 | protos[num++] = ECORE_X_ATOM_NET_WM_PING; | ||
65 | protos[num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; | ||
66 | ecore_x_icccm_protocol_atoms_set(ee->prop.window, protos, num); | ||
67 | |||
68 | if (!ee->engine.x.netwm_sync_counter) | ||
69 | ee->engine.x.netwm_sync_counter = ecore_x_sync_counter_new(0); | ||
70 | |||
71 | tmp = ee->engine.x.netwm_sync_counter; | ||
72 | ecore_x_window_prop_card32_set(ee->prop.window, | ||
73 | ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, | ||
74 | &tmp, 1); | ||
75 | } | ||
76 | |||
77 | static void | ||
78 | _ecore_evas_x_sync_set(Ecore_Evas *ee) | ||
79 | { | ||
80 | if (((ee->should_be_visible) || (ee->visible)) && | ||
81 | ((ecore_x_e_comp_sync_supported_get(ee->engine.x.win_root)) && | ||
82 | (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync))) | ||
83 | { | ||
84 | if (!ee->engine.x.sync_counter) | ||
85 | ee->engine.x.sync_counter = ecore_x_sync_counter_new(0); | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | if (ee->engine.x.sync_counter) | ||
90 | ecore_x_sync_counter_free(ee->engine.x.sync_counter); | ||
91 | ee->engine.x.sync_counter = 0; | ||
92 | } | ||
93 | ecore_x_e_comp_sync_counter_set(ee->prop.window, ee->engine.x.sync_counter); | ||
94 | } | ||
95 | |||
96 | static void | ||
97 | _ecore_evas_x_sync_clear(Ecore_Evas *ee) | ||
98 | { | ||
99 | if (!ee->engine.x.sync_counter) return; | ||
100 | ecore_x_sync_counter_free(ee->engine.x.sync_counter); | ||
101 | ee->engine.x.sync_counter = 0; | ||
102 | } | ||
103 | |||
104 | # ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
105 | static Ecore_X_Window | ||
106 | _ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, int w, int h, int override, int argb, const int *opt) | ||
107 | { | ||
108 | Evas_Engine_Info_GL_X11 *einfo; | ||
109 | Ecore_X_Window win; | ||
110 | |||
111 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
112 | if (einfo) | ||
113 | { | ||
114 | int screen; | ||
115 | |||
116 | if (opt) | ||
117 | { | ||
118 | int op; | ||
119 | |||
120 | for (op = 0; opt[op]; op++) | ||
121 | { | ||
122 | if (opt[op] == ECORE_EVAS_GL_X11_OPT_INDIRECT) | ||
123 | { | ||
124 | op++; | ||
125 | einfo->indirect = opt[op]; | ||
126 | } | ||
127 | else if (opt[op] == ECORE_EVAS_GL_X11_OPT_VSYNC) | ||
128 | { | ||
129 | op++; | ||
130 | einfo->vsync = opt[op]; | ||
131 | } | ||
132 | } | ||
133 | } | ||
134 | |||
135 | /* FIXME: this is inefficient as its 1 or more round trips */ | ||
136 | screen = ecore_x_screen_index_get(ecore_x_default_screen_get()); | ||
137 | if (ecore_x_screen_count_get() > 1) | ||
138 | { | ||
139 | Ecore_X_Window *roots; | ||
140 | int num, i; | ||
141 | |||
142 | num = 0; | ||
143 | roots = ecore_x_window_root_list(&num); | ||
144 | if (roots) | ||
145 | { | ||
146 | Ecore_X_Window root; | ||
147 | |||
148 | root = ecore_x_window_root_get(parent); | ||
149 | for (i = 0; i < num; i++) | ||
150 | { | ||
151 | if (root == roots[i]) | ||
152 | { | ||
153 | screen = i; | ||
154 | break; | ||
155 | } | ||
156 | } | ||
157 | free(roots); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | einfo->info.display = ecore_x_display_get(); | ||
162 | einfo->info.screen = screen; | ||
163 | |||
164 | einfo->info.destination_alpha = argb; | ||
165 | |||
166 | einfo->info.visual = einfo->func.best_visual_get(einfo); | ||
167 | einfo->info.colormap = einfo->func.best_colormap_get(einfo); | ||
168 | einfo->info.depth = einfo->func.best_depth_get(einfo); | ||
169 | |||
170 | if ((!einfo->info.visual) || | ||
171 | (!einfo->info.colormap) || (!einfo->info.depth)) | ||
172 | { | ||
173 | WRN("OpenGL X11 init engine '%s' failed - no visual, colormap or depth.", ee->driver); | ||
174 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
175 | { | ||
176 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
177 | return 0; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | if (argb) | ||
182 | { | ||
183 | if (override) | ||
184 | win = ecore_x_window_override_argb_new(parent, x, y, w, h); | ||
185 | else | ||
186 | win = ecore_x_window_argb_new(parent, x, y, w, h); | ||
187 | } | ||
188 | else | ||
189 | { | ||
190 | if (override) | ||
191 | win = ecore_x_window_override_new(parent, x, y, w, h); | ||
192 | else | ||
193 | win = ecore_x_window_new(parent, x, y, w, h); | ||
194 | } | ||
195 | |||
196 | ecore_x_window_pixel_gravity_set(win, ECORE_X_GRAVITY_FORGET); | ||
197 | |||
198 | /* attr.backing_store = NotUseful; */ | ||
199 | /* attr.override_redirect = override; */ | ||
200 | /* attr.colormap = einfo->info.colormap; */ | ||
201 | /* attr.border_pixel = 0; */ | ||
202 | /* attr.background_pixmap = None; */ | ||
203 | /* attr.event_mask = */ | ||
204 | /* KeyPressMask | KeyReleaseMask | */ | ||
205 | /* ExposureMask | ButtonPressMask | ButtonReleaseMask | */ | ||
206 | /* EnterWindowMask | LeaveWindowMask | */ | ||
207 | /* PointerMotionMask | StructureNotifyMask | VisibilityChangeMask | */ | ||
208 | /* FocusChangeMask | PropertyChangeMask | ColormapChangeMask; */ | ||
209 | /* attr.bit_gravity = ForgetGravity; */ | ||
210 | |||
211 | /* win = */ | ||
212 | /* XCreateWindow(einfo->info.display, parent, x, y, w, h, 0, */ | ||
213 | /* einfo->info.depth, InputOutput, einfo->info.visual, */ | ||
214 | /* CWBackingStore | CWColormap | CWBackPixmap | */ | ||
215 | /* CWBorderPixel | CWBitGravity | CWEventMask | */ | ||
216 | /* CWOverrideRedirect, &attr); */ | ||
217 | |||
218 | einfo->info.drawable = win; | ||
219 | |||
220 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
221 | { | ||
222 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
223 | ecore_x_window_free(win); | ||
224 | return 0; | ||
225 | } | ||
226 | } | ||
227 | else | ||
228 | win = 0; | ||
229 | |||
230 | return win; | ||
231 | } | ||
232 | #endif | ||
233 | |||
234 | static int | ||
235 | _ecore_evas_x_render(Ecore_Evas *ee) | ||
236 | { | ||
237 | int rend = 0; | ||
238 | Eina_List *updates = NULL; | ||
239 | Eina_List *ll; | ||
240 | Ecore_Evas *ee2; | ||
241 | |||
242 | if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync) && | ||
243 | (ee->engine.x.sync_counter) && (!ee->engine.x.sync_began) && | ||
244 | (!ee->engine.x.sync_cancel)) | ||
245 | return 0; | ||
246 | |||
247 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
248 | { | ||
249 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
250 | if (ee2->engine.func->fn_render) | ||
251 | rend |= ee2->engine.func->fn_render(ee2); | ||
252 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
253 | } | ||
254 | |||
255 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
256 | updates = evas_render_updates(ee->evas); | ||
257 | if (ee->prop.avoid_damage) | ||
258 | { | ||
259 | if (ee->engine.x.using_bg_pixmap) | ||
260 | { | ||
261 | if (updates) | ||
262 | { | ||
263 | Eina_List *l = NULL; | ||
264 | Eina_Rectangle *r; | ||
265 | |||
266 | EINA_LIST_FOREACH(updates, l, r) | ||
267 | ecore_x_window_area_clear(ee->prop.window, | ||
268 | r->x, r->y, r->w, r->h); | ||
269 | if (ee->shaped) | ||
270 | { | ||
271 | #ifdef EVAS_FRAME_QUEUING | ||
272 | evas_sync(ee->evas); | ||
273 | #endif | ||
274 | ecore_x_window_shape_mask_set(ee->prop.window, | ||
275 | ee->engine.x.mask); | ||
276 | } | ||
277 | if (ee->alpha) | ||
278 | { | ||
279 | #ifdef EVAS_FRAME_QUEUING | ||
280 | /* wait until ee->engine.x.mask being updated */ | ||
281 | // evas_sync(ee->evas); | ||
282 | #endif | ||
283 | // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); | ||
284 | } | ||
285 | evas_render_updates_free(updates); | ||
286 | _ecore_evas_idle_timeout_update(ee); | ||
287 | rend = 1; | ||
288 | } | ||
289 | } | ||
290 | else | ||
291 | { | ||
292 | if (updates) | ||
293 | { | ||
294 | Eina_List *l = NULL; | ||
295 | Eina_Rectangle *r; | ||
296 | |||
297 | EINA_LIST_FOREACH(updates, l, r) | ||
298 | { | ||
299 | Ecore_X_Rectangle rect; | ||
300 | Ecore_X_XRegion *tmpr; | ||
301 | |||
302 | if (!ee->engine.x.damages) | ||
303 | ee->engine.x.damages = ecore_x_xregion_new(); | ||
304 | tmpr = ecore_x_xregion_new(); | ||
305 | if (ee->rotation == 0) | ||
306 | { | ||
307 | rect.x = r->x; | ||
308 | rect.y = r->y; | ||
309 | rect.width = r->w; | ||
310 | rect.height = r->h; | ||
311 | } | ||
312 | else if (ee->rotation == 90) | ||
313 | { | ||
314 | rect.x = r->y; | ||
315 | rect.y = ee->h - r->x - r->w; | ||
316 | rect.width = r->h; | ||
317 | rect.height = r->w; | ||
318 | } | ||
319 | else if (ee->rotation == 180) | ||
320 | { | ||
321 | rect.x = ee->w - r->x - r->w; | ||
322 | rect.y = ee->h - r->y - r->h; | ||
323 | rect.width = r->w; | ||
324 | rect.height = r->h; | ||
325 | } | ||
326 | else if (ee->rotation == 270) | ||
327 | { | ||
328 | rect.x = ee->w - r->y - r->h; | ||
329 | rect.y = r->x; | ||
330 | rect.width = r->h; | ||
331 | rect.height = r->w; | ||
332 | } | ||
333 | ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, | ||
334 | &rect); | ||
335 | ecore_x_xregion_free(ee->engine.x.damages); | ||
336 | ee->engine.x.damages = tmpr; | ||
337 | } | ||
338 | if (ee->engine.x.damages) | ||
339 | { | ||
340 | /* if we have a damage pixmap - we can avoid exposures by | ||
341 | * disabling them just for setting the mask */ | ||
342 | ecore_x_event_mask_set(ee->prop.window, | ||
343 | ECORE_X_EVENT_MASK_KEY_DOWN | | ||
344 | ECORE_X_EVENT_MASK_KEY_UP | | ||
345 | ECORE_X_EVENT_MASK_MOUSE_DOWN | | ||
346 | ECORE_X_EVENT_MASK_MOUSE_UP | | ||
347 | ECORE_X_EVENT_MASK_MOUSE_IN | | ||
348 | ECORE_X_EVENT_MASK_MOUSE_OUT | | ||
349 | ECORE_X_EVENT_MASK_MOUSE_MOVE | | ||
350 | // ECORE_X_EVENT_MASK_WINDOW_DAMAGE | | ||
351 | ECORE_X_EVENT_MASK_WINDOW_VISIBILITY | | ||
352 | ECORE_X_EVENT_MASK_WINDOW_CONFIGURE | | ||
353 | ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE | | ||
354 | ECORE_X_EVENT_MASK_WINDOW_PROPERTY | | ||
355 | ECORE_X_EVENT_MASK_WINDOW_COLORMAP | ||
356 | ); | ||
357 | if (ee->shaped) | ||
358 | ecore_x_window_shape_mask_set(ee->prop.window, | ||
359 | ee->engine.x.mask); | ||
360 | /* and re-enable them again */ | ||
361 | ecore_x_event_mask_set(ee->prop.window, | ||
362 | ECORE_X_EVENT_MASK_KEY_DOWN | | ||
363 | ECORE_X_EVENT_MASK_KEY_UP | | ||
364 | ECORE_X_EVENT_MASK_MOUSE_DOWN | | ||
365 | ECORE_X_EVENT_MASK_MOUSE_UP | | ||
366 | ECORE_X_EVENT_MASK_MOUSE_IN | | ||
367 | ECORE_X_EVENT_MASK_MOUSE_OUT | | ||
368 | ECORE_X_EVENT_MASK_MOUSE_MOVE | | ||
369 | ECORE_X_EVENT_MASK_WINDOW_DAMAGE | | ||
370 | ECORE_X_EVENT_MASK_WINDOW_VISIBILITY | | ||
371 | ECORE_X_EVENT_MASK_WINDOW_CONFIGURE | | ||
372 | ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE | | ||
373 | ECORE_X_EVENT_MASK_WINDOW_PROPERTY | | ||
374 | ECORE_X_EVENT_MASK_WINDOW_COLORMAP | ||
375 | ); | ||
376 | ecore_x_xregion_set(ee->engine.x.damages, ee->engine.x.gc); | ||
377 | ecore_x_pixmap_paste(ee->engine.x.pmap, ee->prop.window, | ||
378 | ee->engine.x.gc, 0, 0, ee->w, ee->h, | ||
379 | 0, 0); | ||
380 | ecore_x_xregion_free(ee->engine.x.damages); | ||
381 | ee->engine.x.damages = NULL; | ||
382 | } | ||
383 | evas_render_updates_free(updates); | ||
384 | _ecore_evas_idle_timeout_update(ee); | ||
385 | rend = 1; | ||
386 | } | ||
387 | } | ||
388 | } | ||
389 | else if (((ee->visible) && (ee->draw_ok)) || | ||
390 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
391 | ((ee->should_be_visible) && (ee->prop.override))) | ||
392 | { | ||
393 | if (updates) | ||
394 | { | ||
395 | if (ee->shaped) | ||
396 | { | ||
397 | #ifdef EVAS_FRAME_QUEUING | ||
398 | evas_sync(ee->evas); | ||
399 | #endif | ||
400 | ecore_x_window_shape_mask_set(ee->prop.window, | ||
401 | ee->engine.x.mask); | ||
402 | } | ||
403 | if (ee->alpha) | ||
404 | { | ||
405 | #ifdef EVAS_FRAME_QUEUING | ||
406 | /* wait until ee->engine.x.mask being updated */ | ||
407 | // evas_sync(ee->evas); | ||
408 | #endif | ||
409 | // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); | ||
410 | } | ||
411 | evas_render_updates_free(updates); | ||
412 | _ecore_evas_idle_timeout_update(ee); | ||
413 | rend = 1; | ||
414 | } | ||
415 | } | ||
416 | else | ||
417 | evas_norender(ee->evas); | ||
418 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
419 | /* | ||
420 | if (rend) | ||
421 | { | ||
422 | static int frames = 0; | ||
423 | static double t0 = 0.0; | ||
424 | double t, td; | ||
425 | |||
426 | t = ecore_time_get(); | ||
427 | frames++; | ||
428 | if ((t - t0) > 1.0) | ||
429 | { | ||
430 | td = t - t0; | ||
431 | printf("FPS: %3.3f\n", (double)frames / td); | ||
432 | frames = 0; | ||
433 | t0 = t; | ||
434 | } | ||
435 | } | ||
436 | */ | ||
437 | |||
438 | return rend; | ||
439 | } | ||
440 | |||
441 | static void | ||
442 | _ecore_evas_x_resize_shape(Ecore_Evas *ee) | ||
443 | { | ||
444 | if (!strcmp(ee->driver, "software_x11")) | ||
445 | { | ||
446 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
447 | Evas_Engine_Info_Software_X11 *einfo; | ||
448 | |||
449 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
450 | if (einfo) | ||
451 | { | ||
452 | unsigned int foreground; | ||
453 | Ecore_X_GC gc; | ||
454 | |||
455 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
456 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
457 | foreground = 0; | ||
458 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
459 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
460 | &foreground); | ||
461 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
462 | 0, 0, ee->w, ee->h); | ||
463 | ecore_x_gc_free(gc); | ||
464 | einfo->info.mask = ee->engine.x.mask; | ||
465 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
466 | { | ||
467 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
468 | } | ||
469 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
470 | } | ||
471 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
472 | } | ||
473 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
474 | { | ||
475 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
476 | # if 0 /* XXX no shaped window support for software_16_x11 */ | ||
477 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
478 | |||
479 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
480 | if (einfo) | ||
481 | { | ||
482 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
483 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
484 | einfo->info.mask = ee->engine.x.mask; | ||
485 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
486 | { | ||
487 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
488 | } | ||
489 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
490 | } | ||
491 | # endif /* XXX no shaped window support for software_16_x11 */ | ||
492 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
493 | } | ||
494 | if (!strcmp(ee->driver, "software_8_x11")) | ||
495 | { | ||
496 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
497 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
498 | |||
499 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
500 | if (einfo) | ||
501 | { | ||
502 | unsigned int foreground; | ||
503 | Ecore_X_GC gc; | ||
504 | |||
505 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
506 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
507 | foreground = 0; | ||
508 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
509 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
510 | &foreground); | ||
511 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
512 | 0, 0, ee->w, ee->h); | ||
513 | ecore_x_gc_free(gc); | ||
514 | einfo->info.mask = ee->engine.x.mask; | ||
515 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
516 | { | ||
517 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
518 | } | ||
519 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
520 | } | ||
521 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
522 | } | ||
523 | } | ||
524 | |||
525 | /* TODO: we need to make this work for all the states, not just sticky */ | ||
526 | static Eina_Bool | ||
527 | _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
528 | { | ||
529 | Ecore_Evas *ee; | ||
530 | Ecore_X_Event_Window_Property *e; | ||
531 | |||
532 | e = event; | ||
533 | ee = ecore_event_window_match(e->win); | ||
534 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
535 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
536 | if (e->atom == ECORE_X_ATOM_NET_WM_STATE) | ||
537 | { | ||
538 | unsigned int i, num; | ||
539 | Ecore_X_Window_State *state; | ||
540 | int sticky = 0; | ||
541 | |||
542 | /* TODO: we need to move those to the end, with if statements */ | ||
543 | ee->engine.x.state.modal = 0; | ||
544 | ee->engine.x.state.maximized_v = 0; | ||
545 | ee->engine.x.state.maximized_h = 0; | ||
546 | ee->engine.x.state.shaded = 0; | ||
547 | ee->engine.x.state.skip_taskbar = 0; | ||
548 | ee->engine.x.state.skip_pager = 0; | ||
549 | ee->prop.fullscreen = 0; | ||
550 | ee->engine.x.state.fullscreen = 0; | ||
551 | ee->engine.x.state.above = 0; | ||
552 | ee->engine.x.state.below = 0; | ||
553 | |||
554 | ecore_x_netwm_window_state_get(e->win, &state, &num); | ||
555 | if (state) | ||
556 | { | ||
557 | for (i = 0; i < num; i++) | ||
558 | { | ||
559 | switch (state[i]) | ||
560 | { | ||
561 | case ECORE_X_WINDOW_STATE_MODAL: | ||
562 | ee->engine.x.state.modal = 1; | ||
563 | break; | ||
564 | case ECORE_X_WINDOW_STATE_STICKY: | ||
565 | if (ee->prop.sticky && ee->engine.x.state.sticky) | ||
566 | break; | ||
567 | |||
568 | sticky = 1; | ||
569 | ee->prop.sticky = 1; | ||
570 | ee->engine.x.state.sticky = 1; | ||
571 | if (ee->func.fn_sticky) ee->func.fn_sticky(ee); | ||
572 | break; | ||
573 | case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: | ||
574 | ee->engine.x.state.maximized_v = 1; | ||
575 | break; | ||
576 | case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: | ||
577 | ee->engine.x.state.maximized_h = 1; | ||
578 | break; | ||
579 | case ECORE_X_WINDOW_STATE_SHADED: | ||
580 | ee->engine.x.state.shaded = 1; | ||
581 | break; | ||
582 | case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: | ||
583 | ee->engine.x.state.skip_taskbar = 1; | ||
584 | break; | ||
585 | case ECORE_X_WINDOW_STATE_SKIP_PAGER: | ||
586 | ee->engine.x.state.skip_pager = 1; | ||
587 | break; | ||
588 | case ECORE_X_WINDOW_STATE_FULLSCREEN: | ||
589 | ee->prop.fullscreen = 1; | ||
590 | ee->engine.x.state.fullscreen = 1; | ||
591 | break; | ||
592 | case ECORE_X_WINDOW_STATE_ABOVE: | ||
593 | ee->engine.x.state.above = 1; | ||
594 | break; | ||
595 | case ECORE_X_WINDOW_STATE_BELOW: | ||
596 | ee->engine.x.state.below = 1; | ||
597 | break; | ||
598 | default: | ||
599 | break; | ||
600 | } | ||
601 | } | ||
602 | free(state); | ||
603 | } | ||
604 | |||
605 | if ((ee->prop.sticky) && (!sticky)) | ||
606 | { | ||
607 | ee->prop.sticky = 0; | ||
608 | ee->engine.x.state.sticky = 0; | ||
609 | if (ee->func.fn_unsticky) ee->func.fn_unsticky(ee); | ||
610 | } | ||
611 | } | ||
612 | |||
613 | return ECORE_CALLBACK_PASS_ON; | ||
614 | } | ||
615 | |||
616 | static Eina_Bool | ||
617 | _ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
618 | { | ||
619 | Ecore_Evas *ee; | ||
620 | Ecore_X_Event_Window_Visibility_Change *e; | ||
621 | |||
622 | e = event; | ||
623 | ee = ecore_event_window_match(e->win); | ||
624 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
625 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
626 | // printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured); | ||
627 | if (e->fully_obscured) | ||
628 | { | ||
629 | /* FIXME: round trip */ | ||
630 | if (!ecore_x_screen_is_composited(ee->engine.x.screen_num)) | ||
631 | ee->draw_ok = 0; | ||
632 | } | ||
633 | else | ||
634 | ee->draw_ok = 1; | ||
635 | return ECORE_CALLBACK_PASS_ON; | ||
636 | } | ||
637 | |||
638 | static Eina_Bool | ||
639 | _ecore_evas_x_event_client_message(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
640 | { | ||
641 | Ecore_Evas *ee; | ||
642 | Ecore_X_Event_Client_Message *e; | ||
643 | |||
644 | e = event; | ||
645 | if (e->format != 32) return ECORE_CALLBACK_PASS_ON; | ||
646 | if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_BEGIN) | ||
647 | { | ||
648 | ee = ecore_event_window_match(e->data.l[0]); | ||
649 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
650 | if (e->data.l[0] != (long)ee->prop.window) | ||
651 | return ECORE_CALLBACK_PASS_ON; | ||
652 | if (!ee->engine.x.sync_began) | ||
653 | { | ||
654 | // qeue a damage + draw. work around an event re-ordering thing. | ||
655 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
656 | } | ||
657 | ee->engine.x.sync_began = 1; | ||
658 | ee->engine.x.sync_cancel = 0; | ||
659 | } | ||
660 | else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_END) | ||
661 | { | ||
662 | ee = ecore_event_window_match(e->data.l[0]); | ||
663 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
664 | if (e->data.l[0] != (long)ee->prop.window) | ||
665 | return ECORE_CALLBACK_PASS_ON; | ||
666 | ee->engine.x.sync_began = 0; | ||
667 | ee->engine.x.sync_cancel = 0; | ||
668 | } | ||
669 | else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_CANCEL) | ||
670 | { | ||
671 | ee = ecore_event_window_match(e->data.l[0]); | ||
672 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
673 | if (e->data.l[0] != (long)ee->prop.window) | ||
674 | return ECORE_CALLBACK_PASS_ON; | ||
675 | ee->engine.x.sync_began = 0; | ||
676 | ee->engine.x.sync_cancel = 1; | ||
677 | } | ||
678 | else if ((e->message_type == ECORE_X_ATOM_WM_PROTOCOLS) && | ||
679 | (e->data.l[0] == (int)ECORE_X_ATOM_NET_WM_SYNC_REQUEST)) | ||
680 | { | ||
681 | ee = ecore_event_window_match(e->win); | ||
682 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
683 | ee->engine.x.netwm_sync_val_lo = (unsigned int)e->data.l[2]; | ||
684 | ee->engine.x.netwm_sync_val_hi = (int)e->data.l[3]; | ||
685 | ee->engine.x.netwm_sync_set = 1; | ||
686 | } | ||
687 | return ECORE_CALLBACK_PASS_ON; | ||
688 | } | ||
689 | |||
690 | static Eina_Bool | ||
691 | _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
692 | { | ||
693 | Ecore_Evas *ee; | ||
694 | Ecore_X_Event_Mouse_In *e; | ||
695 | |||
696 | e = event; | ||
697 | ee = ecore_event_window_match(e->win); | ||
698 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
699 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
700 | /* { */ | ||
701 | /* time_t t; */ | ||
702 | /* char *ct; */ | ||
703 | |||
704 | /* const char *modes[] = { */ | ||
705 | /* "MODE_NORMAL", */ | ||
706 | /* "MODE_WHILE_GRABBED", */ | ||
707 | /* "MODE_GRAB", */ | ||
708 | /* "MODE_UNGRAB" */ | ||
709 | /* }; */ | ||
710 | /* const char *details[] = { */ | ||
711 | /* "DETAIL_ANCESTOR", */ | ||
712 | /* "DETAIL_VIRTUAL", */ | ||
713 | /* "DETAIL_INFERIOR", */ | ||
714 | /* "DETAIL_NON_LINEAR", */ | ||
715 | /* "DETAIL_NON_LINEAR_VIRTUAL", */ | ||
716 | /* "DETAIL_POINTER", */ | ||
717 | /* "DETAIL_POINTER_ROOT", */ | ||
718 | /* "DETAIL_DETAIL_NONE" */ | ||
719 | /* }; */ | ||
720 | /* t = time(NULL); */ | ||
721 | /* ct = ctime(&t); */ | ||
722 | /* ct[strlen(ct) - 1] = 0; */ | ||
723 | /* printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n", */ | ||
724 | /* e->win, e->event_win, */ | ||
725 | /* ct, */ | ||
726 | /* modes[e->mode], */ | ||
727 | /* details[e->detail]); */ | ||
728 | /* } */ | ||
729 | // disable. causes more problems than it fixes | ||
730 | // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || | ||
731 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) | ||
732 | // return 0; | ||
733 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ | ||
734 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
735 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | ||
736 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | ||
737 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
738 | return ECORE_CALLBACK_PASS_ON; | ||
739 | } | ||
740 | |||
741 | static Eina_Bool | ||
742 | _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
743 | { | ||
744 | Ecore_Evas *ee; | ||
745 | Ecore_X_Event_Mouse_Out *e; | ||
746 | |||
747 | e = event; | ||
748 | ee = ecore_event_window_match(e->win); | ||
749 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
750 | /* pass on event */ | ||
751 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
752 | /* { */ | ||
753 | /* time_t t; */ | ||
754 | /* char *ct; */ | ||
755 | |||
756 | /* const char *modes[] = { */ | ||
757 | /* "MODE_NORMAL", */ | ||
758 | /* "MODE_WHILE_GRABBED", */ | ||
759 | /* "MODE_GRAB", */ | ||
760 | /* "MODE_UNGRAB" */ | ||
761 | /* }; */ | ||
762 | /* const char *details[] = { */ | ||
763 | /* "DETAIL_ANCESTOR", */ | ||
764 | /* "DETAIL_VIRTUAL", */ | ||
765 | /* "DETAIL_INFERIOR", */ | ||
766 | /* "DETAIL_NON_LINEAR", */ | ||
767 | /* "DETAIL_NON_LINEAR_VIRTUAL", */ | ||
768 | /* "DETAIL_POINTER", */ | ||
769 | /* "DETAIL_POINTER_ROOT", */ | ||
770 | /* "DETAIL_DETAIL_NONE" */ | ||
771 | /* }; */ | ||
772 | /* t = time(NULL); */ | ||
773 | /* ct = ctime(&t); */ | ||
774 | /* ct[strlen(ct) - 1] = 0; */ | ||
775 | /* printf("@@ ->OUT 0x%x 0x%x %s md=%s dt=%s\n", */ | ||
776 | /* e->win, e->event_win, */ | ||
777 | /* ct, */ | ||
778 | /* modes[e->mode], */ | ||
779 | /* details[e->detail]); */ | ||
780 | /* } */ | ||
781 | // disable. causes more problems than it fixes | ||
782 | // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || | ||
783 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) | ||
784 | // return 0; | ||
785 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ | ||
786 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | ||
787 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
788 | if (e->mode == ECORE_X_EVENT_MODE_GRAB) | ||
789 | evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); | ||
790 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
791 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
792 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
793 | return ECORE_CALLBACK_PASS_ON; | ||
794 | } | ||
795 | |||
796 | static Eina_Bool | ||
797 | _ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
798 | { | ||
799 | Ecore_Evas *ee; | ||
800 | Ecore_X_Event_Window_Focus_In *e; | ||
801 | |||
802 | e = event; | ||
803 | ee = ecore_event_window_match(e->win); | ||
804 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
805 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
806 | if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON; | ||
807 | ee->prop.focused = 1; | ||
808 | evas_focus_in(ee->evas); | ||
809 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
810 | return ECORE_CALLBACK_PASS_ON; | ||
811 | } | ||
812 | |||
813 | static Eina_Bool | ||
814 | _ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
815 | { | ||
816 | Ecore_Evas *ee; | ||
817 | Ecore_X_Event_Window_Focus_Out *e; | ||
818 | |||
819 | e = event; | ||
820 | ee = ecore_event_window_match(e->win); | ||
821 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
822 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
823 | if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON; | ||
824 | // if (ee->prop.fullscreen) | ||
825 | // ecore_x_window_focus(ee->prop.window); | ||
826 | evas_focus_out(ee->evas); | ||
827 | ee->prop.focused = 0; | ||
828 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
829 | return ECORE_CALLBACK_PASS_ON; | ||
830 | } | ||
831 | |||
832 | static Eina_Bool | ||
833 | _ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
834 | { | ||
835 | Ecore_Evas *ee; | ||
836 | Ecore_X_Event_Window_Damage *e; | ||
837 | |||
838 | e = event; | ||
839 | ee = ecore_event_window_match(e->win); | ||
840 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
841 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
842 | if (ee->engine.x.using_bg_pixmap) return ECORE_CALLBACK_PASS_ON; | ||
843 | // printf("EXPOSE %p [%i] %i %i %ix%i\n", ee, ee->prop.avoid_damage, e->x, e->y, e->w, e->h); | ||
844 | if (ee->prop.avoid_damage) | ||
845 | { | ||
846 | Ecore_X_Rectangle rect; | ||
847 | Ecore_X_XRegion *tmpr; | ||
848 | |||
849 | if (!ee->engine.x.damages) | ||
850 | ee->engine.x.damages = ecore_x_xregion_new(); | ||
851 | tmpr = ecore_x_xregion_new(); | ||
852 | rect.x = e->x; | ||
853 | rect.y = e->y; | ||
854 | rect.width = e->w; | ||
855 | rect.height = e->h; | ||
856 | ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect); | ||
857 | ecore_x_xregion_free(ee->engine.x.damages); | ||
858 | ee->engine.x.damages = tmpr; | ||
859 | /* no - this breaks things badly. disable. Ecore_X_Rectangle != XRectangle - see | ||
860 | * the typedefs in x's headers and ecore_x's. also same with Region - it's a pointer in x - not an X ID | ||
861 | Ecore_X_Rectangle rect; | ||
862 | Ecore_X_XRegion *tmpr; | ||
863 | |||
864 | if (!ee->engine.x.damages) ee->engine.x.damages = ecore_x_xregion_new(); | ||
865 | tmpr = ecore_x_xregion_new(); | ||
866 | rect.x = e->x; | ||
867 | rect.y = e->y; | ||
868 | rect.width = e->w; | ||
869 | rect.height = e->h; | ||
870 | ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect); | ||
871 | ecore_x_xregion_free(ee->engine.x.damages); | ||
872 | ee->engine.x.damages = tmpr; | ||
873 | */ | ||
874 | } | ||
875 | else | ||
876 | { | ||
877 | if (ee->rotation == 0) | ||
878 | evas_damage_rectangle_add(ee->evas, e->x, e->y, e->w, e->h); | ||
879 | else if (ee->rotation == 90) | ||
880 | evas_damage_rectangle_add(ee->evas, | ||
881 | ee->h - e->y - e->h, e->x, e->h, e->w); | ||
882 | else if (ee->rotation == 180) | ||
883 | evas_damage_rectangle_add(ee->evas, ee->w - e->x - e->w, | ||
884 | ee->h - e->y - e->h, e->w, e->h); | ||
885 | else if (ee->rotation == 270) | ||
886 | evas_damage_rectangle_add(ee->evas, e->y, ee->w - e->x - e->w, | ||
887 | e->h, e->w); | ||
888 | } | ||
889 | return ECORE_CALLBACK_PASS_ON; | ||
890 | } | ||
891 | |||
892 | static Eina_Bool | ||
893 | _ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
894 | { | ||
895 | Ecore_Evas *ee; | ||
896 | Ecore_X_Event_Window_Destroy *e; | ||
897 | |||
898 | e = event; | ||
899 | ee = ecore_event_window_match(e->win); | ||
900 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
901 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
902 | if (ee->func.fn_destroy) ee->func.fn_destroy(ee); | ||
903 | _ecore_evas_x_sync_clear(ee); | ||
904 | ecore_evas_free(ee); | ||
905 | return ECORE_CALLBACK_PASS_ON; | ||
906 | } | ||
907 | |||
908 | static Eina_Bool | ||
909 | _ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
910 | { | ||
911 | Ecore_Evas *ee; | ||
912 | Ecore_X_Event_Window_Configure *e; | ||
913 | |||
914 | e = event; | ||
915 | ee = ecore_event_window_match(e->win); | ||
916 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
917 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
918 | if (ee->engine.x.direct_resize) return ECORE_CALLBACK_PASS_ON; | ||
919 | |||
920 | ee->engine.x.configure_coming = 0; | ||
921 | if ((e->from_wm) || (ee->prop.override)) | ||
922 | { | ||
923 | if ((ee->x != e->x) || (ee->y != e->y)) | ||
924 | { | ||
925 | ee->x = e->x; | ||
926 | ee->y = e->y; | ||
927 | ee->req.x = ee->x; | ||
928 | ee->req.y = ee->y; | ||
929 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
930 | } | ||
931 | } | ||
932 | if ((ee->w != e->w) || (ee->h != e->h)) | ||
933 | { | ||
934 | ee->w = e->w; | ||
935 | ee->h = e->h; | ||
936 | ee->req.w = ee->w; | ||
937 | ee->req.h = ee->h; | ||
938 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
939 | { | ||
940 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
941 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
942 | } | ||
943 | else | ||
944 | { | ||
945 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
946 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
947 | } | ||
948 | if (ee->prop.avoid_damage) | ||
949 | { | ||
950 | int pdam; | ||
951 | |||
952 | pdam = ecore_evas_avoid_damage_get(ee); | ||
953 | ecore_evas_avoid_damage_set(ee, 0); | ||
954 | ecore_evas_avoid_damage_set(ee, pdam); | ||
955 | } | ||
956 | if ((ee->shaped) || (ee->alpha)) | ||
957 | _ecore_evas_x_resize_shape(ee); | ||
958 | if ((ee->expecting_resize.w > 0) && (ee->expecting_resize.h > 0)) | ||
959 | { | ||
960 | if ((ee->expecting_resize.w == ee->w) && | ||
961 | (ee->expecting_resize.h == ee->h)) | ||
962 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
963 | ecore_x_current_time_get()); | ||
964 | ee->expecting_resize.w = 0; | ||
965 | ee->expecting_resize.h = 0; | ||
966 | } | ||
967 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
968 | } | ||
969 | return ECORE_CALLBACK_PASS_ON; | ||
970 | } | ||
971 | |||
972 | static Eina_Bool | ||
973 | _ecore_evas_x_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
974 | { | ||
975 | Ecore_Evas *ee; | ||
976 | Ecore_X_Event_Window_Delete_Request *e; | ||
977 | |||
978 | e = event; | ||
979 | ee = ecore_event_window_match(e->win); | ||
980 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
981 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
982 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
983 | return ECORE_CALLBACK_PASS_ON; | ||
984 | } | ||
985 | |||
986 | static Eina_Bool | ||
987 | _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
988 | { | ||
989 | Ecore_Evas *ee; | ||
990 | Ecore_X_Event_Window_Show *e; | ||
991 | static int first_map_bug = -1; | ||
992 | |||
993 | e = event; | ||
994 | ee = ecore_event_window_match(e->win); | ||
995 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
996 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
997 | if (first_map_bug < 0) | ||
998 | { | ||
999 | char *bug = NULL; | ||
1000 | |||
1001 | if ((bug = getenv("ECORE_EVAS_GL_FIRST_MAP_BUG"))) | ||
1002 | first_map_bug = atoi(bug); | ||
1003 | else | ||
1004 | first_map_bug = 0; | ||
1005 | } | ||
1006 | if ((first_map_bug) && (!strcmp(ee->driver, "opengl_x11"))) | ||
1007 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1008 | if (ee->visible) return ECORE_CALLBACK_PASS_ON; | ||
1009 | // if (ee->visible) return ECORE_CALLBACK_DONE; | ||
1010 | // printf("SHOW EVENT %p\n", ee); | ||
1011 | ee->visible = 1; | ||
1012 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
1013 | return ECORE_CALLBACK_PASS_ON; | ||
1014 | } | ||
1015 | |||
1016 | static Eina_Bool | ||
1017 | _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1018 | { | ||
1019 | Ecore_Evas *ee; | ||
1020 | Ecore_X_Event_Window_Hide *e; | ||
1021 | |||
1022 | e = event; | ||
1023 | ee = ecore_event_window_match(e->win); | ||
1024 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1025 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1026 | if (!ee->visible) return ECORE_CALLBACK_PASS_ON; | ||
1027 | // if (!ee->visible) return ECORE_CALLBACK_DONE; | ||
1028 | // printf("HIDE EVENT %p\n", ee); | ||
1029 | ee->visible = 0; | ||
1030 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
1031 | return ECORE_CALLBACK_PASS_ON; | ||
1032 | } | ||
1033 | |||
1034 | /* FIXME, should be in idler */ | ||
1035 | /* FIXME, round trip */ | ||
1036 | static void | ||
1037 | _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee) | ||
1038 | { | ||
1039 | ecore_x_icccm_size_pos_hints_set(ee->prop.window, | ||
1040 | ee->prop.request_pos /*request_pos */, | ||
1041 | ECORE_X_GRAVITY_NW /* gravity */, | ||
1042 | ee->prop.min.w /* min_w */, | ||
1043 | ee->prop.min.h /* min_h */, | ||
1044 | ee->prop.max.w /* max_w */, | ||
1045 | ee->prop.max.h /* max_h */, | ||
1046 | ee->prop.base.w /* base_w */, | ||
1047 | ee->prop.base.h /* base_h */, | ||
1048 | ee->prop.step.w /* step_x */, | ||
1049 | ee->prop.step.h /* step_y */, | ||
1050 | 0 /* min_aspect */, | ||
1051 | 0 /* max_aspect */); | ||
1052 | } | ||
1053 | |||
1054 | /* FIXME, should be in idler */ | ||
1055 | static void | ||
1056 | _ecore_evas_x_state_update(Ecore_Evas *ee) | ||
1057 | { | ||
1058 | Ecore_X_Window_State state[10]; | ||
1059 | int num = 0; | ||
1060 | |||
1061 | /* | ||
1062 | if (bd->client.netwm.state.modal) | ||
1063 | state[num++] = ECORE_X_WINDOW_STATE_MODAL; | ||
1064 | */ | ||
1065 | if (ee->engine.x.state.sticky) | ||
1066 | state[num++] = ECORE_X_WINDOW_STATE_STICKY; | ||
1067 | /* | ||
1068 | if (bd->client.netwm.state.maximized_v) | ||
1069 | state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; | ||
1070 | if (bd->client.netwm.state.maximized_h) | ||
1071 | state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; | ||
1072 | if (bd->client.netwm.state.shaded) | ||
1073 | state[num++] = ECORE_X_WINDOW_STATE_SHADED; | ||
1074 | if (bd->client.netwm.state.skip_taskbar) | ||
1075 | state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; | ||
1076 | if (bd->client.netwm.state.skip_pager) | ||
1077 | state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER; | ||
1078 | if (bd->client.netwm.state.hidden) | ||
1079 | state[num++] = ECORE_X_WINDOW_STATE_HIDDEN; | ||
1080 | */ | ||
1081 | if (ee->engine.x.state.fullscreen) | ||
1082 | state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN; | ||
1083 | if (ee->engine.x.state.above) | ||
1084 | state[num++] = ECORE_X_WINDOW_STATE_ABOVE; | ||
1085 | if (ee->engine.x.state.below) | ||
1086 | state[num++] = ECORE_X_WINDOW_STATE_BELOW; | ||
1087 | |||
1088 | ecore_x_netwm_window_state_set(ee->prop.window, state, num); | ||
1089 | } | ||
1090 | |||
1091 | static void | ||
1092 | _ecore_evas_x_layer_update(Ecore_Evas *ee) | ||
1093 | { | ||
1094 | if (ee->should_be_visible) | ||
1095 | { | ||
1096 | /* We need to send a netwm request to the wm */ | ||
1097 | /* FIXME: Do we have to remove old state before adding new? */ | ||
1098 | if (ee->prop.layer < 3) | ||
1099 | { | ||
1100 | if (ee->engine.x.state.above) | ||
1101 | { | ||
1102 | ee->engine.x.state.above = 0; | ||
1103 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1104 | ee->engine.x.win_root, | ||
1105 | ECORE_X_WINDOW_STATE_ABOVE, -1, 0); | ||
1106 | } | ||
1107 | if (!ee->engine.x.state.below) | ||
1108 | { | ||
1109 | ee->engine.x.state.below = 1; | ||
1110 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1111 | ee->engine.x.win_root, | ||
1112 | ECORE_X_WINDOW_STATE_BELOW, -1, 1); | ||
1113 | } | ||
1114 | } | ||
1115 | else if (ee->prop.layer > 5) | ||
1116 | { | ||
1117 | if (ee->engine.x.state.below) | ||
1118 | { | ||
1119 | ee->engine.x.state.below = 0; | ||
1120 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1121 | ee->engine.x.win_root, | ||
1122 | ECORE_X_WINDOW_STATE_BELOW, -1, 0); | ||
1123 | } | ||
1124 | if (!ee->engine.x.state.above) | ||
1125 | { | ||
1126 | ee->engine.x.state.above = 1; | ||
1127 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1128 | ee->engine.x.win_root, | ||
1129 | ECORE_X_WINDOW_STATE_ABOVE, -1, 1); | ||
1130 | } | ||
1131 | } | ||
1132 | else | ||
1133 | { | ||
1134 | if (ee->engine.x.state.below) | ||
1135 | { | ||
1136 | ee->engine.x.state.below = 0; | ||
1137 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1138 | ee->engine.x.win_root, | ||
1139 | ECORE_X_WINDOW_STATE_BELOW, -1, 0); | ||
1140 | } | ||
1141 | if (ee->engine.x.state.above) | ||
1142 | { | ||
1143 | ee->engine.x.state.above = 0; | ||
1144 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1145 | ee->engine.x.win_root, | ||
1146 | ECORE_X_WINDOW_STATE_ABOVE, -1, 0); | ||
1147 | } | ||
1148 | } | ||
1149 | } | ||
1150 | else | ||
1151 | { | ||
1152 | /* Just set the state */ | ||
1153 | if (ee->prop.layer < 3) | ||
1154 | { | ||
1155 | if ((ee->engine.x.state.above) || (!ee->engine.x.state.below)) | ||
1156 | { | ||
1157 | ee->engine.x.state.above = 0; | ||
1158 | ee->engine.x.state.below = 1; | ||
1159 | _ecore_evas_x_state_update(ee); | ||
1160 | } | ||
1161 | } | ||
1162 | else if (ee->prop.layer > 5) | ||
1163 | { | ||
1164 | if ((!ee->engine.x.state.above) || (ee->engine.x.state.below)) | ||
1165 | { | ||
1166 | ee->engine.x.state.above = 1; | ||
1167 | ee->engine.x.state.below = 0; | ||
1168 | _ecore_evas_x_state_update(ee); | ||
1169 | } | ||
1170 | } | ||
1171 | else | ||
1172 | { | ||
1173 | if ((ee->engine.x.state.above) || (ee->engine.x.state.below)) | ||
1174 | { | ||
1175 | ee->engine.x.state.above = 0; | ||
1176 | ee->engine.x.state.below = 0; | ||
1177 | _ecore_evas_x_state_update(ee); | ||
1178 | } | ||
1179 | } | ||
1180 | } | ||
1181 | /* FIXME: Set gnome layer */ | ||
1182 | } | ||
1183 | |||
1184 | static int | ||
1185 | _ecore_evas_x_init(void) | ||
1186 | { | ||
1187 | _ecore_evas_init_count++; | ||
1188 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
1189 | ecore_evas_event_handlers[0] = | ||
1190 | ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, | ||
1191 | _ecore_evas_x_event_mouse_in, NULL); | ||
1192 | ecore_evas_event_handlers[1] = | ||
1193 | ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, | ||
1194 | _ecore_evas_x_event_mouse_out, NULL); | ||
1195 | ecore_evas_event_handlers[2] = | ||
1196 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, | ||
1197 | _ecore_evas_x_event_window_focus_in, NULL); | ||
1198 | ecore_evas_event_handlers[3] = | ||
1199 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, | ||
1200 | _ecore_evas_x_event_window_focus_out, NULL); | ||
1201 | ecore_evas_event_handlers[4] = | ||
1202 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, | ||
1203 | _ecore_evas_x_event_window_damage, NULL); | ||
1204 | ecore_evas_event_handlers[5] = | ||
1205 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, | ||
1206 | _ecore_evas_x_event_window_destroy, NULL); | ||
1207 | ecore_evas_event_handlers[6] = | ||
1208 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, | ||
1209 | _ecore_evas_x_event_window_configure, NULL); | ||
1210 | ecore_evas_event_handlers[7] = | ||
1211 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, | ||
1212 | _ecore_evas_x_event_window_delete_request, NULL); | ||
1213 | ecore_evas_event_handlers[8] = | ||
1214 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, | ||
1215 | _ecore_evas_x_event_window_show, NULL); | ||
1216 | ecore_evas_event_handlers[9] = | ||
1217 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, | ||
1218 | _ecore_evas_x_event_window_hide, NULL); | ||
1219 | ecore_evas_event_handlers[10] = | ||
1220 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, | ||
1221 | _ecore_evas_x_event_property_change, NULL); | ||
1222 | ecore_evas_event_handlers[11] = | ||
1223 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, | ||
1224 | _ecore_evas_x_event_visibility_change, NULL); | ||
1225 | ecore_evas_event_handlers[12] = | ||
1226 | ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, | ||
1227 | _ecore_evas_x_event_client_message, NULL); | ||
1228 | ecore_event_evas_init(); | ||
1229 | return _ecore_evas_init_count; | ||
1230 | } | ||
1231 | |||
1232 | static void | ||
1233 | _ecore_evas_x_free(Ecore_Evas *ee) | ||
1234 | { | ||
1235 | _ecore_evas_x_group_leader_unset(ee); | ||
1236 | _ecore_evas_x_sync_set(ee); | ||
1237 | if (ee->engine.x.win_shaped_input) | ||
1238 | ecore_x_window_free(ee->engine.x.win_shaped_input); | ||
1239 | ecore_x_window_free(ee->prop.window); | ||
1240 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
1241 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1242 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
1243 | if (ee->engine.x.damages) ecore_x_xregion_free(ee->engine.x.damages); | ||
1244 | ee->engine.x.pmap = 0; | ||
1245 | ee->engine.x.mask = 0; | ||
1246 | ee->engine.x.gc = 0; | ||
1247 | ee->engine.x.damages = NULL; | ||
1248 | ecore_event_window_unregister(ee->prop.window); | ||
1249 | while (ee->engine.x.win_extra) | ||
1250 | { | ||
1251 | Ecore_X_Window *winp; | ||
1252 | |||
1253 | winp = ee->engine.x.win_extra->data; | ||
1254 | ee->engine.x.win_extra = | ||
1255 | eina_list_remove_list(ee->engine.x.win_extra, ee->engine.x.win_extra); | ||
1256 | ecore_event_window_unregister(*winp); | ||
1257 | free(winp); | ||
1258 | } | ||
1259 | _ecore_evas_x_shutdown(); | ||
1260 | ecore_x_shutdown(); | ||
1261 | } | ||
1262 | |||
1263 | static void | ||
1264 | _ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
1265 | { | ||
1266 | ee->func.fn_delete_request = func; | ||
1267 | _ecore_evas_x_protocols_set(ee); | ||
1268 | _ecore_evas_x_sync_set(ee); | ||
1269 | } | ||
1270 | |||
1271 | static void | ||
1272 | _ecore_evas_x_move(Ecore_Evas *ee, int x, int y) | ||
1273 | { | ||
1274 | ee->req.x = x; | ||
1275 | ee->req.y = y; | ||
1276 | if (ee->engine.x.direct_resize) | ||
1277 | { | ||
1278 | if (!ee->engine.x.managed) | ||
1279 | { | ||
1280 | if ((x != ee->x) || (y != ee->y)) | ||
1281 | { | ||
1282 | ee->x = x; | ||
1283 | ee->y = y; | ||
1284 | ecore_x_window_move(ee->prop.window, x, y); | ||
1285 | if (!ee->should_be_visible) | ||
1286 | { | ||
1287 | /* We need to request pos */ | ||
1288 | ee->prop.request_pos = 1; | ||
1289 | _ecore_evas_x_size_pos_hints_update(ee); | ||
1290 | } | ||
1291 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1292 | } | ||
1293 | } | ||
1294 | } | ||
1295 | else | ||
1296 | { | ||
1297 | if (((ee->x != x) || (ee->y != y)) || | ||
1298 | (ee->engine.x.configure_coming)) | ||
1299 | { | ||
1300 | ee->engine.x.configure_coming = 1; | ||
1301 | if (!ee->engine.x.managed) | ||
1302 | { | ||
1303 | ee->x = x; | ||
1304 | ee->y = y; | ||
1305 | } | ||
1306 | ecore_x_window_move(ee->prop.window, x, y); | ||
1307 | } | ||
1308 | if (!ee->should_be_visible) | ||
1309 | { | ||
1310 | /* We need to request pos */ | ||
1311 | ee->prop.request_pos = 1; | ||
1312 | _ecore_evas_x_size_pos_hints_update(ee); | ||
1313 | } | ||
1314 | } | ||
1315 | } | ||
1316 | |||
1317 | static void | ||
1318 | _ecore_evas_x_managed_move(Ecore_Evas *ee, int x, int y) | ||
1319 | { | ||
1320 | ee->req.x = x; | ||
1321 | ee->req.y = y; | ||
1322 | if (ee->engine.x.direct_resize) | ||
1323 | { | ||
1324 | ee->engine.x.managed = 1; | ||
1325 | if ((x != ee->x) || (y != ee->y)) | ||
1326 | { | ||
1327 | ee->x = x; | ||
1328 | ee->y = y; | ||
1329 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1330 | } | ||
1331 | } | ||
1332 | } | ||
1333 | |||
1334 | static void | ||
1335 | _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h) | ||
1336 | { | ||
1337 | ee->req.w = w; | ||
1338 | ee->req.h = h; | ||
1339 | if (ee->engine.x.direct_resize) | ||
1340 | { | ||
1341 | if ((ee->w != w) || (ee->h != h)) | ||
1342 | { | ||
1343 | ee->w = w; | ||
1344 | ee->h = h; | ||
1345 | ecore_x_window_resize(ee->prop.window, w, h); | ||
1346 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1347 | { | ||
1348 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1349 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1350 | } | ||
1351 | else | ||
1352 | { | ||
1353 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1354 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1355 | } | ||
1356 | if (ee->prop.avoid_damage) | ||
1357 | { | ||
1358 | int pdam; | ||
1359 | |||
1360 | pdam = ecore_evas_avoid_damage_get(ee); | ||
1361 | ecore_evas_avoid_damage_set(ee, 0); | ||
1362 | ecore_evas_avoid_damage_set(ee, pdam); | ||
1363 | } | ||
1364 | if ((ee->shaped) || (ee->alpha)) | ||
1365 | _ecore_evas_x_resize_shape(ee); | ||
1366 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1367 | } | ||
1368 | } | ||
1369 | else if (((ee->w != w) || (ee->h != h)) || | ||
1370 | (ee->engine.x.configure_coming)) | ||
1371 | { | ||
1372 | ee->engine.x.configure_coming = 1; | ||
1373 | ecore_x_window_resize(ee->prop.window, w, h); | ||
1374 | } | ||
1375 | } | ||
1376 | |||
1377 | static void | ||
1378 | _ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) | ||
1379 | { | ||
1380 | ee->req.x = x; | ||
1381 | ee->req.y = y; | ||
1382 | ee->req.w = w; | ||
1383 | ee->req.h = h; | ||
1384 | if (ee->engine.x.direct_resize) | ||
1385 | { | ||
1386 | if ((ee->w != w) || (ee->h != h) || (x != ee->x) || (y != ee->y)) | ||
1387 | { | ||
1388 | int change_size = 0, change_pos = 0; | ||
1389 | |||
1390 | if ((ee->w != w) || (ee->h != h)) change_size = 1; | ||
1391 | if (!ee->engine.x.managed) | ||
1392 | { | ||
1393 | if ((x != ee->x) || (y != ee->y)) change_pos = 1; | ||
1394 | } | ||
1395 | ecore_x_window_move_resize(ee->prop.window, x, y, w, h); | ||
1396 | if (!ee->engine.x.managed) | ||
1397 | { | ||
1398 | ee->x = x; | ||
1399 | ee->y = y; | ||
1400 | } | ||
1401 | ee->w = w; | ||
1402 | ee->h = h; | ||
1403 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1404 | { | ||
1405 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1406 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1407 | } | ||
1408 | else | ||
1409 | { | ||
1410 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1411 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1412 | } | ||
1413 | if (ee->prop.avoid_damage) | ||
1414 | { | ||
1415 | int pdam; | ||
1416 | |||
1417 | pdam = ecore_evas_avoid_damage_get(ee); | ||
1418 | ecore_evas_avoid_damage_set(ee, 0); | ||
1419 | ecore_evas_avoid_damage_set(ee, pdam); | ||
1420 | } | ||
1421 | if ((ee->shaped) || (ee->alpha)) | ||
1422 | _ecore_evas_x_resize_shape(ee); | ||
1423 | if (change_pos) | ||
1424 | { | ||
1425 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1426 | } | ||
1427 | if (change_size) | ||
1428 | { | ||
1429 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1430 | } | ||
1431 | } | ||
1432 | } | ||
1433 | else if (((ee->w != w) || (ee->h != h) || (ee->x != x) || (ee->y != y)) || | ||
1434 | (ee->engine.x.configure_coming)) | ||
1435 | { | ||
1436 | ee->engine.x.configure_coming = 1; | ||
1437 | ecore_x_window_move_resize(ee->prop.window, x, y, w, h); | ||
1438 | if (!ee->engine.x.managed) | ||
1439 | { | ||
1440 | ee->x = x; | ||
1441 | ee->y = y; | ||
1442 | } | ||
1443 | } | ||
1444 | } | ||
1445 | |||
1446 | static void | ||
1447 | _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize, | ||
1448 | Evas_Engine_Info *einfo) | ||
1449 | { | ||
1450 | int rot_dif; | ||
1451 | |||
1452 | rot_dif = ee->rotation - rotation; | ||
1453 | if (rot_dif < 0) rot_dif = -rot_dif; | ||
1454 | |||
1455 | if (rot_dif != 180) | ||
1456 | { | ||
1457 | int minw, minh, maxw, maxh, basew, baseh, stepw, steph; | ||
1458 | |||
1459 | if (!evas_engine_info_set(ee->evas, einfo)) | ||
1460 | { | ||
1461 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1462 | } | ||
1463 | |||
1464 | if (!resize) | ||
1465 | { | ||
1466 | ee->engine.x.configure_coming = 1; | ||
1467 | if (!ee->prop.fullscreen) | ||
1468 | { | ||
1469 | ecore_x_window_resize(ee->prop.window, ee->req.h, ee->req.w); | ||
1470 | ee->expecting_resize.w = ee->h; | ||
1471 | ee->expecting_resize.h = ee->w; | ||
1472 | } | ||
1473 | else | ||
1474 | { | ||
1475 | int w, h; | ||
1476 | |||
1477 | ecore_x_window_size_get(ee->prop.window, &w, &h); | ||
1478 | ecore_x_window_resize(ee->prop.window, h, w); | ||
1479 | if ((rotation == 0) || (rotation == 180)) | ||
1480 | { | ||
1481 | evas_output_size_set(ee->evas, ee->req.w, ee->req.h); | ||
1482 | evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1483 | } | ||
1484 | else | ||
1485 | { | ||
1486 | evas_output_size_set(ee->evas, ee->req.h, ee->req.w); | ||
1487 | evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w); | ||
1488 | } | ||
1489 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1490 | } | ||
1491 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1492 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w); | ||
1493 | else | ||
1494 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1495 | } | ||
1496 | else | ||
1497 | { | ||
1498 | /* int w, h; */ | ||
1499 | |||
1500 | /* ecore_x_window_size_get(ee->prop.window, &w, &h); */ | ||
1501 | if ((rotation == 0) || (rotation == 180)) | ||
1502 | { | ||
1503 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1504 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1505 | } | ||
1506 | else | ||
1507 | { | ||
1508 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1509 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1510 | } | ||
1511 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1512 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1513 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1514 | else | ||
1515 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1516 | } | ||
1517 | ecore_evas_size_min_get(ee, &minw, &minh); | ||
1518 | ecore_evas_size_max_get(ee, &maxw, &maxh); | ||
1519 | ecore_evas_size_base_get(ee, &basew, &baseh); | ||
1520 | ecore_evas_size_step_get(ee, &stepw, &steph); | ||
1521 | ee->rotation = rotation; | ||
1522 | ecore_evas_size_min_set(ee, minh, minw); | ||
1523 | ecore_evas_size_max_set(ee, maxh, maxw); | ||
1524 | ecore_evas_size_base_set(ee, baseh, basew); | ||
1525 | ecore_evas_size_step_set(ee, steph, stepw); | ||
1526 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
1527 | ecore_x_current_time_get()); | ||
1528 | } | ||
1529 | else | ||
1530 | { | ||
1531 | if (!evas_engine_info_set(ee->evas, einfo)) | ||
1532 | { | ||
1533 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1534 | } | ||
1535 | ee->rotation = rotation; | ||
1536 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
1537 | ecore_x_current_time_get()); | ||
1538 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1539 | |||
1540 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1541 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1542 | else | ||
1543 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1544 | } | ||
1545 | } | ||
1546 | |||
1547 | static void | ||
1548 | _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) | ||
1549 | { | ||
1550 | if (ee->rotation == rotation) return; | ||
1551 | if (!strcmp(ee->driver, "opengl_x11")) | ||
1552 | { | ||
1553 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
1554 | Evas_Engine_Info_GL_X11 *einfo; | ||
1555 | |||
1556 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
1557 | if (!einfo) return; | ||
1558 | einfo->info.rotation = rotation; | ||
1559 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1560 | (Evas_Engine_Info *)einfo); | ||
1561 | #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
1562 | } | ||
1563 | else if (!strcmp(ee->driver, "software_x11")) | ||
1564 | { | ||
1565 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
1566 | Evas_Engine_Info_Software_X11 *einfo; | ||
1567 | |||
1568 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
1569 | if (!einfo) return; | ||
1570 | einfo->info.rotation = rotation; | ||
1571 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1572 | (Evas_Engine_Info *)einfo); | ||
1573 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
1574 | } | ||
1575 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
1576 | { | ||
1577 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
1578 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
1579 | |||
1580 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
1581 | if (!einfo) return; | ||
1582 | einfo->info.rotation = rotation; | ||
1583 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1584 | (Evas_Engine_Info *)einfo); | ||
1585 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
1586 | } | ||
1587 | else if (!strcmp(ee->driver, "software_8_x11")) | ||
1588 | { | ||
1589 | #if BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
1590 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
1591 | |||
1592 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
1593 | if (!einfo) return; | ||
1594 | einfo->info.rotation = rotation; | ||
1595 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1596 | (Evas_Engine_Info *)einfo); | ||
1597 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
1598 | } | ||
1599 | } | ||
1600 | |||
1601 | static void | ||
1602 | _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) | ||
1603 | { | ||
1604 | if ((ee->shaped == shaped)) return; | ||
1605 | if (!strcmp(ee->driver, "opengl_x11")) return; | ||
1606 | if (!strcmp(ee->driver, "software_x11")) | ||
1607 | { | ||
1608 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
1609 | Evas_Engine_Info_Software_X11 *einfo; | ||
1610 | |||
1611 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
1612 | ee->shaped = shaped; | ||
1613 | if (einfo) | ||
1614 | { | ||
1615 | if (ee->shaped) | ||
1616 | { | ||
1617 | unsigned int foreground; | ||
1618 | Ecore_X_GC gc; | ||
1619 | |||
1620 | if (!ee->engine.x.mask) | ||
1621 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
1622 | foreground = 0; | ||
1623 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
1624 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
1625 | &foreground); | ||
1626 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
1627 | 0, 0, ee->w, ee->h); | ||
1628 | ecore_x_gc_free(gc); | ||
1629 | einfo->info.mask = ee->engine.x.mask; | ||
1630 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1631 | { | ||
1632 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1633 | } | ||
1634 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1635 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1636 | } | ||
1637 | else | ||
1638 | { | ||
1639 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1640 | ee->engine.x.mask = 0; | ||
1641 | einfo->info.mask = 0; | ||
1642 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1643 | { | ||
1644 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1645 | } | ||
1646 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1647 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1648 | } | ||
1649 | } | ||
1650 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
1651 | } | ||
1652 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
1653 | { | ||
1654 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
1655 | # if 0 /* XXX no shaped window support for software_16_x11 */ | ||
1656 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
1657 | |||
1658 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
1659 | ee->shaped = shaped; | ||
1660 | if (einfo) | ||
1661 | { | ||
1662 | if (ee->shaped) | ||
1663 | { | ||
1664 | ee->engine.x.mask = | ||
1665 | ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
1666 | einfo->info.mask = ee->engine.x.mask; | ||
1667 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1668 | { | ||
1669 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1670 | } | ||
1671 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1672 | } | ||
1673 | else | ||
1674 | { | ||
1675 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1676 | ee->engine.x.mask = 0; | ||
1677 | einfo->info.mask = 0; | ||
1678 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1679 | { | ||
1680 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1681 | } | ||
1682 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1683 | } | ||
1684 | } | ||
1685 | # endif /* XXX no shaped window support for software_16_x11 */ | ||
1686 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
1687 | } | ||
1688 | if (!strcmp(ee->driver, "software_8_x11")) | ||
1689 | { | ||
1690 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
1691 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
1692 | |||
1693 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
1694 | ee->shaped = shaped; | ||
1695 | if (einfo) | ||
1696 | { | ||
1697 | if (ee->shaped) | ||
1698 | { | ||
1699 | unsigned int foreground; | ||
1700 | Ecore_X_GC gc; | ||
1701 | |||
1702 | if (!ee->engine.x.mask) | ||
1703 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
1704 | foreground = 0; | ||
1705 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
1706 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
1707 | &foreground); | ||
1708 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
1709 | 0, 0, ee->w, ee->h); | ||
1710 | ecore_x_gc_free(gc); | ||
1711 | einfo->info.mask = ee->engine.x.mask; | ||
1712 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1713 | { | ||
1714 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1715 | } | ||
1716 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1717 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1718 | } | ||
1719 | else | ||
1720 | { | ||
1721 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1722 | ee->engine.x.mask = 0; | ||
1723 | einfo->info.mask = 0; | ||
1724 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1725 | { | ||
1726 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1727 | } | ||
1728 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1729 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1730 | } | ||
1731 | } | ||
1732 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
1733 | } | ||
1734 | } | ||
1735 | |||
1736 | /* FIXME, round trip */ | ||
1737 | static void | ||
1738 | _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) | ||
1739 | { | ||
1740 | Ecore_X_Window_Attributes att; | ||
1741 | char *id = NULL; | ||
1742 | |||
1743 | if ((ee->alpha == alpha)) return; | ||
1744 | |||
1745 | if (!strcmp(ee->driver, "software_x11")) | ||
1746 | { | ||
1747 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
1748 | Evas_Engine_Info_Software_X11 *einfo; | ||
1749 | |||
1750 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
1751 | if (!einfo) return; | ||
1752 | |||
1753 | if (!ecore_x_composite_query()) return; | ||
1754 | |||
1755 | ee->shaped = 0; | ||
1756 | ee->alpha = alpha; | ||
1757 | ecore_x_window_free(ee->prop.window); | ||
1758 | ecore_event_window_unregister(ee->prop.window); | ||
1759 | if (ee->alpha) | ||
1760 | { | ||
1761 | if (ee->prop.override) | ||
1762 | ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1763 | else | ||
1764 | ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1765 | if (!ee->engine.x.mask) | ||
1766 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
1767 | } | ||
1768 | else | ||
1769 | { | ||
1770 | if (ee->prop.override) | ||
1771 | ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1772 | else | ||
1773 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1774 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1775 | ee->engine.x.mask = 0; | ||
1776 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1777 | } | ||
1778 | |||
1779 | einfo->info.destination_alpha = alpha; | ||
1780 | |||
1781 | ecore_x_window_attributes_get(ee->prop.window, &att); | ||
1782 | einfo->info.visual = att.visual; | ||
1783 | einfo->info.colormap = att.colormap; | ||
1784 | einfo->info.depth = att.depth; | ||
1785 | |||
1786 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1787 | // ee->engine.x.mask = 0; | ||
1788 | einfo->info.mask = ee->engine.x.mask; | ||
1789 | einfo->info.drawable = ee->prop.window; | ||
1790 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1791 | { | ||
1792 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1793 | } | ||
1794 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1795 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1796 | ecore_x_input_multi_select(ee->prop.window); | ||
1797 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
1798 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
1799 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
1800 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
1801 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
1802 | if (ee->prop.borderless) | ||
1803 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
1804 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
1805 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
1806 | if (ee->prop.title) | ||
1807 | { | ||
1808 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
1809 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
1810 | } | ||
1811 | ecore_x_icccm_hints_set(ee->prop.window, | ||
1812 | 1 /* accepts_focus */, | ||
1813 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
1814 | 0 /* icon_pixmap */, | ||
1815 | 0 /* icon_mask */, | ||
1816 | 0 /* icon_window */, | ||
1817 | 0 /* window_group */, | ||
1818 | 0 /* is_urgent */); | ||
1819 | _ecore_evas_x_group_leader_update(ee); | ||
1820 | ecore_x_window_defaults_set(ee->prop.window); | ||
1821 | _ecore_evas_x_protocols_set(ee); | ||
1822 | _ecore_evas_x_sync_set(ee); | ||
1823 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
1824 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
1825 | { | ||
1826 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
1827 | /* NB: on linux this may simply empty the env as opposed to completely | ||
1828 | * unset it to being empty - unsure as solartis libc crashes looking | ||
1829 | * for the '=' char */ | ||
1830 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
1831 | } | ||
1832 | } | ||
1833 | else if (!strcmp(ee->driver, "opengl_x11")) | ||
1834 | { | ||
1835 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
1836 | Evas_Engine_Info_GL_X11 *einfo; | ||
1837 | |||
1838 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
1839 | if (!einfo) return; | ||
1840 | |||
1841 | if (!ecore_x_composite_query()) return; | ||
1842 | |||
1843 | ee->shaped = 0; | ||
1844 | ee->alpha = alpha; | ||
1845 | ecore_x_window_free(ee->prop.window); | ||
1846 | ecore_event_window_unregister(ee->prop.window); | ||
1847 | ee->prop.window = 0; | ||
1848 | |||
1849 | einfo->info.destination_alpha = alpha; | ||
1850 | |||
1851 | if (ee->engine.x.win_root != 0) | ||
1852 | { | ||
1853 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
1854 | if (ecore_x_window_argb_get(ee->engine.x.win_root)) | ||
1855 | { | ||
1856 | ee->prop.window = | ||
1857 | _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, | ||
1858 | ee->req.x, ee->req.y, | ||
1859 | ee->req.w, ee->req.h, | ||
1860 | ee->prop.override, 1, NULL); | ||
1861 | } | ||
1862 | else | ||
1863 | { | ||
1864 | ee->prop.window = | ||
1865 | _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, | ||
1866 | ee->req.x, ee->req.y, | ||
1867 | ee->req.w, ee->req.h, | ||
1868 | ee->prop.override, ee->alpha, | ||
1869 | NULL); | ||
1870 | } | ||
1871 | } | ||
1872 | else | ||
1873 | { | ||
1874 | ee->prop.window = | ||
1875 | _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, | ||
1876 | ee->req.x, ee->req.y, | ||
1877 | ee->req.w, ee->req.h, | ||
1878 | ee->prop.override, ee->alpha, NULL); | ||
1879 | } | ||
1880 | |||
1881 | if (!ee->prop.window) return; | ||
1882 | /* | ||
1883 | if (ee->alpha) | ||
1884 | { | ||
1885 | if (ee->prop.override) | ||
1886 | ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1887 | else | ||
1888 | ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1889 | if (!ee->engine.x.mask) | ||
1890 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
1891 | } | ||
1892 | else | ||
1893 | { | ||
1894 | if (ee->prop.override) | ||
1895 | ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1896 | else | ||
1897 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1898 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1899 | ee->engine.x.mask = 0; | ||
1900 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1901 | } | ||
1902 | */ | ||
1903 | |||
1904 | ecore_x_window_attributes_get(ee->prop.window, &att); | ||
1905 | einfo->info.visual = att.visual; | ||
1906 | einfo->info.colormap = att.colormap; | ||
1907 | einfo->info.depth = att.depth; | ||
1908 | |||
1909 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1910 | // ee->engine.x.mask = 0; | ||
1911 | // einfo->info.mask = ee->engine.x.mask; | ||
1912 | einfo->info.drawable = ee->prop.window; | ||
1913 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1914 | { | ||
1915 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1916 | } | ||
1917 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1918 | // ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1919 | ecore_x_input_multi_select(ee->prop.window); | ||
1920 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
1921 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
1922 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
1923 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
1924 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
1925 | if (ee->prop.borderless) | ||
1926 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
1927 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
1928 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
1929 | if (ee->prop.title) | ||
1930 | { | ||
1931 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
1932 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
1933 | } | ||
1934 | ecore_x_icccm_hints_set(ee->prop.window, | ||
1935 | 1 /* accepts_focus */, | ||
1936 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
1937 | 0 /* icon_pixmap */, | ||
1938 | 0 /* icon_mask */, | ||
1939 | 0 /* icon_window */, | ||
1940 | 0 /* window_group */, | ||
1941 | 0 /* is_urgent */); | ||
1942 | _ecore_evas_x_group_leader_update(ee); | ||
1943 | ecore_x_window_defaults_set(ee->prop.window); | ||
1944 | _ecore_evas_x_protocols_set(ee); | ||
1945 | _ecore_evas_x_sync_set(ee); | ||
1946 | #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
1947 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
1948 | { | ||
1949 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
1950 | /* NB: on linux this may simply empty the env as opposed to completely | ||
1951 | * unset it to being empty - unsure as solartis libc crashes looking | ||
1952 | * for the '=' char */ | ||
1953 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
1954 | } | ||
1955 | } | ||
1956 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
1957 | { | ||
1958 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
1959 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
1960 | |||
1961 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
1962 | if (!einfo) return; | ||
1963 | |||
1964 | ee->shaped = 0; | ||
1965 | ee->alpha = alpha; | ||
1966 | ecore_x_window_free(ee->prop.window); | ||
1967 | ecore_event_window_unregister(ee->prop.window); | ||
1968 | if (ee->alpha) | ||
1969 | { | ||
1970 | if (ee->prop.override) | ||
1971 | ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1972 | else | ||
1973 | ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1974 | if (!ee->engine.x.mask) | ||
1975 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
1976 | } | ||
1977 | else | ||
1978 | { | ||
1979 | if (ee->prop.override) | ||
1980 | ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1981 | else | ||
1982 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1983 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1984 | ee->engine.x.mask = 0; | ||
1985 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1986 | } | ||
1987 | |||
1988 | # if 0 /* XXX no alpha window support for software_16_x11 */ | ||
1989 | einfo->info.destination_alpha = alpha; | ||
1990 | # endif /* XXX no alpha window support for software_16_x11 */ | ||
1991 | |||
1992 | # if 0 /* XXX no shaped window support for software_16_x11 */ | ||
1993 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1994 | // ee->engine.x.mask = 0; | ||
1995 | einfo->info.mask = ee->engine.x.mask; | ||
1996 | # endif /* XXX no shaped window support for software_16_x11 */ | ||
1997 | |||
1998 | einfo->info.drawable = ee->prop.window; | ||
1999 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2000 | { | ||
2001 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2002 | } | ||
2003 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
2004 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
2005 | ecore_x_input_multi_select(ee->prop.window); | ||
2006 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
2007 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2008 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2009 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2010 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2011 | if (ee->prop.borderless) | ||
2012 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2013 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
2014 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2015 | if (ee->prop.title) | ||
2016 | { | ||
2017 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2018 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2019 | } | ||
2020 | ecore_x_icccm_hints_set(ee->prop.window, | ||
2021 | 1 /* accepts_focus */, | ||
2022 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
2023 | 0 /* icon_pixmap */, | ||
2024 | 0 /* icon_mask */, | ||
2025 | 0 /* icon_window */, | ||
2026 | 0 /* window_group */, | ||
2027 | 0 /* is_urgent */); | ||
2028 | _ecore_evas_x_group_leader_update(ee); | ||
2029 | ecore_x_window_defaults_set(ee->prop.window); | ||
2030 | _ecore_evas_x_protocols_set(ee); | ||
2031 | _ecore_evas_x_sync_set(ee); | ||
2032 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
2033 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
2034 | { | ||
2035 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
2036 | /* NB: on linux this may simply empty the env as opposed to completely | ||
2037 | * unset it to being empty - unsure as solartis libc crashes looking | ||
2038 | * for the '=' char */ | ||
2039 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
2040 | } | ||
2041 | } | ||
2042 | else if (!strcmp(ee->driver, "software_8_x11")) | ||
2043 | { | ||
2044 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
2045 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
2046 | |||
2047 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
2048 | if (!einfo) return; | ||
2049 | |||
2050 | ee->shaped = 0; | ||
2051 | ee->alpha = alpha; | ||
2052 | ecore_x_window_free(ee->prop.window); | ||
2053 | ecore_event_window_unregister(ee->prop.window); | ||
2054 | if (ee->alpha) | ||
2055 | { | ||
2056 | if (ee->prop.override) | ||
2057 | ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2058 | else | ||
2059 | ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2060 | if (!ee->engine.x.mask) | ||
2061 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
2062 | } | ||
2063 | else | ||
2064 | { | ||
2065 | if (ee->prop.override) | ||
2066 | ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2067 | else | ||
2068 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2069 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2070 | ee->engine.x.mask = 0; | ||
2071 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
2072 | } | ||
2073 | |||
2074 | einfo->info.destination_alpha = alpha; | ||
2075 | |||
2076 | ecore_x_window_attributes_get(ee->prop.window, &att); | ||
2077 | einfo->info.visual = att.visual; | ||
2078 | einfo->info.colormap = att.colormap; | ||
2079 | einfo->info.depth = att.depth; | ||
2080 | |||
2081 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2082 | // ee->engine.x.mask = 0; | ||
2083 | einfo->info.mask = ee->engine.x.mask; | ||
2084 | einfo->info.drawable = ee->prop.window; | ||
2085 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2086 | { | ||
2087 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2088 | } | ||
2089 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
2090 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
2091 | ecore_x_input_multi_select(ee->prop.window); | ||
2092 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
2093 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2094 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2095 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2096 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2097 | if (ee->prop.borderless) | ||
2098 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2099 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
2100 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2101 | if (ee->prop.title) | ||
2102 | { | ||
2103 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2104 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2105 | } | ||
2106 | ecore_x_icccm_hints_set(ee->prop.window, | ||
2107 | 1 /* accepts_focus */, | ||
2108 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
2109 | 0 /* icon_pixmap */, | ||
2110 | 0 /* icon_mask */, | ||
2111 | 0 /* icon_window */, | ||
2112 | 0 /* window_group */, | ||
2113 | 0 /* is_urgent */); | ||
2114 | _ecore_evas_x_group_leader_update(ee); | ||
2115 | ecore_x_window_defaults_set(ee->prop.window); | ||
2116 | _ecore_evas_x_protocols_set(ee); | ||
2117 | _ecore_evas_x_sync_set(ee); | ||
2118 | |||
2119 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
2120 | { | ||
2121 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
2122 | /* NB: on linux this may simply empty the env as opposed to completely | ||
2123 | * unset it to being empty - unsure as solartis libc crashes looking | ||
2124 | * for the '=' char */ | ||
2125 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
2126 | } | ||
2127 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
2128 | } | ||
2129 | } | ||
2130 | |||
2131 | static void | ||
2132 | _ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent) | ||
2133 | { | ||
2134 | if ((ee->transparent == transparent)) return; | ||
2135 | |||
2136 | if (!strcmp(ee->driver, "software_x11")) | ||
2137 | { | ||
2138 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
2139 | Evas_Engine_Info_Software_X11 *einfo; | ||
2140 | |||
2141 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2142 | if (!einfo) return; | ||
2143 | |||
2144 | ee->transparent = transparent; | ||
2145 | einfo->info.destination_alpha = transparent; | ||
2146 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2147 | { | ||
2148 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2149 | } | ||
2150 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2151 | #endif | ||
2152 | } | ||
2153 | } | ||
2154 | #endif /* BUILD_ECORE_EVAS_X11 */ | ||
2155 | |||
2156 | #ifdef BUILD_ECORE_EVAS_X11 | ||
2157 | static void | ||
2158 | _ecore_evas_x_show(Ecore_Evas *ee) | ||
2159 | { | ||
2160 | ee->should_be_visible = 1; | ||
2161 | if (ee->prop.avoid_damage) | ||
2162 | _ecore_evas_x_render(ee); | ||
2163 | _ecore_evas_x_sync_set(ee); | ||
2164 | ecore_x_window_show(ee->prop.window); | ||
2165 | if (ee->prop.fullscreen) | ||
2166 | ecore_x_window_focus(ee->prop.window); | ||
2167 | } | ||
2168 | |||
2169 | static void | ||
2170 | _ecore_evas_x_hide(Ecore_Evas *ee) | ||
2171 | { | ||
2172 | ecore_x_window_hide(ee->prop.window); | ||
2173 | ee->should_be_visible = 0; | ||
2174 | _ecore_evas_x_sync_set(ee); | ||
2175 | } | ||
2176 | |||
2177 | static void | ||
2178 | _ecore_evas_x_raise(Ecore_Evas *ee) | ||
2179 | { | ||
2180 | ecore_x_window_raise(ee->prop.window); | ||
2181 | } | ||
2182 | |||
2183 | static void | ||
2184 | _ecore_evas_x_lower(Ecore_Evas *ee) | ||
2185 | { | ||
2186 | ecore_x_window_lower(ee->prop.window); | ||
2187 | } | ||
2188 | |||
2189 | static void | ||
2190 | _ecore_evas_x_activate(Ecore_Evas *ee) | ||
2191 | { | ||
2192 | ecore_x_netwm_client_active_request(ee->engine.x.win_root, | ||
2193 | ee->prop.window, 2, 0); | ||
2194 | } | ||
2195 | |||
2196 | static void | ||
2197 | _ecore_evas_x_title_set(Ecore_Evas *ee, const char *t) | ||
2198 | { | ||
2199 | if (ee->prop.title) free(ee->prop.title); | ||
2200 | ee->prop.title = NULL; | ||
2201 | if (t) ee->prop.title = strdup(t); | ||
2202 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2203 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2204 | } | ||
2205 | |||
2206 | static void | ||
2207 | _ecore_evas_x_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
2208 | { | ||
2209 | if (ee->prop.name) free(ee->prop.name); | ||
2210 | if (ee->prop.clas) free(ee->prop.clas); | ||
2211 | ee->prop.name = NULL; | ||
2212 | ee->prop.clas = NULL; | ||
2213 | if (n) ee->prop.name = strdup(n); | ||
2214 | if (c) ee->prop.clas = strdup(c); | ||
2215 | ecore_x_icccm_name_class_set(ee->prop.window, ee->prop.name, ee->prop.clas); | ||
2216 | } | ||
2217 | |||
2218 | static void | ||
2219 | _ecore_evas_x_size_min_set(Ecore_Evas *ee, int w, int h) | ||
2220 | { | ||
2221 | if (w < 0) w = 0; | ||
2222 | if (h < 0) h = 0; | ||
2223 | if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; | ||
2224 | ee->prop.min.w = w; | ||
2225 | ee->prop.min.h = h; | ||
2226 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2227 | } | ||
2228 | |||
2229 | static void | ||
2230 | _ecore_evas_x_size_max_set(Ecore_Evas *ee, int w, int h) | ||
2231 | { | ||
2232 | if (w < 0) w = 0; | ||
2233 | if (h < 0) h = 0; | ||
2234 | if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; | ||
2235 | ee->prop.max.w = w; | ||
2236 | ee->prop.max.h = h; | ||
2237 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2238 | } | ||
2239 | |||
2240 | static void | ||
2241 | _ecore_evas_x_size_base_set(Ecore_Evas *ee, int w, int h) | ||
2242 | { | ||
2243 | if (w < 0) w = 0; | ||
2244 | if (h < 0) h = 0; | ||
2245 | if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; | ||
2246 | ee->prop.base.w = w; | ||
2247 | ee->prop.base.h = h; | ||
2248 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2249 | } | ||
2250 | |||
2251 | static void | ||
2252 | _ecore_evas_x_size_step_set(Ecore_Evas *ee, int w, int h) | ||
2253 | { | ||
2254 | if (w < 1) w = 1; | ||
2255 | if (h < 1) h = 1; | ||
2256 | if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; | ||
2257 | ee->prop.step.w = w; | ||
2258 | ee->prop.step.h = h; | ||
2259 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2260 | } | ||
2261 | |||
2262 | static void | ||
2263 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
2264 | { | ||
2265 | Ecore_Evas *ee; | ||
2266 | |||
2267 | ee = data; | ||
2268 | if (ee) ee->prop.cursor.object = NULL; | ||
2269 | } | ||
2270 | |||
2271 | static void | ||
2272 | _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
2273 | { | ||
2274 | int x, y; | ||
2275 | |||
2276 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
2277 | |||
2278 | if (!obj) | ||
2279 | { | ||
2280 | ee->prop.cursor.object = NULL; | ||
2281 | ee->prop.cursor.layer = 0; | ||
2282 | ee->prop.cursor.hot.x = 0; | ||
2283 | ee->prop.cursor.hot.y = 0; | ||
2284 | ecore_x_window_cursor_show(ee->prop.window, 1); | ||
2285 | return; | ||
2286 | } | ||
2287 | |||
2288 | ee->prop.cursor.object = obj; | ||
2289 | ee->prop.cursor.layer = layer; | ||
2290 | ee->prop.cursor.hot.x = hot_x; | ||
2291 | ee->prop.cursor.hot.y = hot_y; | ||
2292 | |||
2293 | ecore_x_window_cursor_show(ee->prop.window, 0); | ||
2294 | |||
2295 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
2296 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
2297 | evas_object_move(ee->prop.cursor.object, | ||
2298 | x - ee->prop.cursor.hot.x, | ||
2299 | y - ee->prop.cursor.hot.y); | ||
2300 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
2301 | if (evas_pointer_inside_get(ee->evas)) | ||
2302 | evas_object_show(ee->prop.cursor.object); | ||
2303 | |||
2304 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
2305 | } | ||
2306 | |||
2307 | /* | ||
2308 | * @param ee | ||
2309 | * @param layer If < 3, @a ee will be put below all other windows. | ||
2310 | * If > 5, @a ee will be "always-on-top" | ||
2311 | * If = 4, @a ee will be put in the default layer. | ||
2312 | * Acceptable values range from 1 to 255 (0 reserved for | ||
2313 | * desktop windows) | ||
2314 | */ | ||
2315 | static void | ||
2316 | _ecore_evas_x_layer_set(Ecore_Evas *ee, int layer) | ||
2317 | { | ||
2318 | if (ee->prop.layer == layer) return; | ||
2319 | |||
2320 | /* FIXME: Should this logic be here? */ | ||
2321 | if (layer < 1) | ||
2322 | layer = 1; | ||
2323 | else if (layer > 255) | ||
2324 | layer = 255; | ||
2325 | |||
2326 | ee->prop.layer = layer; | ||
2327 | _ecore_evas_x_layer_update(ee); | ||
2328 | } | ||
2329 | |||
2330 | static void | ||
2331 | _ecore_evas_x_focus_set(Ecore_Evas *ee, int on __UNUSED__) | ||
2332 | { | ||
2333 | ecore_x_window_focus(ee->prop.window); | ||
2334 | } | ||
2335 | |||
2336 | static void | ||
2337 | _ecore_evas_x_iconified_set(Ecore_Evas *ee, int on) | ||
2338 | { | ||
2339 | if (ee->prop.iconified == on) return; | ||
2340 | ee->prop.iconified = on; | ||
2341 | if (on) | ||
2342 | { | ||
2343 | ecore_x_icccm_hints_set(ee->prop.window, | ||
2344 | 1 /* accepts_focus */, | ||
2345 | ECORE_X_WINDOW_STATE_HINT_ICONIC /* initial_state */, | ||
2346 | 0 /* icon_pixmap */, | ||
2347 | 0 /* icon_mask */, | ||
2348 | 0 /* icon_window */, | ||
2349 | 0 /* window_group */, | ||
2350 | 0 /* is_urgent */); | ||
2351 | ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root); | ||
2352 | } | ||
2353 | else | ||
2354 | { | ||
2355 | ecore_x_icccm_hints_set(ee->prop.window, | ||
2356 | 1 /* accepts_focus */, | ||
2357 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
2358 | 0 /* icon_pixmap */, | ||
2359 | 0 /* icon_mask */, | ||
2360 | 0 /* icon_window */, | ||
2361 | 0 /* window_group */, | ||
2362 | 0 /* is_urgent */); | ||
2363 | ecore_evas_show(ee); | ||
2364 | } | ||
2365 | } | ||
2366 | |||
2367 | static void | ||
2368 | _ecore_evas_x_borderless_set(Ecore_Evas *ee, int on) | ||
2369 | { | ||
2370 | if (ee->prop.borderless == on) return; | ||
2371 | ee->prop.borderless = on; | ||
2372 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2373 | } | ||
2374 | |||
2375 | /* FIXME: This function changes the initial state of the ee | ||
2376 | * whilest the iconic function changes the current state! */ | ||
2377 | static void | ||
2378 | _ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn) | ||
2379 | { | ||
2380 | Ecore_X_Window_State_Hint hint; | ||
2381 | |||
2382 | if (ee->prop.withdrawn == withdrawn) return; | ||
2383 | |||
2384 | ee->prop.withdrawn = withdrawn; | ||
2385 | if (withdrawn) | ||
2386 | hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; | ||
2387 | else | ||
2388 | hint = ECORE_X_WINDOW_STATE_HINT_NORMAL; | ||
2389 | |||
2390 | ecore_x_icccm_hints_set(ee->prop.window, | ||
2391 | 1 /* accepts_focus */, | ||
2392 | hint /* initial_state */, | ||
2393 | 0 /* icon_pixmap */, | ||
2394 | 0 /* icon_mask */, | ||
2395 | 0 /* icon_window */, | ||
2396 | 0 /* window_group */, | ||
2397 | 0 /* is_urgent */); | ||
2398 | } | ||
2399 | |||
2400 | static void | ||
2401 | _ecore_evas_x_sticky_set(Ecore_Evas *ee, int sticky) | ||
2402 | { | ||
2403 | if (ee->prop.sticky == sticky) return; | ||
2404 | |||
2405 | /* We dont want to set prop.sticky here as it will cause | ||
2406 | * the sticky callback not to get called. Its set on the | ||
2407 | * property change event. | ||
2408 | * ee->prop.sticky = sticky; | ||
2409 | */ | ||
2410 | ee->engine.x.state.sticky = sticky; | ||
2411 | if (ee->should_be_visible) | ||
2412 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2413 | ECORE_X_WINDOW_STATE_STICKY, -1, sticky); | ||
2414 | else | ||
2415 | _ecore_evas_x_state_update(ee); | ||
2416 | } | ||
2417 | |||
2418 | static void | ||
2419 | _ecore_evas_x_ignore_events_set(Ecore_Evas *ee, int ignore) | ||
2420 | { | ||
2421 | if (ee->ignore_events == ignore) return; | ||
2422 | |||
2423 | ee->ignore_events = ignore; | ||
2424 | if (ee->prop.window) | ||
2425 | ecore_x_window_ignore_set(ee->prop.window, ignore); | ||
2426 | } | ||
2427 | |||
2428 | /* | ||
2429 | static void | ||
2430 | _ecore_evas_x_reinit_win(Ecore_Evas *ee) | ||
2431 | { | ||
2432 | if (!strcmp(ee->driver, "software_x11")) | ||
2433 | { | ||
2434 | #ifdef BUILD_ECORE_EVAS_X11 | ||
2435 | Evas_Engine_Info_Software_X11 *einfo; | ||
2436 | |||
2437 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2438 | if (einfo) | ||
2439 | { | ||
2440 | einfo->info.drawable = ee->prop.window; | ||
2441 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
2442 | } | ||
2443 | #endif | ||
2444 | } | ||
2445 | else if (!strcmp(ee->driver, "opengl_x11")) | ||
2446 | { | ||
2447 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
2448 | Evas_Engine_Info_GL_X11 *einfo; | ||
2449 | |||
2450 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
2451 | if (einfo) | ||
2452 | { | ||
2453 | einfo->info.drawable = ee->prop.window; | ||
2454 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
2455 | } | ||
2456 | #endif | ||
2457 | } | ||
2458 | } | ||
2459 | */ | ||
2460 | |||
2461 | static void | ||
2462 | _ecore_evas_x_override_set(Ecore_Evas *ee, int on) | ||
2463 | { | ||
2464 | if (ee->prop.override == on) return; | ||
2465 | if (ee->should_be_visible) ecore_x_window_hide(ee->prop.window); | ||
2466 | ecore_x_window_override_set(ee->prop.window, on); | ||
2467 | if (ee->should_be_visible) ecore_x_window_show(ee->prop.window); | ||
2468 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2469 | ee->prop.override = on; | ||
2470 | } | ||
2471 | |||
2472 | static void | ||
2473 | _ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on) | ||
2474 | { | ||
2475 | if (ee->prop.fullscreen == on) return; | ||
2476 | |||
2477 | /* FIXME: Detect if WM is EWMH compliant and handle properly if not, | ||
2478 | * i.e. reposition, resize, and change borderless hint */ | ||
2479 | ee->engine.x.state.fullscreen = on; | ||
2480 | if (ee->should_be_visible) | ||
2481 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2482 | ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on); | ||
2483 | else | ||
2484 | _ecore_evas_x_state_update(ee); | ||
2485 | } | ||
2486 | |||
2487 | static void | ||
2488 | _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) | ||
2489 | { | ||
2490 | if (ee->prop.avoid_damage == on) return; | ||
2491 | if (!strcmp(ee->driver, "opengl_x11")) return; | ||
2492 | |||
2493 | if (!strcmp(ee->driver, "software_x11")) | ||
2494 | { | ||
2495 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
2496 | Evas_Engine_Info_Software_X11 *einfo; | ||
2497 | |||
2498 | ee->prop.avoid_damage = on; | ||
2499 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2500 | if (einfo) | ||
2501 | { | ||
2502 | if (ee->prop.avoid_damage) | ||
2503 | { | ||
2504 | ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth); | ||
2505 | ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); | ||
2506 | einfo->info.drawable = ee->engine.x.pmap; | ||
2507 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2508 | { | ||
2509 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2510 | } | ||
2511 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
2512 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
2513 | else | ||
2514 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2515 | if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN) | ||
2516 | { | ||
2517 | ee->engine.x.using_bg_pixmap = 1; | ||
2518 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2519 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2520 | } | ||
2521 | if (ee->engine.x.direct_resize) | ||
2522 | { | ||
2523 | /* Turn this off for now | ||
2524 | ee->engine.x.using_bg_pixmap = 1; | ||
2525 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2526 | */ | ||
2527 | } | ||
2528 | } | ||
2529 | else | ||
2530 | { | ||
2531 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
2532 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
2533 | if (ee->engine.x.using_bg_pixmap) | ||
2534 | { | ||
2535 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
2536 | ee->engine.x.using_bg_pixmap = 0; | ||
2537 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2538 | } | ||
2539 | ee->engine.x.pmap = 0; | ||
2540 | ee->engine.x.gc = 0; | ||
2541 | einfo->info.drawable = ee->prop.window; | ||
2542 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2543 | { | ||
2544 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2545 | } | ||
2546 | } | ||
2547 | } | ||
2548 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
2549 | } | ||
2550 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
2551 | { | ||
2552 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
2553 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
2554 | |||
2555 | ee->prop.avoid_damage = on; | ||
2556 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
2557 | if (einfo) | ||
2558 | { | ||
2559 | if (ee->prop.avoid_damage) | ||
2560 | { | ||
2561 | ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 16); | ||
2562 | ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); | ||
2563 | einfo->info.drawable = ee->engine.x.pmap; | ||
2564 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2565 | { | ||
2566 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2567 | } | ||
2568 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
2569 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
2570 | else | ||
2571 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2572 | if (ee->engine.x.direct_resize) | ||
2573 | { | ||
2574 | /* Turn this off for now | ||
2575 | ee->engine.x.using_bg_pixmap = 1; | ||
2576 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2577 | */ | ||
2578 | } | ||
2579 | } | ||
2580 | else | ||
2581 | { | ||
2582 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
2583 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
2584 | if (ee->engine.x.using_bg_pixmap) | ||
2585 | { | ||
2586 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
2587 | ee->engine.x.using_bg_pixmap = 0; | ||
2588 | } | ||
2589 | ee->engine.x.pmap = 0; | ||
2590 | ee->engine.x.gc = 0; | ||
2591 | einfo->info.drawable = ee->prop.window; | ||
2592 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2593 | { | ||
2594 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2595 | } | ||
2596 | } | ||
2597 | } | ||
2598 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
2599 | } | ||
2600 | else if (!strcmp(ee->driver, "software_8_x11")) | ||
2601 | { | ||
2602 | #if BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
2603 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
2604 | |||
2605 | ee->prop.avoid_damage = on; | ||
2606 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
2607 | if (einfo) | ||
2608 | { | ||
2609 | if (ee->prop.avoid_damage) | ||
2610 | { | ||
2611 | ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth); | ||
2612 | ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); | ||
2613 | einfo->info.drawable = ee->engine.x.pmap; | ||
2614 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2615 | { | ||
2616 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2617 | } | ||
2618 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
2619 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
2620 | else | ||
2621 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2622 | if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN) | ||
2623 | { | ||
2624 | ee->engine.x.using_bg_pixmap = 1; | ||
2625 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2626 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2627 | } | ||
2628 | if (ee->engine.x.direct_resize) | ||
2629 | { | ||
2630 | /* Turn this off for now | ||
2631 | ee->engine.x.using_bg_pixmap = 1; | ||
2632 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2633 | */ | ||
2634 | } | ||
2635 | } | ||
2636 | else | ||
2637 | { | ||
2638 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
2639 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
2640 | if (ee->engine.x.using_bg_pixmap) | ||
2641 | { | ||
2642 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
2643 | ee->engine.x.using_bg_pixmap = 0; | ||
2644 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2645 | } | ||
2646 | ee->engine.x.pmap = 0; | ||
2647 | ee->engine.x.gc = 0; | ||
2648 | einfo->info.drawable = ee->prop.window; | ||
2649 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2650 | { | ||
2651 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2652 | } | ||
2653 | } | ||
2654 | } | ||
2655 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
2656 | } | ||
2657 | } | ||
2658 | |||
2659 | static void | ||
2660 | _ecore_evas_x_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
2661 | { | ||
2662 | if (x) *x = 0; | ||
2663 | if (y) *y = 0; | ||
2664 | ecore_x_screen_size_get(ecore_x_default_screen_get(), w, h); | ||
2665 | } | ||
2666 | |||
2667 | int | ||
2668 | _ecore_evas_x_shutdown(void) | ||
2669 | { | ||
2670 | _ecore_evas_init_count--; | ||
2671 | if (_ecore_evas_init_count == 0) | ||
2672 | { | ||
2673 | unsigned int i; | ||
2674 | |||
2675 | for (i = 0; i < sizeof(ecore_evas_event_handlers) / sizeof(Ecore_Event_Handler*); i++) | ||
2676 | { | ||
2677 | if (ecore_evas_event_handlers[i]) | ||
2678 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
2679 | } | ||
2680 | ecore_event_evas_shutdown(); | ||
2681 | } | ||
2682 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
2683 | return _ecore_evas_init_count; | ||
2684 | } | ||
2685 | |||
2686 | static Ecore_Evas_Engine_Func _ecore_x_engine_func = | ||
2687 | { | ||
2688 | _ecore_evas_x_free, | ||
2689 | NULL, | ||
2690 | NULL, | ||
2691 | NULL, | ||
2692 | NULL, | ||
2693 | _ecore_evas_x_callback_delete_request_set, | ||
2694 | NULL, | ||
2695 | NULL, | ||
2696 | NULL, | ||
2697 | NULL, | ||
2698 | NULL, | ||
2699 | NULL, | ||
2700 | NULL, | ||
2701 | NULL, | ||
2702 | NULL, | ||
2703 | _ecore_evas_x_move, | ||
2704 | _ecore_evas_x_managed_move, | ||
2705 | _ecore_evas_x_resize, | ||
2706 | _ecore_evas_x_move_resize, | ||
2707 | _ecore_evas_x_rotation_set, | ||
2708 | _ecore_evas_x_shaped_set, | ||
2709 | _ecore_evas_x_show, | ||
2710 | _ecore_evas_x_hide, | ||
2711 | _ecore_evas_x_raise, | ||
2712 | _ecore_evas_x_lower, | ||
2713 | _ecore_evas_x_activate, | ||
2714 | _ecore_evas_x_title_set, | ||
2715 | _ecore_evas_x_name_class_set, | ||
2716 | _ecore_evas_x_size_min_set, | ||
2717 | _ecore_evas_x_size_max_set, | ||
2718 | _ecore_evas_x_size_base_set, | ||
2719 | _ecore_evas_x_size_step_set, | ||
2720 | _ecore_evas_x_object_cursor_set, | ||
2721 | _ecore_evas_x_layer_set, | ||
2722 | _ecore_evas_x_focus_set, | ||
2723 | _ecore_evas_x_iconified_set, | ||
2724 | _ecore_evas_x_borderless_set, | ||
2725 | _ecore_evas_x_override_set, | ||
2726 | NULL, | ||
2727 | _ecore_evas_x_fullscreen_set, | ||
2728 | _ecore_evas_x_avoid_damage_set, | ||
2729 | _ecore_evas_x_withdrawn_set, | ||
2730 | _ecore_evas_x_sticky_set, | ||
2731 | _ecore_evas_x_ignore_events_set, | ||
2732 | _ecore_evas_x_alpha_set, | ||
2733 | _ecore_evas_x_transparent_set, | ||
2734 | |||
2735 | NULL, // render | ||
2736 | _ecore_evas_x_screen_geometry_get | ||
2737 | }; | ||
2738 | #endif /* BUILD_ECORE_EVAS_X11 */ | ||
2739 | |||
2740 | /* | ||
2741 | * FIXME: there are some round trips. Especially, we can split | ||
2742 | * ecore_x_init in 2 functions and suppress some round trips. | ||
2743 | */ | ||
2744 | |||
2745 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_OPENGL_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_16_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
2746 | static void | ||
2747 | _ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
2748 | { | ||
2749 | Ecore_Evas *ee = data; | ||
2750 | |||
2751 | if (ee->no_comp_sync) return; | ||
2752 | if (!_ecore_evas_app_comp_sync) return; | ||
2753 | if (ee->engine.x.sync_counter) | ||
2754 | { | ||
2755 | if (ee->engine.x.sync_began) | ||
2756 | { | ||
2757 | ee->engine.x.sync_val++; | ||
2758 | if (!ee->engine.x.sync_cancel) | ||
2759 | { | ||
2760 | if (!ee->semi_sync) | ||
2761 | ecore_x_sync_counter_val_wait(ee->engine.x.sync_counter, | ||
2762 | ee->engine.x.sync_val); | ||
2763 | } | ||
2764 | } | ||
2765 | } | ||
2766 | } | ||
2767 | |||
2768 | static void | ||
2769 | _ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
2770 | { | ||
2771 | Ecore_Evas *ee = data; | ||
2772 | |||
2773 | if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync)) | ||
2774 | { | ||
2775 | if (ee->engine.x.sync_counter) | ||
2776 | { | ||
2777 | if (ee->engine.x.sync_began) | ||
2778 | { | ||
2779 | if (!ee->engine.x.sync_cancel) | ||
2780 | { | ||
2781 | ecore_x_e_comp_sync_draw_size_done_send | ||
2782 | (ee->engine.x.win_root, ee->prop.window, ee->w, ee->h); | ||
2783 | } | ||
2784 | } | ||
2785 | } | ||
2786 | } | ||
2787 | if (ee->engine.x.netwm_sync_set) | ||
2788 | { | ||
2789 | ecore_x_sync_counter_2_set(ee->engine.x.netwm_sync_counter, | ||
2790 | ee->engine.x.netwm_sync_val_hi, | ||
2791 | ee->engine.x.netwm_sync_val_lo); | ||
2792 | ee->engine.x.netwm_sync_set = 0; | ||
2793 | } | ||
2794 | } | ||
2795 | #endif | ||
2796 | |||
2797 | /** | ||
2798 | * To be documented. | ||
2799 | * | ||
2800 | * FIXME: To be fixed. | ||
2801 | */ | ||
2802 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
2803 | EAPI Ecore_Evas * | ||
2804 | ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, | ||
2805 | int x, int y, int w, int h) | ||
2806 | { | ||
2807 | Evas_Engine_Info_Software_X11 *einfo; | ||
2808 | Ecore_Evas *ee; | ||
2809 | int argb = 0, rmethod; | ||
2810 | static int redraw_debug = -1; | ||
2811 | char *id = NULL; | ||
2812 | |||
2813 | rmethod = evas_render_method_lookup("software_x11"); | ||
2814 | if (!rmethod) return NULL; | ||
2815 | if (!ecore_x_init(disp_name)) return NULL; | ||
2816 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
2817 | if (!ee) return NULL; | ||
2818 | |||
2819 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
2820 | |||
2821 | _ecore_evas_x_init(); | ||
2822 | |||
2823 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
2824 | |||
2825 | ee->driver = "software_x11"; | ||
2826 | if (disp_name) ee->name = strdup(disp_name); | ||
2827 | |||
2828 | if (w < 1) w = 1; | ||
2829 | if (h < 1) h = 1; | ||
2830 | ee->x = x; | ||
2831 | ee->y = y; | ||
2832 | ee->w = w; | ||
2833 | ee->h = h; | ||
2834 | ee->req.x = ee->x; | ||
2835 | ee->req.y = ee->y; | ||
2836 | ee->req.w = ee->w; | ||
2837 | ee->req.h = ee->h; | ||
2838 | |||
2839 | ee->prop.max.w = 32767; | ||
2840 | ee->prop.max.h = 32767; | ||
2841 | ee->prop.layer = 4; | ||
2842 | ee->prop.request_pos = 0; | ||
2843 | ee->prop.sticky = 0; | ||
2844 | ee->engine.x.state.sticky = 0; | ||
2845 | |||
2846 | /* init evas here */ | ||
2847 | ee->evas = evas_new(); | ||
2848 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, | ||
2849 | _ecore_evas_x_flush_pre, ee); | ||
2850 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, | ||
2851 | _ecore_evas_x_flush_post, ee); | ||
2852 | evas_data_attach_set(ee->evas, ee); | ||
2853 | evas_output_method_set(ee->evas, rmethod); | ||
2854 | evas_output_size_set(ee->evas, w, h); | ||
2855 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
2856 | |||
2857 | ee->engine.x.win_root = parent; | ||
2858 | ee->engine.x.screen_num = 0; | ||
2859 | |||
2860 | if (parent != 0) | ||
2861 | { | ||
2862 | ee->engine.x.screen_num = 1; /* FIXME: get real scren # */ | ||
2863 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
2864 | if (ecore_x_window_argb_get(parent)) | ||
2865 | { | ||
2866 | ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); | ||
2867 | argb = 1; | ||
2868 | } | ||
2869 | else | ||
2870 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
2871 | } | ||
2872 | else | ||
2873 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
2874 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
2875 | { | ||
2876 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
2877 | /* NB: on linux this may simply empty the env as opposed to completely | ||
2878 | * unset it to being empty - unsure as solartis libc crashes looking | ||
2879 | * for the '=' char */ | ||
2880 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
2881 | } | ||
2882 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2883 | if (einfo) | ||
2884 | { | ||
2885 | Ecore_X_Screen *screen; | ||
2886 | |||
2887 | /* FIXME: this is inefficient as its 1 or more round trips */ | ||
2888 | screen = ecore_x_default_screen_get(); | ||
2889 | if (ecore_x_screen_count_get() > 1) | ||
2890 | { | ||
2891 | Ecore_X_Window *roots; | ||
2892 | int num, i; | ||
2893 | |||
2894 | num = 0; | ||
2895 | roots = ecore_x_window_root_list(&num); | ||
2896 | if (roots) | ||
2897 | { | ||
2898 | Ecore_X_Window root; | ||
2899 | |||
2900 | root = ecore_x_window_root_get(parent); | ||
2901 | for (i = 0; i < num; i++) | ||
2902 | { | ||
2903 | if (root == roots[i]) | ||
2904 | { | ||
2905 | screen = ecore_x_screen_get(i); | ||
2906 | break; | ||
2907 | } | ||
2908 | } | ||
2909 | free(roots); | ||
2910 | } | ||
2911 | } | ||
2912 | |||
2913 | einfo->info.destination_alpha = argb; | ||
2914 | |||
2915 | if (redraw_debug < 0) | ||
2916 | { | ||
2917 | if (getenv("REDRAW_DEBUG")) | ||
2918 | redraw_debug = atoi(getenv("REDRAW_DEBUG")); | ||
2919 | else | ||
2920 | redraw_debug = 0; | ||
2921 | } | ||
2922 | |||
2923 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB | ||
2924 | einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB; | ||
2925 | einfo->info.connection = ecore_x_connection_get(); | ||
2926 | einfo->info.screen = screen; | ||
2927 | # else | ||
2928 | einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB; | ||
2929 | einfo->info.connection = ecore_x_display_get(); | ||
2930 | einfo->info.screen = NULL; | ||
2931 | # endif | ||
2932 | einfo->info.drawable = ee->prop.window; | ||
2933 | |||
2934 | # ifdef EVAS_FRAME_QUEUING | ||
2935 | { | ||
2936 | char *render_mode; | ||
2937 | |||
2938 | render_mode = getenv("EVAS_RENDER_MODE"); | ||
2939 | if ((render_mode) && (!strcmp(render_mode, "non-blocking"))) | ||
2940 | einfo->render_mode = EVAS_RENDER_MODE_NONBLOCKING; | ||
2941 | } | ||
2942 | # endif | ||
2943 | |||
2944 | if (argb) | ||
2945 | { | ||
2946 | Ecore_X_Window_Attributes at; | ||
2947 | |||
2948 | ecore_x_window_attributes_get(ee->prop.window, &at); | ||
2949 | einfo->info.visual = at.visual; | ||
2950 | einfo->info.colormap = at.colormap; | ||
2951 | einfo->info.depth = at.depth; | ||
2952 | einfo->info.destination_alpha = 1; | ||
2953 | } | ||
2954 | else | ||
2955 | { | ||
2956 | einfo->info.visual = | ||
2957 | ecore_x_default_visual_get(einfo->info.connection, screen); | ||
2958 | einfo->info.colormap = | ||
2959 | ecore_x_default_colormap_get(einfo->info.connection, screen); | ||
2960 | einfo->info.depth = | ||
2961 | ecore_x_default_depth_get(einfo->info.connection, screen); | ||
2962 | einfo->info.destination_alpha = 0; | ||
2963 | } | ||
2964 | |||
2965 | einfo->info.rotation = 0; | ||
2966 | einfo->info.debug = redraw_debug; | ||
2967 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2968 | { | ||
2969 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
2970 | ecore_evas_free(ee); | ||
2971 | return NULL; | ||
2972 | } | ||
2973 | } | ||
2974 | |||
2975 | ecore_x_icccm_hints_set(ee->prop.window, | ||
2976 | 1 /* accepts_focus */, | ||
2977 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
2978 | 0 /* icon_pixmap */, | ||
2979 | 0 /* icon_mask */, | ||
2980 | 0 /* icon_window */, | ||
2981 | 0 /* window_group */, | ||
2982 | 0 /* is_urgent */); | ||
2983 | _ecore_evas_x_group_leader_set(ee); | ||
2984 | ecore_x_window_defaults_set(ee->prop.window); | ||
2985 | _ecore_evas_x_protocols_set(ee); | ||
2986 | _ecore_evas_x_sync_set(ee); | ||
2987 | |||
2988 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
2989 | _ecore_evas_register(ee); | ||
2990 | ecore_x_input_multi_select(ee->prop.window); | ||
2991 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
2992 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2993 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2994 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2995 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2996 | return ee; | ||
2997 | } | ||
2998 | #else | ||
2999 | EAPI Ecore_Evas * | ||
3000 | ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3001 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3002 | { | ||
3003 | return NULL; | ||
3004 | } | ||
3005 | #endif | ||
3006 | |||
3007 | /** | ||
3008 | * To be documented. | ||
3009 | * | ||
3010 | * FIXME: To be fixed. | ||
3011 | */ | ||
3012 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3013 | EAPI Ecore_X_Window | ||
3014 | ecore_evas_software_x11_window_get(const Ecore_Evas *ee) | ||
3015 | { | ||
3016 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3017 | } | ||
3018 | #else | ||
3019 | EAPI Ecore_X_Window | ||
3020 | ecore_evas_software_x11_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3021 | { | ||
3022 | return 0; | ||
3023 | } | ||
3024 | #endif | ||
3025 | |||
3026 | /** | ||
3027 | * To be documented. | ||
3028 | * | ||
3029 | * FIXME: To be fixed. | ||
3030 | */ | ||
3031 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3032 | EAPI void | ||
3033 | ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3034 | { | ||
3035 | ee->engine.x.direct_resize = on; | ||
3036 | if (ee->prop.avoid_damage) | ||
3037 | { | ||
3038 | if (ee->engine.x.direct_resize) | ||
3039 | { | ||
3040 | /* turn this off for now | ||
3041 | ee->engine.x.using_bg_pixmap = 1; | ||
3042 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
3043 | */ | ||
3044 | } | ||
3045 | else | ||
3046 | { | ||
3047 | /* turn this off too- bg pixmap is controlled by avoid damage directly | ||
3048 | ee->engine.x.using_bg_pixmap = 0; | ||
3049 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
3050 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
3051 | */ | ||
3052 | } | ||
3053 | } | ||
3054 | } | ||
3055 | #else | ||
3056 | EAPI void | ||
3057 | ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3058 | { | ||
3059 | } | ||
3060 | #endif | ||
3061 | |||
3062 | /** | ||
3063 | * To be documented. | ||
3064 | * | ||
3065 | * FIXME: To be fixed. | ||
3066 | */ | ||
3067 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3068 | EAPI Eina_Bool | ||
3069 | ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee) | ||
3070 | { | ||
3071 | return ee->engine.x.direct_resize; | ||
3072 | } | ||
3073 | #else | ||
3074 | EAPI Eina_Bool | ||
3075 | ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3076 | { | ||
3077 | return 0; | ||
3078 | } | ||
3079 | #endif | ||
3080 | |||
3081 | /** | ||
3082 | * To be documented. | ||
3083 | * | ||
3084 | * FIXME: To be fixed. | ||
3085 | */ | ||
3086 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3087 | EAPI void | ||
3088 | ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3089 | { | ||
3090 | Ecore_X_Window *winp; | ||
3091 | |||
3092 | winp = malloc(sizeof(Ecore_X_Window)); | ||
3093 | if (winp) | ||
3094 | { | ||
3095 | *winp = win; | ||
3096 | ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); | ||
3097 | ecore_x_input_multi_select(win); | ||
3098 | ecore_event_window_register(win, ee, ee->evas, | ||
3099 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3100 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3101 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3102 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3103 | } | ||
3104 | } | ||
3105 | #else | ||
3106 | EAPI void | ||
3107 | ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3108 | { | ||
3109 | } | ||
3110 | #endif | ||
3111 | |||
3112 | /** | ||
3113 | * To be documented. | ||
3114 | * | ||
3115 | * FIXME: To be fixed. | ||
3116 | */ | ||
3117 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3118 | EAPI Ecore_Evas * | ||
3119 | ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, | ||
3120 | int x, int y, int w, int h) | ||
3121 | { | ||
3122 | return ecore_evas_gl_x11_options_new(disp_name, parent, x, y, w, h, NULL); | ||
3123 | } | ||
3124 | |||
3125 | EAPI Ecore_Evas * | ||
3126 | ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, | ||
3127 | int x, int y, int w, int h, const int *opt) | ||
3128 | { | ||
3129 | Ecore_Evas *ee; | ||
3130 | int rmethod; | ||
3131 | char *id = NULL; | ||
3132 | |||
3133 | rmethod = evas_render_method_lookup("gl_x11"); | ||
3134 | if (!rmethod) return NULL; | ||
3135 | if (!ecore_x_init(disp_name)) return NULL; | ||
3136 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3137 | if (!ee) return NULL; | ||
3138 | |||
3139 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3140 | |||
3141 | _ecore_evas_x_init(); | ||
3142 | |||
3143 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3144 | |||
3145 | ee->driver = "opengl_x11"; | ||
3146 | if (!getenv("ECORE_EVAS_COMP_NOSEMISYNC")) | ||
3147 | ee->semi_sync = 1; // gl engine doesn't need to sync - its whole swaps | ||
3148 | // ee->no_comp_sync = 1; // gl engine doesn't need to sync - its whole swaps | ||
3149 | if (disp_name) ee->name = strdup(disp_name); | ||
3150 | |||
3151 | if (w < 1) w = 1; | ||
3152 | if (h < 1) h = 1; | ||
3153 | ee->x = x; | ||
3154 | ee->y = y; | ||
3155 | ee->w = w; | ||
3156 | ee->h = h; | ||
3157 | ee->req.x = ee->x; | ||
3158 | ee->req.y = ee->y; | ||
3159 | ee->req.w = ee->w; | ||
3160 | ee->req.h = ee->h; | ||
3161 | |||
3162 | ee->prop.max.w = 32767; | ||
3163 | ee->prop.max.h = 32767; | ||
3164 | ee->prop.layer = 4; | ||
3165 | ee->prop.request_pos = 0; | ||
3166 | ee->prop.sticky = 0; | ||
3167 | ee->engine.x.state.sticky = 0; | ||
3168 | |||
3169 | /* init evas here */ | ||
3170 | ee->evas = evas_new(); | ||
3171 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); | ||
3172 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); | ||
3173 | evas_data_attach_set(ee->evas, ee); | ||
3174 | evas_output_method_set(ee->evas, rmethod); | ||
3175 | evas_output_size_set(ee->evas, w, h); | ||
3176 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3177 | |||
3178 | if (parent == 0) parent = DefaultRootWindow(ecore_x_display_get()); | ||
3179 | ee->engine.x.win_root = parent; | ||
3180 | |||
3181 | if (ee->engine.x.win_root != 0) | ||
3182 | { | ||
3183 | ee->engine.x.screen_num = 1; /* FIXME: get real scren # */ | ||
3184 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3185 | if (ecore_x_window_argb_get(ee->engine.x.win_root)) | ||
3186 | { | ||
3187 | ee->prop.window = _ecore_evas_x_gl_window_new | ||
3188 | (ee, ee->engine.x.win_root, x, y, w, h, 0, 1, opt); | ||
3189 | } | ||
3190 | else | ||
3191 | ee->prop.window = _ecore_evas_x_gl_window_new | ||
3192 | (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt); | ||
3193 | } | ||
3194 | else | ||
3195 | ee->prop.window = _ecore_evas_x_gl_window_new | ||
3196 | (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt); | ||
3197 | if (!ee->prop.window) | ||
3198 | { | ||
3199 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3200 | ecore_evas_free(ee); | ||
3201 | return NULL; | ||
3202 | } | ||
3203 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
3204 | { | ||
3205 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
3206 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3207 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3208 | * for the '=' char */ | ||
3209 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3210 | } | ||
3211 | |||
3212 | ecore_x_icccm_hints_set(ee->prop.window, | ||
3213 | 1 /* accepts_focus */, | ||
3214 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
3215 | 0 /* icon_pixmap */, | ||
3216 | 0 /* icon_mask */, | ||
3217 | 0 /* icon_window */, | ||
3218 | 0 /* window_group */, | ||
3219 | 0 /* is_urgent */); | ||
3220 | _ecore_evas_x_group_leader_set(ee); | ||
3221 | ecore_x_window_defaults_set(ee->prop.window); | ||
3222 | _ecore_evas_x_protocols_set(ee); | ||
3223 | _ecore_evas_x_sync_set(ee); | ||
3224 | |||
3225 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
3226 | _ecore_evas_register(ee); | ||
3227 | ecore_x_input_multi_select(ee->prop.window); | ||
3228 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
3229 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3230 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3231 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3232 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3233 | |||
3234 | return ee; | ||
3235 | } | ||
3236 | #else | ||
3237 | EAPI Ecore_Evas * | ||
3238 | ecore_evas_gl_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3239 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3240 | { | ||
3241 | return NULL; | ||
3242 | } | ||
3243 | EAPI Ecore_Evas * | ||
3244 | ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3245 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, const int *opt __UNUSED__) | ||
3246 | { | ||
3247 | return NULL; | ||
3248 | } | ||
3249 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3250 | |||
3251 | /** | ||
3252 | * To be documented. | ||
3253 | * | ||
3254 | * FIXME: To be fixed. | ||
3255 | */ | ||
3256 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3257 | EAPI Ecore_X_Window | ||
3258 | ecore_evas_gl_x11_window_get(const Ecore_Evas *ee) | ||
3259 | { | ||
3260 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3261 | } | ||
3262 | #else | ||
3263 | EAPI Ecore_X_Window | ||
3264 | ecore_evas_gl_x11_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3265 | { | ||
3266 | return 0; | ||
3267 | } | ||
3268 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3269 | |||
3270 | /** | ||
3271 | * To be documented. | ||
3272 | * | ||
3273 | * FIXME: To be fixed. | ||
3274 | */ | ||
3275 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3276 | EAPI void | ||
3277 | ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3278 | { | ||
3279 | ee->engine.x.direct_resize = on; | ||
3280 | } | ||
3281 | #else | ||
3282 | EAPI void | ||
3283 | ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3284 | { | ||
3285 | } | ||
3286 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3287 | |||
3288 | /** | ||
3289 | * To be documented. | ||
3290 | * | ||
3291 | * FIXME: To be fixed. | ||
3292 | */ | ||
3293 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3294 | EAPI Eina_Bool | ||
3295 | ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee) | ||
3296 | { | ||
3297 | return ee->engine.x.direct_resize; | ||
3298 | } | ||
3299 | #else | ||
3300 | EAPI Eina_Bool | ||
3301 | ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3302 | { | ||
3303 | return 0; | ||
3304 | } | ||
3305 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3306 | |||
3307 | /** | ||
3308 | * To be documented. | ||
3309 | * | ||
3310 | * FIXME: To be fixed. | ||
3311 | */ | ||
3312 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3313 | EAPI void | ||
3314 | ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3315 | { | ||
3316 | ecore_evas_software_x11_extra_event_window_add(ee, win); | ||
3317 | } | ||
3318 | #else | ||
3319 | EAPI void | ||
3320 | ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3321 | { | ||
3322 | } | ||
3323 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3324 | |||
3325 | /** | ||
3326 | * To be documented. | ||
3327 | * | ||
3328 | * FIXME: To be fixed. | ||
3329 | */ | ||
3330 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3331 | EAPI void | ||
3332 | ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e)) | ||
3333 | { | ||
3334 | Evas_Engine_Info_GL_X11 *einfo; | ||
3335 | |||
3336 | if (!(!strcmp(ee->driver, "opengl_x11"))) return; | ||
3337 | |||
3338 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
3339 | if (einfo) | ||
3340 | { | ||
3341 | einfo->callback.pre_swap = pre_cb; | ||
3342 | einfo->callback.post_swap = post_cb; | ||
3343 | einfo->callback.data = data; | ||
3344 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
3345 | { | ||
3346 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
3347 | } | ||
3348 | } | ||
3349 | } | ||
3350 | #else | ||
3351 | EAPI void | ||
3352 | ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee __UNUSED__, void *data __UNUSED__, void (*pre_cb) (void *data, Evas *e) __UNUSED__, void (*post_cb) (void *data, Evas *e) __UNUSED__) | ||
3353 | { | ||
3354 | return; | ||
3355 | } | ||
3356 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3357 | |||
3358 | /** | ||
3359 | * To be documented. | ||
3360 | * | ||
3361 | * FIXME: To be fixed or maybe removed rather? | ||
3362 | */ | ||
3363 | EAPI Ecore_Evas * | ||
3364 | ecore_evas_xrender_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3365 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3366 | { | ||
3367 | return NULL; | ||
3368 | } | ||
3369 | |||
3370 | /** | ||
3371 | * To be documented. | ||
3372 | * | ||
3373 | * FIXME: To be fixed or maybe removed rather? | ||
3374 | */ | ||
3375 | EAPI Ecore_X_Window | ||
3376 | ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3377 | { | ||
3378 | return 0; | ||
3379 | } | ||
3380 | |||
3381 | /** | ||
3382 | * To be documented. | ||
3383 | * | ||
3384 | * FIXME: To be fixed. | ||
3385 | */ | ||
3386 | EAPI void | ||
3387 | ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3388 | { | ||
3389 | } | ||
3390 | |||
3391 | /** | ||
3392 | * To be documented. | ||
3393 | * | ||
3394 | * FIXME: To be fixed. | ||
3395 | */ | ||
3396 | EAPI Eina_Bool | ||
3397 | ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3398 | { | ||
3399 | return 0; | ||
3400 | } | ||
3401 | |||
3402 | /** | ||
3403 | * To be documented. | ||
3404 | * | ||
3405 | * FIXME: To be fixed. | ||
3406 | */ | ||
3407 | EAPI void | ||
3408 | ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3409 | { | ||
3410 | } | ||
3411 | |||
3412 | /** | ||
3413 | * To be documented. | ||
3414 | * | ||
3415 | * FIXME: To be fixed. | ||
3416 | */ | ||
3417 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3418 | EAPI Ecore_Evas * | ||
3419 | ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, | ||
3420 | int x, int y, int w, int h) | ||
3421 | { | ||
3422 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
3423 | Ecore_Evas *ee; | ||
3424 | int rmethod; | ||
3425 | static int redraw_debug = -1; | ||
3426 | |||
3427 | rmethod = evas_render_method_lookup("software_16_x11"); | ||
3428 | if (!rmethod) return NULL; | ||
3429 | if (!ecore_x_init(disp_name)) return NULL; | ||
3430 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3431 | if (!ee) return NULL; | ||
3432 | |||
3433 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3434 | |||
3435 | _ecore_evas_x_init(); | ||
3436 | |||
3437 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3438 | |||
3439 | ee->driver = "software_16_x11"; | ||
3440 | if (disp_name) ee->name = strdup(disp_name); | ||
3441 | |||
3442 | if (w < 1) w = 1; | ||
3443 | if (h < 1) h = 1; | ||
3444 | ee->x = x; | ||
3445 | ee->y = y; | ||
3446 | ee->w = w; | ||
3447 | ee->h = h; | ||
3448 | ee->req.x = ee->x; | ||
3449 | ee->req.y = ee->y; | ||
3450 | ee->req.w = ee->w; | ||
3451 | ee->req.h = ee->h; | ||
3452 | |||
3453 | ee->prop.max.w = 32767; | ||
3454 | ee->prop.max.h = 32767; | ||
3455 | ee->prop.layer = 4; | ||
3456 | ee->prop.request_pos = 0; | ||
3457 | ee->prop.sticky = 0; | ||
3458 | ee->engine.x.state.sticky = 0; | ||
3459 | |||
3460 | /* init evas here */ | ||
3461 | ee->evas = evas_new(); | ||
3462 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); | ||
3463 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); | ||
3464 | evas_data_attach_set(ee->evas, ee); | ||
3465 | evas_output_method_set(ee->evas, rmethod); | ||
3466 | evas_output_size_set(ee->evas, w, h); | ||
3467 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3468 | |||
3469 | ee->engine.x.win_root = parent; | ||
3470 | if (parent != 0) | ||
3471 | { | ||
3472 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3473 | if (ecore_x_window_argb_get(parent)) | ||
3474 | { | ||
3475 | ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); | ||
3476 | } | ||
3477 | else | ||
3478 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3479 | } | ||
3480 | else | ||
3481 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3482 | if (getenv("DESKTOP_STARTUP_ID")) | ||
3483 | { | ||
3484 | ecore_x_netwm_startup_id_set(ee->prop.window, | ||
3485 | getenv("DESKTOP_STARTUP_ID")); | ||
3486 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3487 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3488 | * for the '=' char */ | ||
3489 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3490 | } | ||
3491 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
3492 | |||
3493 | if (einfo) | ||
3494 | { | ||
3495 | if (ScreenCount(ecore_x_display_get()) > 1) | ||
3496 | { | ||
3497 | Ecore_X_Window *roots; | ||
3498 | int num, i; | ||
3499 | |||
3500 | num = 0; | ||
3501 | roots = ecore_x_window_root_list(&num); | ||
3502 | if (roots) | ||
3503 | { | ||
3504 | XWindowAttributes at; | ||
3505 | |||
3506 | if (XGetWindowAttributes(ecore_x_display_get(), | ||
3507 | parent, &at)) | ||
3508 | { | ||
3509 | for (i = 0; i < num; i++) | ||
3510 | { | ||
3511 | if (at.root == roots[i]) | ||
3512 | break; | ||
3513 | } | ||
3514 | } | ||
3515 | free(roots); | ||
3516 | } | ||
3517 | } | ||
3518 | |||
3519 | if (redraw_debug < 0) | ||
3520 | { | ||
3521 | if (getenv("REDRAW_DEBUG")) | ||
3522 | redraw_debug = atoi(getenv("REDRAW_DEBUG")); | ||
3523 | else | ||
3524 | redraw_debug = 0; | ||
3525 | } | ||
3526 | einfo->info.display = ecore_x_display_get(); | ||
3527 | einfo->info.drawable = ee->prop.window; | ||
3528 | |||
3529 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
3530 | { | ||
3531 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3532 | ecore_evas_free(ee); | ||
3533 | return NULL; | ||
3534 | } | ||
3535 | } | ||
3536 | else | ||
3537 | { | ||
3538 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3539 | ecore_evas_free(ee); | ||
3540 | return NULL; | ||
3541 | } | ||
3542 | |||
3543 | ecore_x_icccm_hints_set(ee->prop.window, | ||
3544 | 1 /* accepts_focus */, | ||
3545 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
3546 | 0 /* icon_pixmap */, | ||
3547 | 0 /* icon_mask */, | ||
3548 | 0 /* icon_window */, | ||
3549 | 0 /* window_group */, | ||
3550 | 0 /* is_urgent */); | ||
3551 | _ecore_evas_x_group_leader_set(ee); | ||
3552 | ecore_x_window_defaults_set(ee->prop.window); | ||
3553 | _ecore_evas_x_protocols_set(ee); | ||
3554 | _ecore_evas_x_sync_set(ee); | ||
3555 | |||
3556 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
3557 | _ecore_evas_register(ee); | ||
3558 | ecore_x_input_multi_select(ee->prop.window); | ||
3559 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
3560 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3561 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3562 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3563 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3564 | return ee; | ||
3565 | } | ||
3566 | #else | ||
3567 | EAPI Ecore_Evas * | ||
3568 | ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3569 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3570 | { | ||
3571 | return NULL; | ||
3572 | } | ||
3573 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3574 | |||
3575 | /** | ||
3576 | * To be documented. | ||
3577 | * | ||
3578 | * FIXME: To be fixed. | ||
3579 | */ | ||
3580 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3581 | EAPI Ecore_X_Window | ||
3582 | ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee) | ||
3583 | { | ||
3584 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3585 | } | ||
3586 | #else | ||
3587 | EAPI Ecore_X_Window | ||
3588 | ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3589 | { | ||
3590 | return 0; | ||
3591 | } | ||
3592 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3593 | |||
3594 | /** | ||
3595 | * To be documented. | ||
3596 | * | ||
3597 | * FIXME: To be fixed. | ||
3598 | */ | ||
3599 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3600 | EAPI void | ||
3601 | ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3602 | { | ||
3603 | ee->engine.x.direct_resize = on; | ||
3604 | if (ee->prop.avoid_damage) | ||
3605 | { | ||
3606 | if (ee->engine.x.direct_resize) | ||
3607 | { | ||
3608 | /* turn this off for now | ||
3609 | ee->engine.x.using_bg_pixmap = 1; | ||
3610 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
3611 | */ | ||
3612 | } | ||
3613 | else | ||
3614 | { | ||
3615 | /* turn this off too- bg pixmap is controlled by avoid damage directly | ||
3616 | ee->engine.x.using_bg_pixmap = 0; | ||
3617 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
3618 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
3619 | */ | ||
3620 | } | ||
3621 | } | ||
3622 | } | ||
3623 | #else | ||
3624 | EAPI void | ||
3625 | ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3626 | { | ||
3627 | } | ||
3628 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3629 | |||
3630 | /** | ||
3631 | * To be documented. | ||
3632 | * | ||
3633 | * FIXME: To be fixed. | ||
3634 | */ | ||
3635 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3636 | EAPI Eina_Bool | ||
3637 | ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee) | ||
3638 | { | ||
3639 | return ee->engine.x.direct_resize; | ||
3640 | } | ||
3641 | #else | ||
3642 | EAPI Eina_Bool | ||
3643 | ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3644 | { | ||
3645 | return 0; | ||
3646 | } | ||
3647 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3648 | |||
3649 | /** | ||
3650 | * To be documented. | ||
3651 | * | ||
3652 | * FIXME: To be fixed. | ||
3653 | */ | ||
3654 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3655 | EAPI void | ||
3656 | ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3657 | { | ||
3658 | Ecore_X_Window *winp; | ||
3659 | |||
3660 | winp = malloc(sizeof(Ecore_X_Window)); | ||
3661 | if (winp) | ||
3662 | { | ||
3663 | *winp = win; | ||
3664 | ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); | ||
3665 | ecore_x_input_multi_select(win); | ||
3666 | ecore_event_window_register(win, ee, ee->evas, | ||
3667 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3668 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3669 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3670 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3671 | } | ||
3672 | } | ||
3673 | #else | ||
3674 | EAPI void | ||
3675 | ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3676 | { | ||
3677 | } | ||
3678 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3679 | |||
3680 | |||
3681 | /** | ||
3682 | * To be documented. | ||
3683 | * | ||
3684 | * FIXME: To be fixed. | ||
3685 | */ | ||
3686 | EAPI Ecore_Evas * | ||
3687 | ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, | ||
3688 | int x, int y, int w, int h) | ||
3689 | { | ||
3690 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
3691 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
3692 | Ecore_Evas *ee; | ||
3693 | int argb = 0; | ||
3694 | int rmethod; | ||
3695 | static int redraw_debug = -1; | ||
3696 | |||
3697 | rmethod = evas_render_method_lookup("software_8_x11"); | ||
3698 | if (!rmethod) return NULL; | ||
3699 | if (!ecore_x_init(disp_name)) return NULL; | ||
3700 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3701 | if (!ee) return NULL; | ||
3702 | |||
3703 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3704 | |||
3705 | _ecore_evas_x_init(); | ||
3706 | |||
3707 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3708 | |||
3709 | ee->driver = "software_8_x11"; | ||
3710 | if (disp_name) ee->name = strdup(disp_name); | ||
3711 | |||
3712 | if (w < 1) w = 1; | ||
3713 | if (h < 1) h = 1; | ||
3714 | ee->x = x; | ||
3715 | ee->y = y; | ||
3716 | ee->w = w; | ||
3717 | ee->h = h; | ||
3718 | ee->req.x = ee->x; | ||
3719 | ee->req.y = ee->y; | ||
3720 | ee->req.w = ee->w; | ||
3721 | ee->req.h = ee->h; | ||
3722 | |||
3723 | ee->prop.max.w = 32767; | ||
3724 | ee->prop.max.h = 32767; | ||
3725 | ee->prop.layer = 4; | ||
3726 | ee->prop.request_pos = 0; | ||
3727 | ee->prop.sticky = 0; | ||
3728 | ee->engine.x.state.sticky = 0; | ||
3729 | |||
3730 | /* init evas here */ | ||
3731 | ee->evas = evas_new(); | ||
3732 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); | ||
3733 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); | ||
3734 | evas_data_attach_set(ee->evas, ee); | ||
3735 | evas_output_method_set(ee->evas, rmethod); | ||
3736 | evas_output_size_set(ee->evas, w, h); | ||
3737 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3738 | |||
3739 | ee->engine.x.win_root = parent; | ||
3740 | // if (parent != 0) | ||
3741 | // { | ||
3742 | // /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3743 | // if (ecore_x_window_argb_get(parent)) | ||
3744 | // { | ||
3745 | // ee->engine.x.win = ecore_x_window_argb_new(parent, x, y, w, h); | ||
3746 | // argb = 1; | ||
3747 | // } | ||
3748 | // else | ||
3749 | // ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h); | ||
3750 | // } | ||
3751 | // else | ||
3752 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3753 | if (getenv("DESKTOP_STARTUP_ID")) | ||
3754 | { | ||
3755 | ecore_x_netwm_startup_id_set(ee->prop.window, | ||
3756 | getenv("DESKTOP_STARTUP_ID")); | ||
3757 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3758 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3759 | * for the '=' char */ | ||
3760 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3761 | } | ||
3762 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
3763 | if (einfo) | ||
3764 | { | ||
3765 | xcb_screen_iterator_t iter; | ||
3766 | xcb_screen_t *screen; | ||
3767 | |||
3768 | /* FIXME: this is inefficient as its a round trip */ | ||
3769 | //einfo->info.backend = 1; | ||
3770 | screen = ecore_x_default_screen_get(); | ||
3771 | iter = xcb_setup_roots_iterator (xcb_get_setup (ecore_x_connection_get())); | ||
3772 | if (iter.rem > 1) | ||
3773 | { | ||
3774 | xcb_get_geometry_cookie_t cookie; | ||
3775 | xcb_get_geometry_reply_t *reply; | ||
3776 | Ecore_X_Window *roots; | ||
3777 | int num; | ||
3778 | uint8_t i; | ||
3779 | |||
3780 | num = 0; | ||
3781 | cookie = xcb_get_geometry_unchecked(ecore_x_connection_get(), parent); | ||
3782 | roots = ecore_x_window_root_list(&num); | ||
3783 | if (roots) | ||
3784 | { | ||
3785 | reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL); | ||
3786 | |||
3787 | if (reply) | ||
3788 | { | ||
3789 | for (i = 0; i < num; xcb_screen_next (&iter), i++) | ||
3790 | { | ||
3791 | if (reply->root == roots[i]) | ||
3792 | { | ||
3793 | screen = iter.data; | ||
3794 | break; | ||
3795 | } | ||
3796 | } | ||
3797 | free(reply); | ||
3798 | } | ||
3799 | free(roots); | ||
3800 | } | ||
3801 | else | ||
3802 | { | ||
3803 | reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL); | ||
3804 | if (reply) free(reply); | ||
3805 | } | ||
3806 | } | ||
3807 | |||
3808 | if (redraw_debug < 0) | ||
3809 | { | ||
3810 | if (getenv("REDRAW_DEBUG")) | ||
3811 | redraw_debug = atoi(getenv("REDRAW_DEBUG")); | ||
3812 | else | ||
3813 | redraw_debug = 0; | ||
3814 | } | ||
3815 | einfo->info.connection = ecore_x_connection_get(); | ||
3816 | einfo->info.screen = screen; | ||
3817 | einfo->info.drawable = ee->prop.window; | ||
3818 | if (argb) | ||
3819 | { | ||
3820 | /* FIXME: round trip */ | ||
3821 | xcb_get_geometry_cookie_t cookie_geom; | ||
3822 | xcb_get_window_attributes_cookie_t cookie_attr; | ||
3823 | xcb_get_geometry_reply_t *reply_geom; | ||
3824 | xcb_get_window_attributes_reply_t *reply_attr; | ||
3825 | |||
3826 | cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window); | ||
3827 | cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window); | ||
3828 | |||
3829 | reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL); | ||
3830 | reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL); | ||
3831 | if (reply_attr && reply_geom) | ||
3832 | { | ||
3833 | einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual); | ||
3834 | einfo->info.colormap = reply_attr->colormap; | ||
3835 | einfo->info.depth = reply_geom->depth; | ||
3836 | einfo->info.destination_alpha = 1; | ||
3837 | free(reply_geom); | ||
3838 | free(reply_attr); | ||
3839 | } | ||
3840 | } | ||
3841 | else | ||
3842 | { | ||
3843 | xcb_screen_t *screen; | ||
3844 | |||
3845 | screen = ecore_x_default_screen_get(); | ||
3846 | einfo->info.visual = xcb_visualtype_get(screen, screen->root_visual); | ||
3847 | einfo->info.colormap = screen->default_colormap; | ||
3848 | einfo->info.depth = screen->root_depth; | ||
3849 | einfo->info.destination_alpha = 0; | ||
3850 | } | ||
3851 | einfo->info.rotation = 0; | ||
3852 | einfo->info.debug = redraw_debug; | ||
3853 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
3854 | { | ||
3855 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3856 | ecore_evas_free(ee); | ||
3857 | return NULL; | ||
3858 | } | ||
3859 | } | ||
3860 | else | ||
3861 | { | ||
3862 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3863 | ecore_evas_free(ee); | ||
3864 | return NULL; | ||
3865 | } | ||
3866 | |||
3867 | ecore_x_icccm_hints_set(ee->prop.window, | ||
3868 | 1 /* accepts_focus */, | ||
3869 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
3870 | 0 /* icon_pixmap */, | ||
3871 | 0 /* icon_mask */, | ||
3872 | 0 /* icon_window */, | ||
3873 | 0 /* window_group */, | ||
3874 | 0 /* is_urgent */); | ||
3875 | _ecore_evas_x_group_leader_set(ee); | ||
3876 | ecore_x_window_defaults_set(ee->prop.window); | ||
3877 | _ecore_evas_x_protocols_set(ee); | ||
3878 | _ecore_evas_x_sync_set(ee); | ||
3879 | |||
3880 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
3881 | _ecore_evas_register(ee); | ||
3882 | ecore_x_input_multi_select(ee->prop.window); | ||
3883 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
3884 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3885 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3886 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3887 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3888 | |||
3889 | return ee; | ||
3890 | #else | ||
3891 | return NULL; | ||
3892 | (void)(disp_name); | ||
3893 | (void)(parent); | ||
3894 | (void)(x); | ||
3895 | (void)(y); | ||
3896 | (void)(w); | ||
3897 | (void)(h); | ||
3898 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
3899 | } | ||
3900 | |||
3901 | /** | ||
3902 | * To be documented. | ||
3903 | * | ||
3904 | * FIXME: To be fixed. | ||
3905 | */ | ||
3906 | EAPI Ecore_X_Window | ||
3907 | ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee) | ||
3908 | { | ||
3909 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
3910 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3911 | #else | ||
3912 | return 0; | ||
3913 | (void)(ee); | ||
3914 | #endif | ||
3915 | } | ||
3916 | |||
3917 | /** | ||
3918 | * To be documented. | ||
3919 | * | ||
3920 | * FIXME: To be fixed. | ||
3921 | */ | ||
3922 | EAPI Ecore_X_Window | ||
3923 | ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee) | ||
3924 | { | ||
3925 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
3926 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3927 | #else | ||
3928 | return 0; | ||
3929 | (void)(ee); | ||
3930 | #endif | ||
3931 | } | ||
3932 | |||
3933 | /** | ||
3934 | * To be documented. | ||
3935 | * | ||
3936 | * FIXME: To be fixed. | ||
3937 | */ | ||
3938 | EAPI void | ||
3939 | ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3940 | { | ||
3941 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
3942 | ee->engine.x.direct_resize = on; | ||
3943 | if (ee->prop.avoid_damage) | ||
3944 | { | ||
3945 | if (ee->engine.x.direct_resize) | ||
3946 | { | ||
3947 | /* turn this off for now | ||
3948 | ee->engine.x.using_bg_pixmap = 1; | ||
3949 | ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap); | ||
3950 | */ | ||
3951 | } | ||
3952 | else | ||
3953 | { | ||
3954 | /* turn this off too- bg pixmap is controlled by avoid damage directly | ||
3955 | ee->engine.x.using_bg_pixmap = 0; | ||
3956 | ecore_x_window_pixmap_set(ee->engine.x.win, 0); | ||
3957 | ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h); | ||
3958 | */ | ||
3959 | } | ||
3960 | } | ||
3961 | #else | ||
3962 | return; | ||
3963 | (void)(ee); | ||
3964 | (void)(on); | ||
3965 | #endif | ||
3966 | } | ||
3967 | |||
3968 | /** | ||
3969 | * To be documented. | ||
3970 | * | ||
3971 | * FIXME: To be fixed. | ||
3972 | */ | ||
3973 | EAPI Eina_Bool | ||
3974 | ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee) | ||
3975 | { | ||
3976 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
3977 | return ee->engine.x.direct_resize; | ||
3978 | #else | ||
3979 | return 0; | ||
3980 | (void)(ee); | ||
3981 | #endif | ||
3982 | } | ||
3983 | |||
3984 | /** | ||
3985 | * To be documented. | ||
3986 | * | ||
3987 | * FIXME: To be fixed. | ||
3988 | */ | ||
3989 | EAPI void | ||
3990 | ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3991 | { | ||
3992 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
3993 | Ecore_X_Window *winp; | ||
3994 | |||
3995 | winp = malloc(sizeof(Ecore_X_Window)); | ||
3996 | if (winp) | ||
3997 | { | ||
3998 | *winp = win; | ||
3999 | ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); | ||
4000 | ecore_x_input_multi_select(win); | ||
4001 | ecore_event_window_register(win, ee, ee->evas, | ||
4002 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
4003 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
4004 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
4005 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
4006 | } | ||
4007 | #else | ||
4008 | return; | ||
4009 | (void)(ee); | ||
4010 | (void)(win); | ||
4011 | #endif | ||
4012 | } | ||
4013 | |||
4014 | EAPI void | ||
4015 | ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win) | ||
4016 | { | ||
4017 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4018 | _ecore_evas_x_group_leader_unset(ee); | ||
4019 | ee->engine.x.leader = win; | ||
4020 | _ecore_evas_x_group_leader_update(ee); | ||
4021 | #else | ||
4022 | return; | ||
4023 | ee = NULL; | ||
4024 | win = 0; | ||
4025 | #endif | ||
4026 | } | ||
4027 | |||
4028 | EAPI Ecore_X_Window | ||
4029 | ecore_evas_x11_leader_get(Ecore_Evas *ee) | ||
4030 | { | ||
4031 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4032 | return ee->engine.x.leader; | ||
4033 | #else | ||
4034 | return 0; | ||
4035 | ee = NULL; | ||
4036 | #endif | ||
4037 | } | ||
4038 | |||
4039 | EAPI void | ||
4040 | ecore_evas_x11_leader_default_set(Ecore_Evas *ee) | ||
4041 | { | ||
4042 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4043 | _ecore_evas_x_group_leader_unset(ee); | ||
4044 | _ecore_evas_x_group_leader_set(ee); | ||
4045 | #else | ||
4046 | return; | ||
4047 | ee = NULL; | ||
4048 | #endif | ||
4049 | } | ||
4050 | |||
4051 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4052 | static Eina_Bool | ||
4053 | _ecore_evas_x11_convert_rectangle_with_angle(Ecore_Evas *ee, Ecore_X_Rectangle *dst_rect, Ecore_X_Rectangle *src_rect) | ||
4054 | { | ||
4055 | if ((!src_rect) || (!dst_rect)) return 0; | ||
4056 | |||
4057 | if (ee->rotation == 0) | ||
4058 | { | ||
4059 | dst_rect->x = src_rect->x; | ||
4060 | dst_rect->y = src_rect->y; | ||
4061 | dst_rect->width = src_rect->width; | ||
4062 | dst_rect->height = src_rect->height; | ||
4063 | } | ||
4064 | else if (ee->rotation == 90) | ||
4065 | { | ||
4066 | dst_rect->x = src_rect->y; | ||
4067 | dst_rect->y = ee->req.h - src_rect->x - src_rect->width; | ||
4068 | dst_rect->width = src_rect->height; | ||
4069 | dst_rect->height = src_rect->width; | ||
4070 | } | ||
4071 | else if (ee->rotation == 180) | ||
4072 | { | ||
4073 | dst_rect->x = ee->req.w - src_rect->x - src_rect->width; | ||
4074 | dst_rect->y = ee->req.h - src_rect->y - src_rect->height; | ||
4075 | dst_rect->width = src_rect->width; | ||
4076 | dst_rect->height = src_rect->height; | ||
4077 | } | ||
4078 | else if (ee->rotation == 270) | ||
4079 | { | ||
4080 | dst_rect->x = ee->req.w - src_rect->y - src_rect->height; | ||
4081 | dst_rect->y = src_rect->x; | ||
4082 | dst_rect->width = src_rect->height; | ||
4083 | dst_rect->height = src_rect->width; | ||
4084 | } | ||
4085 | else | ||
4086 | { | ||
4087 | return 0; | ||
4088 | } | ||
4089 | |||
4090 | return 1; | ||
4091 | } | ||
4092 | #endif | ||
4093 | |||
4094 | EAPI void | ||
4095 | ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h) | ||
4096 | { | ||
4097 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4098 | Eina_Bool ret; | ||
4099 | Ecore_X_Rectangle src_rect; | ||
4100 | Ecore_X_Rectangle dst_rect; | ||
4101 | |||
4102 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4103 | { | ||
4104 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4105 | "ecore_evas_x11_shape_input_rectangle_set"); | ||
4106 | return; | ||
4107 | } | ||
4108 | |||
4109 | src_rect.x = x; | ||
4110 | src_rect.y = y; | ||
4111 | src_rect.width = w; | ||
4112 | src_rect.height = h; | ||
4113 | |||
4114 | dst_rect.x = 0; | ||
4115 | dst_rect.y = 0; | ||
4116 | dst_rect.width = 0; | ||
4117 | dst_rect.height = 0; | ||
4118 | |||
4119 | ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); | ||
4120 | |||
4121 | if (!ee->engine.x.win_shaped_input) | ||
4122 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, | ||
4123 | 0, 0, 1, 1); | ||
4124 | |||
4125 | if (ret) | ||
4126 | ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, | ||
4127 | dst_rect.x, dst_rect.y, | ||
4128 | dst_rect.width, dst_rect.height); | ||
4129 | #else | ||
4130 | return; | ||
4131 | ee = NULL; | ||
4132 | x = 0; | ||
4133 | y = 0; | ||
4134 | w = 0; | ||
4135 | h = 0; | ||
4136 | #endif | ||
4137 | } | ||
4138 | |||
4139 | EAPI void | ||
4140 | ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h) | ||
4141 | { | ||
4142 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4143 | Eina_Bool ret; | ||
4144 | Ecore_X_Rectangle src_rect; | ||
4145 | Ecore_X_Rectangle dst_rect; | ||
4146 | |||
4147 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4148 | { | ||
4149 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4150 | "ecore_evas_x11_shape_input_rectangle_add"); | ||
4151 | return; | ||
4152 | } | ||
4153 | |||
4154 | src_rect.x = x; | ||
4155 | src_rect.y = y; | ||
4156 | src_rect.width = w; | ||
4157 | src_rect.height = h; | ||
4158 | |||
4159 | dst_rect.x = 0; | ||
4160 | dst_rect.y = 0; | ||
4161 | dst_rect.width = 0; | ||
4162 | dst_rect.height = 0; | ||
4163 | |||
4164 | ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); | ||
4165 | |||
4166 | if (!ee->engine.x.win_shaped_input) | ||
4167 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, | ||
4168 | 0, 0, 1, 1); | ||
4169 | |||
4170 | if (ret) | ||
4171 | ecore_x_window_shape_input_rectangle_add(ee->engine.x.win_shaped_input, | ||
4172 | dst_rect.x, dst_rect.y, | ||
4173 | dst_rect.width, dst_rect.height); | ||
4174 | #else | ||
4175 | return; | ||
4176 | ee = NULL; | ||
4177 | x = 0; | ||
4178 | y = 0; | ||
4179 | w = 0; | ||
4180 | h = 0; | ||
4181 | #endif | ||
4182 | } | ||
4183 | |||
4184 | EAPI void | ||
4185 | ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h) | ||
4186 | { | ||
4187 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4188 | Eina_Bool ret; | ||
4189 | Ecore_X_Rectangle src_rect; | ||
4190 | Ecore_X_Rectangle dst_rect; | ||
4191 | |||
4192 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4193 | { | ||
4194 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4195 | "ecore_evas_x11_shape_input_rectangle_subtract"); | ||
4196 | return; | ||
4197 | } | ||
4198 | |||
4199 | src_rect.x = x; | ||
4200 | src_rect.y = y; | ||
4201 | src_rect.width = w; | ||
4202 | src_rect.height = h; | ||
4203 | |||
4204 | dst_rect.x = 0; | ||
4205 | dst_rect.y = 0; | ||
4206 | dst_rect.width = 0; | ||
4207 | dst_rect.height = 0; | ||
4208 | |||
4209 | ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); | ||
4210 | |||
4211 | if (!ee->engine.x.win_shaped_input) | ||
4212 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, | ||
4213 | 0, 0, 1, 1); | ||
4214 | |||
4215 | if (ret) | ||
4216 | ecore_x_window_shape_input_rectangle_subtract(ee->engine.x.win_shaped_input, | ||
4217 | dst_rect.x, dst_rect.y, | ||
4218 | dst_rect.width, dst_rect.height); | ||
4219 | #else | ||
4220 | return; | ||
4221 | ee = NULL; | ||
4222 | x = 0; | ||
4223 | y = 0; | ||
4224 | w = 0; | ||
4225 | h = 0; | ||
4226 | #endif | ||
4227 | } | ||
4228 | |||
4229 | EAPI void | ||
4230 | ecore_evas_x11_shape_input_empty(Ecore_Evas *ee) | ||
4231 | { | ||
4232 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4233 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4234 | { | ||
4235 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4236 | "ecore_evas_x11_shape_input_empty"); | ||
4237 | return; | ||
4238 | } | ||
4239 | |||
4240 | if (!ee->engine.x.win_shaped_input) | ||
4241 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1); | ||
4242 | |||
4243 | ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 0, 0); | ||
4244 | #else | ||
4245 | return; | ||
4246 | ee = NULL; | ||
4247 | #endif | ||
4248 | } | ||
4249 | |||
4250 | EAPI void | ||
4251 | ecore_evas_x11_shape_input_reset(Ecore_Evas *ee) | ||
4252 | { | ||
4253 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4254 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4255 | { | ||
4256 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4257 | "ecore_evas_x11_shape_input_reset"); | ||
4258 | return; | ||
4259 | } | ||
4260 | |||
4261 | if (!ee->engine.x.win_shaped_input) | ||
4262 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1); | ||
4263 | |||
4264 | ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 65535, 65535); | ||
4265 | #else | ||
4266 | return; | ||
4267 | ee = NULL; | ||
4268 | #endif | ||
4269 | } | ||
4270 | |||
4271 | EAPI void | ||
4272 | ecore_evas_x11_shape_input_apply(Ecore_Evas *ee) | ||
4273 | { | ||
4274 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4275 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4276 | { | ||
4277 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4278 | "ecore_evas_x11_shape_input_apply"); | ||
4279 | return; | ||
4280 | } | ||
4281 | |||
4282 | if (!ee->engine.x.win_shaped_input) return; | ||
4283 | |||
4284 | ecore_x_window_shape_input_window_set(ee->prop.window, ee->engine.x.win_shaped_input); | ||
4285 | #else | ||
4286 | return; | ||
4287 | ee = NULL; | ||
4288 | #endif | ||
4289 | } | ||