diff options
Diffstat (limited to 'libraries/ecore/src/lib/ecore_evas')
19 files changed, 0 insertions, 23472 deletions
diff --git a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h deleted file mode 100644 index a78824e..0000000 --- a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h +++ /dev/null | |||
@@ -1,2079 +0,0 @@ | |||
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 | * @li @ref Ecore_Evas_Window_Sizes_Example_c | ||
43 | * @li @ref Ecore_Evas_Buffer_Example_01_c | ||
44 | * @li @ref Ecore_Evas_Buffer_Example_02_c | ||
45 | */ | ||
46 | |||
47 | /* FIXME: | ||
48 | * to do soon: | ||
49 | * - iconfication api needs to work | ||
50 | * - maximization api needs to work | ||
51 | * - document all calls | ||
52 | * | ||
53 | * later: | ||
54 | * - buffer back-end that renders to an evas_image_object ??? | ||
55 | * - qt back-end ??? | ||
56 | * - dfb back-end ??? (dfb's threads make this REALLY HARD) | ||
57 | */ | ||
58 | |||
59 | #ifdef __cplusplus | ||
60 | extern "C" { | ||
61 | #endif | ||
62 | |||
63 | /** | ||
64 | * @defgroup Ecore_Evas_Group Ecore_Evas wrapper/helper set of functions | ||
65 | * | ||
66 | * Ecore evas is a set of functions that makes it easy to tie together ecore's | ||
67 | * main loop and input handling to evas. As such it's a natural base for EFL | ||
68 | * applications. While this combination makes it easy to create the basic | ||
69 | * aspects all applications need, for normal applications(ones with buttons, | ||
70 | * checkboxes and layouts) one should consider using Elementary. | ||
71 | * | ||
72 | * Ecore evas is extremely well suited for applications that are not based on | ||
73 | * widgets. It has a main loop that delivers events, does basic window handling | ||
74 | * and leaves all of the drawing up to the user. This works very well if used | ||
75 | * in conjunction with Edje or if doing custom drawing as, for example, is done | ||
76 | * in games. | ||
77 | * | ||
78 | * This is a list of examples of these functions: | ||
79 | * @li @ref ecore_evas_basics_example_c | ||
80 | * @li @ref ecore_evas_object_example_c | ||
81 | * @li @ref ecore_evas_callbacks_example_c | ||
82 | * @li @ref Ecore_Evas_Window_Sizes_Example_c | ||
83 | * @li @ref Ecore_Evas_Buffer_Example_01_c | ||
84 | * @li @ref Ecore_Evas_Buffer_Example_02_c | ||
85 | * | ||
86 | * @{ | ||
87 | */ | ||
88 | |||
89 | /* these are dummy and just tell u what API levels ecore_evas supports - not if | ||
90 | * the actual support is compiled in. you need to query for that separately. | ||
91 | */ | ||
92 | #define HAVE_ECORE_EVAS_X 1 | ||
93 | #define HAVE_ECORE_EVAS_FB 1 | ||
94 | #define HAVE_ECORE_EVAS_X11_GL 1 | ||
95 | #define HAVE_ECORE_EVAS_X11_16 1 | ||
96 | #define HAVE_ECORE_EVAS_DIRECTFB 1 | ||
97 | #define HAVE_ECORE_EVAS_WIN32 1 | ||
98 | #define HAVE_ECORE_EVAS_COCOA 1 | ||
99 | #define HAVE_ECORE_EVAS_SDL 1 | ||
100 | #define HAVE_ECORE_EVAS_WINCE 1 | ||
101 | #define HAVE_ECORE_EVAS_EWS 1 | ||
102 | #define HAVE_ECORE_EVAS_PSL1GHT 1 | ||
103 | #define HAVE_ECORE_EVAS_WAYLAND_SHM 1 | ||
104 | #define HAVE_ECORE_EVAS_WAYLAND_EGL 1 | ||
105 | |||
106 | typedef enum _Ecore_Evas_Engine_Type | ||
107 | { | ||
108 | ECORE_EVAS_ENGINE_SOFTWARE_BUFFER, | ||
109 | ECORE_EVAS_ENGINE_SOFTWARE_XLIB, | ||
110 | ECORE_EVAS_ENGINE_XRENDER_X11, | ||
111 | ECORE_EVAS_ENGINE_OPENGL_X11, | ||
112 | ECORE_EVAS_ENGINE_SOFTWARE_XCB, | ||
113 | ECORE_EVAS_ENGINE_XRENDER_XCB, | ||
114 | ECORE_EVAS_ENGINE_SOFTWARE_GDI, | ||
115 | ECORE_EVAS_ENGINE_SOFTWARE_DDRAW, | ||
116 | ECORE_EVAS_ENGINE_DIRECT3D, | ||
117 | ECORE_EVAS_ENGINE_OPENGL_GLEW, | ||
118 | ECORE_EVAS_ENGINE_OPENGL_COCOA, | ||
119 | ECORE_EVAS_ENGINE_SOFTWARE_SDL, | ||
120 | ECORE_EVAS_ENGINE_DIRECTFB, | ||
121 | ECORE_EVAS_ENGINE_SOFTWARE_FB, | ||
122 | ECORE_EVAS_ENGINE_SOFTWARE_8_X11, | ||
123 | ECORE_EVAS_ENGINE_SOFTWARE_16_X11, | ||
124 | ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW, | ||
125 | ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE, | ||
126 | ECORE_EVAS_ENGINE_OPENGL_SDL, | ||
127 | ECORE_EVAS_ENGINE_EWS, | ||
128 | ECORE_EVAS_ENGINE_PSL1GHT, | ||
129 | ECORE_EVAS_ENGINE_WAYLAND_SHM, | ||
130 | ECORE_EVAS_ENGINE_WAYLAND_EGL | ||
131 | } Ecore_Evas_Engine_Type; | ||
132 | |||
133 | typedef enum _Ecore_Evas_Avoid_Damage_Type | ||
134 | { | ||
135 | ECORE_EVAS_AVOID_DAMAGE_NONE = 0, | ||
136 | ECORE_EVAS_AVOID_DAMAGE_EXPOSE = 1, | ||
137 | ECORE_EVAS_AVOID_DAMAGE_BUILT_IN = 2 | ||
138 | } Ecore_Evas_Avoid_Damage_Type; | ||
139 | |||
140 | typedef enum _Ecore_Evas_Object_Associate_Flags | ||
141 | { | ||
142 | ECORE_EVAS_OBJECT_ASSOCIATE_BASE = 0, | ||
143 | ECORE_EVAS_OBJECT_ASSOCIATE_STACK = 1 << 0, | ||
144 | ECORE_EVAS_OBJECT_ASSOCIATE_LAYER = 1 << 1, | ||
145 | ECORE_EVAS_OBJECT_ASSOCIATE_DEL = 1 << 2 | ||
146 | } Ecore_Evas_Object_Associate_Flags; | ||
147 | |||
148 | #ifndef _ECORE_X_H | ||
149 | #define _ECORE_X_WINDOW_PREDEF | ||
150 | typedef unsigned int Ecore_X_Window; | ||
151 | #endif | ||
152 | |||
153 | #ifndef _ECORE_DIRECTFB_H | ||
154 | #define _ECORE_DIRECTFB_WINDOW_PREDEF | ||
155 | typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window; | ||
156 | #endif | ||
157 | |||
158 | #ifndef __ECORE_WIN32_H__ | ||
159 | typedef struct _Ecore_Win32_Window Ecore_Win32_Window; | ||
160 | #endif | ||
161 | |||
162 | #ifndef __ECORE_WINCE_H__ | ||
163 | typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window; | ||
164 | #endif | ||
165 | |||
166 | #ifndef __ECORE_COCOA_H__ | ||
167 | typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; | ||
168 | #endif | ||
169 | |||
170 | #ifndef _ECORE_EVAS_PRIVATE_H | ||
171 | /* basic data types */ | ||
172 | typedef struct _Ecore_Evas Ecore_Evas; | ||
173 | typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */ | ||
174 | #endif | ||
175 | |||
176 | #ifndef _ECORE_WAYLAND_H_ | ||
177 | #define _ECORE_WAYLAND_WINDOW_PREDEF | ||
178 | typedef struct _Ecore_Wl_Window Ecore_Wl_Window; | ||
179 | #endif | ||
180 | |||
181 | /* module setup/shutdown calls */ | ||
182 | |||
183 | EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine); | ||
184 | |||
185 | /** | ||
186 | * @brief Init the Ecore_Evas system. | ||
187 | * | ||
188 | * @return How many times the lib has been initialized, 0 indicates failure. | ||
189 | * | ||
190 | * Set up the Evas wrapper system. Init Evas and Ecore libraries. | ||
191 | * | ||
192 | * @see ecore_evas_shutdown() | ||
193 | */ | ||
194 | EAPI int ecore_evas_init(void); | ||
195 | /** | ||
196 | * @brief Shut down the Ecore_Evas system. | ||
197 | * | ||
198 | * @return 0 if ecore evas is fully shut down, or > 0 if it still being used. | ||
199 | * | ||
200 | * This closes the Evas wrapper system down. Shut down Evas and Ecore libraries. | ||
201 | * | ||
202 | * @see ecore_evas_init() | ||
203 | */ | ||
204 | EAPI int ecore_evas_shutdown(void); | ||
205 | |||
206 | EAPI void ecore_evas_app_comp_sync_set(Eina_Bool do_sync); | ||
207 | EAPI Eina_Bool ecore_evas_app_comp_sync_get(void); | ||
208 | |||
209 | /** | ||
210 | * @brief Returns a list of supported engines names. | ||
211 | * | ||
212 | * @return Newly allocated list with engines names. Engines names | ||
213 | * strings are internal and should be considered constants, do not | ||
214 | * free or modify them, to free the list use ecore_evas_engines_free(). | ||
215 | */ | ||
216 | EAPI Eina_List *ecore_evas_engines_get(void); | ||
217 | /** | ||
218 | * @brief Free list returned by ecore_evas_engines_get() | ||
219 | */ | ||
220 | EAPI void ecore_evas_engines_free(Eina_List *engines); | ||
221 | /** | ||
222 | * @brief Creates a new Ecore_Evas based on engine name and common parameters. | ||
223 | * | ||
224 | * @param engine_name engine name as returned by | ||
225 | * ecore_evas_engines_get() or NULL to use environment variable | ||
226 | * ECORE_EVAS_ENGINE, that can be undefined and in this case | ||
227 | * this call will try to find the first working engine. | ||
228 | * @param x horizontal position of window (not supported in all engines) | ||
229 | * @param y vertical position of window (not supported in all engines) | ||
230 | * @param w width of window | ||
231 | * @param h height of window | ||
232 | * @param extra_options string with extra parameter, dependent on engines | ||
233 | * or NULL. String is usually in the form: 'key1=value1;key2=value2'. | ||
234 | * Pay attention that when getting that from shell commands, most | ||
235 | * consider ';' as the command terminator, so you need to escape | ||
236 | * it or use quotes. | ||
237 | * | ||
238 | * @return Ecore_Evas instance or NULL if creation failed. | ||
239 | */ | ||
240 | EAPI Ecore_Evas *ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options); | ||
241 | /** | ||
242 | * @brief Set whether an Ecore_Evas has an alpha channel or not. | ||
243 | * | ||
244 | * @param ee The Ecore_Evas to shape | ||
245 | * @param alpha EINA_TRUE to enable the alpha channel, EINA_FALSE to disable it | ||
246 | * | ||
247 | * This function allows you to make an Ecore_Evas translucent using an | ||
248 | * alpha channel. See ecore_evas_shaped_set() for details. The difference | ||
249 | * between a shaped window and a window with an alpha channel is that an | ||
250 | * alpha channel supports multiple levels of transparency, as opposed to | ||
251 | * the 1 bit transparency of a shaped window (a pixel is either opaque, or | ||
252 | * it's transparent). | ||
253 | * | ||
254 | * @warning Support for this depends on the underlying windowing system. | ||
255 | */ | ||
256 | EAPI void ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha); | ||
257 | /** | ||
258 | * @brief Query whether an Ecore_Evas has an alpha channel. | ||
259 | * @param ee The Ecore_Evas to query. | ||
260 | * @return EINA_TRUE if ee has an alpha channel, EINA_FALSE if it does not. | ||
261 | * | ||
262 | * This function returns EINA_TRUE if @p ee has an alpha channel, and EINA_FALSE | ||
263 | * if it does not. | ||
264 | * | ||
265 | * @see ecore_evas_alpha_set() | ||
266 | */ | ||
267 | EAPI Eina_Bool ecore_evas_alpha_get(const Ecore_Evas *ee); | ||
268 | /** | ||
269 | * @brief Set whether an Ecore_Evas has an transparent window or not. | ||
270 | * | ||
271 | * @param ee The Ecore_Evas to shape | ||
272 | * @param transparent EINA_TRUE to enable the transparent window, EINA_FALSE to | ||
273 | * disable it | ||
274 | * | ||
275 | * This function sets some translucency options, for more complete support see | ||
276 | * ecore_evas_alpha_set(). | ||
277 | * | ||
278 | * @warning Support for this depends on the underlying windowing system. | ||
279 | * | ||
280 | * @see ecore_evas_alpha_set() | ||
281 | */ | ||
282 | EAPI void ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent); | ||
283 | /** | ||
284 | * @brief Query whether an Ecore_Evas is transparent. | ||
285 | * | ||
286 | * @param ee The Ecore_Evas to query. | ||
287 | * @return EINA_TRUE if ee is transparent, EINA_FALSE if it isn't. | ||
288 | * | ||
289 | * @see ecore_evas_transparent_set() | ||
290 | */ | ||
291 | EAPI Eina_Bool ecore_evas_transparent_get(const Ecore_Evas *ee); | ||
292 | /** | ||
293 | * @brief Get the geometry of an Ecore_Evas. | ||
294 | * | ||
295 | * @param ee The Ecore_Evas whose geometry y | ||
296 | * @param x A pointer to an int to place the x coordinate in | ||
297 | * @param y A pointer to an int to place the y coordinate in | ||
298 | * @param w A pointer to an int to place the w size in | ||
299 | * @param h A pointer to an int to place the h size in | ||
300 | * | ||
301 | * This function takes four pointers to (already allocated) ints, and places | ||
302 | * the geometry of @p ee in them. If any of the parameters is not desired you | ||
303 | * may pass NULL on them. | ||
304 | * | ||
305 | * @code | ||
306 | * int x, y, w, h; | ||
307 | * ecore_evas_geometry_get(ee, &x, &y, &w, &h); | ||
308 | * @endcode | ||
309 | * | ||
310 | * @see ecore_evas_new() | ||
311 | * @see ecore_evas_resize() | ||
312 | * @see ecore_evas_move() | ||
313 | * @see ecore_evas_move_resize() | ||
314 | */ | ||
315 | EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); | ||
316 | /** | ||
317 | * @brief Get the geometry which an Ecore_Evas was latest recently requested. | ||
318 | * | ||
319 | * @param ee The Ecore_Evas whose geometry y | ||
320 | * @param x A pointer to an int to place the x coordinate in | ||
321 | * @param y A pointer to an int to place the y coordinate in | ||
322 | * @param w A pointer to an int to place the w size in | ||
323 | * @param h A pointer to an int to place the h size in | ||
324 | * | ||
325 | * This function takes four pointers to (already allocated) ints, and places | ||
326 | * the geometry which @p ee was latest recently requested . If any of the parameters is not desired you | ||
327 | * may pass NULL on them. | ||
328 | * This function can represent recently requested geometry. | ||
329 | * ecore_evas_geometry_get function returns the value is updated after engine finished request. | ||
330 | * By comparison, ecore_evas_request_geometry_get returns recently requested value. | ||
331 | * | ||
332 | * @code | ||
333 | * int x, y, w, h; | ||
334 | * ecore_evas_request_geometry_get(ee, &x, &y, &w, &h); | ||
335 | * @endcode | ||
336 | * | ||
337 | * @since 1.1 | ||
338 | */ | ||
339 | EAPI void ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); | ||
340 | /** | ||
341 | * @brief Set the focus of an Ecore_Evas' window. | ||
342 | * | ||
343 | * @param ee The Ecore_Evas | ||
344 | * @param on EINA_TRUE for focus, EINA_FALSE to defocus. | ||
345 | * | ||
346 | * This function focuses @p ee if @p on is EINA_TRUE, or unfocuses @p ee if @p | ||
347 | * on is EINA_FALSE. | ||
348 | * | ||
349 | * @warning Support for this depends on the underlying windowing system. | ||
350 | */ | ||
351 | EAPI void ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on); | ||
352 | /** | ||
353 | * @brief Query whether an Ecore_Evas' window is focused or not. | ||
354 | * | ||
355 | * @param ee The Ecore_Evas to set | ||
356 | * @return EINA_TRUE if @p ee if focused, EINA_FALSE if not. | ||
357 | * | ||
358 | * @see ecore_evas_focus_set() | ||
359 | */ | ||
360 | EAPI Eina_Bool ecore_evas_focus_get(const Ecore_Evas *ee); | ||
361 | /** | ||
362 | * @brief Iconify or uniconify an Ecore_Evas' window. | ||
363 | * | ||
364 | * @param ee The Ecore_Evas | ||
365 | * @param on EINA_TRUE to iconify, EINA_FALSE to uniconify. | ||
366 | * | ||
367 | * This function iconifies @p ee if @p on is EINA_TRUE, or uniconifies @p ee if | ||
368 | * @p on is EINA_FALSE. | ||
369 | * | ||
370 | * @note Iconify and minimize are synonyms. | ||
371 | * | ||
372 | * @warning Support for this depends on the underlying windowing system. | ||
373 | */ | ||
374 | EAPI void ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on); | ||
375 | /** | ||
376 | * @brief Query whether an Ecore_Evas' window is iconified or not. | ||
377 | * | ||
378 | * @param ee The Ecore_Evas to set | ||
379 | * @return EINA_TRUE if @p ee is iconified, EINA_FALSE if not. | ||
380 | * | ||
381 | * @note Iconify and minimize are synonyms. | ||
382 | * | ||
383 | * @see ecore_evas_iconified_set() | ||
384 | */ | ||
385 | EAPI Eina_Bool ecore_evas_iconified_get(const Ecore_Evas *ee); | ||
386 | /** | ||
387 | * @brief Set whether an Ecore_Evas' window is borderless or not. | ||
388 | * | ||
389 | * @param ee The Ecore_Evas | ||
390 | * @param on EINA_TRUE for borderless, EINA_FALSE for bordered. | ||
391 | * | ||
392 | * This function makes @p ee borderless if @p on is EINA_TRUE, or bordered if @p | ||
393 | * on is EINA_FALSE. | ||
394 | * | ||
395 | * @warning Support for this depends on the underlying windowing system. | ||
396 | */ | ||
397 | EAPI void ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on); | ||
398 | /** | ||
399 | * @brief Query whether an Ecore_Evas' window is borderless or not. | ||
400 | * | ||
401 | * @param ee The Ecore_Evas to set | ||
402 | * @return EINA_TRUE if @p ee is borderless, EINA_FALSE if not. | ||
403 | * | ||
404 | * @see ecore_evas_borderless_set() | ||
405 | */ | ||
406 | EAPI Eina_Bool ecore_evas_borderless_get(const Ecore_Evas *ee); | ||
407 | /** | ||
408 | * @brief Set whether or not an Ecore_Evas' window is fullscreen. | ||
409 | * | ||
410 | * @param ee The Ecore_Evas | ||
411 | * @param on EINA_TRUE fullscreen, EINA_FALSE not. | ||
412 | * | ||
413 | * This function causes @p ee to be fullscreen if @p on is EINA_TRUE, | ||
414 | * or not if @p on is EINA_FALSE. | ||
415 | * | ||
416 | * @warning Support for this depends on the underlying windowing system. | ||
417 | */ | ||
418 | EAPI void ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on); | ||
419 | /** | ||
420 | * @brief Query whether an Ecore_Evas' window is fullscreen or not. | ||
421 | * | ||
422 | * @param ee The Ecore_Evas to set | ||
423 | * @return EINA_TRUE if @p ee is fullscreen, EINA_FALSE if not. | ||
424 | * | ||
425 | * @see ecore_evas_fullscreen_set() | ||
426 | */ | ||
427 | EAPI Eina_Bool ecore_evas_fullscreen_get(const Ecore_Evas *ee); | ||
428 | /** | ||
429 | * @brief Set another window that this window is a group member of | ||
430 | * | ||
431 | * @param ee The Ecore_Evas | ||
432 | * @param ee_group The other group member | ||
433 | * | ||
434 | * If @p ee_group is NULL, @p ee is removed from the group, otherwise it is | ||
435 | * added. Note that if you free the @p ee_group canvas before @p ee, then | ||
436 | * getting the group canvas with ecore_evas_window_group_get() will return | ||
437 | * an invalid handle. | ||
438 | * | ||
439 | * @warning Support for this depends on the underlying windowing system. | ||
440 | * @since 1.2 | ||
441 | */ | ||
442 | EAPI void ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group); | ||
443 | /** | ||
444 | * @brief Get the canvas group set. | ||
445 | * | ||
446 | * This returns the handle set by ecore_evas_window_group_set(). | ||
447 | * | ||
448 | * @param ee The Ecore_Evas to set | ||
449 | * @return The Canvas group handle | ||
450 | * | ||
451 | * @see ecore_evas_window_group_set() | ||
452 | * @since 1.2 | ||
453 | */ | ||
454 | EAPI const Ecore_Evas *ecore_evas_window_group_get(const Ecore_Evas *ee); | ||
455 | /** | ||
456 | * @brief Set the aspect ratio of a canvas window | ||
457 | * | ||
458 | * @param ee The Ecore_Evas | ||
459 | * @param aspect The aspect ratio (width divided by height), or 0 to disable | ||
460 | * | ||
461 | * This sets the desired aspect ratio of a canvas window | ||
462 | * | ||
463 | * @warning Support for this depends on the underlying windowing system. | ||
464 | * @since 1.2 | ||
465 | */ | ||
466 | EAPI void ecore_evas_aspect_set(Ecore_Evas *ee, double aspect); | ||
467 | /** | ||
468 | * @brief Get the aspect ratio of a canvas window | ||
469 | * | ||
470 | * This returns the value set by ecore_evas_aspect_set(). | ||
471 | * | ||
472 | * @param ee The Ecore_Evas to set | ||
473 | * @return The aspect ratio | ||
474 | * | ||
475 | * @see ecore_evas_aspect_set() | ||
476 | * @since 1.2 | ||
477 | */ | ||
478 | EAPI double ecore_evas_aspect_get(const Ecore_Evas *ee); | ||
479 | /** | ||
480 | * @brief Set The urgent hint flag | ||
481 | * | ||
482 | * @param ee The Ecore_Evas | ||
483 | * @param urgent The urgent state flag | ||
484 | * | ||
485 | * This sets the "urgent" state hint on a window so the desktop environment | ||
486 | * can highlight it somehow. | ||
487 | * | ||
488 | * @warning Support for this depends on the underlying windowing system. | ||
489 | * @since 1.2 | ||
490 | */ | ||
491 | EAPI void ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent); | ||
492 | /** | ||
493 | * @brief Get the urgent state on the cavas window | ||
494 | * | ||
495 | * This returns the value set by ecore_evas_urgent_set() | ||
496 | * | ||
497 | * @param ee The Ecore_Evas to set | ||
498 | * @return The urgent state set | ||
499 | * | ||
500 | * @see ecore_evas_urgent_set() | ||
501 | * @since 1.2 | ||
502 | */ | ||
503 | EAPI Eina_Bool ecore_evas_urgent_get(const Ecore_Evas *ee); | ||
504 | /** | ||
505 | * @brief Set the modal state flag on the canvas window | ||
506 | * | ||
507 | * @param ee The Ecore_Evas | ||
508 | * @param modal The modal hint flag | ||
509 | * | ||
510 | * This hints if the window should be modal (eg if it is also transient | ||
511 | * for another window, the other window will maybe be denied focus by | ||
512 | * the desktop window manager). | ||
513 | * | ||
514 | * @warning Support for this depends on the underlying windowing system. | ||
515 | * @since 1.2 | ||
516 | */ | ||
517 | EAPI void ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal); | ||
518 | /** | ||
519 | * @brief Get The modal flag | ||
520 | * | ||
521 | * This returns the value set by ecore_evas_modal_set(). | ||
522 | * | ||
523 | * @param ee The Ecore_Evas to set | ||
524 | * @return The modal flag | ||
525 | * | ||
526 | * @see ecore_evas_modal_set() | ||
527 | * @since 1.2 | ||
528 | */ | ||
529 | EAPI Eina_Bool ecore_evas_modal_get(const Ecore_Evas *ee); | ||
530 | /** | ||
531 | * @brief Set the "i demand attention" flag on a canvas window | ||
532 | * | ||
533 | * @param ee The Ecore_Evas | ||
534 | * @param demand_attention The flag state to set | ||
535 | * | ||
536 | * A window may demand attention now (eg you must enter a password before | ||
537 | * continuing), and so it may flag a window with this. | ||
538 | * | ||
539 | * @warning Support for this depends on the underlying windowing system. | ||
540 | * @since 1.2 | ||
541 | */ | ||
542 | EAPI void ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand); | ||
543 | /** | ||
544 | * @brief Get the "i demand attention" flag | ||
545 | * | ||
546 | * This returns the value set by ecore_evas_demand_attention_set(). | ||
547 | * | ||
548 | * @param ee The Ecore_Evas to set | ||
549 | * @return The "i demand attention" flag. | ||
550 | * | ||
551 | * @see ecore_evas_demand_attention_set() | ||
552 | * @since 1.2 | ||
553 | */ | ||
554 | EAPI Eina_Bool ecore_evas_demand_attention_get(const Ecore_Evas *ee); | ||
555 | /** | ||
556 | * @brief Set the "focus skip" flag | ||
557 | * | ||
558 | * @param ee The Ecore_Evas | ||
559 | * @param skip The "focus skip" state to set. | ||
560 | * | ||
561 | * A window may not want to accept focus, be in the taskbar, pager etc. | ||
562 | * sometimes (example for a small notification window that hovers around | ||
563 | * a taskbar or panel, or hovers around a window until some activity | ||
564 | * dismisses it). | ||
565 | * | ||
566 | * @warning Support for this depends on the underlying windowing system. | ||
567 | * @since 1.2 | ||
568 | */ | ||
569 | EAPI void ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip); | ||
570 | /** | ||
571 | * @brief Get the "focus skip" flag | ||
572 | * | ||
573 | * This returns the value set by ecore_evas_focus_skip_set(). | ||
574 | * | ||
575 | * @param ee The Ecore_Evas to set | ||
576 | * @return The "focus skip" flag. | ||
577 | * | ||
578 | * @see ecore_evas_focus_skip_set() | ||
579 | * @since 1.2 | ||
580 | */ | ||
581 | EAPI Eina_Bool ecore_evas_focus_skip_get(const Ecore_Evas *ee); | ||
582 | |||
583 | /** | ||
584 | * @brief Set if this evas should ignore @b all events. | ||
585 | * | ||
586 | * @param ee The Ecore_Evas whose window's to ignore events. | ||
587 | * @param ignore The Ecore_Evas new ignore state. | ||
588 | * | ||
589 | * @warning Support for this depends on the underlying windowing system. | ||
590 | */ | ||
591 | EAPI void ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore); | ||
592 | /** | ||
593 | * @brief Returns the ignore state of an Ecore_Evas' window. | ||
594 | * | ||
595 | * @param ee The Ecore_Evas whose window's ignore events state is returned. | ||
596 | * @return The Ecore_Evas window's ignore state. | ||
597 | * | ||
598 | * @see ecore_evas_ignore_events_set() | ||
599 | */ | ||
600 | EAPI Eina_Bool ecore_evas_ignore_events_get(const Ecore_Evas *ee); | ||
601 | /** | ||
602 | * @brief Query whether an Ecore_Evas' window is visible or not. | ||
603 | * | ||
604 | * @param ee The Ecore_Evas to query. | ||
605 | * @return 1 if visible, 0 if not. | ||
606 | * | ||
607 | * This function queries @p ee and returns 1 if it is visible, and 0 if not. | ||
608 | * | ||
609 | * @see ecore_evas_show() | ||
610 | * @see ecore_evas_hide() | ||
611 | */ | ||
612 | EAPI int ecore_evas_visibility_get(const Ecore_Evas *ee); | ||
613 | /** | ||
614 | * @brief Set the layer of an Ecore_Evas' window. | ||
615 | * | ||
616 | * @param ee The Ecore_Evas | ||
617 | * @param layer The layer to put @p ee on. | ||
618 | * | ||
619 | * This function moves @p ee to the layer @p layer. | ||
620 | * | ||
621 | * @warning Support for this depends on the underlying windowing system. | ||
622 | * | ||
623 | * @see ecore_evas_lower() | ||
624 | * @see ecore_evas_raise() | ||
625 | */ | ||
626 | EAPI void ecore_evas_layer_set(Ecore_Evas *ee, int layer); | ||
627 | /** | ||
628 | * @brief Get the layer of an Ecore_Evas' window. | ||
629 | * | ||
630 | * @param ee The Ecore_Evas to set | ||
631 | * @return the layer @p ee's window is on. | ||
632 | * | ||
633 | * @see ecore_evas_layer_set() | ||
634 | * @see ecore_evas_lower() | ||
635 | * @see ecore_evas_raise() | ||
636 | */ | ||
637 | EAPI int ecore_evas_layer_get(const Ecore_Evas *ee); | ||
638 | /** | ||
639 | * @brief Maximize (or unmaximize) an Ecore_Evas' window. | ||
640 | * | ||
641 | * @param ee The Ecore_Evas | ||
642 | * @param on EINA_TRUE to maximize, EINA_FALSE to unmaximize. | ||
643 | * | ||
644 | * This function maximizes @p ee if @p on is EINA_TRUE, or unmaximizes @p ee | ||
645 | * if @p on is EINA_FALSE. | ||
646 | * | ||
647 | * @warning Support for this depends on the underlying windowing system. | ||
648 | */ | ||
649 | EAPI void ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on); | ||
650 | /** | ||
651 | * @brief Query whether an Ecore_Evas' window is maximized or not. | ||
652 | * | ||
653 | * @param ee The Ecore_Evas to set | ||
654 | * @return EINA_TRUE if @p ee is maximized, EINA_FALSE if not. | ||
655 | * | ||
656 | * @see ecore_evas_maximized_set() | ||
657 | */ | ||
658 | EAPI Eina_Bool ecore_evas_maximized_get(const Ecore_Evas *ee); | ||
659 | /** | ||
660 | * @brief Move an Ecore_Evas. | ||
661 | * | ||
662 | * @param ee The Ecore_Evas to move | ||
663 | * @param x The x coordinate to move to | ||
664 | * @param y The y coordinate to move to | ||
665 | * | ||
666 | * This moves @p ee to the screen coordinates (@p x, @p y) | ||
667 | * | ||
668 | * @warning Support for this depends on the underlying windowing system. | ||
669 | * | ||
670 | * @see ecore_evas_new() | ||
671 | * @see ecore_evas_resize() | ||
672 | * @see ecore_evas_move_resize() | ||
673 | */ | ||
674 | EAPI void ecore_evas_move(Ecore_Evas *ee, int x, int y); | ||
675 | /** | ||
676 | * @brief Resize an Ecore_Evas. | ||
677 | * | ||
678 | * @param ee The Ecore_Evas to move | ||
679 | * @param w The w coordinate to resize to | ||
680 | * @param h The h coordinate to resize to | ||
681 | * | ||
682 | * This resizes @p ee to @p w x @p h. | ||
683 | * | ||
684 | * @warning Support for this depends on the underlying windowing system. | ||
685 | * | ||
686 | * @see ecore_evas_new() | ||
687 | * @see ecore_evas_move() | ||
688 | * @see ecore_evas_move_resize() | ||
689 | */ | ||
690 | EAPI void ecore_evas_resize(Ecore_Evas *ee, int w, int h); | ||
691 | /** | ||
692 | * @brief Move and resize an Ecore_Evas | ||
693 | * | ||
694 | * @param ee The Ecore_Evas to move and resize | ||
695 | * @param x The x coordinate to move to | ||
696 | * @param y The y coordinate to move to | ||
697 | * @param w The w coordinate to resize to | ||
698 | * @param h The h coordinate to resize to | ||
699 | * | ||
700 | * This moves @p ee to the screen coordinates (@p x, @p y) and resizes | ||
701 | * it to @p w x @p h. | ||
702 | * | ||
703 | * @warning Support for this depends on the underlying windowing system. | ||
704 | * | ||
705 | * @see ecore_evas_new() | ||
706 | * @see ecore_evas_move() | ||
707 | * @see ecore_evas_resize() | ||
708 | */ | ||
709 | EAPI void ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h); | ||
710 | /** | ||
711 | * @brief Set the rotation of an Ecore_Evas' window. | ||
712 | * | ||
713 | * @param ee The Ecore_Evas | ||
714 | * @param rot the angle (in degrees) of rotation. | ||
715 | * | ||
716 | * The allowed values of @p rot depend on the engine being used. Most only | ||
717 | * allow multiples of 90. | ||
718 | * | ||
719 | * @warning Support for this depends on the underlying windowing system. | ||
720 | * | ||
721 | * @see ecore_evas_rotation_with_resize_set() | ||
722 | */ | ||
723 | EAPI void ecore_evas_rotation_set(Ecore_Evas *ee, int rot); | ||
724 | /** | ||
725 | * @brief Set the rotation of an Ecore_Evas' window | ||
726 | * | ||
727 | * @param ee The Ecore_Evas | ||
728 | * @param rot the angle (in degrees) of rotation. | ||
729 | * | ||
730 | * Like ecore_evas_rotation_set(), but it also resizes the window's contents so | ||
731 | * that they fit inside the current window geometry. | ||
732 | * | ||
733 | * @warning Support for this depends on the underlying windowing system. | ||
734 | * | ||
735 | * @see ecore_evas_rotation_set() | ||
736 | */ | ||
737 | EAPI void ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot); | ||
738 | /** | ||
739 | * @brief Get the rotation of an Ecore_Evas' window | ||
740 | * | ||
741 | * @param ee The Ecore_Evas | ||
742 | * @return the angle (in degrees) of rotation. | ||
743 | * | ||
744 | * @see ecore_evas_rotation_set() | ||
745 | * @see ecore_evas_rotation_with_resize_set() | ||
746 | */ | ||
747 | EAPI int ecore_evas_rotation_get(const Ecore_Evas *ee); | ||
748 | /** | ||
749 | * @brief Raise an Ecore_Evas' window. | ||
750 | * | ||
751 | * @param ee The Ecore_Evas to raise. | ||
752 | * | ||
753 | * This functions raises the Ecore_Evas to the front. | ||
754 | * | ||
755 | * @warning Support for this depends on the underlying windowing system. | ||
756 | * | ||
757 | * @see ecore_evas_lower() | ||
758 | * @see ecore_evas_layer_set() | ||
759 | */ | ||
760 | EAPI void ecore_evas_raise(Ecore_Evas *ee); | ||
761 | /** | ||
762 | * @brief Lower an Ecore_Evas' window. | ||
763 | * | ||
764 | * @param ee The Ecore_Evas to raise. | ||
765 | * | ||
766 | * This functions lowers the Ecore_Evas to the back. | ||
767 | * | ||
768 | * @warning Support for this depends on the underlying windowing system. | ||
769 | * | ||
770 | * @see ecore_evas_raise() | ||
771 | * @see ecore_evas_layer_set() | ||
772 | */ | ||
773 | EAPI void ecore_evas_lower(Ecore_Evas *ee); | ||
774 | /** | ||
775 | * @brief Set the title of an Ecore_Evas' window. | ||
776 | * | ||
777 | * @param ee The Ecore_Evas whose title you wish to set. | ||
778 | * @param t The title | ||
779 | * | ||
780 | * This function sets the title of @p ee to @p t. | ||
781 | * | ||
782 | * @warning Support for this depends on the underlying windowing system. | ||
783 | */ | ||
784 | EAPI void ecore_evas_title_set(Ecore_Evas *ee, const char *t); | ||
785 | /** | ||
786 | * @brief Get the title of an Ecore_Evas' window. | ||
787 | * | ||
788 | * @param ee The Ecore_Evas whose title you wish to get. | ||
789 | * @return The title of @p ee. | ||
790 | * | ||
791 | * This function returns the title of @p ee. | ||
792 | * | ||
793 | * @see ecore_evas_title_set() | ||
794 | */ | ||
795 | EAPI const char *ecore_evas_title_get(const Ecore_Evas *ee); | ||
796 | /** | ||
797 | * @brief Set the name and class of an Ecore_Evas' window. | ||
798 | * | ||
799 | * @param ee the Ecore_Evas | ||
800 | * @param n the name | ||
801 | * @param c the class | ||
802 | * | ||
803 | * This function sets the name of @p ee to @p n, and its class to @p c. The | ||
804 | * meaning of @p name and @p class depends on the underlying windowing system. | ||
805 | * | ||
806 | * @warning Support for this depends on the underlying windowing system. | ||
807 | */ | ||
808 | EAPI void ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c); | ||
809 | /** | ||
810 | * @brief Get the name and class of an Ecore_Evas' window | ||
811 | * | ||
812 | * @p ee The Ecore_Evas to query | ||
813 | * @p n A pointer to a string to place the name in. | ||
814 | * @p c A pointer to a string to place the class in. | ||
815 | * | ||
816 | * This function gets the name of @p ee into @p n, and its class into | ||
817 | * @p c. | ||
818 | * | ||
819 | * @see ecore_evas_name_class_set() | ||
820 | */ | ||
821 | EAPI void ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c); | ||
822 | /** | ||
823 | * @brief Returns a pointer to the underlying window. | ||
824 | * | ||
825 | * @param ee The Ecore_Evas whose window is desired. | ||
826 | * | ||
827 | * @warning Support for this depends on the underlying windowing system. | ||
828 | */ | ||
829 | EAPI Ecore_Window ecore_evas_window_get(const Ecore_Evas *ee); | ||
830 | |||
831 | |||
832 | /* engine/target specific init calls */ | ||
833 | EAPI Ecore_Evas *ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); | ||
834 | EAPI Ecore_X_Window ecore_evas_software_x11_window_get(const Ecore_Evas *ee); | ||
835 | EAPI void ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
836 | EAPI Eina_Bool ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee); | ||
837 | EAPI void ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
838 | |||
839 | #define ECORE_EVAS_GL_X11_OPT_NONE 0 | ||
840 | #define ECORE_EVAS_GL_X11_OPT_INDIRECT 1 | ||
841 | #define ECORE_EVAS_GL_X11_OPT_VSYNC 2 | ||
842 | #define ECORE_EVAS_GL_X11_OPT_LAST 3 | ||
843 | |||
844 | EAPI Ecore_Evas *ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); | ||
845 | 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); | ||
846 | EAPI Ecore_X_Window ecore_evas_gl_x11_window_get(const Ecore_Evas *ee); | ||
847 | EAPI void ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
848 | EAPI Eina_Bool ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee); | ||
849 | EAPI void ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
850 | 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)); | ||
851 | |||
852 | EAPI Ecore_Evas *ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); | ||
853 | EAPI Ecore_X_Window ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee); | ||
854 | EAPI void ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
855 | EAPI Eina_Bool ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee); | ||
856 | EAPI void ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
857 | |||
858 | 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); | ||
859 | EAPI Ecore_X_Window ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee); | ||
860 | EAPI Ecore_X_Window ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee); | ||
861 | EAPI void ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
862 | EAPI Eina_Bool ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee); | ||
863 | EAPI void ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
864 | |||
865 | 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); | ||
866 | EAPI Ecore_X_Window ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee); | ||
867 | EAPI void ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); | ||
868 | EAPI Eina_Bool ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee); | ||
869 | EAPI void ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); | ||
870 | |||
871 | EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h); | ||
872 | |||
873 | EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h); | ||
874 | EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee); | ||
875 | |||
876 | |||
877 | EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame); | ||
878 | EAPI Ecore_Evas *ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame); | ||
879 | EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee, int location); | ||
880 | /* EAPI void ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); */ | ||
881 | /* EAPI void ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); */ | ||
882 | /* EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type); */ | ||
883 | |||
884 | /** | ||
885 | * @brief Create a new @c Ecore_Evas canvas bound to the Evas | ||
886 | * @b buffer engine | ||
887 | * | ||
888 | * @param w The width of the canvas, in pixels | ||
889 | * @param h The height of the canvas, in pixels | ||
890 | * @return A new @c Ecore_Evas instance or @c NULL, on failure | ||
891 | * | ||
892 | * This creates a new buffer canvas wrapper, with image data array | ||
893 | * @b bound to the ARGB format, 8 bits per pixel. | ||
894 | * | ||
895 | * This function will allocate the needed pixels array with canonical | ||
896 | * @c malloc(). If you wish a custom function to allocate it, consider | ||
897 | * using ecore_evas_buffer_allocfunc_new(), instead. | ||
898 | * | ||
899 | * @note This function actually is a wrapper on | ||
900 | * ecore_evas_buffer_allocfunc_new(), using the same @a w and @a h | ||
901 | * arguments and canonical @c malloc() and @c free() to the memory | ||
902 | * allocation and freeing functions. See that function's documentation | ||
903 | * for more details. | ||
904 | */ | ||
905 | EAPI Ecore_Evas *ecore_evas_buffer_new(int w, int h); | ||
906 | |||
907 | /** | ||
908 | * @brief Create a new @c Ecore_Evas canvas bound to the Evas | ||
909 | * @b buffer engine, giving custom allocation and freeing functions for | ||
910 | * the canvas memory region | ||
911 | * | ||
912 | * @param w The width of the canvas, in canvas units | ||
913 | * @param h The height of the canvas, in canvas units | ||
914 | * @param alloc_func Function to be called to allocate the memory | ||
915 | * needed for the new buffer canvas. @a data will be passed the same | ||
916 | * value as the @p data of this function, while @a size will be passed | ||
917 | * @p w times @p h times @c sizeof(int). | ||
918 | * @param free_func Function to be called to free the memory used by | ||
919 | * the new buffer canvas. @a data will be passed the same value as the | ||
920 | * @p data of this function, while @a pix will be passed the canvas | ||
921 | * memory pointer. | ||
922 | * @param data Custom data to be passed to the allocation and freeing | ||
923 | * functions | ||
924 | * @return A new @c Ecore_Evas instance or @c NULL, on failure | ||
925 | * | ||
926 | * This creates a new buffer canvas wrapper, with image data array | ||
927 | * @b bound to the ARGB format, 8 bits per pixel. | ||
928 | * | ||
929 | * This function is useful when one wants an @c Ecore_Evas buffer | ||
930 | * canvas with a custom allocation function, like one getting memory | ||
931 | * chunks from a memory pool, for example. | ||
932 | * | ||
933 | * On any resizing of this @c Ecore_Evas buffer canvas, its image data | ||
934 | * will be @b freed, to be allocated again with the new size. | ||
935 | * | ||
936 | * @note @p w and @p h sizes have to greater or equal to 1. Otherwise, | ||
937 | * they'll be interpreted as 1, exactly. | ||
938 | * | ||
939 | * @see ecore_evas_buffer_new() | ||
940 | */ | ||
941 | 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); | ||
942 | |||
943 | /** | ||
944 | * @brief Grab a pointer to the actual pixels array of a given | ||
945 | * @c Ecore_Evas @b buffer canvas/window. | ||
946 | * | ||
947 | * @param ee An @c Ecore_Evas handle | ||
948 | * @return A pointer to the internal pixels array of @p ee | ||
949 | * | ||
950 | * Besides returning a pointer to the actual pixel array of the given | ||
951 | * canvas, this call will force a <b>rendering update on @p ee</b>, | ||
952 | * first. | ||
953 | * | ||
954 | * A common use case for this call is to create an image object, from | ||
955 | * @b another canvas, to have as data @p ee's contents, thus | ||
956 | * snapshoting the canvas. For that case, one can also use the | ||
957 | * ecore_evas_object_image_new() helper function. | ||
958 | */ | ||
959 | EAPI const void *ecore_evas_buffer_pixels_get(Ecore_Evas *ee); | ||
960 | |||
961 | /** | ||
962 | * @brief Create a new @c Ecore_Evas canvas bound to the Evas | ||
963 | * @b ews (Ecore + Evas Single Process Windowing System) engine | ||
964 | * | ||
965 | * EWS is a simple single process windowing system. The backing store | ||
966 | * is also an @c Ecore_Evas that can be setup with | ||
967 | * ecore_evas_ews_setup() and retrieved with | ||
968 | * ecore_evas_ews_ecore_evas_get(). It will allow window management | ||
969 | * using events prefixed with @c ECORE_EVAS_EVENT_EWS_. | ||
970 | * | ||
971 | * The EWS windows (returned by this function or | ||
972 | * ecore_evas_new("ews"...)) will all be software buffer windows | ||
973 | * automatic rendered to the backing store. | ||
974 | * | ||
975 | * @param x horizontal position of window, in pixels | ||
976 | * @param y vertical position of window, in pixels | ||
977 | * @param w The width of the canvas, in pixels | ||
978 | * @param h The height of the canvas, in pixels | ||
979 | * @return A new @c Ecore_Evas instance or @c NULL, on failure | ||
980 | * | ||
981 | * @see ecore_evas_ews_setup() | ||
982 | * @see ecore_evas_ews_ecore_evas_get() | ||
983 | * | ||
984 | * @since 1.1 | ||
985 | */ | ||
986 | EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h); | ||
987 | |||
988 | |||
989 | /** | ||
990 | * Returns the backing store image object that represents the given | ||
991 | * window in EWS. | ||
992 | * | ||
993 | * @note This should not be modified anyhow, but may be helpful to | ||
994 | * determine stacking and geometry of it for window managers | ||
995 | * that decorate windows. | ||
996 | * | ||
997 | * @see ecore_evas_ews_manager_set() | ||
998 | * @see ecore_evas_ews_evas_get() | ||
999 | * @since 1.1 | ||
1000 | */ | ||
1001 | EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee); | ||
1002 | |||
1003 | /** | ||
1004 | * Calls the window to be deleted (freed), but can let user decide to | ||
1005 | * forbid it by using ecore_evas_callback_delete_request_set() | ||
1006 | * | ||
1007 | * @since 1.1 | ||
1008 | */ | ||
1009 | EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee); | ||
1010 | |||
1011 | /** | ||
1012 | * @brief Create an Evas image object with image data <b>bound to an | ||
1013 | * own, internal @c Ecore_Evas canvas wrapper</b> | ||
1014 | * | ||
1015 | * @param ee_target @c Ecore_Evas to have the canvas receiving the new | ||
1016 | * image object | ||
1017 | * @return A handle to the new image object | ||
1018 | * | ||
1019 | * This will create a @b special Evas image object. The image's pixel | ||
1020 | * array will get bound to the same image data array of an @b internal | ||
1021 | * @b buffer @c Ecore_Evas canvas. The user of this function is, then, | ||
1022 | * supposed to grab that @c Ecore_Evas handle, with | ||
1023 | * ecore_evas_object_ecore_evas_get(), and use its canvas to render | ||
1024 | * whichever contents he/she wants, @b independently of the contents | ||
1025 | * of the canvas owned by @p ee_target. Those contents will reflect on | ||
1026 | * the canvas of @p ee, though, being exactly the image data of the | ||
1027 | * object returned by this function. | ||
1028 | * | ||
1029 | * This is a helper function for the scenario of one wanting to grab a | ||
1030 | * buffer canvas' contents (with ecore_evas_buffer_pixels_get()) to be | ||
1031 | * used on another canvas, for whichever reason. The most common goal | ||
1032 | * of this setup is to @b save an image file with a whole canvas as | ||
1033 | * contents, which could not be achieved by using an image file within | ||
1034 | * the target canvas. | ||
1035 | * | ||
1036 | * @warning Always resize the returned image and its underlying | ||
1037 | * @c Ecore_Evas handle accordingly. They must be kept with same sizes | ||
1038 | * for things to work as expected. Also, you @b must issue | ||
1039 | * @c evas_object_image_size_set() on the image with that same size. If | ||
1040 | * the image is to be shown in a canvas bound to an engine different | ||
1041 | * than the buffer one, then you must also set this image's @b fill | ||
1042 | * properties accordingly. | ||
1043 | * | ||
1044 | * @note The image returned will always be bound to the | ||
1045 | * @c EVAS_COLORSPACE_ARGB8888 colorspace, always. | ||
1046 | * | ||
1047 | * @note Use ecore_evas_object_evas_get() to grab the image's internal | ||
1048 | * own canvas directly. | ||
1049 | * | ||
1050 | * @note If snapshoting this image's internal canvas, remember to | ||
1051 | * flush its internal @c Ecore_Evas firstly, with | ||
1052 | * ecore_evas_manual_render(). | ||
1053 | */ | ||
1054 | EAPI Evas_Object *ecore_evas_object_image_new(Ecore_Evas *ee_target); | ||
1055 | |||
1056 | /** | ||
1057 | * @brief Retrieve the internal @c Ecore_Evas handle of an image | ||
1058 | * object created via ecore_evas_object_image_new() | ||
1059 | * | ||
1060 | * @param obj A handle to an image object created via | ||
1061 | * ecore_evas_object_image_new() | ||
1062 | * @return The underlying @c Ecore_Evas handle in @p obj | ||
1063 | */ | ||
1064 | EAPI Ecore_Evas *ecore_evas_object_ecore_evas_get(Evas_Object *obj); | ||
1065 | |||
1066 | /** | ||
1067 | * @brief Retrieve the canvas bound to the internal @c Ecore_Evas | ||
1068 | * handle of an image object created via ecore_evas_object_image_new() | ||
1069 | * | ||
1070 | * @param obj A handle to an image object created via | ||
1071 | * ecore_evas_object_image_new() | ||
1072 | * @return A handle to @p obj's underlying @c Ecore_Evas's canvas | ||
1073 | */ | ||
1074 | EAPI Evas *ecore_evas_object_evas_get(Evas_Object *obj); | ||
1075 | |||
1076 | EAPI Ecore_Evas *ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, | ||
1077 | int x, | ||
1078 | int y, | ||
1079 | int width, | ||
1080 | int height); | ||
1081 | |||
1082 | EAPI Ecore_Evas *ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, | ||
1083 | int x, | ||
1084 | int y, | ||
1085 | int width, | ||
1086 | int height); | ||
1087 | |||
1088 | EAPI Ecore_Evas *ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent, | ||
1089 | int x, | ||
1090 | int y, | ||
1091 | int width, | ||
1092 | int height); | ||
1093 | |||
1094 | EAPI Ecore_Evas *ecore_evas_direct3d_new(Ecore_Win32_Window *parent, | ||
1095 | int x, | ||
1096 | int y, | ||
1097 | int width, | ||
1098 | int height); | ||
1099 | |||
1100 | EAPI Ecore_Evas *ecore_evas_gl_glew_new(Ecore_Win32_Window *parent, | ||
1101 | int x, | ||
1102 | int y, | ||
1103 | int width, | ||
1104 | int height); | ||
1105 | |||
1106 | EAPI Ecore_Win32_Window *ecore_evas_win32_window_get(const Ecore_Evas *ee); | ||
1107 | |||
1108 | EAPI Ecore_Evas *ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha); | ||
1109 | EAPI Ecore_Evas *ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha); | ||
1110 | EAPI Ecore_Evas *ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe); | ||
1111 | |||
1112 | EAPI Ecore_Evas *ecore_evas_software_wince_new(Ecore_WinCE_Window *parent, | ||
1113 | int x, | ||
1114 | int y, | ||
1115 | int width, | ||
1116 | int height); | ||
1117 | |||
1118 | EAPI Ecore_Evas *ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent, | ||
1119 | int x, | ||
1120 | int y, | ||
1121 | int width, | ||
1122 | int height); | ||
1123 | |||
1124 | EAPI Ecore_Evas *ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent, | ||
1125 | int x, | ||
1126 | int y, | ||
1127 | int width, | ||
1128 | int height); | ||
1129 | |||
1130 | EAPI Ecore_Evas *ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent, | ||
1131 | int x, | ||
1132 | int y, | ||
1133 | int width, | ||
1134 | int height); | ||
1135 | |||
1136 | EAPI Ecore_Evas *ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent, | ||
1137 | int x, | ||
1138 | int y, | ||
1139 | int width, | ||
1140 | int height); | ||
1141 | |||
1142 | EAPI Ecore_WinCE_Window *ecore_evas_software_wince_window_get(const Ecore_Evas *ee); | ||
1143 | |||
1144 | EAPI Ecore_Evas *ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, | ||
1145 | int x, | ||
1146 | int y, | ||
1147 | int w, | ||
1148 | int h); | ||
1149 | |||
1150 | EAPI Ecore_Evas *ecore_evas_psl1ght_new(const char* name, int w, int h); | ||
1151 | |||
1152 | |||
1153 | /* generic manipulation calls */ | ||
1154 | /** | ||
1155 | * @brief Get the engine name used by this Ecore_Evas(window). | ||
1156 | * | ||
1157 | * @param ee Ecore_Evas whose engine's name is desired. | ||
1158 | * @return A string that can(usually) be used in ecore_evas_new() | ||
1159 | * | ||
1160 | * @see ecore_evas_free() | ||
1161 | */ | ||
1162 | EAPI const char *ecore_evas_engine_name_get(const Ecore_Evas *ee); | ||
1163 | /** | ||
1164 | * @brief Return the Ecore_Evas for this Evas | ||
1165 | * | ||
1166 | * @param e The Evas to get the Ecore_Evas from | ||
1167 | * @return The Ecore_Evas that holds this Evas, or NULL if not held by one. | ||
1168 | * | ||
1169 | * @warning Only use on Evas' created with ecore evas! | ||
1170 | */ | ||
1171 | EAPI Ecore_Evas *ecore_evas_ecore_evas_get(const Evas *e); | ||
1172 | /** | ||
1173 | * @brief Free an Ecore_Evas | ||
1174 | * | ||
1175 | * @param ee The Ecore_Evas to free | ||
1176 | * | ||
1177 | * This frees up any memory used by the Ecore_Evas. | ||
1178 | */ | ||
1179 | EAPI void ecore_evas_free(Ecore_Evas *ee); | ||
1180 | /** | ||
1181 | * @brief Retrieve user data associated with an Ecore_Evas. | ||
1182 | * | ||
1183 | * @param ee The Ecore_Evas to retrieve the user data from. | ||
1184 | * @param key The key which the user data to be retrieved is associated with. | ||
1185 | * | ||
1186 | * This function retrieves user specific data that has been stored within an | ||
1187 | * Ecore_Evas structure with ecore_evas_data_set(). | ||
1188 | * | ||
1189 | * @returns NULL on error or no data found, A pointer to the user data on | ||
1190 | * success. | ||
1191 | * | ||
1192 | * @see ecore_evas_data_set() | ||
1193 | */ | ||
1194 | EAPI void *ecore_evas_data_get(const Ecore_Evas *ee, const char *key); | ||
1195 | /** | ||
1196 | * @brief Store user data in an Ecore_Evas structure. | ||
1197 | * | ||
1198 | * @param ee The Ecore_Evas to store the user data in. | ||
1199 | * @param key A unique string to associate the user data against. Cannot | ||
1200 | * be NULL. | ||
1201 | * @param data A pointer to the user data to store. | ||
1202 | * | ||
1203 | * This function associates the @p data with a @p key which is stored by | ||
1204 | * the Ecore_Evas @p ee. Be aware that a call to ecore_evas_free() will | ||
1205 | * not free any memory for the associated user data, this is the responsibility | ||
1206 | * of the caller. | ||
1207 | * | ||
1208 | * @see ecore_evas_callback_pre_free_set() | ||
1209 | * @see ecore_evas_free() | ||
1210 | * @see ecore_evas_data_get() | ||
1211 | */ | ||
1212 | EAPI void ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data); | ||
1213 | /** | ||
1214 | * Set a callback for Ecore_Evas resize events. | ||
1215 | * @param ee The Ecore_Evas to set callbacks on | ||
1216 | * @param func The function to call | ||
1217 | |||
1218 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1219 | * @p func to be called whenever @p ee is resized. | ||
1220 | * | ||
1221 | * @warning If and when this function is called depends on the underlying | ||
1222 | * windowing system. | ||
1223 | */ | ||
1224 | EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1225 | /** | ||
1226 | * Set a callback for Ecore_Evas move events. | ||
1227 | * @param ee The Ecore_Evas to set callbacks on | ||
1228 | * @param func The function to call | ||
1229 | |||
1230 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1231 | * @p func to be called whenever @p ee is moved. | ||
1232 | * | ||
1233 | * @warning If and when this function is called depends on the underlying | ||
1234 | * windowing system. | ||
1235 | */ | ||
1236 | EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1237 | /** | ||
1238 | * Set a callback for Ecore_Evas show events. | ||
1239 | * @param ee The Ecore_Evas to set callbacks on | ||
1240 | * @param func The function to call | ||
1241 | |||
1242 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1243 | * @p func to be called whenever @p ee is shown. | ||
1244 | * | ||
1245 | * @warning If and when this function is called depends on the underlying | ||
1246 | * windowing system. | ||
1247 | */ | ||
1248 | EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1249 | /** | ||
1250 | * Set a callback for Ecore_Evas hide events. | ||
1251 | * @param ee The Ecore_Evas to set callbacks on | ||
1252 | * @param func The function to call | ||
1253 | |||
1254 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1255 | * @p func to be called whenever @p ee is hidden. | ||
1256 | * | ||
1257 | * @warning If and when this function is called depends on the underlying | ||
1258 | * windowing system. | ||
1259 | */ | ||
1260 | EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1261 | /** | ||
1262 | * Set a callback for Ecore_Evas delete request events. | ||
1263 | * @param ee The Ecore_Evas to set callbacks on | ||
1264 | * @param func The function to call | ||
1265 | |||
1266 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1267 | * @p func to be called whenever @p ee gets a delete request. | ||
1268 | * | ||
1269 | * @warning If and when this function is called depends on the underlying | ||
1270 | * windowing system. | ||
1271 | */ | ||
1272 | EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1273 | /** | ||
1274 | * Set a callback for Ecore_Evas destroy events. | ||
1275 | * @param ee The Ecore_Evas to set callbacks on | ||
1276 | * @param func The function to call | ||
1277 | |||
1278 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1279 | * @p func to be called whenever @p ee is destroyed. | ||
1280 | * | ||
1281 | * @warning If and when this function is called depends on the underlying | ||
1282 | * windowing system. | ||
1283 | */ | ||
1284 | EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1285 | /** | ||
1286 | * Set a callback for Ecore_Evas focus in events. | ||
1287 | * @param ee The Ecore_Evas to set callbacks on | ||
1288 | * @param func The function to call | ||
1289 | |||
1290 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1291 | * @p func to be called whenever @p ee gets focus. | ||
1292 | * | ||
1293 | * @warning If and when this function is called depends on the underlying | ||
1294 | * windowing system. | ||
1295 | */ | ||
1296 | EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1297 | /** | ||
1298 | * Set a callback for Ecore_Evas focus out events. | ||
1299 | * @param ee The Ecore_Evas to set callbacks on | ||
1300 | * @param func The function to call | ||
1301 | |||
1302 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1303 | * @p func to be called whenever @p ee loses focus. | ||
1304 | * | ||
1305 | * @warning If and when this function is called depends on the underlying | ||
1306 | * windowing system. | ||
1307 | */ | ||
1308 | EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1309 | /** | ||
1310 | * Set a callback for Ecore_Evas sticky events. | ||
1311 | * @param ee The Ecore_Evas to set callbacks on | ||
1312 | * @param func The function to call | ||
1313 | |||
1314 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1315 | * @p func to be called whenever @p ee becomes sticky. | ||
1316 | * | ||
1317 | * @warning If and when this function is called depends on the underlying | ||
1318 | * windowing system. | ||
1319 | */ | ||
1320 | EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1321 | /** | ||
1322 | * Set a callback for Ecore_Evas un-sticky events. | ||
1323 | * @param ee The Ecore_Evas to set callbacks on | ||
1324 | * @param func The function to call | ||
1325 | |||
1326 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1327 | * @p func to be called whenever @p ee becomes un-sticky. | ||
1328 | * | ||
1329 | * @warning If and when this function is called depends on the underlying | ||
1330 | * windowing system. | ||
1331 | */ | ||
1332 | EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1333 | /** | ||
1334 | * Set a callback for Ecore_Evas mouse in events. | ||
1335 | * @param ee The Ecore_Evas to set callbacks on | ||
1336 | * @param func The function to call | ||
1337 | |||
1338 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1339 | * @p func to be called whenever the mouse enters @p ee. | ||
1340 | * | ||
1341 | * @warning If and when this function is called depends on the underlying | ||
1342 | * windowing system. | ||
1343 | */ | ||
1344 | EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1345 | /** | ||
1346 | * Set a callback for Ecore_Evas mouse out events. | ||
1347 | * @param ee The Ecore_Evas to set callbacks on | ||
1348 | * @param func The function to call | ||
1349 | |||
1350 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1351 | * @p func to be called whenever the mouse leaves @p ee. | ||
1352 | * | ||
1353 | * @warning If and when this function is called depends on the underlying | ||
1354 | * windowing system. | ||
1355 | */ | ||
1356 | EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1357 | /** | ||
1358 | * Set a callback for Ecore_Evas pre render events. | ||
1359 | * @param ee The Ecore_Evas to set callbacks on | ||
1360 | * @param func The function to call | ||
1361 | |||
1362 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1363 | * @p func to be called just before the evas in @p ee is rendered. | ||
1364 | * | ||
1365 | * @warning If and when this function is called depends on the underlying | ||
1366 | * windowing system. | ||
1367 | */ | ||
1368 | EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1369 | /** | ||
1370 | * Set a callback for Ecore_Evas mouse post render events. | ||
1371 | * @param ee The Ecore_Evas to set callbacks on | ||
1372 | * @param func The function to call | ||
1373 | |||
1374 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1375 | * @p func to be called just after the evas in @p ee is rendered. | ||
1376 | * | ||
1377 | * @warning If and when this function is called depends on the underlying | ||
1378 | * windowing system. | ||
1379 | */ | ||
1380 | EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1381 | /** | ||
1382 | * Set a callback for Ecore_Evas pre-free event. | ||
1383 | * @param ee The Ecore_Evas to set callbacks on | ||
1384 | * @param func The function to call | ||
1385 | * | ||
1386 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1387 | * @p func to be called just before the instance @p ee is freed. | ||
1388 | * | ||
1389 | * @warning If and when this function is called depends on the underlying | ||
1390 | * windowing system. | ||
1391 | */ | ||
1392 | EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1393 | /** | ||
1394 | * Set a callback for Ecore_Evas state changes. | ||
1395 | * @param ee The Ecore_Evas to set callbacks on | ||
1396 | * @param func The function to call | ||
1397 | |||
1398 | * A call to this function will set a callback on an Ecore_Evas, causing | ||
1399 | * @p func to be called whenever @p ee changes state. | ||
1400 | * | ||
1401 | * @since 1.2 | ||
1402 | * @warning If and when this function is called depends on the underlying | ||
1403 | * windowing system. | ||
1404 | */ | ||
1405 | EAPI void ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
1406 | |||
1407 | EAPI Evas *ecore_evas_get(const Ecore_Evas *ee); | ||
1408 | EAPI void ecore_evas_managed_move(Ecore_Evas *ee, int x, int y); | ||
1409 | EAPI void ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped); | ||
1410 | EAPI Eina_Bool ecore_evas_shaped_get(const Ecore_Evas *ee); | ||
1411 | /** | ||
1412 | * @brief Show an Ecore_Evas' window | ||
1413 | * | ||
1414 | * @param ee The Ecore_Evas to show. | ||
1415 | * | ||
1416 | * This function makes @p ee visible. | ||
1417 | */ | ||
1418 | EAPI void ecore_evas_show(Ecore_Evas *ee); | ||
1419 | /** | ||
1420 | * @brief Hide an Ecore_Evas' window | ||
1421 | * | ||
1422 | * @param ee The Ecore_Evas to hide. | ||
1423 | * | ||
1424 | * This function makes @p ee hidden(not visible). | ||
1425 | */ | ||
1426 | EAPI void ecore_evas_hide(Ecore_Evas *ee); | ||
1427 | EAPI void ecore_evas_activate(Ecore_Evas *ee); | ||
1428 | |||
1429 | |||
1430 | /** | ||
1431 | * Set the minimum size of a given @c Ecore_Evas window | ||
1432 | * | ||
1433 | * @param ee An @c Ecore_Evas window's handle | ||
1434 | * @param w The minimum width | ||
1435 | * @param h The minimum height | ||
1436 | * | ||
1437 | * This function sets the minimum size of @p ee to be @p w x @p h. | ||
1438 | * One won't be able to resize that window to dimensions smaller than | ||
1439 | * the ones set. | ||
1440 | * | ||
1441 | * @note When base sizes are set, via ecore_evas_size_base_set(), | ||
1442 | * they'll be used to calculate a window's minimum size, instead of | ||
1443 | * those set by this function. | ||
1444 | * | ||
1445 | * @see ecore_evas_size_min_get() | ||
1446 | */ | ||
1447 | EAPI void ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h); | ||
1448 | |||
1449 | /** | ||
1450 | * Get the minimum size set for a given @c Ecore_Evas window | ||
1451 | * | ||
1452 | * @param ee An @c Ecore_Evas window's handle | ||
1453 | * @param w A pointer to an int to place the minimum width in. | ||
1454 | * @param h A pointer to an int to place the minimum height in. | ||
1455 | * | ||
1456 | * @note Use @c NULL pointers on the size components you're not | ||
1457 | * interested in: they'll be ignored by the function. | ||
1458 | * | ||
1459 | * @see ecore_evas_size_min_set() for more details | ||
1460 | */ | ||
1461 | EAPI void ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h); | ||
1462 | |||
1463 | /** | ||
1464 | * Set the maximum size of a given @c Ecore_Evas window | ||
1465 | * | ||
1466 | * @param ee An @c Ecore_Evas window's handle | ||
1467 | * @param w The maximum width | ||
1468 | * @param h The maximum height | ||
1469 | * | ||
1470 | * This function sets the maximum size of @p ee to be @p w x @p h. | ||
1471 | * One won't be able to resize that window to dimensions bigger than | ||
1472 | * the ones set. | ||
1473 | * | ||
1474 | * @see ecore_evas_size_max_get() | ||
1475 | */ | ||
1476 | EAPI void ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h); | ||
1477 | |||
1478 | /** | ||
1479 | * Get the maximum size set for a given @c Ecore_Evas window | ||
1480 | * | ||
1481 | * @param ee An @c Ecore_Evas window's handle | ||
1482 | * @param w A pointer to an int to place the maximum width in. | ||
1483 | * @param h A pointer to an int to place the maximum height in. | ||
1484 | * | ||
1485 | * @note Use @c NULL pointers on the size components you're not | ||
1486 | * interested in: they'll be ignored by the function. | ||
1487 | * | ||
1488 | * @see ecore_evas_size_max_set() for more details | ||
1489 | */ | ||
1490 | EAPI void ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h); | ||
1491 | |||
1492 | /** | ||
1493 | * Set the base size for a given @c Ecore_Evas window | ||
1494 | * | ||
1495 | * @param ee An @c Ecore_Evas window's handle | ||
1496 | * @param w The base width | ||
1497 | * @param h The base height | ||
1498 | * | ||
1499 | * This function sets the @b base size of @p ee to be @p w x @p h. | ||
1500 | * When base sizes are set, they'll be used to calculate a window's | ||
1501 | * @b minimum size, instead of those set by ecore_evas_size_min_get(). | ||
1502 | * | ||
1503 | * @see ecore_evas_size_base_get() | ||
1504 | */ | ||
1505 | EAPI void ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h); | ||
1506 | |||
1507 | /** | ||
1508 | * Get the base size set for a given @c Ecore_Evas window | ||
1509 | * | ||
1510 | * @param ee An @c Ecore_Evas window's handle | ||
1511 | * @param w A pointer to an int to place the base width in. | ||
1512 | * @param h A pointer to an int to place the base height in. | ||
1513 | * | ||
1514 | * @note Use @c NULL pointers on the size components you're not | ||
1515 | * interested in: they'll be ignored by the function. | ||
1516 | * | ||
1517 | * @see ecore_evas_size_base_set() for more details | ||
1518 | */ | ||
1519 | EAPI void ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h); | ||
1520 | |||
1521 | /** | ||
1522 | * Set the "size step" for a given @c Ecore_Evas window | ||
1523 | * | ||
1524 | * @param ee An @c Ecore_Evas window's handle | ||
1525 | * @param w The step width | ||
1526 | * @param h The step height | ||
1527 | * | ||
1528 | * This function sets the size steps of @p ee to be @p w x @p h. This | ||
1529 | * limits the size of this @c Ecore_Evas window to be @b always an | ||
1530 | * integer multiple of the step size, for each axis. | ||
1531 | */ | ||
1532 | EAPI void ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h); | ||
1533 | |||
1534 | /** | ||
1535 | * Get the "size step" set for a given @c Ecore_Evas window | ||
1536 | * | ||
1537 | * @param ee An @c Ecore_Evas window's handle | ||
1538 | * @param w A pointer to an int to place the step width in. | ||
1539 | * @param h A pointer to an int to place the step height in. | ||
1540 | * | ||
1541 | * @note Use @c NULL pointers on the size components you're not | ||
1542 | * interested in: they'll be ignored by the function. | ||
1543 | * | ||
1544 | * @see ecore_evas_size_base_set() for more details | ||
1545 | */ | ||
1546 | EAPI void ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h); | ||
1547 | |||
1548 | /** | ||
1549 | * @brief Set the cursor of an Ecore_Evas. | ||
1550 | * | ||
1551 | * @param ee The Ecore_Evas | ||
1552 | * @param file The path to an image file for the cursor. | ||
1553 | * @param layer The layer in which the cursor will appear. | ||
1554 | * @param hot_x The x coordinate of the cursor's hot spot. | ||
1555 | * @param hot_y The y coordinate of the cursor's hot spot. | ||
1556 | * | ||
1557 | * This function makes the mouse cursor over @p ee be the image specified by | ||
1558 | * @p file. The actual point within the image that the mouse is at is specified | ||
1559 | * by @p hot_x and @p hot_y, which are coordinates with respect to the top left | ||
1560 | * corner of the cursor image. | ||
1561 | * | ||
1562 | * @note This function creates an object from the image and uses | ||
1563 | * ecore_evas_object_cursor_set(). | ||
1564 | * | ||
1565 | * @see ecore_evas_object_cursor_set() | ||
1566 | */ | ||
1567 | EAPI void ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y); | ||
1568 | /** | ||
1569 | * @brief Get information about an Ecore_Evas' cursor | ||
1570 | * | ||
1571 | * @param ee The Ecore_Evas to set | ||
1572 | * @param obj A pointer to an Evas_Object to place the cursor Evas_Object. | ||
1573 | * @param layer A pointer to an int to place the cursor's layer in. | ||
1574 | * @param hot_x A pointer to an int to place the cursor's hot_x coordinate in. | ||
1575 | * @param hot_y A pointer to an int to place the cursor's hot_y coordinate in. | ||
1576 | * | ||
1577 | * This function queries information about an Ecore_Evas' cursor. | ||
1578 | * | ||
1579 | * @see ecore_evas_cursor_set() | ||
1580 | * @see ecore_evas_object_cursor_set() | ||
1581 | */ | ||
1582 | EAPI void ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y); | ||
1583 | /** | ||
1584 | * @brief Set the cursor of an Ecore_Evas | ||
1585 | * | ||
1586 | * @param ee The Ecore_Evas | ||
1587 | * | ||
1588 | * @param obj The Evas_Object which will be the cursor. | ||
1589 | * @param layer The layer in which the cursor will appear. | ||
1590 | * @param hot_x The x coordinate of the cursor's hot spot. | ||
1591 | * @param hot_y The y coordinate of the cursor's hot spot. | ||
1592 | * | ||
1593 | * This function makes the mouse cursor over @p ee be the object specified by | ||
1594 | * @p obj. The actual point within the object that the mouse is at is specified | ||
1595 | * by @p hot_x and @p hot_y, which are coordinates with respect to the top left | ||
1596 | * corner of the cursor object. | ||
1597 | * | ||
1598 | * @see ecore_evas_cursor_set() | ||
1599 | */ | ||
1600 | EAPI void ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); | ||
1601 | EAPI void ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on); | ||
1602 | EAPI Eina_Bool ecore_evas_override_get(const Ecore_Evas *ee); | ||
1603 | EAPI void ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on); | ||
1604 | EAPI Ecore_Evas_Avoid_Damage_Type ecore_evas_avoid_damage_get(const Ecore_Evas *ee); | ||
1605 | EAPI void ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn); | ||
1606 | EAPI Eina_Bool ecore_evas_withdrawn_get(const Ecore_Evas *ee); | ||
1607 | EAPI void ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky); | ||
1608 | EAPI Eina_Bool ecore_evas_sticky_get(const Ecore_Evas *ee); | ||
1609 | EAPI void ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render); | ||
1610 | EAPI Eina_Bool ecore_evas_manual_render_get(const Ecore_Evas *ee); | ||
1611 | |||
1612 | /** | ||
1613 | * @brief Registers an @c Ecore_Evas to receive events through ecore_input_evas. | ||
1614 | * | ||
1615 | * @param ee The @c Ecore_Evas handle. | ||
1616 | * | ||
1617 | * This function calls ecore_event_window_register() with the @p ee as its @c | ||
1618 | * id argument, @c window argument, and uses its @c Evas too. It is useful when | ||
1619 | * no @c window information is available on a given @c Ecore_Evas backend. | ||
1620 | * | ||
1621 | * @see ecore_evas_input_event_unregister() | ||
1622 | * @since 1.1 | ||
1623 | */ | ||
1624 | EAPI void ecore_evas_input_event_register(Ecore_Evas *ee); | ||
1625 | /** | ||
1626 | * @brief Unregisters an @c Ecore_Evas receiving events through ecore_input_evas. | ||
1627 | * | ||
1628 | * @param ee The @c Ecore_Evas handle. | ||
1629 | * | ||
1630 | * @see ecore_evas_input_event_register() | ||
1631 | * @since 1.1 | ||
1632 | */ | ||
1633 | EAPI void ecore_evas_input_event_unregister(Ecore_Evas *ee); | ||
1634 | |||
1635 | /** | ||
1636 | * @brief Force immediate rendering on a given @c Ecore_Evas window | ||
1637 | * | ||
1638 | * @param ee An @c Ecore_Evas handle | ||
1639 | * | ||
1640 | * Use this call to forcefully flush the @p ee's canvas rendering | ||
1641 | * pipeline, thus bring its window to an up to date state. | ||
1642 | */ | ||
1643 | EAPI void ecore_evas_manual_render(Ecore_Evas *ee); | ||
1644 | EAPI void ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync); | ||
1645 | EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee); | ||
1646 | /** | ||
1647 | * @brief Get geometry of screen associated with this Ecore_Evas. | ||
1648 | * | ||
1649 | * @param ee The Ecore_Evas whose window's to query container screen geometry. | ||
1650 | * @param x where to return the horizontal offset value. May be NULL. | ||
1651 | * @param y where to return the vertical offset value. May be NULL. | ||
1652 | * @param w where to return the width value. May be NULL. | ||
1653 | * @param h where to return the height value. May be NULL. | ||
1654 | * | ||
1655 | * @since 1.1 | ||
1656 | */ | ||
1657 | EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); | ||
1658 | |||
1659 | EAPI void ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame); | ||
1660 | EAPI Eina_Bool ecore_evas_draw_frame_get(const Ecore_Evas *ee); | ||
1661 | |||
1662 | /** | ||
1663 | * @brief Associate the given object to this ecore evas. | ||
1664 | * | ||
1665 | * @param ee The Ecore_Evas to associate to @a obj | ||
1666 | * @param obj The object to associate to @a ee | ||
1667 | * @param flags The association flags. | ||
1668 | * @return EINA_TRUE on success, EINA_FALSE otherwise. | ||
1669 | * | ||
1670 | * Association means that operations on one will affect the other, for | ||
1671 | * example moving the object will move the window, resize the object will | ||
1672 | * also affect the ecore evas window, hide and show applies as well. | ||
1673 | * | ||
1674 | * This is meant to simplify development, since you often need to associate | ||
1675 | * these events with your "base" objects, background or bottom-most object. | ||
1676 | * | ||
1677 | * Be aware that some methods might not be what you would like, deleting | ||
1678 | * either the window or the object will delete the other. If you want to | ||
1679 | * change that behavior, let's say to hide window when it's closed, you | ||
1680 | * must use ecore_evas_callback_delete_request_set() and set your own code, | ||
1681 | * like ecore_evas_hide(). Just remember that if you override delete_request | ||
1682 | * and still want to delete the window/object, you must do that yourself. | ||
1683 | * | ||
1684 | * Since we now define delete_request, deleting windows will not quit | ||
1685 | * main loop, if you wish to do so, you should listen for EVAS_CALLBACK_FREE | ||
1686 | * on the object, that way you get notified and you can call | ||
1687 | * ecore_main_loop_quit(). | ||
1688 | * | ||
1689 | * Flags can be OR'ed of: | ||
1690 | * @li ECORE_EVAS_OBJECT_ASSOCIATE_BASE (or 0): to listen to basic events | ||
1691 | * like delete, resize and move, but no stacking or layer are used. | ||
1692 | * @li ECORE_EVAS_OBJECT_ASSOCIATE_STACK: stacking operations will act | ||
1693 | * on the Ecore_Evas, not the object. So evas_object_raise() will | ||
1694 | * call ecore_evas_raise(). Relative operations (stack_above, stack_below) | ||
1695 | * are still not implemented. | ||
1696 | * @li ECORE_EVAS_OBJECT_ASSOCIATE_LAYER: stacking operations will act | ||
1697 | * on the Ecore_Evas, not the object. So evas_object_layer_set() will | ||
1698 | * call ecore_evas_layer_set(). | ||
1699 | * @li ECORE_EVAS_OBJECT_ASSOCIATE_DEL: the object delete will delete the | ||
1700 | * ecore_evas as well as delete_requests on the ecore_evas will delete | ||
1701 | * etc. | ||
1702 | */ | ||
1703 | EAPI Eina_Bool ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags); | ||
1704 | /** | ||
1705 | * @brief Cancel the association set with ecore_evas_object_associate(). | ||
1706 | * | ||
1707 | * @param ee The Ecore_Evas to dissociate from @a obj | ||
1708 | * @param obj The object to dissociate from @a ee | ||
1709 | * @return EINA_TRUE on success, EINA_FALSE otherwise. | ||
1710 | */ | ||
1711 | EAPI Eina_Bool ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj); | ||
1712 | /** | ||
1713 | * @brief Get the object associated with @p ee | ||
1714 | * | ||
1715 | * @param ee The Ecore_Evas to get the object from. | ||
1716 | * @return The associated object, or NULL if there is no associated object. | ||
1717 | */ | ||
1718 | EAPI Evas_Object *ecore_evas_object_associate_get(const Ecore_Evas *ee); | ||
1719 | |||
1720 | /* helper function to be used with ECORE_GETOPT_CALLBACK_*() */ | ||
1721 | 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); | ||
1722 | |||
1723 | /** | ||
1724 | * @brief Get a list of all the ecore_evases. | ||
1725 | * | ||
1726 | * @return A list of ecore_evases. | ||
1727 | * | ||
1728 | * The returned list of ecore evases is only valid until the canvases are | ||
1729 | * destroyed (and should not be cached for instance). The list can be freed by | ||
1730 | * just deleting the list. | ||
1731 | */ | ||
1732 | EAPI Eina_List *ecore_evas_ecore_evas_list_get(void); | ||
1733 | |||
1734 | /* specific calls to an x11 environment ecore_evas */ | ||
1735 | EAPI void ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win); | ||
1736 | EAPI Ecore_X_Window ecore_evas_x11_leader_get(Ecore_Evas *ee); | ||
1737 | EAPI void ecore_evas_x11_leader_default_set(Ecore_Evas *ee); | ||
1738 | EAPI void ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h); | ||
1739 | EAPI void ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h); | ||
1740 | EAPI void ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h); | ||
1741 | EAPI void ecore_evas_x11_shape_input_empty(Ecore_Evas *ee); | ||
1742 | EAPI void ecore_evas_x11_shape_input_reset(Ecore_Evas *ee); | ||
1743 | EAPI void ecore_evas_x11_shape_input_apply(Ecore_Evas *ee); | ||
1744 | |||
1745 | /** | ||
1746 | * @defgroup Ecore_Evas_Ews Ecore_Evas Single Process Windowing System. | ||
1747 | * | ||
1748 | * These are global scope functions to manage the EWS to be used by | ||
1749 | * ecore_evas_ews_new(). | ||
1750 | * | ||
1751 | * @since 1.1 | ||
1752 | * @{ | ||
1753 | */ | ||
1754 | |||
1755 | /** | ||
1756 | * Sets the engine to be used by the backing store engine. | ||
1757 | * | ||
1758 | * @return EINA_TRUE on success, EINA_FALSE if ews is already in use. | ||
1759 | * @since 1.1 | ||
1760 | */ | ||
1761 | EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options); | ||
1762 | |||
1763 | /** | ||
1764 | * Reconfigure the backing store used. | ||
1765 | * @since 1.1 | ||
1766 | */ | ||
1767 | EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h); | ||
1768 | |||
1769 | /** | ||
1770 | * Return the internal backing store in use. | ||
1771 | * | ||
1772 | * @note this will forced it to be created, making future calls to | ||
1773 | * ecore_evas_ews_engine_set() void. | ||
1774 | * | ||
1775 | * @see ecore_evas_ews_evas_get() | ||
1776 | * @since 1.1 | ||
1777 | */ | ||
1778 | EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void); | ||
1779 | |||
1780 | /** | ||
1781 | * Return the internal backing store in use. | ||
1782 | * | ||
1783 | * @note this will forced it to be created, making future calls to | ||
1784 | * ecore_evas_ews_engine_set() void. | ||
1785 | * | ||
1786 | * @see ecore_evas_ews_ecore_evas_get() | ||
1787 | * @since 1.1 | ||
1788 | */ | ||
1789 | EAPI Evas *ecore_evas_ews_evas_get(void); | ||
1790 | |||
1791 | /** | ||
1792 | * Get the current background. | ||
1793 | */ | ||
1794 | EAPI Evas_Object *ecore_evas_ews_background_get(void); | ||
1795 | |||
1796 | /** | ||
1797 | * Set the current background, must be created at evas ecore_evas_ews_evas_get() | ||
1798 | * | ||
1799 | * It will be kept at lowest layer (EVAS_LAYER_MIN) and below | ||
1800 | * everything else. You can set any object, default is a black | ||
1801 | * rectangle. | ||
1802 | * | ||
1803 | * @note previous object will be deleted! | ||
1804 | */ | ||
1805 | EAPI void ecore_evas_ews_background_set(Evas_Object *o); | ||
1806 | |||
1807 | /** | ||
1808 | * Return all Ecore_Evas* created by EWS. | ||
1809 | * | ||
1810 | * @note do not change the returned list or its contents. | ||
1811 | * @since 1.1 | ||
1812 | */ | ||
1813 | EAPI const Eina_List *ecore_evas_ews_children_get(void); | ||
1814 | |||
1815 | /** | ||
1816 | * Set the identifier of the manager taking care of internal windows. | ||
1817 | * | ||
1818 | * The ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE event is issued. Consider | ||
1819 | * handling it to know if you should stop handling events yourself | ||
1820 | * (ie: another manager took over) | ||
1821 | * | ||
1822 | * @param manager any unique identifier address. | ||
1823 | * | ||
1824 | * @see ecore_evas_ews_manager_get() | ||
1825 | * @since 1.1 | ||
1826 | */ | ||
1827 | EAPI void ecore_evas_ews_manager_set(const void *manager); | ||
1828 | |||
1829 | /** | ||
1830 | * Get the identifier of the manager taking care of internal windows. | ||
1831 | * | ||
1832 | * @return the value set by ecore_evas_ews_manager_set() | ||
1833 | * @since 1.1 | ||
1834 | */ | ||
1835 | EAPI const void *ecore_evas_ews_manager_get(void); | ||
1836 | |||
1837 | EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed @since 1.1 */ | ||
1838 | EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created @since 1.1 */ | ||
1839 | 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. @since 1.1 */ | ||
1840 | EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized @since 1.1 */ | ||
1841 | EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved @since 1.1 */ | ||
1842 | EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible @since 1.1 */ | ||
1843 | EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden @since 1.1 */ | ||
1844 | EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused @since 1.1 */ | ||
1845 | EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus @since 1.1 */ | ||
1846 | EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised @since 1.1 */ | ||
1847 | EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered @since 1.1 */ | ||
1848 | EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated @since 1.1 */ | ||
1849 | |||
1850 | EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed @since 1.1 */ | ||
1851 | EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed @since 1.1 */ | ||
1852 | EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed @since 1.1 */ | ||
1853 | EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed @since 1.1 */ | ||
1854 | EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) @since 1.1 */ | ||
1855 | |||
1856 | /** | ||
1857 | * @} | ||
1858 | */ | ||
1859 | |||
1860 | /** | ||
1861 | * @defgroup Ecore_Evas_Extn External plug/socket infrastructure to remote canvases | ||
1862 | * | ||
1863 | * These functions allow 1 process to create a "socket" was pluged into which another | ||
1864 | * process can create a "plug" remotely to plug into. | ||
1865 | * Socket can provides content for several plugs. | ||
1866 | * This is best for small sized objects (about the size range | ||
1867 | * of a small icon up to a few large icons). Sine the plug is actually an | ||
1868 | * image object, you can fetch the pixel data | ||
1869 | * | ||
1870 | * @since 1.2 | ||
1871 | * @{ | ||
1872 | */ | ||
1873 | |||
1874 | EAPI extern int ECORE_EVAS_EXTN_CLIENT_ADD; /**< this event is received when a plug has connected to an extn socket @since 1.2 */ | ||
1875 | EAPI extern int ECORE_EVAS_EXTN_CLIENT_DEL; /**< this event is received when a plug has disconnected from an extn socket @since 1.2 */ | ||
1876 | |||
1877 | /** | ||
1878 | * @brief Create a new Ecore_Evas canvas for the new external ecore evas socket | ||
1879 | * | ||
1880 | * @param w The width of the canvas, in pixels | ||
1881 | * @param h The height of the canvas, in pixels | ||
1882 | * @return A new @c Ecore_Evas instance or @c NULL, on failure | ||
1883 | * | ||
1884 | * This creates a new extn_socket canvas wrapper, with image data array | ||
1885 | * @b bound to the ARGB format, 8 bits per pixel. | ||
1886 | * | ||
1887 | * If creation is successful, an Ecore_Evas handle is returned or NULL if creation | ||
1888 | * fails. Also focus, show, hide etc. callbacks | ||
1889 | * will also be called if the plug object is shown, or already visible on | ||
1890 | * connect, or if it is hidden later, focused or unfocused. | ||
1891 | * | ||
1892 | * This function has to be flowed by ecore_evas_extn_socket_listen(), | ||
1893 | * for starting ecore ipc service. | ||
1894 | * | ||
1895 | * @code | ||
1896 | * Eina_Bool res = EINA_FALSE; | ||
1897 | * Ecore_Evas *ee = ecore_evas_extn_socket_new(1, 1); | ||
1898 | * | ||
1899 | * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE); | ||
1900 | * if (!res) return; | ||
1901 | * ecore_evas_resize(ee, 240, 400); | ||
1902 | * @endcode | ||
1903 | * | ||
1904 | * or | ||
1905 | * | ||
1906 | * @code | ||
1907 | * Eina_Bool res = EINA_FALSE; | ||
1908 | * Ecore_Evas *ee = ecore_evas_extn_socket_new(240, 400); | ||
1909 | * | ||
1910 | * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE); | ||
1911 | * if (!res) return; | ||
1912 | * @endcode | ||
1913 | * | ||
1914 | * When a client(plug) connects, you will get the ECORE_EVAS_EXTN_CLIENT_ADD event | ||
1915 | * in the ecore event queue, with event_info being the image object pointer | ||
1916 | * passed as a void pointer. When a client disconnects you will get the | ||
1917 | * ECORE_EVAS_EXTN_CLIENT_DEL event. | ||
1918 | * | ||
1919 | * You can set up event handles for these events as follows: | ||
1920 | * | ||
1921 | * @code | ||
1922 | * static void client_add_cb(void *data, int event, void *event_info) | ||
1923 | * { | ||
1924 | * Evas_Object *obj = event_info; | ||
1925 | * printf("client added to image object %p\n", obj); | ||
1926 | * evas_object_show(obj); | ||
1927 | * } | ||
1928 | * | ||
1929 | * static void client_del_cb(void *data, int event, void *event_info) | ||
1930 | * { | ||
1931 | * Evas_Object *obj = event_info; | ||
1932 | * printf("client deleted from image object %p\n", obj); | ||
1933 | * evas_object_hide(obj); | ||
1934 | * } | ||
1935 | * | ||
1936 | * void setup(void) | ||
1937 | * { | ||
1938 | * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_ADD, | ||
1939 | * client_add_cb, NULL); | ||
1940 | * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_DEL, | ||
1941 | * client_del_cb, NULL); | ||
1942 | * } | ||
1943 | * @endcode | ||
1944 | * | ||
1945 | * Note that events come in later after the event happened. You may want to be | ||
1946 | * careful as data structures you had associated with the image object | ||
1947 | * may have been freed after deleting, but the object may still be around | ||
1948 | * awating cleanup and thus still be valid.You can change the size with something like: | ||
1949 | * | ||
1950 | * @see ecore_evas_extn_socket_listen() | ||
1951 | * @see ecore_evas_extn_plug_new() | ||
1952 | * @see ecore_evas_extn_plug_object_data_lock() | ||
1953 | * @see ecore_evas_extn_plug_object_data_unlock() | ||
1954 | * | ||
1955 | * @since 1.2 | ||
1956 | */ | ||
1957 | EAPI Ecore_Evas *ecore_evas_extn_socket_new(int w, int h); | ||
1958 | |||
1959 | /** | ||
1960 | * @brief Create a socket to provide the service for external ecore evas socket. | ||
1961 | * | ||
1962 | * @param ee The Ecore_Evas | ||
1963 | * @param svcname The name of the service to be advertised. ensure that it is unique (when combined with @p svcnum) otherwise creation may fail. | ||
1964 | * @param svcnum A number (any value, 0 beig the common default) to differentiate multiple instances of services with the same name. | ||
1965 | * @param svcsys A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user ide that created the service. | ||
1966 | * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not. | ||
1967 | * | ||
1968 | * This creates socket specified by @p svcname, @p svcnum and @p svcsys. If creation | ||
1969 | * is successful, EINA_TRUE is returned or EINA_FALSE if creation | ||
1970 | * fails. | ||
1971 | * | ||
1972 | * @see ecore_evas_extn_socket_new() | ||
1973 | * @see ecore_evas_extn_plug_new() | ||
1974 | * @see ecore_evas_extn_plug_object_data_lock() | ||
1975 | * @see ecore_evas_extn_plug_object_data_unlock() | ||
1976 | * | ||
1977 | * @since 1.2 | ||
1978 | */ | ||
1979 | EAPI Eina_Bool ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys); | ||
1980 | |||
1981 | /** | ||
1982 | * @brief Lock the pixel data so the socket cannot change it | ||
1983 | * | ||
1984 | * @param obj The image object returned by ecore_evas_extn_plug_new() to lock | ||
1985 | * | ||
1986 | * You may need to get the image pixel data with evas_object_image_data_get() | ||
1987 | * from the image object, but need to ensure that it does not change while | ||
1988 | * you are using the data. This function lets you set an advisory lock on the | ||
1989 | * image data so the external plug process will not render to it or alter it. | ||
1990 | * | ||
1991 | * You should only hold the lock for just as long as you need to read out the | ||
1992 | * image data or otherwise deal with it, and then unlock it with | ||
1993 | * ecore_evas_extn_plug_object_data_unlock(). Keeping a lock over more than | ||
1994 | * 1 iteration of the main ecore loop will be problematic, so avoid it. Also | ||
1995 | * forgetting to unlock may cause the socket process to freeze and thus create | ||
1996 | * odd behavior. | ||
1997 | * | ||
1998 | * @see ecore_evas_extn_plug_new() | ||
1999 | * @see ecore_evas_extn_plug_object_data_unlock() | ||
2000 | * | ||
2001 | * @since 1.2 | ||
2002 | */ | ||
2003 | EAPI void ecore_evas_extn_plug_object_data_lock(Evas_Object *obj); | ||
2004 | |||
2005 | /** | ||
2006 | * @brief Unlock the pixel data so the socket can change it again. | ||
2007 | * | ||
2008 | * @param obj The image object returned by ecore_evas_extn_plug_new() to unlock | ||
2009 | * | ||
2010 | * This unlocks after an advisor lock has been taken by | ||
2011 | * ecore_evas_extn_plug_object_data_lock(). | ||
2012 | * | ||
2013 | * @see ecore_evas_extn_plug_new() | ||
2014 | * @see ecore_evas_extn_plug_object_data_lock() | ||
2015 | * | ||
2016 | * @since 1.2 | ||
2017 | */ | ||
2018 | EAPI void ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj); | ||
2019 | |||
2020 | /** | ||
2021 | * @brief Create a new external ecore evas plug | ||
2022 | * | ||
2023 | * @param ee_target The Ecore_Evas containing the canvas in which the new image object will live. | ||
2024 | * @return An evas image object that will contain the image output of a socket. | ||
2025 | * | ||
2026 | * This creates an image object that will contain the output of another | ||
2027 | * processes socket canvas when it connects. All input will be sent back to | ||
2028 | * this process as well, effectively swallowing or placing the socket process | ||
2029 | * in the canvas of the plug process in place of the image object. The image | ||
2030 | * object by default is created to be filled (equivalent of | ||
2031 | * evas_object_image_filled_add() on creation) so image content will scale | ||
2032 | * to fill the image unless otherwise reconfigured. The Ecore_Evas size | ||
2033 | * of the plug is the master size and determines size in pixels of the | ||
2034 | * plug canvas. You can change the size with something like: | ||
2035 | * | ||
2036 | * @code | ||
2037 | * Eina_Bool res = EINA_FALSE; | ||
2038 | * Evas_Object *obj = ecore_evas_extn_plug_new(ee); | ||
2039 | * | ||
2040 | * res = ecore_evas_extn_plug_connect("svcname", 1, EINA_FALSE); | ||
2041 | * if (!res) return; | ||
2042 | * ecore_evas_resize(ee, 240, 400); | ||
2043 | * @endcode | ||
2044 | * | ||
2045 | * @see ecore_evas_extn_socket_new() | ||
2046 | * @see ecore_evas_extn_plug_connect() | ||
2047 | * @since 1.2 | ||
2048 | */ | ||
2049 | EAPI Evas_Object *ecore_evas_extn_plug_new(Ecore_Evas *ee_target); | ||
2050 | |||
2051 | /** | ||
2052 | * @brief Connect a external ecore evas plug to service provided by external ecore evas socket | ||
2053 | * | ||
2054 | * @param obj The Ecore_Evas containing the canvas in which the new image object will live. | ||
2055 | * @param svcname The service name to connect to set up by the socket. | ||
2056 | * @param svcnum The service number to connect to (set up by socket). | ||
2057 | * @param svcsys Booleain to set if the service is a system one or not (set up by socket). | ||
2058 | * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not. | ||
2059 | * | ||
2060 | * | ||
2061 | * @see ecore_evas_extn_plug_new() | ||
2062 | * | ||
2063 | * @since 1.2 | ||
2064 | */ | ||
2065 | EAPI Eina_Bool ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys); | ||
2066 | |||
2067 | /** | ||
2068 | * @} | ||
2069 | */ | ||
2070 | |||
2071 | /** | ||
2072 | * @} | ||
2073 | */ | ||
2074 | |||
2075 | #ifdef __cplusplus | ||
2076 | } | ||
2077 | #endif | ||
2078 | |||
2079 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.am b/libraries/ecore/src/lib/ecore_evas/Makefile.am deleted file mode 100644 index c85af09..0000000 --- a/libraries/ecore/src/lib/ecore_evas/Makefile.am +++ /dev/null | |||
@@ -1,160 +0,0 @@ | |||
1 | MAINTAINERCLEANFILES = Makefile.in | ||
2 | |||
3 | if BUILD_ECORE_X | ||
4 | ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ | ||
5 | ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_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 | if BUILD_ECORE_WAYLAND | ||
70 | ECORE_WAYLAND_INC = -I$(top_srcdir)/src/lib/ecore_wayland @WAYLAND_CFLAGS@ | ||
71 | ECORE_WAYLAND_LIB = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la | ||
72 | ECORE_WAYLAND_LIBADD = @WAYLAND_LIBS@ $(ECORE_WAYLAND_LIB) | ||
73 | else | ||
74 | ECORE_WAYLAND_INC = | ||
75 | ECORE_WAYLAND_LIB = | ||
76 | ECORE_WAYLAND_LIBADD = | ||
77 | endif | ||
78 | |||
79 | if BUILD_ECORE_IPC | ||
80 | ECORE_IPC_INC= \ | ||
81 | -I$(top_srcdir)/src/lib/ecore_ipc \ | ||
82 | -I$(top_builddir)/src/lib/ecore_ipc | ||
83 | |||
84 | ECORE_IPC_LIB=$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la | ||
85 | endif | ||
86 | |||
87 | AM_CPPFLAGS = \ | ||
88 | -I$(top_srcdir)/src/lib/ecore \ | ||
89 | -I$(top_srcdir)/src/lib/ecore_evas \ | ||
90 | -I$(top_srcdir)/src/lib/ecore_input \ | ||
91 | -I$(top_srcdir)/src/lib/ecore_input_evas \ | ||
92 | -I$(top_builddir)/src/lib/ecore \ | ||
93 | -I$(top_builddir)/src/lib/ecore_evas \ | ||
94 | -I$(top_builddir)/src/lib/ecore_input \ | ||
95 | -I$(top_builddir)/src/lib/ecore_input_evas \ | ||
96 | @EFL_ECORE_EVAS_BUILD@ \ | ||
97 | $(ECORE_X_INC) \ | ||
98 | $(ECORE_FB_INC) \ | ||
99 | $(ECORE_DIRECTFB_INC) \ | ||
100 | $(ECORE_WIN32_INC) \ | ||
101 | $(ECORE_SDL_INC) \ | ||
102 | $(ECORE_COCOA_INC) \ | ||
103 | $(ECORE_WINCE_INC) \ | ||
104 | $(ECORE_PSL1GHT_INC) \ | ||
105 | $(ECORE_WAYLAND_INC) \ | ||
106 | $(ECORE_IPC_INC) \ | ||
107 | @EVAS_CFLAGS@ \ | ||
108 | @EINA_CFLAGS@ \ | ||
109 | @EVIL_CFLAGS@ \ | ||
110 | @WAYLAND_EGL_CFLAGS@ | ||
111 | |||
112 | AM_CFLAGS = @WIN32_CFLAGS@ | ||
113 | |||
114 | lib_LTLIBRARIES = libecore_evas.la | ||
115 | includes_HEADERS = Ecore_Evas.h | ||
116 | includesdir = $(includedir)/ecore-@VMAJ@ | ||
117 | |||
118 | libecore_evas_la_SOURCES = \ | ||
119 | ecore_evas.c \ | ||
120 | ecore_evas_util.c \ | ||
121 | ecore_evas_x.c \ | ||
122 | ecore_evas_fb.c \ | ||
123 | ecore_evas_buffer.c \ | ||
124 | ecore_evas_directfb.c \ | ||
125 | ecore_evas_win32.c \ | ||
126 | ecore_evas_sdl.c \ | ||
127 | ecore_evas_cocoa.c \ | ||
128 | ecore_evas_wince.c \ | ||
129 | ecore_evas_ews.c \ | ||
130 | ecore_evas_psl1ght.c \ | ||
131 | ecore_evas_wayland_shm.c \ | ||
132 | ecore_evas_wayland_egl.c \ | ||
133 | ecore_evas_extn.c | ||
134 | |||
135 | libecore_evas_la_LIBADD = \ | ||
136 | $(ECORE_X_LIB) \ | ||
137 | $(ECORE_FB_LIB) \ | ||
138 | $(ECORE_DIRECTFB_LIB) \ | ||
139 | $(ECORE_WIN32_LIB) \ | ||
140 | $(ECORE_SDL_LIB) \ | ||
141 | $(ECORE_SDL_LIBADD) \ | ||
142 | $(ECORE_COCOA_LIB) \ | ||
143 | $(ECORE_WINCE_LIB) \ | ||
144 | $(ECORE_IPC_LIB) \ | ||
145 | $(ECORE_PSL1GHT_LIB) \ | ||
146 | $(ECORE_WAYLAND_LIB) \ | ||
147 | $(ECORE_WAYLAND_LIBADD) \ | ||
148 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | ||
149 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ | ||
150 | $(top_builddir)/src/lib/ecore/libecore.la \ | ||
151 | @EVAS_LIBS@ \ | ||
152 | @EINA_LIBS@ \ | ||
153 | @EVIL_LIBS@ \ | ||
154 | @SHM_OPEN_LIBS@ \ | ||
155 | @WAYLAND_EGL_LIBS@ | ||
156 | |||
157 | libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ | ||
158 | |||
159 | EXTRA_DIST = \ | ||
160 | ecore_evas_private.h | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.in b/libraries/ecore/src/lib/ecore_evas/Makefile.in deleted file mode 100644 index b48f26f..0000000 --- a/libraries/ecore/src/lib/ecore_evas/Makefile.in +++ /dev/null | |||
@@ -1,965 +0,0 @@ | |||
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/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ | ||
54 | $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ | ||
55 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ | ||
56 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ | ||
57 | $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ | ||
58 | $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac | ||
59 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
60 | $(ACLOCAL_M4) | ||
61 | mkinstalldirs = $(install_sh) -d | ||
62 | CONFIG_HEADER = $(top_builddir)/config.h | ||
63 | CONFIG_CLEAN_FILES = | ||
64 | CONFIG_CLEAN_VPATH_FILES = | ||
65 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | ||
66 | am__vpath_adj = case $$p in \ | ||
67 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | ||
68 | *) f=$$p;; \ | ||
69 | esac; | ||
70 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; | ||
71 | am__install_max = 40 | ||
72 | am__nobase_strip_setup = \ | ||
73 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` | ||
74 | am__nobase_strip = \ | ||
75 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" | ||
76 | am__nobase_list = $(am__nobase_strip_setup); \ | ||
77 | for p in $$list; do echo "$$p $$p"; done | \ | ||
78 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ | ||
79 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ | ||
80 | if (++n[$$2] == $(am__install_max)) \ | ||
81 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ | ||
82 | END { for (dir in files) print dir, files[dir] }' | ||
83 | am__base_list = \ | ||
84 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ | ||
85 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | ||
86 | am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" | ||
87 | LTLIBRARIES = $(lib_LTLIBRARIES) | ||
88 | @BUILD_ECORE_X_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/src/lib/ecore_x/libecore_x.la | ||
89 | @BUILD_ECORE_FB_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la | ||
90 | @BUILD_ECORE_DIRECTFB_TRUE@am__DEPENDENCIES_3 = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la | ||
91 | @BUILD_ECORE_WIN32_TRUE@am__DEPENDENCIES_4 = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la | ||
92 | @BUILD_ECORE_SDL_TRUE@am__DEPENDENCIES_5 = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la | ||
93 | @BUILD_ECORE_SDL_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_5) | ||
94 | @BUILD_ECORE_COCOA_TRUE@am__DEPENDENCIES_7 = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la | ||
95 | @BUILD_ECORE_WINCE_TRUE@am__DEPENDENCIES_8 = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la | ||
96 | @BUILD_ECORE_PSL1GHT_TRUE@am__DEPENDENCIES_9 = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la | ||
97 | @BUILD_ECORE_WAYLAND_TRUE@am__DEPENDENCIES_10 = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la | ||
98 | @BUILD_ECORE_WAYLAND_TRUE@am__DEPENDENCIES_11 = \ | ||
99 | @BUILD_ECORE_WAYLAND_TRUE@ $(am__DEPENDENCIES_10) | ||
100 | libecore_evas_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ | ||
101 | $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ | ||
102 | $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \ | ||
103 | $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_7) \ | ||
104 | $(am__DEPENDENCIES_8) $(ECORE_IPC_LIB) $(am__DEPENDENCIES_9) \ | ||
105 | $(am__DEPENDENCIES_10) $(am__DEPENDENCIES_11) \ | ||
106 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | ||
107 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ | ||
108 | $(top_builddir)/src/lib/ecore/libecore.la | ||
109 | am_libecore_evas_la_OBJECTS = ecore_evas.lo ecore_evas_util.lo \ | ||
110 | ecore_evas_x.lo ecore_evas_fb.lo ecore_evas_buffer.lo \ | ||
111 | ecore_evas_directfb.lo ecore_evas_win32.lo ecore_evas_sdl.lo \ | ||
112 | ecore_evas_cocoa.lo ecore_evas_wince.lo ecore_evas_ews.lo \ | ||
113 | ecore_evas_psl1ght.lo ecore_evas_wayland_shm.lo \ | ||
114 | ecore_evas_wayland_egl.lo ecore_evas_extn.lo | ||
115 | libecore_evas_la_OBJECTS = $(am_libecore_evas_la_OBJECTS) | ||
116 | AM_V_lt = $(am__v_lt_$(V)) | ||
117 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | ||
118 | am__v_lt_0 = --silent | ||
119 | libecore_evas_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ | ||
120 | $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ | ||
121 | $(AM_CFLAGS) $(CFLAGS) $(libecore_evas_la_LDFLAGS) $(LDFLAGS) \ | ||
122 | -o $@ | ||
123 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) | ||
124 | depcomp = $(SHELL) $(top_srcdir)/depcomp | ||
125 | am__depfiles_maybe = depfiles | ||
126 | am__mv = mv -f | ||
127 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | ||
128 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||
129 | LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
130 | $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ | ||
131 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | ||
132 | $(AM_CFLAGS) $(CFLAGS) | ||
133 | AM_V_CC = $(am__v_CC_$(V)) | ||
134 | am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) | ||
135 | am__v_CC_0 = @echo " CC " $@; | ||
136 | AM_V_at = $(am__v_at_$(V)) | ||
137 | am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) | ||
138 | am__v_at_0 = @ | ||
139 | CCLD = $(CC) | ||
140 | LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
141 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | ||
142 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
143 | AM_V_CCLD = $(am__v_CCLD_$(V)) | ||
144 | am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) | ||
145 | am__v_CCLD_0 = @echo " CCLD " $@; | ||
146 | AM_V_GEN = $(am__v_GEN_$(V)) | ||
147 | am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) | ||
148 | am__v_GEN_0 = @echo " GEN " $@; | ||
149 | SOURCES = $(libecore_evas_la_SOURCES) | ||
150 | DIST_SOURCES = $(libecore_evas_la_SOURCES) | ||
151 | HEADERS = $(includes_HEADERS) | ||
152 | ETAGS = etags | ||
153 | CTAGS = ctags | ||
154 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
155 | ACLOCAL = @ACLOCAL@ | ||
156 | ALLOCA = @ALLOCA@ | ||
157 | AMTAR = @AMTAR@ | ||
158 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | ||
159 | AR = @AR@ | ||
160 | AS = @AS@ | ||
161 | AUTOCONF = @AUTOCONF@ | ||
162 | AUTOHEADER = @AUTOHEADER@ | ||
163 | AUTOMAKE = @AUTOMAKE@ | ||
164 | AWK = @AWK@ | ||
165 | CARES_CFLAGS = @CARES_CFLAGS@ | ||
166 | CARES_LIBS = @CARES_LIBS@ | ||
167 | CC = @CC@ | ||
168 | CCDEPMODE = @CCDEPMODE@ | ||
169 | CFLAGS = @CFLAGS@ | ||
170 | CHECK_CFLAGS = @CHECK_CFLAGS@ | ||
171 | CHECK_LIBS = @CHECK_LIBS@ | ||
172 | CPP = @CPP@ | ||
173 | CPPFLAGS = @CPPFLAGS@ | ||
174 | CURL_CFLAGS = @CURL_CFLAGS@ | ||
175 | CURL_LIBS = @CURL_LIBS@ | ||
176 | CXX = @CXX@ | ||
177 | CXXCPP = @CXXCPP@ | ||
178 | CXXDEPMODE = @CXXDEPMODE@ | ||
179 | CXXFLAGS = @CXXFLAGS@ | ||
180 | CYGPATH_W = @CYGPATH_W@ | ||
181 | DEFS = @DEFS@ | ||
182 | DEPDIR = @DEPDIR@ | ||
183 | DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ | ||
184 | DIRECTFB_LIBS = @DIRECTFB_LIBS@ | ||
185 | DLLTOOL = @DLLTOOL@ | ||
186 | DSYMUTIL = @DSYMUTIL@ | ||
187 | DUMPBIN = @DUMPBIN@ | ||
188 | ECHO_C = @ECHO_C@ | ||
189 | ECHO_N = @ECHO_N@ | ||
190 | ECHO_T = @ECHO_T@ | ||
191 | ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ | ||
192 | ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ | ||
193 | EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ | ||
194 | EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ | ||
195 | EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ | ||
196 | EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ | ||
197 | EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ | ||
198 | EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ | ||
199 | EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ | ||
200 | EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ | ||
201 | EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ | ||
202 | EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ | ||
203 | EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ | ||
204 | EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ | ||
205 | EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ | ||
206 | EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ | ||
207 | EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ | ||
208 | EGREP = @EGREP@ | ||
209 | EINA_CFLAGS = @EINA_CFLAGS@ | ||
210 | EINA_LIBS = @EINA_LIBS@ | ||
211 | ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ | ||
212 | ESCAPE_LIBS = @ESCAPE_LIBS@ | ||
213 | EVAS_CFLAGS = @EVAS_CFLAGS@ | ||
214 | EVAS_LIBS = @EVAS_LIBS@ | ||
215 | EVIL_CFLAGS = @EVIL_CFLAGS@ | ||
216 | EVIL_LIBS = @EVIL_LIBS@ | ||
217 | EXEEXT = @EXEEXT@ | ||
218 | EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ | ||
219 | EXOTIC_LIBS = @EXOTIC_LIBS@ | ||
220 | FGREP = @FGREP@ | ||
221 | GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ | ||
222 | GLIB_CFLAGS = @GLIB_CFLAGS@ | ||
223 | GLIB_LIBS = @GLIB_LIBS@ | ||
224 | GMSGFMT = @GMSGFMT@ | ||
225 | GMSGFMT_015 = @GMSGFMT_015@ | ||
226 | GREP = @GREP@ | ||
227 | INSTALL = @INSTALL@ | ||
228 | INSTALL_DATA = @INSTALL_DATA@ | ||
229 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
230 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
231 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
232 | INTLLIBS = @INTLLIBS@ | ||
233 | INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ | ||
234 | KEYSYMDEFS = @KEYSYMDEFS@ | ||
235 | LD = @LD@ | ||
236 | LDFLAGS = @LDFLAGS@ | ||
237 | LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ | ||
238 | LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ | ||
239 | LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ | ||
240 | LIBICONV = @LIBICONV@ | ||
241 | LIBINTL = @LIBINTL@ | ||
242 | LIBOBJS = @LIBOBJS@ | ||
243 | LIBS = @LIBS@ | ||
244 | LIBTOOL = @LIBTOOL@ | ||
245 | LIPO = @LIPO@ | ||
246 | LN_S = @LN_S@ | ||
247 | LTLIBICONV = @LTLIBICONV@ | ||
248 | LTLIBINTL = @LTLIBINTL@ | ||
249 | LTLIBOBJS = @LTLIBOBJS@ | ||
250 | MAKEINFO = @MAKEINFO@ | ||
251 | MKDIR_P = @MKDIR_P@ | ||
252 | MSGFMT = @MSGFMT@ | ||
253 | MSGFMT_015 = @MSGFMT_015@ | ||
254 | MSGMERGE = @MSGMERGE@ | ||
255 | NM = @NM@ | ||
256 | NMEDIT = @NMEDIT@ | ||
257 | OBJC = @OBJC@ | ||
258 | OBJCDEPMODE = @OBJCDEPMODE@ | ||
259 | OBJCFLAGS = @OBJCFLAGS@ | ||
260 | OBJDUMP = @OBJDUMP@ | ||
261 | OBJEXT = @OBJEXT@ | ||
262 | OTOOL = @OTOOL@ | ||
263 | OTOOL64 = @OTOOL64@ | ||
264 | PACKAGE = @PACKAGE@ | ||
265 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
266 | PACKAGE_NAME = @PACKAGE_NAME@ | ||
267 | PACKAGE_STRING = @PACKAGE_STRING@ | ||
268 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
269 | PACKAGE_URL = @PACKAGE_URL@ | ||
270 | PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
271 | PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
272 | PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ | ||
273 | PIXMAN_LIBS = @PIXMAN_LIBS@ | ||
274 | PKG_CONFIG = @PKG_CONFIG@ | ||
275 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ | ||
276 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ | ||
277 | POSUB = @POSUB@ | ||
278 | RANLIB = @RANLIB@ | ||
279 | SCIM_CFLAGS = @SCIM_CFLAGS@ | ||
280 | SCIM_LIBS = @SCIM_LIBS@ | ||
281 | SDL_CFLAGS = @SDL_CFLAGS@ | ||
282 | SDL_CONFIG = @SDL_CONFIG@ | ||
283 | SDL_LIBS = @SDL_LIBS@ | ||
284 | SED = @SED@ | ||
285 | SET_MAKE = @SET_MAKE@ | ||
286 | SHELL = @SHELL@ | ||
287 | SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ | ||
288 | SSL_CFLAGS = @SSL_CFLAGS@ | ||
289 | SSL_LIBS = @SSL_LIBS@ | ||
290 | STRIP = @STRIP@ | ||
291 | TLS2_CFLAGS = @TLS2_CFLAGS@ | ||
292 | TLS2_LIBS = @TLS2_LIBS@ | ||
293 | TLS_CFLAGS = @TLS_CFLAGS@ | ||
294 | TLS_LIBS = @TLS_LIBS@ | ||
295 | TSLIB_CFLAGS = @TSLIB_CFLAGS@ | ||
296 | TSLIB_LIBS = @TSLIB_LIBS@ | ||
297 | USE_NLS = @USE_NLS@ | ||
298 | VERSION = @VERSION@ | ||
299 | VMAJ = @VMAJ@ | ||
300 | WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ | ||
301 | WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ | ||
302 | WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ | ||
303 | WAYLAND_LIBS = @WAYLAND_LIBS@ | ||
304 | WIN32_CFLAGS = @WIN32_CFLAGS@ | ||
305 | WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ | ||
306 | WIN32_LIBS = @WIN32_LIBS@ | ||
307 | XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ | ||
308 | XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ | ||
309 | XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ | ||
310 | XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ | ||
311 | XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ | ||
312 | XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ | ||
313 | XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ | ||
314 | XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ | ||
315 | XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ | ||
316 | XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ | ||
317 | XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ | ||
318 | XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ | ||
319 | XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ | ||
320 | XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ | ||
321 | XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ | ||
322 | XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ | ||
323 | XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ | ||
324 | XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ | ||
325 | XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ | ||
326 | XCB_X11_LIBS = @XCB_X11_LIBS@ | ||
327 | XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ | ||
328 | XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ | ||
329 | XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ | ||
330 | XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ | ||
331 | XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ | ||
332 | XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ | ||
333 | XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ | ||
334 | XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ | ||
335 | XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ | ||
336 | XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ | ||
337 | XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ | ||
338 | XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ | ||
339 | XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ | ||
340 | XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ | ||
341 | XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ | ||
342 | XDAMAGE_LIBS = @XDAMAGE_LIBS@ | ||
343 | XDPMS_CFLAGS = @XDPMS_CFLAGS@ | ||
344 | XDPMS_LIBS = @XDPMS_LIBS@ | ||
345 | XFIXES_CFLAGS = @XFIXES_CFLAGS@ | ||
346 | XFIXES_LIBS = @XFIXES_LIBS@ | ||
347 | XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ | ||
348 | XGESTURE_LIBS = @XGESTURE_LIBS@ | ||
349 | XGETTEXT = @XGETTEXT@ | ||
350 | XGETTEXT_015 = @XGETTEXT_015@ | ||
351 | XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ | ||
352 | XI2_CFLAGS = @XI2_CFLAGS@ | ||
353 | XI2_LIBS = @XI2_LIBS@ | ||
354 | XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ | ||
355 | XINERAMA_LIBS = @XINERAMA_LIBS@ | ||
356 | XKB_CFLAGS = @XKB_CFLAGS@ | ||
357 | XKB_LIBS = @XKB_LIBS@ | ||
358 | XMKMF = @XMKMF@ | ||
359 | XPRINT_CFLAGS = @XPRINT_CFLAGS@ | ||
360 | XPRINT_LIBS = @XPRINT_LIBS@ | ||
361 | XRANDR_CFLAGS = @XRANDR_CFLAGS@ | ||
362 | XRANDR_LIBS = @XRANDR_LIBS@ | ||
363 | XRENDER_CFLAGS = @XRENDER_CFLAGS@ | ||
364 | XRENDER_LIBS = @XRENDER_LIBS@ | ||
365 | XSS_CFLAGS = @XSS_CFLAGS@ | ||
366 | XSS_LIBS = @XSS_LIBS@ | ||
367 | XTEST_CFLAGS = @XTEST_CFLAGS@ | ||
368 | XTEST_LIBS = @XTEST_LIBS@ | ||
369 | X_CFLAGS = @X_CFLAGS@ | ||
370 | X_EXTRA_LIBS = @X_EXTRA_LIBS@ | ||
371 | X_LIBS = @X_LIBS@ | ||
372 | X_PRE_LIBS = @X_PRE_LIBS@ | ||
373 | Xcursor_cflags = @Xcursor_cflags@ | ||
374 | Xcursor_libs = @Xcursor_libs@ | ||
375 | abs_builddir = @abs_builddir@ | ||
376 | abs_srcdir = @abs_srcdir@ | ||
377 | abs_top_builddir = @abs_top_builddir@ | ||
378 | abs_top_srcdir = @abs_top_srcdir@ | ||
379 | ac_ct_CC = @ac_ct_CC@ | ||
380 | ac_ct_CXX = @ac_ct_CXX@ | ||
381 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | ||
382 | ac_ct_OBJC = @ac_ct_OBJC@ | ||
383 | am__include = @am__include@ | ||
384 | am__leading_dot = @am__leading_dot@ | ||
385 | am__quote = @am__quote@ | ||
386 | am__tar = @am__tar@ | ||
387 | am__untar = @am__untar@ | ||
388 | bindir = @bindir@ | ||
389 | build = @build@ | ||
390 | build_alias = @build_alias@ | ||
391 | build_cpu = @build_cpu@ | ||
392 | build_os = @build_os@ | ||
393 | build_vendor = @build_vendor@ | ||
394 | builddir = @builddir@ | ||
395 | cocoa_ldflags = @cocoa_ldflags@ | ||
396 | datadir = @datadir@ | ||
397 | datarootdir = @datarootdir@ | ||
398 | dlopen_libs = @dlopen_libs@ | ||
399 | docdir = @docdir@ | ||
400 | dvidir = @dvidir@ | ||
401 | ecore_cocoa_cflags = @ecore_cocoa_cflags@ | ||
402 | ecore_cocoa_libs = @ecore_cocoa_libs@ | ||
403 | ecore_con_cflags = @ecore_con_cflags@ | ||
404 | ecore_con_libs = @ecore_con_libs@ | ||
405 | ecore_directfb_cflags = @ecore_directfb_cflags@ | ||
406 | ecore_directfb_libs = @ecore_directfb_libs@ | ||
407 | ecore_evas_cflags = @ecore_evas_cflags@ | ||
408 | ecore_evas_libs = @ecore_evas_libs@ | ||
409 | ecore_fb_cflags = @ecore_fb_cflags@ | ||
410 | ecore_fb_libs = @ecore_fb_libs@ | ||
411 | ecore_file_cflags = @ecore_file_cflags@ | ||
412 | ecore_file_libs = @ecore_file_libs@ | ||
413 | ecore_imf_cflags = @ecore_imf_cflags@ | ||
414 | ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ | ||
415 | ecore_imf_evas_libs = @ecore_imf_evas_libs@ | ||
416 | ecore_imf_libs = @ecore_imf_libs@ | ||
417 | ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ | ||
418 | ecore_imf_scim_libs = @ecore_imf_scim_libs@ | ||
419 | ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ | ||
420 | ecore_imf_xim_libs = @ecore_imf_xim_libs@ | ||
421 | ecore_input_cflags = @ecore_input_cflags@ | ||
422 | ecore_input_evas_cflags = @ecore_input_evas_cflags@ | ||
423 | ecore_input_evas_libs = @ecore_input_evas_libs@ | ||
424 | ecore_input_libs = @ecore_input_libs@ | ||
425 | ecore_ipc_cflags = @ecore_ipc_cflags@ | ||
426 | ecore_ipc_libs = @ecore_ipc_libs@ | ||
427 | ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ | ||
428 | ecore_psl1ght_libs = @ecore_psl1ght_libs@ | ||
429 | ecore_sdl_cflags = @ecore_sdl_cflags@ | ||
430 | ecore_sdl_libs = @ecore_sdl_libs@ | ||
431 | ecore_wayland_cflags = @ecore_wayland_cflags@ | ||
432 | ecore_wayland_libs = @ecore_wayland_libs@ | ||
433 | ecore_win32_cflags = @ecore_win32_cflags@ | ||
434 | ecore_win32_libs = @ecore_win32_libs@ | ||
435 | ecore_wince_cflags = @ecore_wince_cflags@ | ||
436 | ecore_wince_libs = @ecore_wince_libs@ | ||
437 | ecore_x_cflags = @ecore_x_cflags@ | ||
438 | ecore_x_libs = @ecore_x_libs@ | ||
439 | ecore_x_libs_private = @ecore_x_libs_private@ | ||
440 | efl_doxygen = @efl_doxygen@ | ||
441 | efl_have_doxygen = @efl_have_doxygen@ | ||
442 | exec_prefix = @exec_prefix@ | ||
443 | have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ | ||
444 | host = @host@ | ||
445 | host_alias = @host_alias@ | ||
446 | host_cpu = @host_cpu@ | ||
447 | host_os = @host_os@ | ||
448 | host_vendor = @host_vendor@ | ||
449 | htmldir = @htmldir@ | ||
450 | includedir = @includedir@ | ||
451 | infodir = @infodir@ | ||
452 | install_sh = @install_sh@ | ||
453 | libdir = @libdir@ | ||
454 | libexecdir = @libexecdir@ | ||
455 | localedir = @localedir@ | ||
456 | localstatedir = @localstatedir@ | ||
457 | lt_ECHO = @lt_ECHO@ | ||
458 | lt_enable_auto_import = @lt_enable_auto_import@ | ||
459 | mandir = @mandir@ | ||
460 | mkdir_p = @mkdir_p@ | ||
461 | oldincludedir = @oldincludedir@ | ||
462 | pdfdir = @pdfdir@ | ||
463 | pkgconfig_requires_private = @pkgconfig_requires_private@ | ||
464 | prefix = @prefix@ | ||
465 | program_transform_name = @program_transform_name@ | ||
466 | psdir = @psdir@ | ||
467 | release_info = @release_info@ | ||
468 | requirements_ecore = @requirements_ecore@ | ||
469 | requirements_ecore_cocoa = @requirements_ecore_cocoa@ | ||
470 | requirements_ecore_con = @requirements_ecore_con@ | ||
471 | requirements_ecore_directfb = @requirements_ecore_directfb@ | ||
472 | requirements_ecore_evas = @requirements_ecore_evas@ | ||
473 | requirements_ecore_fb = @requirements_ecore_fb@ | ||
474 | requirements_ecore_file = @requirements_ecore_file@ | ||
475 | requirements_ecore_imf = @requirements_ecore_imf@ | ||
476 | requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ | ||
477 | requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ | ||
478 | requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ | ||
479 | requirements_ecore_input = @requirements_ecore_input@ | ||
480 | requirements_ecore_input_evas = @requirements_ecore_input_evas@ | ||
481 | requirements_ecore_ipc = @requirements_ecore_ipc@ | ||
482 | requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ | ||
483 | requirements_ecore_sdl = @requirements_ecore_sdl@ | ||
484 | requirements_ecore_wayland = @requirements_ecore_wayland@ | ||
485 | requirements_ecore_win32 = @requirements_ecore_win32@ | ||
486 | requirements_ecore_wince = @requirements_ecore_wince@ | ||
487 | requirements_ecore_x = @requirements_ecore_x@ | ||
488 | rt_libs = @rt_libs@ | ||
489 | sbindir = @sbindir@ | ||
490 | sharedstatedir = @sharedstatedir@ | ||
491 | srcdir = @srcdir@ | ||
492 | sysconfdir = @sysconfdir@ | ||
493 | target_alias = @target_alias@ | ||
494 | top_build_prefix = @top_build_prefix@ | ||
495 | top_builddir = @top_builddir@ | ||
496 | top_srcdir = @top_srcdir@ | ||
497 | version_info = @version_info@ | ||
498 | x_cflags = @x_cflags@ | ||
499 | x_includes = @x_includes@ | ||
500 | x_libs = @x_libs@ | ||
501 | MAINTAINERCLEANFILES = Makefile.in | ||
502 | @BUILD_ECORE_X_FALSE@ECORE_X_INC = | ||
503 | @BUILD_ECORE_X_TRUE@ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ | ||
504 | @BUILD_ECORE_X_FALSE@ECORE_X_LIB = | ||
505 | @BUILD_ECORE_X_TRUE@ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ | ||
506 | @BUILD_ECORE_FB_FALSE@ECORE_FB_INC = | ||
507 | @BUILD_ECORE_FB_TRUE@ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb | ||
508 | @BUILD_ECORE_FB_FALSE@ECORE_FB_LIB = | ||
509 | @BUILD_ECORE_FB_TRUE@ECORE_FB_LIB = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la | ||
510 | @BUILD_ECORE_DIRECTFB_FALSE@ECORE_DIRECTFB_INC = | ||
511 | @BUILD_ECORE_DIRECTFB_TRUE@ECORE_DIRECTFB_INC = -I$(top_srcdir)/src/lib/ecore_directfb -I@DIRECTFB_CFLAGS@ | ||
512 | @BUILD_ECORE_DIRECTFB_FALSE@ECORE_DIRECTFB_LIB = | ||
513 | @BUILD_ECORE_DIRECTFB_TRUE@ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la | ||
514 | @BUILD_ECORE_WIN32_FALSE@ECORE_WIN32_INC = | ||
515 | @BUILD_ECORE_WIN32_TRUE@ECORE_WIN32_INC = -I$(top_srcdir)/src/lib/ecore_win32 | ||
516 | @BUILD_ECORE_WIN32_FALSE@ECORE_WIN32_LIB = | ||
517 | @BUILD_ECORE_WIN32_TRUE@ECORE_WIN32_LIB = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la | ||
518 | @BUILD_ECORE_SDL_FALSE@ECORE_SDL_INC = | ||
519 | @BUILD_ECORE_SDL_TRUE@ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@ | ||
520 | @BUILD_ECORE_SDL_FALSE@ECORE_SDL_LIB = | ||
521 | @BUILD_ECORE_SDL_TRUE@ECORE_SDL_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la | ||
522 | @BUILD_ECORE_SDL_FALSE@ECORE_SDL_LIBADD = | ||
523 | @BUILD_ECORE_SDL_TRUE@ECORE_SDL_LIBADD = @SDL_LIBS@ $(ECORE_SDL_LIB) | ||
524 | @BUILD_ECORE_COCOA_FALSE@ECORE_COCOA_INC = | ||
525 | @BUILD_ECORE_COCOA_TRUE@ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa | ||
526 | @BUILD_ECORE_COCOA_FALSE@ECORE_COCOA_LIB = | ||
527 | @BUILD_ECORE_COCOA_TRUE@ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la | ||
528 | @BUILD_ECORE_WINCE_FALSE@ECORE_WINCE_INC = | ||
529 | @BUILD_ECORE_WINCE_TRUE@ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince | ||
530 | @BUILD_ECORE_WINCE_FALSE@ECORE_WINCE_LIB = | ||
531 | @BUILD_ECORE_WINCE_TRUE@ECORE_WINCE_LIB = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la | ||
532 | @BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_INC = | ||
533 | @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght | ||
534 | @BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_LIB = | ||
535 | @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la | ||
536 | @BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_INC = | ||
537 | @BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_INC = -I$(top_srcdir)/src/lib/ecore_wayland @WAYLAND_CFLAGS@ | ||
538 | @BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_LIB = | ||
539 | @BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_LIB = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la | ||
540 | @BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_LIBADD = | ||
541 | @BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_LIBADD = @WAYLAND_LIBS@ $(ECORE_WAYLAND_LIB) | ||
542 | @BUILD_ECORE_IPC_TRUE@ECORE_IPC_INC = \ | ||
543 | @BUILD_ECORE_IPC_TRUE@-I$(top_srcdir)/src/lib/ecore_ipc \ | ||
544 | @BUILD_ECORE_IPC_TRUE@-I$(top_builddir)/src/lib/ecore_ipc | ||
545 | |||
546 | @BUILD_ECORE_IPC_TRUE@ECORE_IPC_LIB = $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la | ||
547 | AM_CPPFLAGS = \ | ||
548 | -I$(top_srcdir)/src/lib/ecore \ | ||
549 | -I$(top_srcdir)/src/lib/ecore_evas \ | ||
550 | -I$(top_srcdir)/src/lib/ecore_input \ | ||
551 | -I$(top_srcdir)/src/lib/ecore_input_evas \ | ||
552 | -I$(top_builddir)/src/lib/ecore \ | ||
553 | -I$(top_builddir)/src/lib/ecore_evas \ | ||
554 | -I$(top_builddir)/src/lib/ecore_input \ | ||
555 | -I$(top_builddir)/src/lib/ecore_input_evas \ | ||
556 | @EFL_ECORE_EVAS_BUILD@ \ | ||
557 | $(ECORE_X_INC) \ | ||
558 | $(ECORE_FB_INC) \ | ||
559 | $(ECORE_DIRECTFB_INC) \ | ||
560 | $(ECORE_WIN32_INC) \ | ||
561 | $(ECORE_SDL_INC) \ | ||
562 | $(ECORE_COCOA_INC) \ | ||
563 | $(ECORE_WINCE_INC) \ | ||
564 | $(ECORE_PSL1GHT_INC) \ | ||
565 | $(ECORE_WAYLAND_INC) \ | ||
566 | $(ECORE_IPC_INC) \ | ||
567 | @EVAS_CFLAGS@ \ | ||
568 | @EINA_CFLAGS@ \ | ||
569 | @EVIL_CFLAGS@ \ | ||
570 | @WAYLAND_EGL_CFLAGS@ | ||
571 | |||
572 | AM_CFLAGS = @WIN32_CFLAGS@ | ||
573 | lib_LTLIBRARIES = libecore_evas.la | ||
574 | includes_HEADERS = Ecore_Evas.h | ||
575 | includesdir = $(includedir)/ecore-@VMAJ@ | ||
576 | libecore_evas_la_SOURCES = \ | ||
577 | ecore_evas.c \ | ||
578 | ecore_evas_util.c \ | ||
579 | ecore_evas_x.c \ | ||
580 | ecore_evas_fb.c \ | ||
581 | ecore_evas_buffer.c \ | ||
582 | ecore_evas_directfb.c \ | ||
583 | ecore_evas_win32.c \ | ||
584 | ecore_evas_sdl.c \ | ||
585 | ecore_evas_cocoa.c \ | ||
586 | ecore_evas_wince.c \ | ||
587 | ecore_evas_ews.c \ | ||
588 | ecore_evas_psl1ght.c \ | ||
589 | ecore_evas_wayland_shm.c \ | ||
590 | ecore_evas_wayland_egl.c \ | ||
591 | ecore_evas_extn.c | ||
592 | |||
593 | libecore_evas_la_LIBADD = \ | ||
594 | $(ECORE_X_LIB) \ | ||
595 | $(ECORE_FB_LIB) \ | ||
596 | $(ECORE_DIRECTFB_LIB) \ | ||
597 | $(ECORE_WIN32_LIB) \ | ||
598 | $(ECORE_SDL_LIB) \ | ||
599 | $(ECORE_SDL_LIBADD) \ | ||
600 | $(ECORE_COCOA_LIB) \ | ||
601 | $(ECORE_WINCE_LIB) \ | ||
602 | $(ECORE_IPC_LIB) \ | ||
603 | $(ECORE_PSL1GHT_LIB) \ | ||
604 | $(ECORE_WAYLAND_LIB) \ | ||
605 | $(ECORE_WAYLAND_LIBADD) \ | ||
606 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | ||
607 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ | ||
608 | $(top_builddir)/src/lib/ecore/libecore.la \ | ||
609 | @EVAS_LIBS@ \ | ||
610 | @EINA_LIBS@ \ | ||
611 | @EVIL_LIBS@ \ | ||
612 | @SHM_OPEN_LIBS@ \ | ||
613 | @WAYLAND_EGL_LIBS@ | ||
614 | |||
615 | libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ | ||
616 | EXTRA_DIST = \ | ||
617 | ecore_evas_private.h | ||
618 | |||
619 | all: all-am | ||
620 | |||
621 | .SUFFIXES: | ||
622 | .SUFFIXES: .c .lo .o .obj | ||
623 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
624 | @for dep in $?; do \ | ||
625 | case '$(am__configure_deps)' in \ | ||
626 | *$$dep*) \ | ||
627 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | ||
628 | && { if test -f $@; then exit 0; else break; fi; }; \ | ||
629 | exit 1;; \ | ||
630 | esac; \ | ||
631 | done; \ | ||
632 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_evas/Makefile'; \ | ||
633 | $(am__cd) $(top_srcdir) && \ | ||
634 | $(AUTOMAKE) --gnu src/lib/ecore_evas/Makefile | ||
635 | .PRECIOUS: Makefile | ||
636 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
637 | @case '$?' in \ | ||
638 | *config.status*) \ | ||
639 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
640 | *) \ | ||
641 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
642 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
643 | esac; | ||
644 | |||
645 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
646 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
647 | |||
648 | $(top_srcdir)/configure: $(am__configure_deps) | ||
649 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
650 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
651 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
652 | $(am__aclocal_m4_deps): | ||
653 | install-libLTLIBRARIES: $(lib_LTLIBRARIES) | ||
654 | @$(NORMAL_INSTALL) | ||
655 | test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" | ||
656 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | ||
657 | list2=; for p in $$list; do \ | ||
658 | if test -f $$p; then \ | ||
659 | list2="$$list2 $$p"; \ | ||
660 | else :; fi; \ | ||
661 | done; \ | ||
662 | test -z "$$list2" || { \ | ||
663 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ | ||
664 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ | ||
665 | } | ||
666 | |||
667 | uninstall-libLTLIBRARIES: | ||
668 | @$(NORMAL_UNINSTALL) | ||
669 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ | ||
670 | for p in $$list; do \ | ||
671 | $(am__strip_dir) \ | ||
672 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ | ||
673 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ | ||
674 | done | ||
675 | |||
676 | clean-libLTLIBRARIES: | ||
677 | -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) | ||
678 | @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ | ||
679 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ | ||
680 | test "$$dir" != "$$p" || dir=.; \ | ||
681 | echo "rm -f \"$${dir}/so_locations\""; \ | ||
682 | rm -f "$${dir}/so_locations"; \ | ||
683 | done | ||
684 | libecore_evas.la: $(libecore_evas_la_OBJECTS) $(libecore_evas_la_DEPENDENCIES) | ||
685 | $(AM_V_CCLD)$(libecore_evas_la_LINK) -rpath $(libdir) $(libecore_evas_la_OBJECTS) $(libecore_evas_la_LIBADD) $(LIBS) | ||
686 | |||
687 | mostlyclean-compile: | ||
688 | -rm -f *.$(OBJEXT) | ||
689 | |||
690 | distclean-compile: | ||
691 | -rm -f *.tab.c | ||
692 | |||
693 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas.Plo@am__quote@ | ||
694 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_buffer.Plo@am__quote@ | ||
695 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_cocoa.Plo@am__quote@ | ||
696 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_directfb.Plo@am__quote@ | ||
697 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_ews.Plo@am__quote@ | ||
698 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_extn.Plo@am__quote@ | ||
699 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_fb.Plo@am__quote@ | ||
700 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_psl1ght.Plo@am__quote@ | ||
701 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_sdl.Plo@am__quote@ | ||
702 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_util.Plo@am__quote@ | ||
703 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wayland_egl.Plo@am__quote@ | ||
704 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wayland_shm.Plo@am__quote@ | ||
705 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_win32.Plo@am__quote@ | ||
706 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wince.Plo@am__quote@ | ||
707 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_x.Plo@am__quote@ | ||
708 | |||
709 | .c.o: | ||
710 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
711 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
712 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
713 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
714 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
715 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< | ||
716 | |||
717 | .c.obj: | ||
718 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | ||
719 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
720 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
721 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
722 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
723 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` | ||
724 | |||
725 | .c.lo: | ||
726 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
727 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | ||
728 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
729 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | ||
730 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
731 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< | ||
732 | |||
733 | mostlyclean-libtool: | ||
734 | -rm -f *.lo | ||
735 | |||
736 | clean-libtool: | ||
737 | -rm -rf .libs _libs | ||
738 | install-includesHEADERS: $(includes_HEADERS) | ||
739 | @$(NORMAL_INSTALL) | ||
740 | test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" | ||
741 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
742 | for p in $$list; do \ | ||
743 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | ||
744 | echo "$$d$$p"; \ | ||
745 | done | $(am__base_list) | \ | ||
746 | while read files; do \ | ||
747 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ | ||
748 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ | ||
749 | done | ||
750 | |||
751 | uninstall-includesHEADERS: | ||
752 | @$(NORMAL_UNINSTALL) | ||
753 | @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ | ||
754 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ | ||
755 | test -n "$$files" || exit 0; \ | ||
756 | echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ | ||
757 | cd "$(DESTDIR)$(includesdir)" && rm -f $$files | ||
758 | |||
759 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
760 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
761 | unique=`for i in $$list; do \ | ||
762 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
763 | done | \ | ||
764 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
765 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
766 | mkid -fID $$unique | ||
767 | tags: TAGS | ||
768 | |||
769 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
770 | $(TAGS_FILES) $(LISP) | ||
771 | set x; \ | ||
772 | here=`pwd`; \ | ||
773 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
774 | unique=`for i in $$list; do \ | ||
775 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
776 | done | \ | ||
777 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
778 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
779 | shift; \ | ||
780 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ | ||
781 | test -n "$$unique" || unique=$$empty_fix; \ | ||
782 | if test $$# -gt 0; then \ | ||
783 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
784 | "$$@" $$unique; \ | ||
785 | else \ | ||
786 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
787 | $$unique; \ | ||
788 | fi; \ | ||
789 | fi | ||
790 | ctags: CTAGS | ||
791 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
792 | $(TAGS_FILES) $(LISP) | ||
793 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
794 | unique=`for i in $$list; do \ | ||
795 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
796 | done | \ | ||
797 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
798 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
799 | test -z "$(CTAGS_ARGS)$$unique" \ | ||
800 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | ||
801 | $$unique | ||
802 | |||
803 | GTAGS: | ||
804 | here=`$(am__cd) $(top_builddir) && pwd` \ | ||
805 | && $(am__cd) $(top_srcdir) \ | ||
806 | && gtags -i $(GTAGS_ARGS) "$$here" | ||
807 | |||
808 | distclean-tags: | ||
809 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||
810 | |||
811 | distdir: $(DISTFILES) | ||
812 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
813 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
814 | list='$(DISTFILES)'; \ | ||
815 | dist_files=`for file in $$list; do echo $$file; done | \ | ||
816 | sed -e "s|^$$srcdirstrip/||;t" \ | ||
817 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | ||
818 | case $$dist_files in \ | ||
819 | */*) $(MKDIR_P) `echo "$$dist_files" | \ | ||
820 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | ||
821 | sort -u` ;; \ | ||
822 | esac; \ | ||
823 | for file in $$dist_files; do \ | ||
824 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
825 | if test -d $$d/$$file; then \ | ||
826 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
827 | if test -d "$(distdir)/$$file"; then \ | ||
828 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
829 | fi; \ | ||
830 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
831 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | ||
832 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
833 | fi; \ | ||
834 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | ||
835 | else \ | ||
836 | test -f "$(distdir)/$$file" \ | ||
837 | || cp -p $$d/$$file "$(distdir)/$$file" \ | ||
838 | || exit 1; \ | ||
839 | fi; \ | ||
840 | done | ||
841 | check-am: all-am | ||
842 | check: check-am | ||
843 | all-am: Makefile $(LTLIBRARIES) $(HEADERS) | ||
844 | installdirs: | ||
845 | for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ | ||
846 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ | ||
847 | done | ||
848 | install: install-am | ||
849 | install-exec: install-exec-am | ||
850 | install-data: install-data-am | ||
851 | uninstall: uninstall-am | ||
852 | |||
853 | install-am: all-am | ||
854 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
855 | |||
856 | installcheck: installcheck-am | ||
857 | install-strip: | ||
858 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
859 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
860 | `test -z '$(STRIP)' || \ | ||
861 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
862 | mostlyclean-generic: | ||
863 | |||
864 | clean-generic: | ||
865 | |||
866 | distclean-generic: | ||
867 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
868 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||
869 | |||
870 | maintainer-clean-generic: | ||
871 | @echo "This command is intended for maintainers to use" | ||
872 | @echo "it deletes files that may require special tools to rebuild." | ||
873 | -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | ||
874 | clean: clean-am | ||
875 | |||
876 | clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ | ||
877 | mostlyclean-am | ||
878 | |||
879 | distclean: distclean-am | ||
880 | -rm -rf ./$(DEPDIR) | ||
881 | -rm -f Makefile | ||
882 | distclean-am: clean-am distclean-compile distclean-generic \ | ||
883 | distclean-tags | ||
884 | |||
885 | dvi: dvi-am | ||
886 | |||
887 | dvi-am: | ||
888 | |||
889 | html: html-am | ||
890 | |||
891 | html-am: | ||
892 | |||
893 | info: info-am | ||
894 | |||
895 | info-am: | ||
896 | |||
897 | install-data-am: install-includesHEADERS | ||
898 | |||
899 | install-dvi: install-dvi-am | ||
900 | |||
901 | install-dvi-am: | ||
902 | |||
903 | install-exec-am: install-libLTLIBRARIES | ||
904 | |||
905 | install-html: install-html-am | ||
906 | |||
907 | install-html-am: | ||
908 | |||
909 | install-info: install-info-am | ||
910 | |||
911 | install-info-am: | ||
912 | |||
913 | install-man: | ||
914 | |||
915 | install-pdf: install-pdf-am | ||
916 | |||
917 | install-pdf-am: | ||
918 | |||
919 | install-ps: install-ps-am | ||
920 | |||
921 | install-ps-am: | ||
922 | |||
923 | installcheck-am: | ||
924 | |||
925 | maintainer-clean: maintainer-clean-am | ||
926 | -rm -rf ./$(DEPDIR) | ||
927 | -rm -f Makefile | ||
928 | maintainer-clean-am: distclean-am maintainer-clean-generic | ||
929 | |||
930 | mostlyclean: mostlyclean-am | ||
931 | |||
932 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ | ||
933 | mostlyclean-libtool | ||
934 | |||
935 | pdf: pdf-am | ||
936 | |||
937 | pdf-am: | ||
938 | |||
939 | ps: ps-am | ||
940 | |||
941 | ps-am: | ||
942 | |||
943 | uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES | ||
944 | |||
945 | .MAKE: install-am install-strip | ||
946 | |||
947 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||
948 | clean-libLTLIBRARIES clean-libtool ctags distclean \ | ||
949 | distclean-compile distclean-generic distclean-libtool \ | ||
950 | distclean-tags distdir dvi dvi-am html html-am info info-am \ | ||
951 | install install-am install-data install-data-am install-dvi \ | ||
952 | install-dvi-am install-exec install-exec-am install-html \ | ||
953 | install-html-am install-includesHEADERS install-info \ | ||
954 | install-info-am install-libLTLIBRARIES install-man install-pdf \ | ||
955 | install-pdf-am install-ps install-ps-am install-strip \ | ||
956 | installcheck installcheck-am installdirs maintainer-clean \ | ||
957 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | ||
958 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | ||
959 | tags uninstall uninstall-am uninstall-includesHEADERS \ | ||
960 | uninstall-libLTLIBRARIES | ||
961 | |||
962 | |||
963 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
964 | # Otherwise a system limit (for SysV at least) may be exceeded. | ||
965 | .NOEXPORT: | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c deleted file mode 100644 index 6ecd609..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c +++ /dev/null | |||
@@ -1,2855 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | #include <sys/types.h> | ||
8 | #include <errno.h> | ||
9 | #include <sys/stat.h> | ||
10 | #include <fcntl.h> | ||
11 | |||
12 | #ifndef _MSC_VER | ||
13 | # include <unistd.h> | ||
14 | #endif | ||
15 | |||
16 | #ifdef HAVE_SYS_MMAN_H | ||
17 | # include <sys/mman.h> | ||
18 | #endif | ||
19 | |||
20 | #ifdef HAVE_EVIL | ||
21 | # include <Evil.h> | ||
22 | #endif | ||
23 | |||
24 | #include "Ecore.h" | ||
25 | #include "ecore_private.h" | ||
26 | #include "Ecore_Input.h" | ||
27 | |||
28 | #include "ecore_evas_private.h" | ||
29 | #include "Ecore_Evas.h" | ||
30 | |||
31 | Eina_Bool _ecore_evas_app_comp_sync = 1; | ||
32 | int _ecore_evas_log_dom = -1; | ||
33 | static int _ecore_evas_init_count = 0; | ||
34 | static Ecore_Fd_Handler *_ecore_evas_async_events_fd = NULL; | ||
35 | static Eina_Bool _ecore_evas_async_events_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); | ||
36 | |||
37 | static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; | ||
38 | static Ecore_Evas *ecore_evases = NULL; | ||
39 | static int _ecore_evas_fps_debug = 0; | ||
40 | |||
41 | static Eina_Bool | ||
42 | _ecore_evas_idle_enter(void *data __UNUSED__) | ||
43 | { | ||
44 | Ecore_Evas *ee; | ||
45 | double t1 = 0.0; | ||
46 | double t2 = 0.0; | ||
47 | int rend = 0; | ||
48 | |||
49 | if (!ecore_evases) return ECORE_CALLBACK_RENEW; | ||
50 | if (_ecore_evas_fps_debug) | ||
51 | { | ||
52 | t1 = ecore_time_get(); | ||
53 | } | ||
54 | EINA_INLIST_FOREACH(ecore_evases, ee) | ||
55 | { | ||
56 | if (!ee->manual_render) | ||
57 | { | ||
58 | if (ee->engine.func->fn_render) | ||
59 | rend |= ee->engine.func->fn_render(ee); | ||
60 | } | ||
61 | } | ||
62 | if (_ecore_evas_fps_debug) | ||
63 | { | ||
64 | t2 = ecore_time_get(); | ||
65 | if (rend) | ||
66 | _ecore_evas_fps_debug_rendertime_add(t2 - t1); | ||
67 | } | ||
68 | return ECORE_CALLBACK_RENEW; | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Query if a particular renginering engine target has support | ||
73 | * @param engine The engine to check support for | ||
74 | * @return 1 if the particular engine is supported, 0 if it is not | ||
75 | * | ||
76 | * Query if engine @param engine is supported by ecore_evas. 1 is returned if | ||
77 | * it is, and 0 is returned if it is not supported. | ||
78 | */ | ||
79 | EAPI int | ||
80 | ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) | ||
81 | { | ||
82 | switch (engine) | ||
83 | { | ||
84 | case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER: | ||
85 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
86 | return EINA_TRUE; | ||
87 | #else | ||
88 | return EINA_FALSE; | ||
89 | #endif | ||
90 | case ECORE_EVAS_ENGINE_SOFTWARE_XLIB: | ||
91 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB | ||
92 | return EINA_TRUE; | ||
93 | #else | ||
94 | return EINA_FALSE; | ||
95 | #endif | ||
96 | case ECORE_EVAS_ENGINE_XRENDER_X11: | ||
97 | return EINA_FALSE; | ||
98 | case ECORE_EVAS_ENGINE_OPENGL_X11: | ||
99 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
100 | return EINA_TRUE; | ||
101 | #else | ||
102 | return EINA_FALSE; | ||
103 | #endif | ||
104 | case ECORE_EVAS_ENGINE_SOFTWARE_XCB: | ||
105 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB | ||
106 | return EINA_TRUE; | ||
107 | #else | ||
108 | return EINA_FALSE; | ||
109 | #endif | ||
110 | case ECORE_EVAS_ENGINE_XRENDER_XCB: | ||
111 | return EINA_FALSE; | ||
112 | case ECORE_EVAS_ENGINE_SOFTWARE_GDI: | ||
113 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
114 | return EINA_TRUE; | ||
115 | #else | ||
116 | return EINA_FALSE; | ||
117 | #endif | ||
118 | case ECORE_EVAS_ENGINE_SOFTWARE_DDRAW: | ||
119 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
120 | return EINA_TRUE; | ||
121 | #else | ||
122 | return EINA_FALSE; | ||
123 | #endif | ||
124 | case ECORE_EVAS_ENGINE_DIRECT3D: | ||
125 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
126 | return EINA_TRUE; | ||
127 | #else | ||
128 | return EINA_FALSE; | ||
129 | #endif | ||
130 | case ECORE_EVAS_ENGINE_OPENGL_GLEW: | ||
131 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
132 | return EINA_TRUE; | ||
133 | #else | ||
134 | return EINA_FALSE; | ||
135 | #endif | ||
136 | case ECORE_EVAS_ENGINE_SOFTWARE_SDL: | ||
137 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
138 | return EINA_TRUE; | ||
139 | #else | ||
140 | return EINA_FALSE; | ||
141 | #endif | ||
142 | case ECORE_EVAS_ENGINE_OPENGL_SDL: | ||
143 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
144 | return EINA_TRUE; | ||
145 | #else | ||
146 | return EINA_FALSE; | ||
147 | #endif | ||
148 | case ECORE_EVAS_ENGINE_DIRECTFB: | ||
149 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
150 | return EINA_TRUE; | ||
151 | #else | ||
152 | return EINA_FALSE; | ||
153 | #endif | ||
154 | case ECORE_EVAS_ENGINE_SOFTWARE_FB: | ||
155 | #ifdef BUILD_ECORE_EVAS_FB | ||
156 | return EINA_TRUE; | ||
157 | #else | ||
158 | return EINA_FALSE; | ||
159 | #endif | ||
160 | |||
161 | case ECORE_EVAS_ENGINE_SOFTWARE_8_X11: | ||
162 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
163 | return EINA_TRUE; | ||
164 | #else | ||
165 | return EINA_FALSE; | ||
166 | #endif | ||
167 | |||
168 | case ECORE_EVAS_ENGINE_SOFTWARE_16_X11: | ||
169 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
170 | return EINA_TRUE; | ||
171 | #else | ||
172 | return EINA_FALSE; | ||
173 | #endif | ||
174 | case ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW: | ||
175 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
176 | return EINA_TRUE; | ||
177 | #else | ||
178 | return EINA_FALSE; | ||
179 | #endif | ||
180 | case ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE: | ||
181 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
182 | return EINA_TRUE; | ||
183 | #else | ||
184 | return EINA_FALSE; | ||
185 | #endif | ||
186 | case ECORE_EVAS_ENGINE_OPENGL_COCOA: | ||
187 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
188 | return EINA_TRUE; | ||
189 | #else | ||
190 | return EINA_FALSE; | ||
191 | #endif | ||
192 | case ECORE_EVAS_ENGINE_EWS: | ||
193 | #ifdef BUILD_ECORE_EVAS_EWS | ||
194 | return EINA_TRUE; | ||
195 | #else | ||
196 | return EINA_FALSE; | ||
197 | #endif | ||
198 | case ECORE_EVAS_ENGINE_PSL1GHT: | ||
199 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
200 | return EINA_TRUE; | ||
201 | #else | ||
202 | return EINA_FALSE; | ||
203 | #endif | ||
204 | case ECORE_EVAS_ENGINE_WAYLAND_SHM: | ||
205 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
206 | return EINA_TRUE; | ||
207 | #else | ||
208 | return EINA_FALSE; | ||
209 | #endif | ||
210 | case ECORE_EVAS_ENGINE_WAYLAND_EGL: | ||
211 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
212 | return EINA_TRUE; | ||
213 | #else | ||
214 | return EINA_FALSE; | ||
215 | #endif | ||
216 | default: | ||
217 | return EINA_FALSE; | ||
218 | }; | ||
219 | } | ||
220 | |||
221 | EAPI int | ||
222 | ecore_evas_init(void) | ||
223 | { | ||
224 | int fd; | ||
225 | |||
226 | if (++_ecore_evas_init_count != 1) | ||
227 | return _ecore_evas_init_count; | ||
228 | |||
229 | if (!evas_init()) | ||
230 | return --_ecore_evas_init_count; | ||
231 | |||
232 | if (!ecore_init()) | ||
233 | goto shutdown_evas; | ||
234 | |||
235 | _ecore_evas_log_dom = eina_log_domain_register | ||
236 | ("ecore_evas", ECORE_EVAS_DEFAULT_LOG_COLOR); | ||
237 | if(_ecore_evas_log_dom < 0) | ||
238 | { | ||
239 | EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas."); | ||
240 | goto shutdown_ecore; | ||
241 | } | ||
242 | |||
243 | fd = evas_async_events_fd_get(); | ||
244 | if (fd > 0) | ||
245 | _ecore_evas_async_events_fd = ecore_main_fd_handler_add(fd, | ||
246 | ECORE_FD_READ, | ||
247 | _ecore_evas_async_events_fd_handler, NULL, | ||
248 | NULL, NULL); | ||
249 | |||
250 | ecore_evas_idle_enterer = | ||
251 | ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL); | ||
252 | if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; | ||
253 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); | ||
254 | |||
255 | #ifdef BUILD_ECORE_EVAS_EWS | ||
256 | _ecore_evas_ews_events_init(); | ||
257 | #endif | ||
258 | |||
259 | _ecore_evas_extn_init(); | ||
260 | |||
261 | if (getenv("ECORE_EVAS_COMP_NOSYNC")) | ||
262 | _ecore_evas_app_comp_sync = 0; | ||
263 | return _ecore_evas_init_count; | ||
264 | |||
265 | shutdown_ecore: | ||
266 | ecore_shutdown(); | ||
267 | shutdown_evas: | ||
268 | evas_shutdown(); | ||
269 | |||
270 | return --_ecore_evas_init_count; | ||
271 | } | ||
272 | |||
273 | EAPI int | ||
274 | ecore_evas_shutdown(void) | ||
275 | { | ||
276 | if (--_ecore_evas_init_count != 0) | ||
277 | return _ecore_evas_init_count; | ||
278 | |||
279 | while (ecore_evases) _ecore_evas_free(ecore_evases); | ||
280 | |||
281 | _ecore_evas_extn_shutdown(); | ||
282 | |||
283 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); | ||
284 | ecore_idle_enterer_del(ecore_evas_idle_enterer); | ||
285 | ecore_evas_idle_enterer = NULL; | ||
286 | |||
287 | #ifdef BUILD_ECORE_EVAS_X11 | ||
288 | while (_ecore_evas_x_shutdown()); | ||
289 | #endif | ||
290 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
291 | while (_ecore_evas_win32_shutdown()); | ||
292 | #endif | ||
293 | #ifdef BUILD_ECORE_EVAS_FB | ||
294 | while (_ecore_evas_fb_shutdown()); | ||
295 | #endif | ||
296 | #ifdef BUILD_ECORE_EVAS_EWS | ||
297 | while (_ecore_evas_ews_shutdown()); | ||
298 | #endif | ||
299 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
300 | while (_ecore_evas_buffer_shutdown()); | ||
301 | #endif | ||
302 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
303 | while (_ecore_evas_directfb_shutdown()); | ||
304 | #endif | ||
305 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
306 | while (_ecore_evas_wince_shutdown()); | ||
307 | #endif | ||
308 | |||
309 | if (_ecore_evas_async_events_fd) | ||
310 | ecore_main_fd_handler_del(_ecore_evas_async_events_fd); | ||
311 | |||
312 | eina_log_domain_unregister(_ecore_evas_log_dom); | ||
313 | _ecore_evas_log_dom = -1; | ||
314 | ecore_shutdown(); | ||
315 | evas_shutdown(); | ||
316 | |||
317 | return _ecore_evas_init_count; | ||
318 | } | ||
319 | |||
320 | EAPI void | ||
321 | ecore_evas_app_comp_sync_set(Eina_Bool do_sync) | ||
322 | { | ||
323 | _ecore_evas_app_comp_sync = do_sync; | ||
324 | } | ||
325 | |||
326 | EAPI Eina_Bool | ||
327 | ecore_evas_app_comp_sync_get(void) | ||
328 | { | ||
329 | return _ecore_evas_app_comp_sync; | ||
330 | } | ||
331 | |||
332 | struct ecore_evas_engine { | ||
333 | const char *name; | ||
334 | Ecore_Evas *(*constructor)(int x, int y, int w, int h, const char *extra_options); | ||
335 | }; | ||
336 | |||
337 | /* inline is just to avoid need to ifdef around it */ | ||
338 | static inline const char * | ||
339 | _ecore_evas_parse_extra_options_str(const char *extra_options, const char *key, char **value) | ||
340 | { | ||
341 | int len = strlen(key); | ||
342 | |||
343 | while (extra_options) | ||
344 | { | ||
345 | const char *p; | ||
346 | |||
347 | if (strncmp(extra_options, key, len) != 0) | ||
348 | { | ||
349 | extra_options = strchr(extra_options, ';'); | ||
350 | if (extra_options) | ||
351 | extra_options++; | ||
352 | continue; | ||
353 | } | ||
354 | |||
355 | extra_options += len; | ||
356 | p = strchr(extra_options, ';'); | ||
357 | if (p) | ||
358 | { | ||
359 | len = p - extra_options; | ||
360 | *value = malloc(len + 1); | ||
361 | memcpy(*value, extra_options, len); | ||
362 | (*value)[len] = '\0'; | ||
363 | extra_options = p + 1; | ||
364 | } | ||
365 | else | ||
366 | { | ||
367 | *value = strdup(extra_options); | ||
368 | extra_options = NULL; | ||
369 | } | ||
370 | } | ||
371 | return extra_options; | ||
372 | } | ||
373 | |||
374 | /* inline is just to avoid need to ifdef around it */ | ||
375 | static inline const char * | ||
376 | _ecore_evas_parse_extra_options_uint(const char *extra_options, const char *key, unsigned int *value) | ||
377 | { | ||
378 | int len = strlen(key); | ||
379 | |||
380 | while (extra_options) | ||
381 | { | ||
382 | const char *p; | ||
383 | |||
384 | if (strncmp(extra_options, key, len) != 0) | ||
385 | { | ||
386 | extra_options = strchr(extra_options, ';'); | ||
387 | if (extra_options) | ||
388 | extra_options++; | ||
389 | continue; | ||
390 | } | ||
391 | |||
392 | extra_options += len; | ||
393 | *value = strtol(extra_options, NULL, 0); | ||
394 | |||
395 | p = strchr(extra_options, ';'); | ||
396 | if (p) | ||
397 | extra_options = p + 1; | ||
398 | else | ||
399 | extra_options = NULL; | ||
400 | } | ||
401 | return extra_options; | ||
402 | } | ||
403 | |||
404 | /* inline is just to avoid need to ifdef around it */ | ||
405 | static inline const char * | ||
406 | _ecore_evas_parse_extra_options_x(const char *extra_options, char **disp_name, unsigned int *parent) | ||
407 | { | ||
408 | _ecore_evas_parse_extra_options_str(extra_options, "display=", disp_name); | ||
409 | _ecore_evas_parse_extra_options_uint(extra_options, "parent=", parent); | ||
410 | return extra_options; | ||
411 | } | ||
412 | |||
413 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
414 | static Ecore_Evas * | ||
415 | _ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *extra_options) | ||
416 | { | ||
417 | unsigned int parent = 0; | ||
418 | char *disp_name = NULL; | ||
419 | Ecore_Evas *ee; | ||
420 | |||
421 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
422 | ee = ecore_evas_software_x11_new(disp_name, parent, x, y, w, h); | ||
423 | free(disp_name); | ||
424 | |||
425 | return ee; | ||
426 | } | ||
427 | #endif | ||
428 | |||
429 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
430 | static Ecore_Evas * | ||
431 | _ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_options) | ||
432 | { | ||
433 | char *name = NULL; | ||
434 | Ecore_Evas *ee; | ||
435 | |||
436 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
437 | ee = ecore_evas_cocoa_new(NULL, x, y, w, h); | ||
438 | free(name); | ||
439 | |||
440 | if (ee) ecore_evas_move(ee, x, y); | ||
441 | return ee; | ||
442 | } | ||
443 | #endif | ||
444 | |||
445 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
446 | static Ecore_Evas * | ||
447 | _ecore_evas_constructor_opengl_x11(int x, int y, int w, int h, const char *extra_options) | ||
448 | { | ||
449 | Ecore_X_Window parent = 0; | ||
450 | char *disp_name = NULL; | ||
451 | Ecore_Evas *ee; | ||
452 | |||
453 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
454 | ee = ecore_evas_gl_x11_new(disp_name, parent, x, y, w, h); | ||
455 | free(disp_name); | ||
456 | |||
457 | return ee; | ||
458 | } | ||
459 | #endif | ||
460 | |||
461 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
462 | static Ecore_Evas * | ||
463 | _ecore_evas_constructor_software_8_x11(int x, int y, int w, int h, const char *extra_options) | ||
464 | { | ||
465 | Ecore_X_Window parent = 0; | ||
466 | char *disp_name = NULL; | ||
467 | Ecore_Evas *ee; | ||
468 | |||
469 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
470 | ee = ecore_evas_software_x11_8_new(disp_name, parent, x, y, w, h); | ||
471 | free(disp_name); | ||
472 | |||
473 | return ee; | ||
474 | } | ||
475 | #endif | ||
476 | |||
477 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
478 | static Ecore_Evas * | ||
479 | _ecore_evas_constructor_software_16_x11(int x, int y, int w, int h, const char *extra_options) | ||
480 | { | ||
481 | Ecore_X_Window parent = 0; | ||
482 | char *disp_name = NULL; | ||
483 | Ecore_Evas *ee; | ||
484 | |||
485 | _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); | ||
486 | ee = ecore_evas_software_x11_16_new(disp_name, parent, x, y, w, h); | ||
487 | free(disp_name); | ||
488 | |||
489 | return ee; | ||
490 | } | ||
491 | #endif | ||
492 | |||
493 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
494 | static Ecore_Evas * | ||
495 | _ecore_evas_constructor_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) | ||
496 | { | ||
497 | Ecore_Evas *ee; | ||
498 | unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0; | ||
499 | char *name = NULL; | ||
500 | |||
501 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
502 | _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); | ||
503 | _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface); | ||
504 | _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe); | ||
505 | _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha); | ||
506 | |||
507 | ee = ecore_evas_sdl_new(name, w, h, fullscreen, hwsurface, noframe, alpha); | ||
508 | free(name); | ||
509 | |||
510 | return ee; | ||
511 | } | ||
512 | #endif | ||
513 | |||
514 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
515 | static Ecore_Evas * | ||
516 | _ecore_evas_constructor_opengl_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) | ||
517 | { | ||
518 | Ecore_Evas *ee; | ||
519 | unsigned int fullscreen = 0, noframe = 0; | ||
520 | char *name = NULL; | ||
521 | |||
522 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
523 | _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); | ||
524 | _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe); | ||
525 | |||
526 | ee = ecore_evas_gl_sdl_new(name, w, h, fullscreen, noframe); | ||
527 | free(name); | ||
528 | |||
529 | return ee; | ||
530 | } | ||
531 | #endif | ||
532 | |||
533 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
534 | static Ecore_Evas * | ||
535 | _ecore_evas_constructor_directfb(int x, int y, int w, int h, const char *extra_options) | ||
536 | { | ||
537 | Ecore_Evas *ee; | ||
538 | char *disp_name = NULL; | ||
539 | unsigned int windowed = 1; | ||
540 | |||
541 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
542 | _ecore_evas_parse_extra_options_uint(extra_options, "windowed=", &windowed); | ||
543 | |||
544 | ee = ecore_evas_directfb_new(disp_name, windowed, x, y, w, h); | ||
545 | free(disp_name); | ||
546 | |||
547 | return ee; | ||
548 | } | ||
549 | #endif | ||
550 | |||
551 | #ifdef BUILD_ECORE_EVAS_FB | ||
552 | static Ecore_Evas * | ||
553 | _ecore_evas_constructor_fb(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) | ||
554 | { | ||
555 | Ecore_Evas *ee; | ||
556 | char *disp_name = NULL; | ||
557 | unsigned int rotation = 0; | ||
558 | |||
559 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
560 | _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation); | ||
561 | |||
562 | ee = ecore_evas_fb_new(disp_name, rotation, w, h); | ||
563 | free(disp_name); | ||
564 | |||
565 | return ee; | ||
566 | } | ||
567 | #endif | ||
568 | |||
569 | |||
570 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
571 | static Ecore_Evas * | ||
572 | _ecore_evas_constructor_psl1ght(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) | ||
573 | { | ||
574 | Ecore_Evas *ee; | ||
575 | char *name = NULL; | ||
576 | |||
577 | _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); | ||
578 | ee = ecore_evas_psl1ght_new(name, w, h); | ||
579 | free(name); | ||
580 | |||
581 | if (ee) ecore_evas_move(ee, x, y); | ||
582 | return ee; | ||
583 | } | ||
584 | #endif | ||
585 | |||
586 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
587 | static Ecore_Evas * | ||
588 | _ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options) | ||
589 | { | ||
590 | char *disp_name = NULL; | ||
591 | unsigned int frame = 0, parent = 0; | ||
592 | Ecore_Evas *ee; | ||
593 | |||
594 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
595 | _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); | ||
596 | _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent); | ||
597 | ee = ecore_evas_wayland_shm_new(disp_name, parent, x, y, w, h, frame); | ||
598 | free(disp_name); | ||
599 | |||
600 | return ee; | ||
601 | } | ||
602 | #endif | ||
603 | |||
604 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
605 | static Ecore_Evas * | ||
606 | _ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options) | ||
607 | { | ||
608 | char *disp_name = NULL; | ||
609 | unsigned int frame = 0, parent = 0; | ||
610 | Ecore_Evas *ee; | ||
611 | |||
612 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
613 | _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); | ||
614 | _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent); | ||
615 | ee = ecore_evas_wayland_egl_new(disp_name, parent, x, y, w, h, frame); | ||
616 | free(disp_name); | ||
617 | |||
618 | return ee; | ||
619 | } | ||
620 | #endif | ||
621 | |||
622 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
623 | static Ecore_Evas * | ||
624 | _ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options) | ||
625 | { | ||
626 | return ecore_evas_software_gdi_new(NULL, x, y, w, h); | ||
627 | } | ||
628 | #endif | ||
629 | |||
630 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
631 | static Ecore_Evas * | ||
632 | _ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options) | ||
633 | { | ||
634 | return ecore_evas_software_ddraw_new(NULL, x, y, w, h); | ||
635 | } | ||
636 | #endif | ||
637 | |||
638 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
639 | static Ecore_Evas * | ||
640 | _ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options) | ||
641 | { | ||
642 | return ecore_evas_direct3d_new(NULL, x, y, w, h); | ||
643 | } | ||
644 | #endif | ||
645 | |||
646 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
647 | static Ecore_Evas * | ||
648 | _ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options) | ||
649 | { | ||
650 | return ecore_evas_gl_glew_new(NULL, x, y, w, h); | ||
651 | } | ||
652 | #endif | ||
653 | |||
654 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
655 | static Ecore_Evas * | ||
656 | _ecore_evas_constructor_software_16_ddraw(int x, int y, int w, int h, const char *extra_options) | ||
657 | { | ||
658 | return ecore_evas_software_16_ddraw_new(NULL, x, y, w, h); | ||
659 | } | ||
660 | #endif | ||
661 | |||
662 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
663 | static Ecore_Evas * | ||
664 | _ecore_evas_constructor_software_16_wince(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
665 | { | ||
666 | return ecore_evas_software_wince_new(NULL, x, y, w, h); | ||
667 | } | ||
668 | |||
669 | static Ecore_Evas * | ||
670 | _ecore_evas_constructor_software_16_wince_fb(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
671 | { | ||
672 | return ecore_evas_software_wince_fb_new(NULL, x, y, w, h); | ||
673 | } | ||
674 | |||
675 | static Ecore_Evas * | ||
676 | _ecore_evas_constructor_software_16_wince_gapi(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
677 | { | ||
678 | return ecore_evas_software_wince_gapi_new(NULL, x, y, w, h); | ||
679 | } | ||
680 | |||
681 | static Ecore_Evas * | ||
682 | _ecore_evas_constructor_software_16_wince_gdi(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
683 | { | ||
684 | return ecore_evas_software_wince_gdi_new(NULL, x, y, w, h); | ||
685 | } | ||
686 | #endif | ||
687 | |||
688 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
689 | static Ecore_Evas * | ||
690 | _ecore_evas_constructor_buffer(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options __UNUSED__) | ||
691 | { | ||
692 | return ecore_evas_buffer_new(w, h); | ||
693 | } | ||
694 | #endif | ||
695 | |||
696 | #ifdef BUILD_ECORE_EVAS_EWS | ||
697 | static Ecore_Evas * | ||
698 | _ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options __UNUSED__) | ||
699 | { | ||
700 | return ecore_evas_ews_new(x, y, w, h); | ||
701 | } | ||
702 | #endif | ||
703 | |||
704 | /* note: keep sorted by priority, highest first */ | ||
705 | static const struct ecore_evas_engine _engines[] = { | ||
706 | /* unix */ | ||
707 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
708 | {"software_x11", _ecore_evas_constructor_software_x11}, | ||
709 | #endif | ||
710 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
711 | {"opengl_x11", _ecore_evas_constructor_opengl_x11}, | ||
712 | #endif | ||
713 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
714 | {"software_8_x11", _ecore_evas_constructor_software_8_x11}, | ||
715 | #endif | ||
716 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
717 | {"software_16_x11", _ecore_evas_constructor_software_16_x11}, | ||
718 | #endif | ||
719 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
720 | {"directfb", _ecore_evas_constructor_directfb}, | ||
721 | #endif | ||
722 | #ifdef BUILD_ECORE_EVAS_FB | ||
723 | {"fb", _ecore_evas_constructor_fb}, | ||
724 | #endif | ||
725 | |||
726 | /* windows */ | ||
727 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
728 | {"software_gdi", _ecore_evas_constructor_software_gdi}, | ||
729 | #endif | ||
730 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
731 | {"software_ddraw", _ecore_evas_constructor_software_ddraw}, | ||
732 | #endif | ||
733 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
734 | {"direct3d", _ecore_evas_constructor_direct3d}, | ||
735 | #endif | ||
736 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
737 | {"opengl_glew", _ecore_evas_constructor_opengl_glew}, | ||
738 | #endif | ||
739 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
740 | {"software_16_ddraw", _ecore_evas_constructor_software_16_ddraw}, | ||
741 | #endif | ||
742 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
743 | {"software_16_wince", _ecore_evas_constructor_software_16_wince}, | ||
744 | {"software_16_wince_fb", _ecore_evas_constructor_software_16_wince_fb}, | ||
745 | {"software_16_wince_gapi", _ecore_evas_constructor_software_16_wince_gapi}, | ||
746 | {"software_16_wince_gdi", _ecore_evas_constructor_software_16_wince_gdi}, | ||
747 | #endif | ||
748 | |||
749 | /* Apple */ | ||
750 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
751 | {"opengl_cocoa", _ecore_evas_constructor_cocoa}, | ||
752 | #endif | ||
753 | |||
754 | /* PS3 support */ | ||
755 | #ifdef BUILD_ECORE_EVAS_PSL1GHT | ||
756 | {"psl1ght", _ecore_evas_constructor_psl1ght}, | ||
757 | #endif | ||
758 | |||
759 | /* Wayland */ | ||
760 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
761 | {"wayland_shm", _ecore_evas_constructor_wayland_shm}, | ||
762 | #endif | ||
763 | |||
764 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
765 | {"wayland_egl", _ecore_evas_constructor_wayland_egl}, | ||
766 | #endif | ||
767 | |||
768 | /* Last chance to have a window */ | ||
769 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
770 | {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, | ||
771 | #endif | ||
772 | |||
773 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
774 | {"sdl", _ecore_evas_constructor_sdl}, | ||
775 | #endif | ||
776 | |||
777 | /* independent */ | ||
778 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
779 | {"buffer", _ecore_evas_constructor_buffer}, | ||
780 | #endif | ||
781 | |||
782 | #ifdef BUILD_ECORE_EVAS_EWS | ||
783 | {"ews", _ecore_evas_constructor_ews}, | ||
784 | #endif | ||
785 | {NULL, NULL} | ||
786 | }; | ||
787 | |||
788 | EAPI Eina_List * | ||
789 | ecore_evas_engines_get(void) | ||
790 | { | ||
791 | const struct ecore_evas_engine *itr; | ||
792 | Eina_List *lst = NULL; | ||
793 | |||
794 | for (itr = _engines; itr->name; itr++) | ||
795 | lst = eina_list_append(lst, itr->name); | ||
796 | |||
797 | return lst; | ||
798 | } | ||
799 | |||
800 | EAPI void | ||
801 | ecore_evas_engines_free(Eina_List *engines) | ||
802 | { | ||
803 | eina_list_free(engines); | ||
804 | } | ||
805 | |||
806 | static Ecore_Evas * | ||
807 | _ecore_evas_new_auto_discover(int x, int y, int w, int h, const char *extra_options) | ||
808 | { | ||
809 | const struct ecore_evas_engine *itr; | ||
810 | |||
811 | DBG("auto discover engine"); | ||
812 | |||
813 | for (itr = _engines; itr->constructor; itr++) | ||
814 | { | ||
815 | Ecore_Evas *ee = itr->constructor(x, y, w, h, extra_options); | ||
816 | if (ee) | ||
817 | { | ||
818 | INF("auto discovered '%s'", itr->name); | ||
819 | return ee; | ||
820 | } | ||
821 | } | ||
822 | |||
823 | WRN("could not auto discover."); | ||
824 | return NULL; | ||
825 | } | ||
826 | |||
827 | EAPI Ecore_Evas * | ||
828 | ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options) | ||
829 | { | ||
830 | const struct ecore_evas_engine *itr; | ||
831 | |||
832 | if (!engine_name) | ||
833 | { | ||
834 | engine_name = getenv("ECORE_EVAS_ENGINE"); | ||
835 | if (engine_name) | ||
836 | DBG("no engine_name provided, using ECORE_EVAS_ENGINE='%s'", | ||
837 | engine_name); | ||
838 | } | ||
839 | if (!engine_name) | ||
840 | return _ecore_evas_new_auto_discover(x, y, w, h, extra_options); | ||
841 | |||
842 | for (itr = _engines; itr->name; itr++) | ||
843 | if (strcmp(itr->name, engine_name) == 0) | ||
844 | { | ||
845 | INF("using engine '%s', extra_options=%s", | ||
846 | engine_name, extra_options ? extra_options : "(null)"); | ||
847 | return itr->constructor(x, y, w, h, extra_options); | ||
848 | } | ||
849 | |||
850 | WRN("unknown engine '%s'", engine_name); | ||
851 | return NULL; | ||
852 | } | ||
853 | |||
854 | EAPI const char * | ||
855 | ecore_evas_engine_name_get(const Ecore_Evas *ee) | ||
856 | { | ||
857 | if (!ee) | ||
858 | return NULL; | ||
859 | return ee->driver; | ||
860 | } | ||
861 | |||
862 | EAPI Ecore_Evas * | ||
863 | ecore_evas_ecore_evas_get(const Evas *e) | ||
864 | { | ||
865 | Ecore_Evas *ee = evas_data_attach_get(e); | ||
866 | if (!ee) return NULL; | ||
867 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
868 | { | ||
869 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get"); | ||
870 | return NULL; | ||
871 | } | ||
872 | return ee; | ||
873 | } | ||
874 | |||
875 | EAPI void | ||
876 | ecore_evas_free(Ecore_Evas *ee) | ||
877 | { | ||
878 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
879 | { | ||
880 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
881 | "ecore_evas_free"); | ||
882 | return; | ||
883 | } | ||
884 | _ecore_evas_free(ee); | ||
885 | return; | ||
886 | } | ||
887 | |||
888 | EAPI void * | ||
889 | ecore_evas_data_get(const Ecore_Evas *ee, const char *key) | ||
890 | { | ||
891 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
892 | { | ||
893 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
894 | "ecore_evas_data_get"); | ||
895 | return NULL; | ||
896 | } | ||
897 | |||
898 | if (!key) return NULL; | ||
899 | if (!ee->data) return NULL; | ||
900 | |||
901 | return eina_hash_find(ee->data, key); | ||
902 | } | ||
903 | |||
904 | EAPI void | ||
905 | ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data) | ||
906 | { | ||
907 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
908 | { | ||
909 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
910 | "ecore_evas_data_set"); | ||
911 | return; | ||
912 | } | ||
913 | |||
914 | if (!key) return; | ||
915 | |||
916 | if (ee->data) | ||
917 | eina_hash_del(ee->data, key, NULL); | ||
918 | if (data) | ||
919 | { | ||
920 | if (!ee->data) | ||
921 | ee->data = eina_hash_string_superfast_new(NULL); | ||
922 | eina_hash_add(ee->data, key, data); | ||
923 | } | ||
924 | } | ||
925 | |||
926 | #define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn | ||
927 | #define IFE return;} | ||
928 | |||
929 | EAPI void | ||
930 | ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
931 | { | ||
932 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
933 | { | ||
934 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
935 | "ecore_evas_callback_resize_set"); | ||
936 | return; | ||
937 | } | ||
938 | IFC(ee, fn_callback_resize_set) (ee, func); | ||
939 | IFE; | ||
940 | ee->func.fn_resize = func; | ||
941 | } | ||
942 | |||
943 | EAPI void | ||
944 | ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
945 | { | ||
946 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
947 | { | ||
948 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
949 | "ecore_evas_callback_move_set"); | ||
950 | return; | ||
951 | } | ||
952 | IFC(ee, fn_callback_move_set) (ee, func); | ||
953 | IFE; | ||
954 | ee->func.fn_move = func; | ||
955 | } | ||
956 | |||
957 | EAPI void | ||
958 | ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
959 | { | ||
960 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
961 | { | ||
962 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
963 | "ecore_evas_callback_show_set"); | ||
964 | return; | ||
965 | } | ||
966 | IFC(ee, fn_callback_show_set) (ee, func); | ||
967 | IFE; | ||
968 | ee->func.fn_show = func; | ||
969 | } | ||
970 | |||
971 | EAPI void | ||
972 | ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
973 | { | ||
974 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
975 | { | ||
976 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
977 | "ecore_evas_callback_hide_set"); | ||
978 | return; | ||
979 | } | ||
980 | IFC(ee, fn_callback_hide_set) (ee, func); | ||
981 | IFE; | ||
982 | ee->func.fn_hide = func; | ||
983 | } | ||
984 | |||
985 | EAPI void | ||
986 | ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
987 | { | ||
988 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
989 | { | ||
990 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
991 | "ecore_evas_callback_delete_request_set"); | ||
992 | return; | ||
993 | } | ||
994 | IFC(ee, fn_callback_delete_request_set) (ee, func); | ||
995 | IFE; | ||
996 | ee->func.fn_delete_request = func; | ||
997 | } | ||
998 | |||
999 | EAPI void | ||
1000 | ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1001 | { | ||
1002 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1003 | { | ||
1004 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1005 | "ecore_evas_callback_destroy_set"); | ||
1006 | return; | ||
1007 | } | ||
1008 | IFC(ee, fn_callback_destroy_set) (ee, func); | ||
1009 | IFE; | ||
1010 | ee->func.fn_destroy = func; | ||
1011 | } | ||
1012 | |||
1013 | EAPI void | ||
1014 | ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1015 | { | ||
1016 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1017 | { | ||
1018 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1019 | "ecore_evas_callback_focus_in_set"); | ||
1020 | return; | ||
1021 | } | ||
1022 | IFC(ee, fn_callback_focus_in_set) (ee, func); | ||
1023 | IFE; | ||
1024 | ee->func.fn_focus_in = func; | ||
1025 | } | ||
1026 | |||
1027 | EAPI void | ||
1028 | ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1029 | { | ||
1030 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1031 | { | ||
1032 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1033 | "ecore_evas_callback_focus_out_set"); | ||
1034 | return; | ||
1035 | } | ||
1036 | IFC(ee, fn_callback_focus_out_set) (ee, func); | ||
1037 | IFE; | ||
1038 | ee->func.fn_focus_out = func; | ||
1039 | } | ||
1040 | |||
1041 | EAPI void | ||
1042 | ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1043 | { | ||
1044 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1045 | { | ||
1046 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1047 | "ecore_evas_callback_sticky_set"); | ||
1048 | return; | ||
1049 | } | ||
1050 | IFC(ee, fn_callback_sticky_set) (ee, func); | ||
1051 | IFE; | ||
1052 | ee->func.fn_sticky = func; | ||
1053 | } | ||
1054 | |||
1055 | EAPI void | ||
1056 | ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1057 | { | ||
1058 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1059 | { | ||
1060 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1061 | "ecore_evas_callback_unsticky_set"); | ||
1062 | return; | ||
1063 | } | ||
1064 | IFC(ee, fn_callback_unsticky_set) (ee, func); | ||
1065 | IFE; | ||
1066 | ee->func.fn_unsticky = func; | ||
1067 | } | ||
1068 | |||
1069 | EAPI void | ||
1070 | ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1071 | { | ||
1072 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1073 | { | ||
1074 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1075 | "ecore_evas_callback_mouse_in_set"); | ||
1076 | return; | ||
1077 | } | ||
1078 | IFC(ee, fn_callback_mouse_in_set) (ee, func); | ||
1079 | IFE; | ||
1080 | ee->func.fn_mouse_in = func; | ||
1081 | } | ||
1082 | |||
1083 | EAPI void | ||
1084 | ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1085 | { | ||
1086 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1087 | { | ||
1088 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1089 | "ecore_evas_callback_mouse_out_set"); | ||
1090 | return; | ||
1091 | } | ||
1092 | IFC(ee, fn_callback_mouse_out_set) (ee, func); | ||
1093 | IFE; | ||
1094 | ee->func.fn_mouse_out = func; | ||
1095 | } | ||
1096 | |||
1097 | EAPI void | ||
1098 | ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1099 | { | ||
1100 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1101 | { | ||
1102 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1103 | "ecore_evas_callback_pre_render_set"); | ||
1104 | return; | ||
1105 | } | ||
1106 | IFC(ee, fn_callback_pre_render_set) (ee, func); | ||
1107 | IFE; | ||
1108 | ee->func.fn_pre_render = func; | ||
1109 | } | ||
1110 | |||
1111 | EAPI void | ||
1112 | ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1113 | { | ||
1114 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1115 | { | ||
1116 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1117 | "ecore_evas_callback_post_render_set"); | ||
1118 | return; | ||
1119 | } | ||
1120 | IFC(ee, fn_callback_post_render_set) (ee, func); | ||
1121 | IFE; | ||
1122 | ee->func.fn_post_render = func; | ||
1123 | } | ||
1124 | |||
1125 | EAPI void | ||
1126 | ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1127 | { | ||
1128 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1129 | { | ||
1130 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1131 | "ecore_evas_callback_pre_free_set"); | ||
1132 | return; | ||
1133 | } | ||
1134 | ee->func.fn_pre_free = func; | ||
1135 | } | ||
1136 | |||
1137 | EAPI void | ||
1138 | ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1139 | { | ||
1140 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1141 | { | ||
1142 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1143 | "ecore_evas_callback_state_change_set"); | ||
1144 | return; | ||
1145 | } | ||
1146 | ee->func.fn_state_change = func; | ||
1147 | } | ||
1148 | |||
1149 | /** | ||
1150 | * Get an Ecore_Evas's Evas | ||
1151 | * @param ee The Ecore_Evas whose Evas you wish to get | ||
1152 | * @return The Evas wrapped by @p ee | ||
1153 | * | ||
1154 | * This function returns the Evas contained within @p ee. | ||
1155 | */ | ||
1156 | EAPI Evas * | ||
1157 | ecore_evas_get(const Ecore_Evas *ee) | ||
1158 | { | ||
1159 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1160 | { | ||
1161 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1162 | "ecore_evas_get"); | ||
1163 | return NULL; | ||
1164 | } | ||
1165 | return ee->evas; | ||
1166 | } | ||
1167 | |||
1168 | EAPI void | ||
1169 | ecore_evas_move(Ecore_Evas *ee, int x, int y) | ||
1170 | { | ||
1171 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1172 | { | ||
1173 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1174 | "ecore_evas_move"); | ||
1175 | return; | ||
1176 | } | ||
1177 | if (ee->prop.fullscreen) return; | ||
1178 | IFC(ee, fn_move) (ee, x, y); | ||
1179 | IFE; | ||
1180 | } | ||
1181 | |||
1182 | /** | ||
1183 | * Provide Managed move co-ordinates for an Ecore_Evas | ||
1184 | * @param ee The Ecore_Evas to move | ||
1185 | * @param x The x coordinate to set as the managed location | ||
1186 | * @param y The y coordinate to set as the managed location | ||
1187 | * | ||
1188 | * This sets the managed geometry position of the @p ee to (@p x, @p y) | ||
1189 | */ | ||
1190 | EAPI void | ||
1191 | ecore_evas_managed_move(Ecore_Evas *ee, int x, int y) | ||
1192 | { | ||
1193 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1194 | { | ||
1195 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1196 | "ecore_evas_move"); | ||
1197 | return; | ||
1198 | } | ||
1199 | IFC(ee, fn_managed_move) (ee, x, y); | ||
1200 | IFE; | ||
1201 | } | ||
1202 | |||
1203 | EAPI void | ||
1204 | ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
1205 | { | ||
1206 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1207 | { | ||
1208 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1209 | "ecore_evas_resize"); | ||
1210 | return; | ||
1211 | } | ||
1212 | if (ee->prop.fullscreen) return; | ||
1213 | if (w < 1) w = 1; | ||
1214 | if (h < 1) h = 1; | ||
1215 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1216 | { | ||
1217 | IFC(ee, fn_resize) (ee, h, w); | ||
1218 | IFE; | ||
1219 | } | ||
1220 | else | ||
1221 | { | ||
1222 | IFC(ee, fn_resize) (ee, w, h); | ||
1223 | IFE; | ||
1224 | } | ||
1225 | } | ||
1226 | |||
1227 | EAPI void | ||
1228 | ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) | ||
1229 | { | ||
1230 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1231 | { | ||
1232 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1233 | "ecore_evas_move_resize"); | ||
1234 | return; | ||
1235 | } | ||
1236 | if (ee->prop.fullscreen) return; | ||
1237 | if (w < 1) w = 1; | ||
1238 | if (h < 1) h = 1; | ||
1239 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1240 | { | ||
1241 | IFC(ee, fn_move_resize) (ee, x, y, h, w); | ||
1242 | IFE; | ||
1243 | } | ||
1244 | else | ||
1245 | { | ||
1246 | IFC(ee, fn_move_resize) (ee, x, y, w, h); | ||
1247 | IFE; | ||
1248 | } | ||
1249 | } | ||
1250 | |||
1251 | EAPI void | ||
1252 | ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) | ||
1253 | { | ||
1254 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1255 | { | ||
1256 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1257 | "ecore_evas_geometry_get"); | ||
1258 | return; | ||
1259 | } | ||
1260 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1261 | { | ||
1262 | if (x) *x = ee->x; | ||
1263 | if (y) *y = ee->y; | ||
1264 | if (w) *w = ee->h; | ||
1265 | if (h) *h = ee->w; | ||
1266 | } | ||
1267 | else | ||
1268 | { | ||
1269 | if (x) *x = ee->x; | ||
1270 | if (y) *y = ee->y; | ||
1271 | if (w) *w = ee->w; | ||
1272 | if (h) *h = ee->h; | ||
1273 | } | ||
1274 | } | ||
1275 | |||
1276 | EAPI void | ||
1277 | ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) | ||
1278 | { | ||
1279 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1280 | { | ||
1281 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1282 | "ecore_evas_request_geometry_get"); | ||
1283 | return; | ||
1284 | } | ||
1285 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1286 | { | ||
1287 | if (x) *x = ee->req.x; | ||
1288 | if (y) *y = ee->req.y; | ||
1289 | if (w) *w = ee->req.h; | ||
1290 | if (h) *h = ee->req.w; | ||
1291 | } | ||
1292 | else | ||
1293 | { | ||
1294 | if (x) *x = ee->req.x; | ||
1295 | if (y) *y = ee->req.y; | ||
1296 | if (w) *w = ee->req.w; | ||
1297 | if (h) *h = ee->req.h; | ||
1298 | } | ||
1299 | } | ||
1300 | |||
1301 | EAPI void | ||
1302 | ecore_evas_rotation_set(Ecore_Evas *ee, int rot) | ||
1303 | { | ||
1304 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1305 | { | ||
1306 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1307 | "ecore_evas_rotation_set"); | ||
1308 | return; | ||
1309 | } | ||
1310 | rot = rot % 360; | ||
1311 | while (rot < 0) rot += 360; | ||
1312 | while (rot >= 360) rot -= 360; | ||
1313 | IFC(ee, fn_rotation_set) (ee, rot, 0); | ||
1314 | /* make sure everything gets redrawn */ | ||
1315 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1316 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1317 | IFE; | ||
1318 | } | ||
1319 | |||
1320 | EAPI void | ||
1321 | ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot) | ||
1322 | { | ||
1323 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1324 | { | ||
1325 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1326 | "ecore_evas_rotation_set"); | ||
1327 | return; | ||
1328 | } | ||
1329 | rot = rot % 360; | ||
1330 | while (rot < 0) rot += 360; | ||
1331 | while (rot >= 360) rot -= 360; | ||
1332 | IFC(ee, fn_rotation_set) (ee, rot, 1); | ||
1333 | /* make sure everything gets redrawn */ | ||
1334 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1335 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1336 | IFE; | ||
1337 | } | ||
1338 | |||
1339 | EAPI int | ||
1340 | ecore_evas_rotation_get(const Ecore_Evas *ee) | ||
1341 | { | ||
1342 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1343 | { | ||
1344 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1345 | "ecore_evas_rotation_get"); | ||
1346 | return 0; | ||
1347 | } | ||
1348 | return ee->rotation; | ||
1349 | } | ||
1350 | |||
1351 | /** | ||
1352 | * Set whether an Ecore_Evas is shaped or not. | ||
1353 | * @param ee The Ecore_Evas to shape | ||
1354 | * @param shaped EINA_TRUE to shape, EINA_FALSE to not | ||
1355 | * | ||
1356 | * This function allows one to make an Ecore_Evas shaped to the contents of the | ||
1357 | * evas. If @p shaped is EINA_TRUE, @p ee will be transparent in parts of the evas that | ||
1358 | * contain no objects. If @p shaped is EINA_FALSE, then @p ee will be rectangular, and | ||
1359 | * and parts with no data will show random framebuffer artifacting. For | ||
1360 | * non-shaped Ecore_Evases, it is recommend to cover the entire evas with a | ||
1361 | * background object. | ||
1362 | */ | ||
1363 | EAPI void | ||
1364 | ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped) | ||
1365 | { | ||
1366 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1367 | { | ||
1368 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1369 | "ecore_evas_shaped_set"); | ||
1370 | return; | ||
1371 | } | ||
1372 | IFC(ee, fn_shaped_set) (ee, shaped); | ||
1373 | IFE; | ||
1374 | } | ||
1375 | |||
1376 | /** | ||
1377 | * Query whether an Ecore_Evas is shaped or not. | ||
1378 | * @param ee The Ecore_Evas to query. | ||
1379 | * @return EINA_TRUE if shaped, EINA_FALSE if not. | ||
1380 | * | ||
1381 | * This function returns EINA_TRUE if @p ee is shaped, and EINA_FALSE if not. | ||
1382 | */ | ||
1383 | EAPI Eina_Bool | ||
1384 | ecore_evas_shaped_get(const 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_shaped_get"); | ||
1390 | return EINA_FALSE; | ||
1391 | } | ||
1392 | return ee->shaped ? EINA_TRUE : EINA_FALSE; | ||
1393 | } | ||
1394 | |||
1395 | EAPI void | ||
1396 | ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha) | ||
1397 | { | ||
1398 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1399 | { | ||
1400 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1401 | "ecore_evas_alpha_set"); | ||
1402 | return; | ||
1403 | } | ||
1404 | IFC(ee, fn_alpha_set) (ee, alpha); | ||
1405 | IFE; | ||
1406 | } | ||
1407 | |||
1408 | EAPI Eina_Bool | ||
1409 | ecore_evas_alpha_get(const Ecore_Evas *ee) | ||
1410 | { | ||
1411 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1412 | { | ||
1413 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1414 | "ecore_evas_alpha_get"); | ||
1415 | return EINA_FALSE; | ||
1416 | } | ||
1417 | return ee->alpha ? EINA_TRUE : EINA_FALSE; | ||
1418 | } | ||
1419 | |||
1420 | EAPI void | ||
1421 | ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent) | ||
1422 | { | ||
1423 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1424 | { | ||
1425 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1426 | "ecore_evas_transparent_set"); | ||
1427 | return; | ||
1428 | } | ||
1429 | IFC(ee, fn_transparent_set) (ee, transparent); | ||
1430 | IFE; | ||
1431 | } | ||
1432 | |||
1433 | EAPI Eina_Bool | ||
1434 | ecore_evas_transparent_get(const Ecore_Evas *ee) | ||
1435 | { | ||
1436 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1437 | { | ||
1438 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1439 | "ecore_evas_transparent_get"); | ||
1440 | return EINA_FALSE; | ||
1441 | } | ||
1442 | return ee->transparent ? EINA_TRUE : 0; | ||
1443 | } | ||
1444 | |||
1445 | EAPI void | ||
1446 | ecore_evas_show(Ecore_Evas *ee) | ||
1447 | { | ||
1448 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1449 | { | ||
1450 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1451 | "ecore_evas_show"); | ||
1452 | return; | ||
1453 | } | ||
1454 | IFC(ee, fn_show) (ee); | ||
1455 | IFE; | ||
1456 | } | ||
1457 | |||
1458 | EAPI void | ||
1459 | ecore_evas_hide(Ecore_Evas *ee) | ||
1460 | { | ||
1461 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1462 | { | ||
1463 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1464 | "ecore_evas_hide"); | ||
1465 | return; | ||
1466 | } | ||
1467 | IFC(ee, fn_hide) (ee); | ||
1468 | IFE; | ||
1469 | } | ||
1470 | |||
1471 | EAPI int | ||
1472 | ecore_evas_visibility_get(const Ecore_Evas *ee) | ||
1473 | { | ||
1474 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1475 | { | ||
1476 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1477 | "ecore_evas_visibility_get"); | ||
1478 | return 0; | ||
1479 | } | ||
1480 | return ee->visible ? 1:0; | ||
1481 | } | ||
1482 | |||
1483 | EAPI void | ||
1484 | ecore_evas_raise(Ecore_Evas *ee) | ||
1485 | { | ||
1486 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1487 | { | ||
1488 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1489 | "ecore_evas_raise"); | ||
1490 | return; | ||
1491 | } | ||
1492 | IFC(ee, fn_raise) (ee); | ||
1493 | IFE; | ||
1494 | } | ||
1495 | |||
1496 | EAPI void | ||
1497 | ecore_evas_lower(Ecore_Evas *ee) | ||
1498 | { | ||
1499 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1500 | { | ||
1501 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1502 | "ecore_evas_lower"); | ||
1503 | return; | ||
1504 | } | ||
1505 | IFC(ee, fn_lower) (ee); | ||
1506 | IFE; | ||
1507 | } | ||
1508 | |||
1509 | /** | ||
1510 | * Activate (set focus to, via the window manager) an Ecore_Evas' window. | ||
1511 | * @param ee The Ecore_Evas to activate. | ||
1512 | * | ||
1513 | * This functions activates the Ecore_Evas. | ||
1514 | */ | ||
1515 | EAPI void | ||
1516 | ecore_evas_activate(Ecore_Evas *ee) | ||
1517 | { | ||
1518 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1519 | { | ||
1520 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1521 | "ecore_evas_activate"); | ||
1522 | return; | ||
1523 | } | ||
1524 | IFC(ee, fn_activate) (ee); | ||
1525 | IFE; | ||
1526 | } | ||
1527 | |||
1528 | EAPI void | ||
1529 | ecore_evas_title_set(Ecore_Evas *ee, const char *t) | ||
1530 | { | ||
1531 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1532 | { | ||
1533 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1534 | "ecore_evas_title_set"); | ||
1535 | return; | ||
1536 | } | ||
1537 | IFC(ee, fn_title_set) (ee, t); | ||
1538 | IFE; | ||
1539 | } | ||
1540 | |||
1541 | EAPI const char * | ||
1542 | ecore_evas_title_get(const Ecore_Evas *ee) | ||
1543 | { | ||
1544 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1545 | { | ||
1546 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1547 | "ecore_evas_title_get"); | ||
1548 | return NULL; | ||
1549 | } | ||
1550 | return ee->prop.title; | ||
1551 | } | ||
1552 | |||
1553 | EAPI void | ||
1554 | ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
1555 | { | ||
1556 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1557 | { | ||
1558 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1559 | "ecore_evas_name_class_set"); | ||
1560 | return; | ||
1561 | } | ||
1562 | IFC(ee, fn_name_class_set) (ee, n, c); | ||
1563 | IFE; | ||
1564 | } | ||
1565 | |||
1566 | EAPI void | ||
1567 | ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c) | ||
1568 | { | ||
1569 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1570 | { | ||
1571 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1572 | "ecore_evas_name_class_get"); | ||
1573 | return; | ||
1574 | } | ||
1575 | if (n) *n = ee->prop.name; | ||
1576 | if (c) *c = ee->prop.clas; | ||
1577 | } | ||
1578 | |||
1579 | EAPI void | ||
1580 | ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h) | ||
1581 | { | ||
1582 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1583 | { | ||
1584 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1585 | "ecore_evas_size_min_set"); | ||
1586 | return; | ||
1587 | } | ||
1588 | if (w < 0) w = 0; | ||
1589 | if (h < 0) h = 0; | ||
1590 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1591 | { | ||
1592 | IFC(ee, fn_size_min_set) (ee, h, w); | ||
1593 | IFE; | ||
1594 | } | ||
1595 | else | ||
1596 | { | ||
1597 | IFC(ee, fn_size_min_set) (ee, w, h); | ||
1598 | IFE; | ||
1599 | } | ||
1600 | } | ||
1601 | |||
1602 | EAPI void | ||
1603 | ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h) | ||
1604 | { | ||
1605 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1606 | { | ||
1607 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1608 | "ecore_evas_size_min_get"); | ||
1609 | return; | ||
1610 | } | ||
1611 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1612 | { | ||
1613 | if (w) *w = ee->prop.min.h; | ||
1614 | if (h) *h = ee->prop.min.w; | ||
1615 | } | ||
1616 | else | ||
1617 | { | ||
1618 | if (w) *w = ee->prop.min.w; | ||
1619 | if (h) *h = ee->prop.min.h; | ||
1620 | } | ||
1621 | } | ||
1622 | |||
1623 | EAPI void | ||
1624 | ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h) | ||
1625 | { | ||
1626 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1627 | { | ||
1628 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1629 | "ecore_evas_size_max_set"); | ||
1630 | return; | ||
1631 | } | ||
1632 | if (w < 0) w = 0; | ||
1633 | if (h < 0) h = 0; | ||
1634 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1635 | { | ||
1636 | IFC(ee, fn_size_max_set) (ee, h, w); | ||
1637 | IFE; | ||
1638 | } | ||
1639 | else | ||
1640 | { | ||
1641 | IFC(ee, fn_size_max_set) (ee, w, h); | ||
1642 | IFE; | ||
1643 | } | ||
1644 | } | ||
1645 | |||
1646 | EAPI void | ||
1647 | ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h) | ||
1648 | { | ||
1649 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1650 | { | ||
1651 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1652 | "ecore_evas_size_max_get"); | ||
1653 | return; | ||
1654 | } | ||
1655 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1656 | { | ||
1657 | if (w) *w = ee->prop.max.h; | ||
1658 | if (h) *h = ee->prop.max.w; | ||
1659 | } | ||
1660 | else | ||
1661 | { | ||
1662 | if (w) *w = ee->prop.max.w; | ||
1663 | if (h) *h = ee->prop.max.h; | ||
1664 | } | ||
1665 | } | ||
1666 | |||
1667 | EAPI void | ||
1668 | ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h) | ||
1669 | { | ||
1670 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1671 | { | ||
1672 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1673 | "ecore_evas_size_base_set"); | ||
1674 | return; | ||
1675 | } | ||
1676 | if (w < 0) w = 0; | ||
1677 | if (h < 0) h = 0; | ||
1678 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1679 | { | ||
1680 | IFC(ee, fn_size_base_set) (ee, h, w); | ||
1681 | IFE; | ||
1682 | } | ||
1683 | else | ||
1684 | { | ||
1685 | IFC(ee, fn_size_base_set) (ee, w, h); | ||
1686 | IFE; | ||
1687 | } | ||
1688 | } | ||
1689 | |||
1690 | EAPI void | ||
1691 | ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h) | ||
1692 | { | ||
1693 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1694 | { | ||
1695 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1696 | "ecore_evas_size_base_get"); | ||
1697 | return; | ||
1698 | } | ||
1699 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1700 | { | ||
1701 | if (w) *w = ee->prop.base.h; | ||
1702 | if (h) *h = ee->prop.base.w; | ||
1703 | } | ||
1704 | else | ||
1705 | { | ||
1706 | if (w) *w = ee->prop.base.w; | ||
1707 | if (h) *h = ee->prop.base.h; | ||
1708 | } | ||
1709 | } | ||
1710 | |||
1711 | EAPI void | ||
1712 | ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h) | ||
1713 | { | ||
1714 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1715 | { | ||
1716 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1717 | "ecore_evas_size_step_set"); | ||
1718 | return; | ||
1719 | } | ||
1720 | if (w < 0) w = 0; | ||
1721 | if (h < 0) h = 0; | ||
1722 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1723 | { | ||
1724 | IFC(ee, fn_size_step_set) (ee, h, w); | ||
1725 | IFE; | ||
1726 | } | ||
1727 | else | ||
1728 | { | ||
1729 | IFC(ee, fn_size_step_set) (ee, w, h); | ||
1730 | IFE; | ||
1731 | } | ||
1732 | } | ||
1733 | |||
1734 | EAPI void | ||
1735 | ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h) | ||
1736 | { | ||
1737 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1738 | { | ||
1739 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1740 | "ecore_evas_size_step_get"); | ||
1741 | return; | ||
1742 | } | ||
1743 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1744 | { | ||
1745 | if (w) *w = ee->prop.step.h; | ||
1746 | if (h) *h = ee->prop.step.w; | ||
1747 | } | ||
1748 | else | ||
1749 | { | ||
1750 | if (w) *w = ee->prop.step.w; | ||
1751 | if (h) *h = ee->prop.step.h; | ||
1752 | } | ||
1753 | } | ||
1754 | |||
1755 | EAPI void | ||
1756 | ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y) | ||
1757 | { | ||
1758 | Evas_Object *obj = NULL; | ||
1759 | |||
1760 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1761 | { | ||
1762 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1763 | "ecore_evas_cursor_set"); | ||
1764 | return; | ||
1765 | } | ||
1766 | |||
1767 | if (file) | ||
1768 | { | ||
1769 | int x, y; | ||
1770 | |||
1771 | obj = evas_object_image_add(ee->evas); | ||
1772 | evas_object_image_file_set(obj, file, NULL); | ||
1773 | evas_object_image_size_get(obj, &x, &y); | ||
1774 | evas_object_resize(obj, x, y); | ||
1775 | evas_object_image_fill_set(obj, 0, 0, x, y); | ||
1776 | } | ||
1777 | |||
1778 | IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); | ||
1779 | IFE; | ||
1780 | } | ||
1781 | |||
1782 | EAPI void | ||
1783 | ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
1784 | { | ||
1785 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1786 | { | ||
1787 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1788 | "ecore_evas_cursor_set"); | ||
1789 | return; | ||
1790 | } | ||
1791 | IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); | ||
1792 | IFE; | ||
1793 | } | ||
1794 | |||
1795 | EAPI void | ||
1796 | ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y) | ||
1797 | { | ||
1798 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1799 | { | ||
1800 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1801 | "ecore_evas_cursor_get"); | ||
1802 | return; | ||
1803 | } | ||
1804 | if (obj) *obj = ee->prop.cursor.object; | ||
1805 | if (layer) *layer = ee->prop.cursor.layer; | ||
1806 | if (hot_x) *hot_x = ee->prop.cursor.hot.x; | ||
1807 | if (hot_y) *hot_y = ee->prop.cursor.hot.y; | ||
1808 | } | ||
1809 | |||
1810 | EAPI void | ||
1811 | ecore_evas_layer_set(Ecore_Evas *ee, int layer) | ||
1812 | { | ||
1813 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1814 | { | ||
1815 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1816 | "ecore_evas_layer_set"); | ||
1817 | return; | ||
1818 | } | ||
1819 | IFC(ee, fn_layer_set) (ee, layer); | ||
1820 | IFE; | ||
1821 | } | ||
1822 | |||
1823 | EAPI int | ||
1824 | ecore_evas_layer_get(const Ecore_Evas *ee) | ||
1825 | { | ||
1826 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1827 | { | ||
1828 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1829 | "ecore_evas_layer_get"); | ||
1830 | return 0; | ||
1831 | } | ||
1832 | return ee->prop.layer; | ||
1833 | } | ||
1834 | |||
1835 | EAPI void | ||
1836 | ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on) | ||
1837 | { | ||
1838 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1839 | { | ||
1840 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1841 | "ecore_evas_focus_set"); | ||
1842 | return; | ||
1843 | } | ||
1844 | IFC(ee, fn_focus_set) (ee, on); | ||
1845 | IFE; | ||
1846 | } | ||
1847 | |||
1848 | EAPI Eina_Bool | ||
1849 | ecore_evas_focus_get(const Ecore_Evas *ee) | ||
1850 | { | ||
1851 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1852 | { | ||
1853 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1854 | "ecore_evas_focus_get"); | ||
1855 | return EINA_FALSE; | ||
1856 | } | ||
1857 | return ee->prop.focused ? EINA_TRUE : EINA_FALSE; | ||
1858 | } | ||
1859 | |||
1860 | EAPI void | ||
1861 | ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on) | ||
1862 | { | ||
1863 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1864 | { | ||
1865 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1866 | "ecore_evas_iconified_set"); | ||
1867 | return; | ||
1868 | } | ||
1869 | IFC(ee, fn_iconified_set) (ee, on); | ||
1870 | IFE; | ||
1871 | } | ||
1872 | |||
1873 | EAPI Eina_Bool | ||
1874 | ecore_evas_iconified_get(const Ecore_Evas *ee) | ||
1875 | { | ||
1876 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1877 | { | ||
1878 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1879 | "ecore_evas_iconified_get"); | ||
1880 | return EINA_FALSE; | ||
1881 | } | ||
1882 | return ee->prop.iconified ? EINA_TRUE : EINA_FALSE; | ||
1883 | } | ||
1884 | |||
1885 | EAPI void | ||
1886 | ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on) | ||
1887 | { | ||
1888 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1889 | { | ||
1890 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1891 | "ecore_evas_borderless_set"); | ||
1892 | return; | ||
1893 | } | ||
1894 | IFC(ee, fn_borderless_set) (ee, on); | ||
1895 | IFE; | ||
1896 | } | ||
1897 | |||
1898 | EAPI Eina_Bool | ||
1899 | ecore_evas_borderless_get(const Ecore_Evas *ee) | ||
1900 | { | ||
1901 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1902 | { | ||
1903 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1904 | "ecore_evas_borderless_get"); | ||
1905 | return EINA_FALSE; | ||
1906 | } | ||
1907 | return ee->prop.borderless ? EINA_TRUE : EINA_FALSE; | ||
1908 | } | ||
1909 | |||
1910 | /** | ||
1911 | * Tell the WM whether or not to ignore an Ecore_Evas' window | ||
1912 | * @param ee The Ecore_Evas | ||
1913 | * @param on EINA_TRUE to ignore, EINA_FALSE to not. | ||
1914 | * | ||
1915 | * This function causes the window manager to ignore @p ee if @p on is EINA_TRUE, | ||
1916 | * or not ignore @p ee if @p on is EINA_FALSE. | ||
1917 | */ | ||
1918 | EAPI void | ||
1919 | ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on) | ||
1920 | { | ||
1921 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1922 | { | ||
1923 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1924 | "ecore_evas_override_set"); | ||
1925 | return; | ||
1926 | } | ||
1927 | IFC(ee, fn_override_set) (ee, on); | ||
1928 | IFE; | ||
1929 | } | ||
1930 | |||
1931 | /** | ||
1932 | * Query whether an Ecore_Evas' window is overridden or not | ||
1933 | * @param ee The Ecore_Evas to set | ||
1934 | * @return EINA_TRUE if @p ee is overridden, EINA_FALSE if not. | ||
1935 | * | ||
1936 | */ | ||
1937 | EAPI Eina_Bool | ||
1938 | ecore_evas_override_get(const Ecore_Evas *ee) | ||
1939 | { | ||
1940 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1941 | { | ||
1942 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1943 | "ecore_evas_override_get"); | ||
1944 | return EINA_FALSE; | ||
1945 | } | ||
1946 | return ee->prop.override ? EINA_TRUE : EINA_FALSE; | ||
1947 | } | ||
1948 | |||
1949 | EAPI void | ||
1950 | ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on) | ||
1951 | { | ||
1952 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1953 | { | ||
1954 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1955 | "ecore_evas_maximized_set"); | ||
1956 | return; | ||
1957 | } | ||
1958 | IFC(ee, fn_maximized_set) (ee, on); | ||
1959 | IFE; | ||
1960 | } | ||
1961 | |||
1962 | EAPI Eina_Bool | ||
1963 | ecore_evas_maximized_get(const Ecore_Evas *ee) | ||
1964 | { | ||
1965 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1966 | { | ||
1967 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1968 | "ecore_evas_maximized_get"); | ||
1969 | return EINA_FALSE; | ||
1970 | } | ||
1971 | return ee->prop.maximized ? EINA_TRUE : EINA_FALSE; | ||
1972 | } | ||
1973 | |||
1974 | EAPI void | ||
1975 | ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) | ||
1976 | { | ||
1977 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1978 | { | ||
1979 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1980 | "ecore_evas_fullscreen_set"); | ||
1981 | return; | ||
1982 | } | ||
1983 | IFC(ee, fn_fullscreen_set) (ee, on); | ||
1984 | IFE; | ||
1985 | } | ||
1986 | |||
1987 | EAPI Eina_Bool | ||
1988 | ecore_evas_fullscreen_get(const Ecore_Evas *ee) | ||
1989 | { | ||
1990 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1991 | { | ||
1992 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1993 | "ecore_evas_fullscreen_get"); | ||
1994 | return EINA_FALSE; | ||
1995 | } | ||
1996 | return ee->prop.fullscreen ? EINA_TRUE : EINA_FALSE; | ||
1997 | } | ||
1998 | |||
1999 | /** | ||
2000 | * Set whether or not an Ecore_Evas' window should avoid damage | ||
2001 | * | ||
2002 | * @param ee The Ecore_Evas | ||
2003 | * @param on The type of the damage management | ||
2004 | * | ||
2005 | * This function causes @p ee to be drawn to a pixmap to avoid recalculations. | ||
2006 | * On expose events it will copy from the pixmap to the window. | ||
2007 | */ | ||
2008 | EAPI void | ||
2009 | ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on) | ||
2010 | { | ||
2011 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2012 | { | ||
2013 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2014 | "ecore_evas_avoid_damage_set"); | ||
2015 | return; | ||
2016 | } | ||
2017 | IFC(ee, fn_avoid_damage_set) (ee, on); | ||
2018 | IFE; | ||
2019 | } | ||
2020 | |||
2021 | /** | ||
2022 | * Query whether an Ecore_Evas' window avoids damage or not | ||
2023 | * @param ee The Ecore_Evas to set | ||
2024 | * @return The type of the damage management | ||
2025 | * | ||
2026 | */ | ||
2027 | EAPI Ecore_Evas_Avoid_Damage_Type | ||
2028 | ecore_evas_avoid_damage_get(const Ecore_Evas *ee) | ||
2029 | { | ||
2030 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2031 | { | ||
2032 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2033 | "ecore_evas_avoid_damage_get"); | ||
2034 | return ECORE_EVAS_AVOID_DAMAGE_NONE; | ||
2035 | } | ||
2036 | return ee->prop.avoid_damage; | ||
2037 | } | ||
2038 | |||
2039 | /** | ||
2040 | * Set the withdrawn state of an Ecore_Evas' window. | ||
2041 | * @param ee The Ecore_Evas whose window's withdrawn state is set. | ||
2042 | * @param withdrawn The Ecore_Evas window's new withdrawn state. | ||
2043 | * | ||
2044 | */ | ||
2045 | EAPI void | ||
2046 | ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn) | ||
2047 | { | ||
2048 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2049 | { | ||
2050 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2051 | "ecore_evas_withdrawn_set"); | ||
2052 | return; | ||
2053 | } | ||
2054 | |||
2055 | IFC(ee, fn_withdrawn_set) (ee, withdrawn); | ||
2056 | IFE; | ||
2057 | } | ||
2058 | |||
2059 | /** | ||
2060 | * Returns the withdrawn state of an Ecore_Evas' window. | ||
2061 | * @param ee The Ecore_Evas whose window's withdrawn state is returned. | ||
2062 | * @return The Ecore_Evas window's withdrawn state. | ||
2063 | * | ||
2064 | */ | ||
2065 | EAPI Eina_Bool | ||
2066 | ecore_evas_withdrawn_get(const Ecore_Evas *ee) | ||
2067 | { | ||
2068 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2069 | { | ||
2070 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2071 | "ecore_evas_withdrawn_get"); | ||
2072 | return EINA_FALSE; | ||
2073 | } | ||
2074 | return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE; | ||
2075 | } | ||
2076 | |||
2077 | /** | ||
2078 | * Set the sticky state of an Ecore_Evas window. | ||
2079 | * | ||
2080 | * @param ee The Ecore_Evas whose window's sticky state is set. | ||
2081 | * @param sticky The Ecore_Evas window's new sticky state. | ||
2082 | * | ||
2083 | */ | ||
2084 | EAPI void | ||
2085 | ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky) | ||
2086 | { | ||
2087 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2088 | { | ||
2089 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2090 | "ecore_evas_sticky_set"); | ||
2091 | return; | ||
2092 | } | ||
2093 | |||
2094 | IFC(ee, fn_sticky_set) (ee, sticky); | ||
2095 | IFE; | ||
2096 | } | ||
2097 | |||
2098 | /** | ||
2099 | * Returns the sticky state of an Ecore_Evas' window. | ||
2100 | * | ||
2101 | * @param ee The Ecore_Evas whose window's sticky state is returned. | ||
2102 | * @return The Ecore_Evas window's sticky state. | ||
2103 | * | ||
2104 | */ | ||
2105 | EAPI Eina_Bool | ||
2106 | ecore_evas_sticky_get(const 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_sticky_get"); | ||
2112 | return EINA_FALSE; | ||
2113 | } | ||
2114 | return ee->prop.sticky ? EINA_TRUE : EINA_FALSE; | ||
2115 | } | ||
2116 | |||
2117 | EAPI void | ||
2118 | ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group) | ||
2119 | { | ||
2120 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2121 | { | ||
2122 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2123 | "XXX"); | ||
2124 | return; | ||
2125 | } | ||
2126 | |||
2127 | IFC(ee, fn_window_group_set) (ee, ee_group); | ||
2128 | IFE; | ||
2129 | } | ||
2130 | |||
2131 | EAPI const Ecore_Evas * | ||
2132 | ecore_evas_window_group_get(const Ecore_Evas *ee) | ||
2133 | { | ||
2134 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2135 | { | ||
2136 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2137 | "XXX"); | ||
2138 | return EINA_FALSE; | ||
2139 | } | ||
2140 | return ee->prop.group_ee; | ||
2141 | } | ||
2142 | |||
2143 | EAPI void | ||
2144 | ecore_evas_aspect_set(Ecore_Evas *ee, double aspect) | ||
2145 | { | ||
2146 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2147 | { | ||
2148 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2149 | "XXX"); | ||
2150 | return; | ||
2151 | } | ||
2152 | |||
2153 | IFC(ee, fn_aspect_set) (ee, aspect); | ||
2154 | IFE; | ||
2155 | } | ||
2156 | |||
2157 | EAPI double | ||
2158 | ecore_evas_aspect_get(const Ecore_Evas *ee) | ||
2159 | { | ||
2160 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2161 | { | ||
2162 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2163 | "XXX"); | ||
2164 | return EINA_FALSE; | ||
2165 | } | ||
2166 | return ee->prop.aspect; | ||
2167 | } | ||
2168 | |||
2169 | EAPI void | ||
2170 | ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent) | ||
2171 | { | ||
2172 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2173 | { | ||
2174 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2175 | "XXX"); | ||
2176 | return; | ||
2177 | } | ||
2178 | |||
2179 | IFC(ee, fn_urgent_set) (ee, urgent); | ||
2180 | IFE; | ||
2181 | } | ||
2182 | |||
2183 | EAPI Eina_Bool | ||
2184 | ecore_evas_urgent_get(const Ecore_Evas *ee) | ||
2185 | { | ||
2186 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2187 | { | ||
2188 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2189 | "XXX"); | ||
2190 | return EINA_FALSE; | ||
2191 | } | ||
2192 | return ee->prop.urgent ? EINA_TRUE : EINA_FALSE; | ||
2193 | } | ||
2194 | |||
2195 | EAPI void | ||
2196 | ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal) | ||
2197 | { | ||
2198 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2199 | { | ||
2200 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2201 | "XXX"); | ||
2202 | return; | ||
2203 | } | ||
2204 | |||
2205 | IFC(ee, fn_modal_set) (ee, modal); | ||
2206 | IFE; | ||
2207 | } | ||
2208 | |||
2209 | EAPI Eina_Bool | ||
2210 | ecore_evas_modal_get(const Ecore_Evas *ee) | ||
2211 | { | ||
2212 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2213 | { | ||
2214 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2215 | "XXX"); | ||
2216 | return EINA_FALSE; | ||
2217 | } | ||
2218 | return ee->prop.modal ? EINA_TRUE : EINA_FALSE; | ||
2219 | } | ||
2220 | |||
2221 | EAPI void | ||
2222 | ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand) | ||
2223 | { | ||
2224 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2225 | { | ||
2226 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2227 | "XXX"); | ||
2228 | return; | ||
2229 | } | ||
2230 | |||
2231 | IFC(ee, fn_demands_attention_set) (ee, demand); | ||
2232 | IFE; | ||
2233 | } | ||
2234 | |||
2235 | EAPI Eina_Bool | ||
2236 | ecore_evas_demand_attention_get(const Ecore_Evas *ee) | ||
2237 | { | ||
2238 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2239 | { | ||
2240 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2241 | "XXX"); | ||
2242 | return EINA_FALSE; | ||
2243 | } | ||
2244 | return ee->prop.demand_attention ? EINA_TRUE : EINA_FALSE; | ||
2245 | } | ||
2246 | |||
2247 | EAPI void | ||
2248 | ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip) | ||
2249 | { | ||
2250 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2251 | { | ||
2252 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2253 | "XXX"); | ||
2254 | return; | ||
2255 | } | ||
2256 | |||
2257 | IFC(ee, fn_focus_skip_set) (ee, skip); | ||
2258 | IFE; | ||
2259 | } | ||
2260 | |||
2261 | EAPI Eina_Bool | ||
2262 | ecore_evas_focus_skip_get(const Ecore_Evas *ee) | ||
2263 | { | ||
2264 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2265 | { | ||
2266 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2267 | "XXX"); | ||
2268 | return EINA_FALSE; | ||
2269 | } | ||
2270 | return ee->prop.focus_skip ? EINA_TRUE : EINA_FALSE; | ||
2271 | } | ||
2272 | |||
2273 | EAPI void | ||
2274 | ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore) | ||
2275 | { | ||
2276 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2277 | { | ||
2278 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2279 | "ecore_evas_ignore_events_set"); | ||
2280 | return; | ||
2281 | } | ||
2282 | |||
2283 | IFC(ee, fn_ignore_events_set) (ee, ignore); | ||
2284 | IFE; | ||
2285 | } | ||
2286 | |||
2287 | EAPI Eina_Bool | ||
2288 | ecore_evas_ignore_events_get(const Ecore_Evas *ee) | ||
2289 | { | ||
2290 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2291 | { | ||
2292 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2293 | "ecore_evas_ignore_events_get"); | ||
2294 | return EINA_FALSE; | ||
2295 | } | ||
2296 | return ee->ignore_events ? EINA_TRUE : EINA_FALSE; | ||
2297 | } | ||
2298 | |||
2299 | EAPI void | ||
2300 | ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render) | ||
2301 | { | ||
2302 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2303 | { | ||
2304 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2305 | "ecore_evas_manual_render_set"); | ||
2306 | return; | ||
2307 | } | ||
2308 | ee->manual_render = manual_render; | ||
2309 | } | ||
2310 | |||
2311 | EAPI Eina_Bool | ||
2312 | ecore_evas_manual_render_get(const Ecore_Evas *ee) | ||
2313 | { | ||
2314 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2315 | { | ||
2316 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2317 | "ecore_evas_manual_render_get"); | ||
2318 | return EINA_FALSE; | ||
2319 | } | ||
2320 | return ee->manual_render ? EINA_TRUE : EINA_FALSE; | ||
2321 | } | ||
2322 | |||
2323 | EAPI void | ||
2324 | ecore_evas_manual_render(Ecore_Evas *ee) | ||
2325 | { | ||
2326 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2327 | { | ||
2328 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2329 | "ecore_evas_manual_render"); | ||
2330 | return; | ||
2331 | } | ||
2332 | if (ee->engine.func->fn_render) | ||
2333 | ee->engine.func->fn_render(ee); | ||
2334 | } | ||
2335 | |||
2336 | EAPI void | ||
2337 | ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync) | ||
2338 | { | ||
2339 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2340 | { | ||
2341 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2342 | "ecore_evas_comp_sync_set"); | ||
2343 | return; | ||
2344 | } | ||
2345 | ee->no_comp_sync = !do_sync; | ||
2346 | } | ||
2347 | |||
2348 | EAPI Eina_Bool | ||
2349 | ecore_evas_comp_sync_get(const Ecore_Evas *ee) | ||
2350 | { | ||
2351 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2352 | { | ||
2353 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2354 | "ecore_evas_comp_sync_get"); | ||
2355 | return EINA_FALSE; | ||
2356 | } | ||
2357 | return !ee->no_comp_sync; | ||
2358 | } | ||
2359 | |||
2360 | EAPI Ecore_Window | ||
2361 | ecore_evas_window_get(const Ecore_Evas *ee) | ||
2362 | { | ||
2363 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2364 | { | ||
2365 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2366 | "ecore_evas_window_get"); | ||
2367 | return 0; | ||
2368 | } | ||
2369 | |||
2370 | return ee->prop.window; | ||
2371 | } | ||
2372 | |||
2373 | EAPI void | ||
2374 | ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) | ||
2375 | { | ||
2376 | if (x) *x = 0; | ||
2377 | if (y) *y = 0; | ||
2378 | if (w) *w = 0; | ||
2379 | if (h) *h = 0; | ||
2380 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2381 | { | ||
2382 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
2383 | "ecore_evas_screen_geometry_get"); | ||
2384 | return; | ||
2385 | } | ||
2386 | |||
2387 | IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h); | ||
2388 | IFE; | ||
2389 | } | ||
2390 | |||
2391 | EAPI void | ||
2392 | ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame) | ||
2393 | { | ||
2394 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2395 | { | ||
2396 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_set"); | ||
2397 | return; | ||
2398 | } | ||
2399 | ee->prop.draw_frame = draw_frame; | ||
2400 | } | ||
2401 | |||
2402 | EAPI Eina_Bool | ||
2403 | ecore_evas_draw_frame_get(const Ecore_Evas *ee) | ||
2404 | { | ||
2405 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2406 | { | ||
2407 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_get"); | ||
2408 | return EINA_FALSE; | ||
2409 | } | ||
2410 | return ee->prop.draw_frame; | ||
2411 | } | ||
2412 | |||
2413 | /* fps debug calls - for debugging how much time your app actually spends */ | ||
2414 | /* rendering graphics... :) */ | ||
2415 | |||
2416 | static int _ecore_evas_fps_debug_init_count = 0; | ||
2417 | static int _ecore_evas_fps_debug_fd = -1; | ||
2418 | unsigned int *_ecore_evas_fps_rendertime_mmap = NULL; | ||
2419 | |||
2420 | void | ||
2421 | _ecore_evas_fps_debug_init(void) | ||
2422 | { | ||
2423 | char buf[4096]; | ||
2424 | const char *tmp; | ||
2425 | |||
2426 | _ecore_evas_fps_debug_init_count++; | ||
2427 | if (_ecore_evas_fps_debug_init_count > 1) return; | ||
2428 | |||
2429 | #ifndef HAVE_EVIL | ||
2430 | tmp = "/tmp"; | ||
2431 | #else | ||
2432 | tmp = evil_tmpdir_get (); | ||
2433 | #endif /* HAVE_EVIL */ | ||
2434 | snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", tmp, (int)getpid()); | ||
2435 | _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); | ||
2436 | if (_ecore_evas_fps_debug_fd < 0) | ||
2437 | { | ||
2438 | unlink(buf); | ||
2439 | _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); | ||
2440 | } | ||
2441 | if (_ecore_evas_fps_debug_fd >= 0) | ||
2442 | { | ||
2443 | unsigned int zero = 0; | ||
2444 | char *buf2 = (char *)&zero; | ||
2445 | ssize_t todo = sizeof(unsigned int); | ||
2446 | |||
2447 | while (todo > 0) | ||
2448 | { | ||
2449 | ssize_t r = write(_ecore_evas_fps_debug_fd, buf2, todo); | ||
2450 | if (r > 0) | ||
2451 | { | ||
2452 | todo -= r; | ||
2453 | buf2 += r; | ||
2454 | } | ||
2455 | else if ((r < 0) && (errno == EINTR)) | ||
2456 | continue; | ||
2457 | else | ||
2458 | { | ||
2459 | ERR("could not write to file '%s' fd %d: %s", | ||
2460 | buf, _ecore_evas_fps_debug_fd, strerror(errno)); | ||
2461 | close(_ecore_evas_fps_debug_fd); | ||
2462 | _ecore_evas_fps_debug_fd = -1; | ||
2463 | return; | ||
2464 | } | ||
2465 | } | ||
2466 | _ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int), | ||
2467 | PROT_READ | PROT_WRITE, | ||
2468 | MAP_SHARED, | ||
2469 | _ecore_evas_fps_debug_fd, 0); | ||
2470 | if (_ecore_evas_fps_rendertime_mmap == MAP_FAILED) | ||
2471 | _ecore_evas_fps_rendertime_mmap = NULL; | ||
2472 | } | ||
2473 | } | ||
2474 | |||
2475 | void | ||
2476 | _ecore_evas_fps_debug_shutdown(void) | ||
2477 | { | ||
2478 | _ecore_evas_fps_debug_init_count--; | ||
2479 | if (_ecore_evas_fps_debug_init_count > 0) return; | ||
2480 | if (_ecore_evas_fps_debug_fd >= 0) | ||
2481 | { | ||
2482 | char buf[4096]; | ||
2483 | |||
2484 | snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid()); | ||
2485 | unlink(buf); | ||
2486 | if (_ecore_evas_fps_rendertime_mmap) | ||
2487 | { | ||
2488 | munmap(_ecore_evas_fps_rendertime_mmap, sizeof(int)); | ||
2489 | _ecore_evas_fps_rendertime_mmap = NULL; | ||
2490 | } | ||
2491 | close(_ecore_evas_fps_debug_fd); | ||
2492 | _ecore_evas_fps_debug_fd = -1; | ||
2493 | } | ||
2494 | } | ||
2495 | |||
2496 | void | ||
2497 | _ecore_evas_fps_debug_rendertime_add(double t) | ||
2498 | { | ||
2499 | static double rtime = 0.0; | ||
2500 | static double rlapse = 0.0; | ||
2501 | static int frames = 0; | ||
2502 | static int flapse = 0; | ||
2503 | double tim; | ||
2504 | |||
2505 | tim = ecore_time_get(); | ||
2506 | rtime += t; | ||
2507 | frames++; | ||
2508 | if (rlapse == 0.0) | ||
2509 | { | ||
2510 | rlapse = tim; | ||
2511 | flapse = frames; | ||
2512 | } | ||
2513 | else if ((tim - rlapse) >= 0.5) | ||
2514 | { | ||
2515 | printf("FRAME: %i, FPS: %3.1f, RTIME %3.0f%%\n", | ||
2516 | frames, | ||
2517 | (frames - flapse) / (tim - rlapse), | ||
2518 | (100.0 * rtime) / (tim - rlapse) | ||
2519 | ); | ||
2520 | rlapse = tim; | ||
2521 | flapse = frames; | ||
2522 | rtime = 0.0; | ||
2523 | } | ||
2524 | } | ||
2525 | |||
2526 | void | ||
2527 | _ecore_evas_register(Ecore_Evas *ee) | ||
2528 | { | ||
2529 | ee->registered = 1; | ||
2530 | ecore_evases = (Ecore_Evas *)eina_inlist_prepend | ||
2531 | (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); | ||
2532 | } | ||
2533 | |||
2534 | void | ||
2535 | _ecore_evas_ref(Ecore_Evas *ee) | ||
2536 | { | ||
2537 | ee->refcount++; | ||
2538 | } | ||
2539 | |||
2540 | void | ||
2541 | _ecore_evas_unref(Ecore_Evas *ee) | ||
2542 | { | ||
2543 | ee->refcount--; | ||
2544 | if (ee->refcount == 0) | ||
2545 | { | ||
2546 | if (ee->deleted) _ecore_evas_free(ee); | ||
2547 | } | ||
2548 | else if (ee->refcount < -1) | ||
2549 | ERR("Ecore_Evas %p->refcount=%d < 0", ee, ee->refcount); | ||
2550 | } | ||
2551 | |||
2552 | void | ||
2553 | _ecore_evas_free(Ecore_Evas *ee) | ||
2554 | { | ||
2555 | ee->deleted = EINA_TRUE; | ||
2556 | if (ee->refcount > 0) return; | ||
2557 | |||
2558 | if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee); | ||
2559 | while (ee->sub_ecore_evas) | ||
2560 | { | ||
2561 | _ecore_evas_free(ee->sub_ecore_evas->data); | ||
2562 | } | ||
2563 | if (ee->data) eina_hash_free(ee->data); | ||
2564 | ee->data = NULL; | ||
2565 | if (ee->name) free(ee->name); | ||
2566 | ee->name = NULL; | ||
2567 | if (ee->prop.title) free(ee->prop.title); | ||
2568 | ee->prop.title = NULL; | ||
2569 | if (ee->prop.name) free(ee->prop.name); | ||
2570 | ee->prop.name = NULL; | ||
2571 | if (ee->prop.clas) free(ee->prop.clas); | ||
2572 | ee->prop.clas = NULL; | ||
2573 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
2574 | ee->prop.cursor.object = NULL; | ||
2575 | if (ee->evas) evas_free(ee->evas); | ||
2576 | ee->evas = NULL; | ||
2577 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE); | ||
2578 | ee->driver = NULL; | ||
2579 | if (ee->engine.idle_flush_timer) | ||
2580 | ecore_timer_del(ee->engine.idle_flush_timer); | ||
2581 | if (ee->engine.func->fn_free) ee->engine.func->fn_free(ee); | ||
2582 | if (ee->registered) | ||
2583 | { | ||
2584 | ecore_evases = (Ecore_Evas *)eina_inlist_remove | ||
2585 | (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); | ||
2586 | } | ||
2587 | free(ee); | ||
2588 | } | ||
2589 | |||
2590 | static Eina_Bool | ||
2591 | _ecore_evas_cb_idle_flush(void *data) | ||
2592 | { | ||
2593 | Ecore_Evas *ee; | ||
2594 | |||
2595 | ee = (Ecore_Evas *)data; | ||
2596 | evas_render_idle_flush(ee->evas); | ||
2597 | ee->engine.idle_flush_timer = NULL; | ||
2598 | return ECORE_CALLBACK_CANCEL; | ||
2599 | } | ||
2600 | |||
2601 | static Eina_Bool | ||
2602 | _ecore_evas_async_events_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) | ||
2603 | { | ||
2604 | evas_async_events_process(); | ||
2605 | |||
2606 | return ECORE_CALLBACK_RENEW; | ||
2607 | } | ||
2608 | |||
2609 | void | ||
2610 | _ecore_evas_idle_timeout_update(Ecore_Evas *ee) | ||
2611 | { | ||
2612 | if (ee->engine.idle_flush_timer) | ||
2613 | ecore_timer_del(ee->engine.idle_flush_timer); | ||
2614 | ee->engine.idle_flush_timer = ecore_timer_add(IDLE_FLUSH_TIME, | ||
2615 | _ecore_evas_cb_idle_flush, | ||
2616 | ee); | ||
2617 | } | ||
2618 | |||
2619 | void | ||
2620 | _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp) | ||
2621 | { | ||
2622 | ee->mouse.x = x; | ||
2623 | ee->mouse.y = y; | ||
2624 | if (ee->prop.cursor.object) | ||
2625 | { | ||
2626 | evas_object_show(ee->prop.cursor.object); | ||
2627 | if (ee->rotation == 0) | ||
2628 | evas_object_move(ee->prop.cursor.object, | ||
2629 | x - ee->prop.cursor.hot.x, | ||
2630 | y - ee->prop.cursor.hot.y); | ||
2631 | else if (ee->rotation == 90) | ||
2632 | evas_object_move(ee->prop.cursor.object, | ||
2633 | ee->h - y - 1 - ee->prop.cursor.hot.x, | ||
2634 | x - ee->prop.cursor.hot.y); | ||
2635 | else if (ee->rotation == 180) | ||
2636 | evas_object_move(ee->prop.cursor.object, | ||
2637 | ee->w - x - 1 - ee->prop.cursor.hot.x, | ||
2638 | ee->h - y - 1 - ee->prop.cursor.hot.y); | ||
2639 | else if (ee->rotation == 270) | ||
2640 | evas_object_move(ee->prop.cursor.object, | ||
2641 | y - ee->prop.cursor.hot.x, | ||
2642 | ee->w - x - 1 - ee->prop.cursor.hot.y); | ||
2643 | } | ||
2644 | if (ee->rotation == 0) | ||
2645 | evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL); | ||
2646 | else if (ee->rotation == 90) | ||
2647 | evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL); | ||
2648 | else if (ee->rotation == 180) | ||
2649 | evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL); | ||
2650 | else if (ee->rotation == 270) | ||
2651 | evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL); | ||
2652 | } | ||
2653 | |||
2654 | void | ||
2655 | _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, | ||
2656 | int x, int y, | ||
2657 | double radius, | ||
2658 | double radius_x, double radius_y, | ||
2659 | double pressure, | ||
2660 | double angle, | ||
2661 | double mx, double my, | ||
2662 | unsigned int timestamp) | ||
2663 | { | ||
2664 | if (ee->rotation == 0) | ||
2665 | evas_event_feed_multi_move(ee->evas, device, | ||
2666 | x, y, | ||
2667 | radius, | ||
2668 | radius_x, radius_y, | ||
2669 | pressure, | ||
2670 | angle - ee->rotation, | ||
2671 | mx, my, | ||
2672 | timestamp, NULL); | ||
2673 | else if (ee->rotation == 90) | ||
2674 | evas_event_feed_multi_move(ee->evas, device, | ||
2675 | ee->h - y - 1, x, | ||
2676 | radius, | ||
2677 | radius_y, radius_x, | ||
2678 | pressure, | ||
2679 | angle - ee->rotation, | ||
2680 | ee->h - my - 1, mx, | ||
2681 | timestamp, NULL); | ||
2682 | else if (ee->rotation == 180) | ||
2683 | evas_event_feed_multi_move(ee->evas, device, | ||
2684 | ee->w - x - 1, ee->h - y - 1, | ||
2685 | radius, | ||
2686 | radius_x, radius_y, | ||
2687 | pressure, | ||
2688 | angle - ee->rotation, | ||
2689 | ee->w - mx - 1, ee->h - my - 1, | ||
2690 | timestamp, NULL); | ||
2691 | else if (ee->rotation == 270) | ||
2692 | evas_event_feed_multi_move(ee->evas, device, | ||
2693 | y, ee->w - x - 1, | ||
2694 | radius, | ||
2695 | radius_y, radius_x, | ||
2696 | pressure, | ||
2697 | angle - ee->rotation, | ||
2698 | my, ee->w - mx - 1, | ||
2699 | timestamp, NULL); | ||
2700 | } | ||
2701 | |||
2702 | void | ||
2703 | _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, | ||
2704 | int x, int y, | ||
2705 | double radius, | ||
2706 | double radius_x, double radius_y, | ||
2707 | double pressure, | ||
2708 | double angle, | ||
2709 | double mx, double my, | ||
2710 | Evas_Button_Flags flags, | ||
2711 | unsigned int timestamp) | ||
2712 | { | ||
2713 | if (ee->rotation == 0) | ||
2714 | evas_event_feed_multi_down(ee->evas, device, | ||
2715 | x, y, | ||
2716 | radius, | ||
2717 | radius_x, radius_y, | ||
2718 | pressure, | ||
2719 | angle - ee->rotation, | ||
2720 | mx, my, | ||
2721 | flags, timestamp, NULL); | ||
2722 | else if (ee->rotation == 90) | ||
2723 | evas_event_feed_multi_down(ee->evas, device, | ||
2724 | ee->h - y - 1, x, | ||
2725 | radius, | ||
2726 | radius_y, radius_x, | ||
2727 | pressure, | ||
2728 | angle - ee->rotation, | ||
2729 | ee->h - my - 1, mx, | ||
2730 | flags, timestamp, NULL); | ||
2731 | else if (ee->rotation == 180) | ||
2732 | evas_event_feed_multi_down(ee->evas, device, | ||
2733 | ee->w - x - 1, ee->h - y - 1, | ||
2734 | radius, | ||
2735 | radius_x, radius_y, | ||
2736 | pressure, | ||
2737 | angle - ee->rotation, | ||
2738 | ee->w - mx - 1, ee->h - my - 1, | ||
2739 | flags, timestamp, NULL); | ||
2740 | else if (ee->rotation == 270) | ||
2741 | evas_event_feed_multi_down(ee->evas, device, | ||
2742 | y, ee->w - x - 1, | ||
2743 | radius, | ||
2744 | radius_y, radius_x, | ||
2745 | pressure, | ||
2746 | angle - ee->rotation, | ||
2747 | my, ee->w - mx - 1, | ||
2748 | flags, timestamp, NULL); | ||
2749 | } | ||
2750 | |||
2751 | void | ||
2752 | _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, | ||
2753 | int x, int y, | ||
2754 | double radius, | ||
2755 | double radius_x, double radius_y, | ||
2756 | double pressure, | ||
2757 | double angle, | ||
2758 | double mx, double my, | ||
2759 | Evas_Button_Flags flags, | ||
2760 | unsigned int timestamp) | ||
2761 | { | ||
2762 | if (ee->rotation == 0) | ||
2763 | evas_event_feed_multi_up(ee->evas, device, | ||
2764 | x, y, | ||
2765 | radius, | ||
2766 | radius_x, radius_y, | ||
2767 | pressure, | ||
2768 | angle - ee->rotation, | ||
2769 | mx, my, | ||
2770 | flags, timestamp, NULL); | ||
2771 | else if (ee->rotation == 90) | ||
2772 | evas_event_feed_multi_up(ee->evas, device, | ||
2773 | ee->h - y - 1, x, | ||
2774 | radius, | ||
2775 | radius_y, radius_x, | ||
2776 | pressure, | ||
2777 | angle - ee->rotation, | ||
2778 | ee->h - my - 1, mx, | ||
2779 | flags, timestamp, NULL); | ||
2780 | else if (ee->rotation == 180) | ||
2781 | evas_event_feed_multi_up(ee->evas, device, | ||
2782 | ee->w - x - 1, ee->h - y - 1, | ||
2783 | radius, | ||
2784 | radius_x, radius_y, | ||
2785 | pressure, | ||
2786 | angle - ee->rotation, | ||
2787 | ee->w - mx - 1, ee->h - my - 1, | ||
2788 | flags, timestamp, NULL); | ||
2789 | else if (ee->rotation == 270) | ||
2790 | evas_event_feed_multi_up(ee->evas, device, | ||
2791 | y, ee->w - x - 1, | ||
2792 | radius, | ||
2793 | radius_y, radius_x, | ||
2794 | pressure, | ||
2795 | angle - ee->rotation, | ||
2796 | my, ee->w - mx - 1, | ||
2797 | flags, timestamp, NULL); | ||
2798 | } | ||
2799 | |||
2800 | EAPI Eina_List * | ||
2801 | ecore_evas_ecore_evas_list_get(void) | ||
2802 | { | ||
2803 | Ecore_Evas *ee; | ||
2804 | Eina_List *l = NULL; | ||
2805 | |||
2806 | EINA_INLIST_FOREACH(ecore_evases, ee) | ||
2807 | { | ||
2808 | l = eina_list_append(l, ee); | ||
2809 | } | ||
2810 | |||
2811 | return l; | ||
2812 | } | ||
2813 | |||
2814 | EAPI void | ||
2815 | ecore_evas_input_event_register(Ecore_Evas *ee) | ||
2816 | { | ||
2817 | ecore_event_window_register((Ecore_Window)ee, ee, ee->evas, | ||
2818 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2819 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2820 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2821 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2822 | } | ||
2823 | |||
2824 | EAPI void | ||
2825 | ecore_evas_input_event_unregister(Ecore_Evas *ee) | ||
2826 | { | ||
2827 | ecore_event_window_unregister((Ecore_Window)ee); | ||
2828 | } | ||
2829 | |||
2830 | #if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL) | ||
2831 | EAPI void | ||
2832 | ecore_evas_wayland_resize(Ecore_Evas *ee, int location) | ||
2833 | { | ||
2834 | if (!ee) return; | ||
2835 | if (!strcmp(ee->driver, "wayland_shm")) | ||
2836 | { | ||
2837 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
2838 | _ecore_evas_wayland_shm_resize(ee, location); | ||
2839 | #endif | ||
2840 | } | ||
2841 | else if (!strcmp(ee->driver, "wayland_egl")) | ||
2842 | { | ||
2843 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
2844 | _ecore_evas_wayland_egl_resize(ee, location); | ||
2845 | #endif | ||
2846 | } | ||
2847 | } | ||
2848 | |||
2849 | #else | ||
2850 | EAPI void | ||
2851 | ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__) | ||
2852 | { | ||
2853 | |||
2854 | } | ||
2855 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c deleted file mode 100644 index 4c81db7..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c +++ /dev/null | |||
@@ -1,824 +0,0 @@ | |||
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 | #include <stdlib.h> | ||
7 | |||
8 | #include <Ecore.h> | ||
9 | #include "ecore_private.h" | ||
10 | #include <Ecore_Input.h> | ||
11 | |||
12 | #include "ecore_evas_private.h" | ||
13 | #include "Ecore_Evas.h" | ||
14 | |||
15 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
16 | static int _ecore_evas_init_count = 0; | ||
17 | |||
18 | static int | ||
19 | _ecore_evas_buffer_init(void) | ||
20 | { | ||
21 | _ecore_evas_init_count++; | ||
22 | return _ecore_evas_init_count; | ||
23 | } | ||
24 | |||
25 | static void | ||
26 | _ecore_evas_buffer_free(Ecore_Evas *ee) | ||
27 | { | ||
28 | if (ee->engine.buffer.image) | ||
29 | { | ||
30 | Ecore_Evas *ee2; | ||
31 | |||
32 | ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent"); | ||
33 | evas_object_del(ee->engine.buffer.image); | ||
34 | ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee); | ||
35 | } | ||
36 | else | ||
37 | { | ||
38 | ee->engine.buffer.free_func(ee->engine.buffer.data, | ||
39 | ee->engine.buffer.pixels); | ||
40 | } | ||
41 | _ecore_evas_buffer_shutdown(); | ||
42 | } | ||
43 | |||
44 | static void | ||
45 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
46 | { | ||
47 | Evas_Engine_Info_Buffer *einfo; | ||
48 | int stride = 0; | ||
49 | |||
50 | if (w < 1) w = 1; | ||
51 | if (h < 1) h = 1; | ||
52 | ee->req.w = w; | ||
53 | ee->req.h = h; | ||
54 | if ((w == ee->w) && (h == ee->h)) return; | ||
55 | ee->w = w; | ||
56 | ee->h = h; | ||
57 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
58 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
59 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
60 | |||
61 | if (ee->engine.buffer.image) | ||
62 | { | ||
63 | ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1); | ||
64 | stride = evas_object_image_stride_get(ee->engine.buffer.image); | ||
65 | } | ||
66 | else | ||
67 | { | ||
68 | if (ee->engine.buffer.pixels) | ||
69 | ee->engine.buffer.free_func(ee->engine.buffer.data, | ||
70 | ee->engine.buffer.pixels); | ||
71 | ee->engine.buffer.pixels = | ||
72 | ee->engine.buffer.alloc_func(ee->engine.buffer.data, | ||
73 | ee->w * ee->h * sizeof(int)); | ||
74 | stride = ee->w * sizeof(int); | ||
75 | } | ||
76 | |||
77 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
78 | if (einfo) | ||
79 | { | ||
80 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
81 | einfo->info.dest_buffer = ee->engine.buffer.pixels; | ||
82 | einfo->info.dest_buffer_row_bytes = stride; | ||
83 | einfo->info.use_color_key = 0; | ||
84 | einfo->info.alpha_threshold = 0; | ||
85 | einfo->info.func.new_update_region = NULL; | ||
86 | einfo->info.func.free_update_region = NULL; | ||
87 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
88 | { | ||
89 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
90 | } | ||
91 | } | ||
92 | if (ee->engine.buffer.image) | ||
93 | evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels); | ||
94 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
95 | } | ||
96 | |||
97 | static void | ||
98 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
99 | { | ||
100 | _ecore_evas_resize(ee, w, h); | ||
101 | } | ||
102 | |||
103 | int | ||
104 | _ecore_evas_buffer_shutdown(void) | ||
105 | { | ||
106 | _ecore_evas_init_count--; | ||
107 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
108 | return _ecore_evas_init_count; | ||
109 | } | ||
110 | |||
111 | static void | ||
112 | _ecore_evas_show(Ecore_Evas *ee) | ||
113 | { | ||
114 | if (ee->engine.buffer.image) return; | ||
115 | if (ee->prop.focused) return; | ||
116 | ee->prop.focused = 1; | ||
117 | evas_focus_in(ee->evas); | ||
118 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
119 | } | ||
120 | |||
121 | int | ||
122 | _ecore_evas_buffer_render(Ecore_Evas *ee) | ||
123 | { | ||
124 | Eina_List *updates = NULL, *l, *ll; | ||
125 | Ecore_Evas *ee2; | ||
126 | int rend = 0; | ||
127 | |||
128 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
129 | { | ||
130 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
131 | if (ee2->engine.func->fn_render) | ||
132 | rend |= ee2->engine.func->fn_render(ee2); | ||
133 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
134 | } | ||
135 | if (ee->engine.buffer.image) | ||
136 | { | ||
137 | int w, h; | ||
138 | |||
139 | evas_object_image_size_get(ee->engine.buffer.image, &w, &h); | ||
140 | if ((w != ee->w) || (h != ee->h)) | ||
141 | _ecore_evas_resize(ee, w, h); | ||
142 | ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1); | ||
143 | } | ||
144 | if (ee->engine.buffer.pixels) | ||
145 | { | ||
146 | updates = evas_render_updates(ee->evas); | ||
147 | } | ||
148 | if (ee->engine.buffer.image) | ||
149 | { | ||
150 | Eina_Rectangle *r; | ||
151 | |||
152 | evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels); | ||
153 | EINA_LIST_FOREACH(updates, l, r) | ||
154 | evas_object_image_data_update_add(ee->engine.buffer.image, | ||
155 | r->x, r->y, r->w, r->h); | ||
156 | } | ||
157 | if (updates) | ||
158 | { | ||
159 | evas_render_updates_free(updates); | ||
160 | _ecore_evas_idle_timeout_update(ee); | ||
161 | } | ||
162 | |||
163 | return updates ? 1 : rend; | ||
164 | } | ||
165 | |||
166 | // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! | ||
167 | static void | ||
168 | _ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) | ||
169 | { | ||
170 | Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; | ||
171 | |||
172 | evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh); | ||
173 | evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh); | ||
174 | |||
175 | if (fw < 1) fw = 1; | ||
176 | if (fh < 1) fh = 1; | ||
177 | |||
178 | if (evas_object_map_get(ee->engine.buffer.image) && | ||
179 | evas_object_map_enable_get(ee->engine.buffer.image)) | ||
180 | { | ||
181 | fx = 0; fy = 0; | ||
182 | fw = ee->w; fh = ee->h; | ||
183 | ww = ee->w; hh = ee->h; | ||
184 | } | ||
185 | |||
186 | if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) | ||
187 | { | ||
188 | *x = (ee->w * (*x - xx)) / fw; | ||
189 | *y = (ee->h * (*y - yy)) / fh; | ||
190 | } | ||
191 | else | ||
192 | { | ||
193 | xx = (*x - xx) - fx; | ||
194 | while (xx < 0) xx += fw; | ||
195 | while (xx > fw) xx -= fw; | ||
196 | *x = (ee->w * xx) / fw; | ||
197 | |||
198 | yy = (*y - yy) - fy; | ||
199 | while (yy < 0) yy += fh; | ||
200 | while (yy > fh) yy -= fh; | ||
201 | *y = (ee->h * yy) / fh; | ||
202 | } | ||
203 | } | ||
204 | |||
205 | static void | ||
206 | _ecore_evas_buffer_transfer_modifiers_locks(Evas *e, Evas *e2) | ||
207 | { | ||
208 | const char *mods[] = | ||
209 | { "Shift", "Control", "Alt", "Meta", "Hyper", "Super", NULL }; | ||
210 | const char *locks[] = | ||
211 | { "Scroll_Lock", "Num_Lock", "Caps_Lock", NULL }; | ||
212 | int i; | ||
213 | |||
214 | for (i = 0; mods[i]; i++) | ||
215 | { | ||
216 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), mods[i])) | ||
217 | evas_key_modifier_on(e2, mods[i]); | ||
218 | else | ||
219 | evas_key_modifier_off(e2, mods[i]); | ||
220 | } | ||
221 | for (i = 0; locks[i]; i++) | ||
222 | { | ||
223 | if (evas_key_lock_is_set(evas_key_lock_get(e), locks[i])) | ||
224 | evas_key_lock_on(e2, locks[i]); | ||
225 | else | ||
226 | evas_key_lock_off(e2, locks[i]); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | static void | ||
231 | _ecore_evas_buffer_cb_mouse_in(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
232 | { | ||
233 | Ecore_Evas *ee; | ||
234 | Evas_Event_Mouse_In *ev; | ||
235 | |||
236 | ee = data; | ||
237 | ev = event_info; | ||
238 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
239 | evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); | ||
240 | } | ||
241 | |||
242 | static void | ||
243 | _ecore_evas_buffer_cb_mouse_out(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
244 | { | ||
245 | Ecore_Evas *ee; | ||
246 | Evas_Event_Mouse_Out *ev; | ||
247 | |||
248 | ee = data; | ||
249 | ev = event_info; | ||
250 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
251 | evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); | ||
252 | } | ||
253 | |||
254 | static void | ||
255 | _ecore_evas_buffer_cb_mouse_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
256 | { | ||
257 | Ecore_Evas *ee; | ||
258 | Evas_Event_Mouse_Down *ev; | ||
259 | |||
260 | ee = data; | ||
261 | ev = event_info; | ||
262 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
263 | evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | ||
264 | } | ||
265 | |||
266 | static void | ||
267 | _ecore_evas_buffer_cb_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
268 | { | ||
269 | Ecore_Evas *ee; | ||
270 | Evas_Event_Mouse_Up *ev; | ||
271 | |||
272 | ee = data; | ||
273 | ev = event_info; | ||
274 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
275 | evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | ||
276 | } | ||
277 | |||
278 | static void | ||
279 | _ecore_evas_buffer_cb_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
280 | { | ||
281 | Ecore_Evas *ee; | ||
282 | Evas_Event_Mouse_Move *ev; | ||
283 | Evas_Coord x, y; | ||
284 | |||
285 | ee = data; | ||
286 | ev = event_info; | ||
287 | x = ev->cur.canvas.x; | ||
288 | y = ev->cur.canvas.y; | ||
289 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | ||
290 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
291 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); | ||
292 | } | ||
293 | |||
294 | static void | ||
295 | _ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
296 | { | ||
297 | Ecore_Evas *ee; | ||
298 | Evas_Event_Mouse_Wheel *ev; | ||
299 | |||
300 | ee = data; | ||
301 | ev = event_info; | ||
302 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
303 | evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL); | ||
304 | } | ||
305 | |||
306 | static void | ||
307 | _ecore_evas_buffer_cb_multi_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
308 | { | ||
309 | Ecore_Evas *ee; | ||
310 | Evas_Event_Multi_Down *ev; | ||
311 | Evas_Coord x, y, xx, yy; | ||
312 | double xf, yf; | ||
313 | |||
314 | ee = data; | ||
315 | ev = event_info; | ||
316 | x = ev->canvas.x; | ||
317 | y = ev->canvas.y; | ||
318 | xx = x; | ||
319 | yy = y; | ||
320 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | ||
321 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | ||
322 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | ||
323 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
324 | 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); | ||
325 | } | ||
326 | |||
327 | static void | ||
328 | _ecore_evas_buffer_cb_multi_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
329 | { | ||
330 | Ecore_Evas *ee; | ||
331 | Evas_Event_Multi_Up *ev; | ||
332 | Evas_Coord x, y, xx, yy; | ||
333 | double xf, yf; | ||
334 | |||
335 | ee = data; | ||
336 | ev = event_info; | ||
337 | x = ev->canvas.x; | ||
338 | y = ev->canvas.y; | ||
339 | xx = x; | ||
340 | yy = y; | ||
341 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | ||
342 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | ||
343 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | ||
344 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
345 | 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); | ||
346 | } | ||
347 | |||
348 | static void | ||
349 | _ecore_evas_buffer_cb_multi_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
350 | { | ||
351 | Ecore_Evas *ee; | ||
352 | Evas_Event_Multi_Move *ev; | ||
353 | Evas_Coord x, y, xx, yy; | ||
354 | double xf, yf; | ||
355 | |||
356 | ee = data; | ||
357 | ev = event_info; | ||
358 | x = ev->cur.canvas.x; | ||
359 | y = ev->cur.canvas.y; | ||
360 | xx = x; | ||
361 | yy = y; | ||
362 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | ||
363 | xf = (ev->cur.canvas.xsub - (double)xx) + (double)x; | ||
364 | yf = (ev->cur.canvas.ysub - (double)yy) + (double)y; | ||
365 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
366 | 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); | ||
367 | } | ||
368 | |||
369 | static void | ||
370 | _ecore_evas_buffer_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
371 | { | ||
372 | Ecore_Evas *ee; | ||
373 | |||
374 | ee = data; | ||
375 | if (ee->driver) _ecore_evas_free(ee); | ||
376 | } | ||
377 | |||
378 | static void | ||
379 | _ecore_evas_buffer_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
380 | { | ||
381 | Ecore_Evas *ee; | ||
382 | Evas_Event_Key_Down *ev; | ||
383 | |||
384 | ee = data; | ||
385 | ev = event_info; | ||
386 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
387 | evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | ||
388 | } | ||
389 | |||
390 | static void | ||
391 | _ecore_evas_buffer_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
392 | { | ||
393 | Ecore_Evas *ee; | ||
394 | Evas_Event_Key_Up *ev; | ||
395 | |||
396 | ee = data; | ||
397 | ev = event_info; | ||
398 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
399 | evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | ||
400 | } | ||
401 | |||
402 | static void | ||
403 | _ecore_evas_buffer_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
404 | { | ||
405 | Ecore_Evas *ee; | ||
406 | |||
407 | ee = data; | ||
408 | ee->prop.focused = 1; | ||
409 | evas_focus_in(ee->evas); | ||
410 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
411 | } | ||
412 | |||
413 | static void | ||
414 | _ecore_evas_buffer_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
415 | { | ||
416 | Ecore_Evas *ee; | ||
417 | |||
418 | ee = data; | ||
419 | ee->prop.focused = 0; | ||
420 | evas_focus_out(ee->evas); | ||
421 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
422 | } | ||
423 | |||
424 | static void | ||
425 | _ecore_evas_buffer_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
426 | { | ||
427 | Ecore_Evas *ee; | ||
428 | |||
429 | ee = data; | ||
430 | ee->visible = 1; | ||
431 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
432 | } | ||
433 | |||
434 | static void | ||
435 | _ecore_evas_buffer_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
436 | { | ||
437 | Ecore_Evas *ee; | ||
438 | |||
439 | ee = data; | ||
440 | ee->visible = 0; | ||
441 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
442 | } | ||
443 | |||
444 | static void | ||
445 | _ecore_evas_buffer_alpha_set(Ecore_Evas *ee, int alpha) | ||
446 | { | ||
447 | if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return; | ||
448 | ee->alpha = alpha; | ||
449 | if (ee->engine.buffer.image) | ||
450 | evas_object_image_alpha_set(ee->engine.buffer.image, ee->alpha); | ||
451 | else | ||
452 | { | ||
453 | Evas_Engine_Info_Buffer *einfo; | ||
454 | |||
455 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
456 | if (einfo) | ||
457 | { | ||
458 | if (ee->alpha) | ||
459 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
460 | else | ||
461 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
462 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
463 | } | ||
464 | } | ||
465 | } | ||
466 | |||
467 | static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = | ||
468 | { | ||
469 | _ecore_evas_buffer_free, | ||
470 | NULL, | ||
471 | NULL, | ||
472 | NULL, | ||
473 | NULL, | ||
474 | NULL, | ||
475 | NULL, | ||
476 | NULL, | ||
477 | NULL, | ||
478 | NULL, | ||
479 | NULL, | ||
480 | NULL, | ||
481 | NULL, | ||
482 | NULL, | ||
483 | NULL, | ||
484 | NULL, | ||
485 | NULL, | ||
486 | _ecore_evas_resize, | ||
487 | _ecore_evas_move_resize, | ||
488 | NULL, | ||
489 | NULL, | ||
490 | _ecore_evas_show, | ||
491 | NULL, | ||
492 | NULL, | ||
493 | NULL, | ||
494 | NULL, | ||
495 | NULL, | ||
496 | NULL, | ||
497 | NULL, | ||
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 | _ecore_evas_buffer_alpha_set, | ||
514 | NULL, //transparent | ||
515 | |||
516 | NULL, | ||
517 | NULL, | ||
518 | NULL, | ||
519 | NULL, | ||
520 | NULL, | ||
521 | NULL, | ||
522 | |||
523 | _ecore_evas_buffer_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_RGB32; | ||
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 | _ecore_evas_register(ee); | ||
640 | |||
641 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
642 | |||
643 | return ee; | ||
644 | #else | ||
645 | return NULL; | ||
646 | #endif | ||
647 | } | ||
648 | |||
649 | EAPI const void * | ||
650 | ecore_evas_buffer_pixels_get(Ecore_Evas *ee) | ||
651 | { | ||
652 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
653 | _ecore_evas_buffer_render(ee); | ||
654 | return ee->engine.buffer.pixels; | ||
655 | #else | ||
656 | return NULL; | ||
657 | #endif | ||
658 | } | ||
659 | |||
660 | EAPI Evas * | ||
661 | ecore_evas_object_evas_get(Evas_Object *obj) | ||
662 | { | ||
663 | Ecore_Evas *ee; | ||
664 | |||
665 | ee = evas_object_data_get(obj, "Ecore_Evas"); | ||
666 | if (!ee) return NULL; | ||
667 | |||
668 | return ecore_evas_get(ee); | ||
669 | } | ||
670 | |||
671 | EAPI Ecore_Evas * | ||
672 | ecore_evas_object_ecore_evas_get(Evas_Object *obj) | ||
673 | { | ||
674 | return evas_object_data_get(obj, "Ecore_Evas"); | ||
675 | } | ||
676 | |||
677 | EAPI Evas_Object * | ||
678 | ecore_evas_object_image_new(Ecore_Evas *ee_target) | ||
679 | { | ||
680 | // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! | ||
681 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
682 | Evas_Object *o; | ||
683 | Evas_Engine_Info_Buffer *einfo; | ||
684 | Ecore_Evas *ee; | ||
685 | int rmethod; | ||
686 | int w = 1, h = 1; | ||
687 | |||
688 | rmethod = evas_render_method_lookup("buffer"); | ||
689 | if (!rmethod) return NULL; | ||
690 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
691 | if (!ee) return NULL; | ||
692 | |||
693 | o = evas_object_image_add(ee_target->evas); | ||
694 | evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); | ||
695 | evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); | ||
696 | evas_object_image_alpha_set(o, 0); | ||
697 | evas_object_image_size_set(o, w, h); | ||
698 | |||
699 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
700 | |||
701 | _ecore_evas_buffer_init(); | ||
702 | |||
703 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func; | ||
704 | |||
705 | ee->driver = "buffer"; | ||
706 | |||
707 | ee->rotation = 0; | ||
708 | ee->visible = 0; | ||
709 | ee->w = w; | ||
710 | ee->h = h; | ||
711 | ee->req.w = ee->w; | ||
712 | ee->req.h = ee->h; | ||
713 | |||
714 | ee->prop.max.w = 0; | ||
715 | ee->prop.max.h = 0; | ||
716 | ee->prop.layer = 0; | ||
717 | ee->prop.focused = 0; | ||
718 | ee->prop.borderless = 1; | ||
719 | ee->prop.override = 1; | ||
720 | ee->prop.maximized = 0; | ||
721 | ee->prop.fullscreen = 0; | ||
722 | ee->prop.withdrawn = 0; | ||
723 | ee->prop.sticky = 0; | ||
724 | |||
725 | /* init evas here */ | ||
726 | ee->evas = evas_new(); | ||
727 | evas_data_attach_set(ee->evas, ee); | ||
728 | evas_output_method_set(ee->evas, rmethod); | ||
729 | evas_output_size_set(ee->evas, w, h); | ||
730 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
731 | |||
732 | ee->engine.buffer.image = o; | ||
733 | evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee); | ||
734 | evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target); | ||
735 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
736 | EVAS_CALLBACK_MOUSE_IN, | ||
737 | _ecore_evas_buffer_cb_mouse_in, ee); | ||
738 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
739 | EVAS_CALLBACK_MOUSE_OUT, | ||
740 | _ecore_evas_buffer_cb_mouse_out, ee); | ||
741 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
742 | EVAS_CALLBACK_MOUSE_DOWN, | ||
743 | _ecore_evas_buffer_cb_mouse_down, ee); | ||
744 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
745 | EVAS_CALLBACK_MOUSE_UP, | ||
746 | _ecore_evas_buffer_cb_mouse_up, ee); | ||
747 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
748 | EVAS_CALLBACK_MOUSE_MOVE, | ||
749 | _ecore_evas_buffer_cb_mouse_move, ee); | ||
750 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
751 | EVAS_CALLBACK_MOUSE_WHEEL, | ||
752 | _ecore_evas_buffer_cb_mouse_wheel, ee); | ||
753 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
754 | EVAS_CALLBACK_MULTI_DOWN, | ||
755 | _ecore_evas_buffer_cb_multi_down, ee); | ||
756 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
757 | EVAS_CALLBACK_MULTI_UP, | ||
758 | _ecore_evas_buffer_cb_multi_up, ee); | ||
759 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
760 | EVAS_CALLBACK_MULTI_MOVE, | ||
761 | _ecore_evas_buffer_cb_multi_move, ee); | ||
762 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
763 | EVAS_CALLBACK_FREE, | ||
764 | _ecore_evas_buffer_cb_free, ee); | ||
765 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
766 | EVAS_CALLBACK_KEY_DOWN, | ||
767 | _ecore_evas_buffer_cb_key_down, ee); | ||
768 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
769 | EVAS_CALLBACK_KEY_UP, | ||
770 | _ecore_evas_buffer_cb_key_up, ee); | ||
771 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
772 | EVAS_CALLBACK_FOCUS_IN, | ||
773 | _ecore_evas_buffer_cb_focus_in, ee); | ||
774 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
775 | EVAS_CALLBACK_FOCUS_OUT, | ||
776 | _ecore_evas_buffer_cb_focus_out, ee); | ||
777 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
778 | EVAS_CALLBACK_SHOW, | ||
779 | _ecore_evas_buffer_cb_show, ee); | ||
780 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
781 | EVAS_CALLBACK_HIDE, | ||
782 | _ecore_evas_buffer_cb_hide, ee); | ||
783 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
784 | if (einfo) | ||
785 | { | ||
786 | ee->engine.buffer.pixels = evas_object_image_data_get(o, 1); | ||
787 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
788 | einfo->info.dest_buffer = ee->engine.buffer.pixels; | ||
789 | einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o); | ||
790 | einfo->info.use_color_key = 0; | ||
791 | einfo->info.alpha_threshold = 0; | ||
792 | einfo->info.func.new_update_region = NULL; | ||
793 | einfo->info.func.free_update_region = NULL; | ||
794 | evas_object_image_data_set(o, ee->engine.buffer.pixels); | ||
795 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
796 | { | ||
797 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
798 | ecore_evas_free(ee); | ||
799 | return NULL; | ||
800 | } | ||
801 | } | ||
802 | else | ||
803 | { | ||
804 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
805 | ecore_evas_free(ee); | ||
806 | return NULL; | ||
807 | } | ||
808 | evas_key_modifier_add(ee->evas, "Shift"); | ||
809 | evas_key_modifier_add(ee->evas, "Control"); | ||
810 | evas_key_modifier_add(ee->evas, "Alt"); | ||
811 | evas_key_modifier_add(ee->evas, "Meta"); | ||
812 | evas_key_modifier_add(ee->evas, "Hyper"); | ||
813 | evas_key_modifier_add(ee->evas, "Super"); | ||
814 | evas_key_lock_add(ee->evas, "Caps_Lock"); | ||
815 | evas_key_lock_add(ee->evas, "Num_Lock"); | ||
816 | evas_key_lock_add(ee->evas, "Scroll_Lock"); | ||
817 | |||
818 | ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee); | ||
819 | |||
820 | return o; | ||
821 | #else | ||
822 | return NULL; | ||
823 | #endif | ||
824 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c deleted file mode 100644 index 0947b11..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c +++ /dev/null | |||
@@ -1,582 +0,0 @@ | |||
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 | |||
467 | NULL, | ||
468 | NULL, | ||
469 | NULL, | ||
470 | NULL, | ||
471 | NULL, | ||
472 | NULL, | ||
473 | |||
474 | NULL, // render | ||
475 | NULL | ||
476 | }; | ||
477 | #endif | ||
478 | |||
479 | EAPI Ecore_Evas * | ||
480 | ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h) | ||
481 | { | ||
482 | #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA | ||
483 | Evas_Engine_Info_GL_Cocoa *einfo; | ||
484 | Ecore_Evas *ee; | ||
485 | int rmethod; | ||
486 | |||
487 | DBG("Cocoa new"); | ||
488 | |||
489 | if (!ecore_cocoa_init()) | ||
490 | return NULL; | ||
491 | |||
492 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
493 | if (!ee) | ||
494 | goto shutdown_ecore_cocoa; | ||
495 | |||
496 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
497 | |||
498 | _ecore_evas_cocoa_init(); | ||
499 | |||
500 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func; | ||
501 | |||
502 | if (w < 1) w = 1; | ||
503 | if (h < 1) h = 1; | ||
504 | ee->visible = 1; | ||
505 | ee->x = x; | ||
506 | ee->y = y; | ||
507 | ee->w = w; | ||
508 | ee->h = h; | ||
509 | ee->req.x = ee->x; | ||
510 | ee->req.y = ee->y; | ||
511 | ee->req.w = ee->w; | ||
512 | ee->req.h = ee->h; | ||
513 | |||
514 | ee->semi_sync = 1; | ||
515 | |||
516 | |||
517 | ee->prop.max.w = 32767; | ||
518 | ee->prop.max.h = 32767; | ||
519 | ee->prop.layer = 4; | ||
520 | ee->prop.request_pos = 0; | ||
521 | ee->prop.sticky = 0; | ||
522 | ee->prop.window = 0; | ||
523 | |||
524 | printf("Create New Evas\n"); | ||
525 | |||
526 | ee->evas = evas_new(); | ||
527 | |||
528 | if (!ee->evas) | ||
529 | goto free_name; | ||
530 | |||
531 | evas_data_attach_set(ee->evas, ee); | ||
532 | evas_output_method_set(ee->evas, rmethod); | ||
533 | evas_output_size_set(ee->evas, w, h); | ||
534 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
535 | |||
536 | printf("Create New Cocoa Window\n"); | ||
537 | ee->prop.window = (Ecore_Cocoa_Window*)ecore_cocoa_window_new(x, y, w, h); | ||
538 | printf("Window Created %p\n", ee->prop.window); | ||
539 | if (!ee->prop.window) | ||
540 | { | ||
541 | _ecore_evas_cocoa_shutdown(); | ||
542 | free(ee); | ||
543 | return NULL; | ||
544 | } | ||
545 | |||
546 | printf("Init Evas engine cocoa\n"); | ||
547 | if (!_ecore_evas_engine_cocoa_init(ee)) | ||
548 | { | ||
549 | _ecore_evas_cocoa_shutdown(); | ||
550 | free(ee); | ||
551 | return NULL; | ||
552 | } | ||
553 | |||
554 | |||
555 | ee->engine.func->fn_render = _ecore_evas_cocoa_render; | ||
556 | _ecore_evas_register(ee); | ||
557 | ecore_event_window_register(0, ee, ee->evas, NULL, NULL, NULL, NULL); | ||
558 | |||
559 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
560 | printf("Ecore Evas returned : %p\n", ee); | ||
561 | return ee; | ||
562 | |||
563 | free_window: | ||
564 | /* FIXME: free window here */ | ||
565 | free_evas: | ||
566 | free(ee->evas); | ||
567 | free_name: | ||
568 | free(ee->name); | ||
569 | free_ee: | ||
570 | _ecore_evas_cocoa_shutdown(); | ||
571 | free(ee); | ||
572 | shutdown_ecore_cocoa: | ||
573 | ecore_cocoa_shutdown(); | ||
574 | |||
575 | return NULL; | ||
576 | #else | ||
577 | ERR("Cocoa support in ecore-evas not enabled"); | ||
578 | return NULL; | ||
579 | (void) parent; | ||
580 | (void) x; (void) y; (void) w; (void) h; | ||
581 | #endif | ||
582 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c deleted file mode 100644 index ed24355..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c +++ /dev/null | |||
@@ -1,603 +0,0 @@ | |||
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, | ||
494 | NULL, | ||
495 | NULL, | ||
496 | NULL, | ||
497 | NULL, | ||
498 | NULL, | ||
499 | |||
500 | NULL, // render | ||
501 | NULL // screen_geometry_get | ||
502 | }; | ||
503 | #endif | ||
504 | |||
505 | /* api */ | ||
506 | /*******/ | ||
507 | |||
508 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
509 | EAPI Ecore_Evas * | ||
510 | ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) | ||
511 | { | ||
512 | Evas_Engine_Info_DirectFB *einfo; | ||
513 | Ecore_Evas *ee; | ||
514 | Ecore_DirectFB_Window *window; | ||
515 | int rmethod; | ||
516 | |||
517 | rmethod = evas_render_method_lookup("directfb"); | ||
518 | if (!rmethod) return NULL; | ||
519 | if (!ecore_directfb_init(disp_name)) return NULL; | ||
520 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
521 | if (!ee) return NULL; | ||
522 | |||
523 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
524 | _ecore_evas_directfb_init(); | ||
525 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_directfb_engine_func; | ||
526 | |||
527 | ee->driver = "directfb"; | ||
528 | if (disp_name) ee->name = strdup(disp_name); | ||
529 | |||
530 | if (w < 1) w = 1; | ||
531 | if (h < 1) h = 1; | ||
532 | |||
533 | ee->rotation = 0; | ||
534 | ee->visible = 1; | ||
535 | ee->x = x; | ||
536 | ee->y = y; | ||
537 | ee->w = w; | ||
538 | ee->h = h; | ||
539 | ee->req.x = ee->x; | ||
540 | ee->req.y = ee->y; | ||
541 | ee->req.w = ee->w; | ||
542 | ee->req.h = ee->h; | ||
543 | ee->prop.layer = 1; | ||
544 | ee->prop.fullscreen = 0; | ||
545 | |||
546 | /* init evas here */ | ||
547 | ee->evas = evas_new(); | ||
548 | evas_data_attach_set(ee->evas, ee); | ||
549 | evas_output_method_set(ee->evas, rmethod); | ||
550 | evas_output_size_set(ee->evas, w, h); | ||
551 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
552 | einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas); | ||
553 | |||
554 | window = ecore_directfb_window_new(x,y,w,h); | ||
555 | ee->engine.directfb.window = window; | ||
556 | if (einfo) | ||
557 | { | ||
558 | einfo->info.dfb = ecore_directfb_interface_get(); | ||
559 | einfo->info.surface = window->surface; | ||
560 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
561 | { | ||
562 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
563 | ecore_evas_free(ee); | ||
564 | return NULL; | ||
565 | } | ||
566 | } | ||
567 | else | ||
568 | { | ||
569 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
570 | ecore_evas_free(ee); | ||
571 | return NULL; | ||
572 | } | ||
573 | |||
574 | ee->engine.func->fn_render = _ecore_evas_directfb_render; | ||
575 | _ecore_evas_register(ee); | ||
576 | |||
577 | if (!ecore_evases_hash) | ||
578 | ecore_evases_hash = eina_hash_string_superfast_new(NULL); | ||
579 | eina_hash_add(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); | ||
580 | |||
581 | return ee; | ||
582 | } | ||
583 | #else | ||
584 | EAPI Ecore_Evas * | ||
585 | ecore_evas_directfb_new(const char *disp_name __UNUSED__, int windowed __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
586 | { | ||
587 | return NULL; | ||
588 | } | ||
589 | #endif | ||
590 | |||
591 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
592 | EAPI Ecore_DirectFB_Window * | ||
593 | ecore_evas_directfb_window_get(const Ecore_Evas *ee) | ||
594 | { | ||
595 | return (Ecore_DirectFB_Window *) _ecore_evas_directfb_window_get(ee); | ||
596 | } | ||
597 | #else | ||
598 | EAPI Ecore_DirectFB_Window * | ||
599 | ecore_evas_directfb_window_get(const Ecore_Evas *ee __UNUSED__) | ||
600 | { | ||
601 | return NULL; | ||
602 | } | ||
603 | #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 deleted file mode 100644 index ec02472..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c +++ /dev/null | |||
@@ -1,1467 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | #include <sys/types.h> | ||
8 | |||
9 | #include <Eina.h> | ||
10 | #include <Ecore.h> | ||
11 | #include "ecore_private.h" | ||
12 | #include <Ecore_Input.h> | ||
13 | |||
14 | #include "ecore_evas_private.h" | ||
15 | #include "Ecore_Evas.h" | ||
16 | |||
17 | EAPI int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = 0; | ||
18 | EAPI int ECORE_EVAS_EWS_EVENT_ADD = 0; | ||
19 | EAPI int ECORE_EVAS_EWS_EVENT_DEL = 0; | ||
20 | EAPI int ECORE_EVAS_EWS_EVENT_RESIZE = 0; | ||
21 | EAPI int ECORE_EVAS_EWS_EVENT_MOVE = 0; | ||
22 | EAPI int ECORE_EVAS_EWS_EVENT_SHOW = 0; | ||
23 | EAPI int ECORE_EVAS_EWS_EVENT_HIDE = 0; | ||
24 | EAPI int ECORE_EVAS_EWS_EVENT_FOCUS = 0; | ||
25 | EAPI int ECORE_EVAS_EWS_EVENT_UNFOCUS = 0; | ||
26 | EAPI int ECORE_EVAS_EWS_EVENT_RAISE = 0; | ||
27 | EAPI int ECORE_EVAS_EWS_EVENT_LOWER = 0; | ||
28 | EAPI int ECORE_EVAS_EWS_EVENT_ACTIVATE = 0; | ||
29 | |||
30 | EAPI int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = 0; | ||
31 | EAPI int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = 0; | ||
32 | EAPI int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = 0; | ||
33 | EAPI int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = 0; | ||
34 | EAPI int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = 0; | ||
35 | |||
36 | #ifdef BUILD_ECORE_EVAS_EWS | ||
37 | static int _ecore_evas_init_count = 0; | ||
38 | |||
39 | static Ecore_Evas *_ews_ee = NULL; | ||
40 | static Evas_Object *_ews_bg = NULL; | ||
41 | static Eina_List *_ews_children = NULL; | ||
42 | static const void *_ews_manager = NULL; | ||
43 | static char *_ews_engine = NULL; | ||
44 | static char *_ews_options = NULL; | ||
45 | static int _ews_x = 0; | ||
46 | static int _ews_y = 0; | ||
47 | static int _ews_w = 1024; | ||
48 | static int _ews_h = 768; | ||
49 | static Eina_Bool _ews_defaults_engine = EINA_TRUE; | ||
50 | static Eina_Bool _ews_defaults_geo = EINA_TRUE; | ||
51 | |||
52 | static const char EWS_ENGINE_NAME[] = "ews"; | ||
53 | |||
54 | static void | ||
55 | _ecore_evas_ews_pre_free(Ecore_Evas *ee __UNUSED__) | ||
56 | { | ||
57 | DBG("EWS backing store free'd"); | ||
58 | _ews_children = eina_list_free(_ews_children); | ||
59 | _ews_ee = NULL; | ||
60 | _ews_bg = NULL; | ||
61 | } | ||
62 | |||
63 | static void | ||
64 | _ecore_evas_ews_del_request(Ecore_Evas *ee __UNUSED__) | ||
65 | { | ||
66 | INF("EWS backing store deletion is forbidden!"); | ||
67 | } | ||
68 | |||
69 | static Ecore_Evas * | ||
70 | _ecore_evas_ews_ee_new(void) | ||
71 | { | ||
72 | Ecore_Evas *ee = ecore_evas_new(_ews_engine, _ews_x, _ews_y, _ews_w, _ews_h, | ||
73 | _ews_options); | ||
74 | if (!ee) | ||
75 | ERR("Failed: ecore_evas_new(%s, %d, %d, %d, %d, %s)", | ||
76 | _ews_engine, _ews_x, _ews_y, _ews_w, _ews_h, _ews_options); | ||
77 | else | ||
78 | { | ||
79 | ecore_evas_size_min_set(ee, _ews_w, _ews_h); | ||
80 | ecore_evas_size_max_set(ee, _ews_w, _ews_h); | ||
81 | ecore_evas_callback_pre_free_set(ee, _ecore_evas_ews_pre_free); | ||
82 | ecore_evas_callback_delete_request_set(ee, _ecore_evas_ews_del_request); | ||
83 | ecore_evas_name_class_set(ee, "ecore_evas_ews", "ews"); | ||
84 | ecore_evas_title_set | ||
85 | (ee, "EWS: Ecore + Evas Single Process Windowing System"); | ||
86 | ecore_evas_show(ee); | ||
87 | } | ||
88 | |||
89 | return ee; | ||
90 | } | ||
91 | |||
92 | static void | ||
93 | _ecore_evas_ews_env_setup(void) | ||
94 | { | ||
95 | const char *env = getenv("ECORE_EVAS_EWS"); | ||
96 | char *p, *n, *tmp; | ||
97 | |||
98 | if (_ews_defaults_engine) | ||
99 | { | ||
100 | free(_ews_engine); | ||
101 | _ews_engine = NULL; | ||
102 | free(_ews_options); | ||
103 | _ews_options = NULL; | ||
104 | } | ||
105 | if (_ews_defaults_geo) | ||
106 | { | ||
107 | _ews_x = 0; | ||
108 | _ews_y = 0; | ||
109 | _ews_w = 1024; | ||
110 | _ews_h = 768; | ||
111 | } | ||
112 | |||
113 | if ((!env) || (!*env)) return; | ||
114 | |||
115 | p = tmp = strdup(env); | ||
116 | if (!tmp) return; | ||
117 | |||
118 | n = strchr(p, ':'); | ||
119 | if (n) *n = '\0'; | ||
120 | if (_ews_defaults_engine) _ews_engine = strdup(p); | ||
121 | if (!n) goto end; | ||
122 | |||
123 | p = n + 1; | ||
124 | n = strchr(p, ':'); | ||
125 | if (!n) goto end; | ||
126 | *n = '\0'; | ||
127 | if (_ews_defaults_geo) _ews_x = atoi(p); | ||
128 | |||
129 | p = n + 1; | ||
130 | n = strchr(p, ':'); | ||
131 | if (!n) goto end; | ||
132 | *n = '\0'; | ||
133 | if (_ews_defaults_geo) _ews_y = atoi(p); | ||
134 | |||
135 | p = n + 1; | ||
136 | n = strchr(p, ':'); | ||
137 | if (!n) goto end; | ||
138 | *n = '\0'; | ||
139 | if (_ews_defaults_geo) _ews_w = atoi(p); | ||
140 | |||
141 | p = n + 1; | ||
142 | n = strchr(p, ':'); | ||
143 | if (n) *n = '\0'; | ||
144 | if (_ews_defaults_geo) _ews_h = atoi(p); | ||
145 | if (!n) goto end; | ||
146 | |||
147 | p = n + 1; | ||
148 | if (_ews_defaults_engine) _ews_options = strdup(p); | ||
149 | |||
150 | end: | ||
151 | free(tmp); | ||
152 | } | ||
153 | |||
154 | static void | ||
155 | _ecore_evas_ews_event_free(void *data __UNUSED__, void *ev) | ||
156 | { | ||
157 | Ecore_Evas *ee = ev; | ||
158 | _ecore_evas_unref(ee); | ||
159 | } | ||
160 | |||
161 | static void | ||
162 | _ecore_evas_ews_event(Ecore_Evas *ee, int event) | ||
163 | { | ||
164 | _ecore_evas_ref(ee); | ||
165 | ecore_event_add(event, ee, _ecore_evas_ews_event_free, NULL); | ||
166 | } | ||
167 | |||
168 | static void | ||
169 | _ecore_evas_ews_event_free_del(void *data __UNUSED__, void *ev __UNUSED__) | ||
170 | { | ||
171 | _ecore_evas_ews_shutdown(); | ||
172 | } | ||
173 | |||
174 | static void | ||
175 | _ecore_evas_ews_free(Ecore_Evas *ee) | ||
176 | { | ||
177 | evas_object_del(ee->engine.ews.image); | ||
178 | _ews_ee->sub_ecore_evas = eina_list_remove(_ews_ee->sub_ecore_evas, ee); | ||
179 | |||
180 | ecore_event_add(ECORE_EVAS_EWS_EVENT_DEL, ee, _ecore_evas_ews_event_free_del, NULL); | ||
181 | } | ||
182 | |||
183 | static void | ||
184 | _ecore_evas_ews_move(Ecore_Evas *ee, int x, int y) | ||
185 | { | ||
186 | ee->req.x = x; | ||
187 | ee->req.y = y; | ||
188 | |||
189 | if ((x == ee->x) && (y == ee->y)) return; | ||
190 | ee->x = x; | ||
191 | ee->y = y; | ||
192 | evas_object_move(ee->engine.ews.image, x, y); | ||
193 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
194 | |||
195 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE); | ||
196 | } | ||
197 | |||
198 | static void | ||
199 | _ecore_evas_ews_managed_move(Ecore_Evas *ee, int x, int y) | ||
200 | { | ||
201 | ee->req.x = x; | ||
202 | ee->req.y = y; | ||
203 | |||
204 | if ((x == ee->x) && (y == ee->y)) return; | ||
205 | ee->x = x; | ||
206 | ee->y = y; | ||
207 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
208 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE); | ||
209 | } | ||
210 | |||
211 | static void | ||
212 | _ecore_evas_ews_resize_internal(Ecore_Evas *ee, int w, int h) | ||
213 | { | ||
214 | Evas_Engine_Info_Buffer *einfo; | ||
215 | void *pixels; | ||
216 | int stride; | ||
217 | |||
218 | evas_output_size_set(ee->evas, w, h); | ||
219 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
220 | evas_damage_rectangle_add(ee->evas, 0, 0, w, h); | ||
221 | |||
222 | evas_object_image_size_set(ee->engine.ews.image, w, h); | ||
223 | evas_object_image_fill_set(ee->engine.ews.image, 0, 0, w, h); | ||
224 | evas_object_resize(ee->engine.ews.image, w, h); | ||
225 | |||
226 | pixels = evas_object_image_data_get(ee->engine.ews.image, 1); | ||
227 | evas_object_image_data_set(ee->engine.ews.image, pixels); // refcount | ||
228 | stride = evas_object_image_stride_get(ee->engine.ews.image); | ||
229 | |||
230 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
231 | EINA_SAFETY_ON_NULL_RETURN(einfo); | ||
232 | |||
233 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
234 | einfo->info.dest_buffer = pixels; | ||
235 | einfo->info.dest_buffer_row_bytes = stride; | ||
236 | einfo->info.use_color_key = 0; | ||
237 | einfo->info.alpha_threshold = 0; | ||
238 | einfo->info.func.new_update_region = NULL; | ||
239 | einfo->info.func.free_update_region = NULL; | ||
240 | evas_object_image_data_set(ee->engine.ews.image, pixels); | ||
241 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
242 | { | ||
243 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | static void | ||
248 | _ecore_evas_ews_resize(Ecore_Evas *ee, int w, int h) | ||
249 | { | ||
250 | if (w < 1) w = 1; | ||
251 | if (h < 1) h = 1; | ||
252 | |||
253 | ee->req.w = w; | ||
254 | ee->req.h = h; | ||
255 | |||
256 | if ((w == ee->w) && (h == ee->h)) return; | ||
257 | ee->w = w; | ||
258 | ee->h = h; | ||
259 | _ecore_evas_ews_resize_internal(ee, w, h); | ||
260 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
261 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RESIZE); | ||
262 | } | ||
263 | |||
264 | static void | ||
265 | _ecore_evas_ews_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) | ||
266 | { | ||
267 | _ecore_evas_ews_move(ee, x, y); | ||
268 | _ecore_evas_ews_resize(ee, w, h); | ||
269 | } | ||
270 | |||
271 | static void | ||
272 | _ecore_evas_ews_rotation_set(Ecore_Evas *ee, int rot, int resize) | ||
273 | { | ||
274 | if (ee->rotation == rot) return; | ||
275 | ee->rotation = rot; | ||
276 | |||
277 | ERR("TODO: rot=%d, resize=%d", rot, resize); | ||
278 | |||
279 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
280 | } | ||
281 | |||
282 | static void | ||
283 | _ecore_evas_ews_shaped_set(Ecore_Evas *ee, int val) | ||
284 | { | ||
285 | if (ee->shaped == val) return; | ||
286 | ee->shaped = val; | ||
287 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
288 | } | ||
289 | |||
290 | static void | ||
291 | _ecore_evas_ews_show(Ecore_Evas *ee) | ||
292 | { | ||
293 | ee->should_be_visible = EINA_TRUE; | ||
294 | evas_object_show(ee->engine.ews.image); | ||
295 | if (ee->prop.fullscreen) | ||
296 | evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); | ||
297 | |||
298 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
299 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_SHOW); | ||
300 | } | ||
301 | |||
302 | static void | ||
303 | _ecore_evas_ews_hide(Ecore_Evas *ee) | ||
304 | { | ||
305 | ee->should_be_visible = EINA_FALSE; | ||
306 | evas_object_hide(ee->engine.ews.image); | ||
307 | |||
308 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
309 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_HIDE); | ||
310 | } | ||
311 | |||
312 | static void | ||
313 | _ecore_evas_ews_raise(Ecore_Evas *ee) | ||
314 | { | ||
315 | evas_object_raise(ee->engine.ews.image); | ||
316 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RAISE); | ||
317 | } | ||
318 | |||
319 | static void | ||
320 | _ecore_evas_ews_lower(Ecore_Evas *ee) | ||
321 | { | ||
322 | evas_object_lower(ee->engine.ews.image); | ||
323 | evas_object_lower(_ews_bg); | ||
324 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LOWER); | ||
325 | } | ||
326 | |||
327 | static void | ||
328 | _ecore_evas_ews_activate(Ecore_Evas *ee) | ||
329 | { | ||
330 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ACTIVATE); | ||
331 | } | ||
332 | |||
333 | static void | ||
334 | _ecore_evas_ews_title_set(Ecore_Evas *ee, const char *t) | ||
335 | { | ||
336 | if (ee->prop.title) free(ee->prop.title); | ||
337 | ee->prop.title = NULL; | ||
338 | if (t) ee->prop.title = strdup(t); | ||
339 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
340 | } | ||
341 | |||
342 | static void | ||
343 | _ecore_evas_ews_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
344 | { | ||
345 | if (ee->prop.name) free(ee->prop.name); | ||
346 | if (ee->prop.clas) free(ee->prop.clas); | ||
347 | ee->prop.name = NULL; | ||
348 | ee->prop.clas = NULL; | ||
349 | if (n) ee->prop.name = strdup(n); | ||
350 | if (c) ee->prop.clas = strdup(c); | ||
351 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
352 | } | ||
353 | |||
354 | static void | ||
355 | _ecore_evas_ews_size_min_set(Ecore_Evas *ee, int w, int h) | ||
356 | { | ||
357 | if (w < 0) w = 0; | ||
358 | if (h < 0) h = 0; | ||
359 | if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; | ||
360 | ee->prop.min.w = w; | ||
361 | ee->prop.min.h = h; | ||
362 | evas_object_size_hint_min_set(ee->engine.ews.image, w, h); | ||
363 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
364 | } | ||
365 | |||
366 | static void | ||
367 | _ecore_evas_ews_size_max_set(Ecore_Evas *ee, int w, int h) | ||
368 | { | ||
369 | if (w < 0) w = 0; | ||
370 | if (h < 0) h = 0; | ||
371 | if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; | ||
372 | ee->prop.max.w = w; | ||
373 | ee->prop.max.h = h; | ||
374 | evas_object_size_hint_max_set(ee->engine.ews.image, w, h); | ||
375 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
376 | } | ||
377 | |||
378 | static void | ||
379 | _ecore_evas_ews_size_base_set(Ecore_Evas *ee, int w, int h) | ||
380 | { | ||
381 | if (w < 0) w = 0; | ||
382 | if (h < 0) h = 0; | ||
383 | if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; | ||
384 | ee->prop.base.w = w; | ||
385 | ee->prop.base.h = h; | ||
386 | evas_object_size_hint_request_set(ee->engine.ews.image, w, h); | ||
387 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
388 | } | ||
389 | |||
390 | static void | ||
391 | _ecore_evas_ews_size_step_set(Ecore_Evas *ee, int w, int h) | ||
392 | { | ||
393 | if (w < 1) w = 1; | ||
394 | if (h < 1) h = 1; | ||
395 | if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; | ||
396 | ee->prop.step.w = w; | ||
397 | ee->prop.step.h = h; | ||
398 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
399 | } | ||
400 | |||
401 | static void | ||
402 | _ecore_evas_ews_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
403 | { | ||
404 | Ecore_Evas *ee = data; | ||
405 | ee->prop.cursor.object = NULL; | ||
406 | } | ||
407 | |||
408 | static void | ||
409 | _ecore_evas_ews_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
410 | { | ||
411 | int x, y; | ||
412 | |||
413 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
414 | |||
415 | if (!obj) | ||
416 | { | ||
417 | ee->prop.cursor.object = NULL; | ||
418 | ee->prop.cursor.layer = 0; | ||
419 | ee->prop.cursor.hot.x = 0; | ||
420 | ee->prop.cursor.hot.y = 0; | ||
421 | return; | ||
422 | } | ||
423 | |||
424 | ee->prop.cursor.object = obj; | ||
425 | ee->prop.cursor.layer = layer; | ||
426 | ee->prop.cursor.hot.x = hot_x; | ||
427 | ee->prop.cursor.hot.y = hot_y; | ||
428 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
429 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
430 | evas_object_move(ee->prop.cursor.object, | ||
431 | x - ee->prop.cursor.hot.x, | ||
432 | y - ee->prop.cursor.hot.y); | ||
433 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
434 | if (evas_pointer_inside_get(ee->evas)) | ||
435 | evas_object_show(ee->prop.cursor.object); | ||
436 | |||
437 | evas_object_event_callback_add | ||
438 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_ews_object_cursor_del, ee); | ||
439 | |||
440 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
441 | } | ||
442 | |||
443 | static void | ||
444 | _ecore_evas_ews_layer_set(Ecore_Evas *ee, int layer) | ||
445 | { | ||
446 | if (layer < EVAS_LAYER_MIN + 1) | ||
447 | layer = EVAS_LAYER_MIN + 1; | ||
448 | else if (layer > EVAS_LAYER_MAX) | ||
449 | layer = EVAS_LAYER_MAX; | ||
450 | |||
451 | if (ee->prop.layer == layer) return; | ||
452 | ee->prop.layer = layer; | ||
453 | evas_object_layer_set(ee->engine.ews.image, layer); | ||
454 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LAYER_CHANGE); | ||
455 | } | ||
456 | |||
457 | static void | ||
458 | _ecore_evas_ews_focus_set(Ecore_Evas *ee, int val) | ||
459 | { | ||
460 | evas_object_focus_set(ee->engine.ews.image, val); | ||
461 | ee->prop.focused = val; | ||
462 | if (val) | ||
463 | { | ||
464 | evas_focus_in(ee->evas); | ||
465 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
466 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FOCUS); | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | evas_focus_out(ee->evas); | ||
471 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
472 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_UNFOCUS); | ||
473 | } | ||
474 | } | ||
475 | |||
476 | static void | ||
477 | _ecore_evas_ews_iconified_set(Ecore_Evas *ee, int val) | ||
478 | { | ||
479 | if (ee->prop.iconified == val) return; | ||
480 | ee->prop.iconified = val; | ||
481 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE); | ||
482 | } | ||
483 | |||
484 | static void | ||
485 | _ecore_evas_ews_borderless_set(Ecore_Evas *ee, int val) | ||
486 | { | ||
487 | if (ee->prop.borderless == val) return; | ||
488 | ee->prop.borderless = val; | ||
489 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
490 | } | ||
491 | |||
492 | static void | ||
493 | _ecore_evas_ews_override_set(Ecore_Evas *ee, int val) | ||
494 | { | ||
495 | if (ee->prop.override == val) return; | ||
496 | if (ee->visible) evas_object_show(ee->engine.ews.image); | ||
497 | if (ee->prop.focused) evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); | ||
498 | ee->prop.override = val; | ||
499 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
500 | } | ||
501 | |||
502 | static void | ||
503 | _ecore_evas_ews_maximized_set(Ecore_Evas *ee, int val) | ||
504 | { | ||
505 | if (ee->prop.maximized == val) return; | ||
506 | ee->prop.maximized = val; | ||
507 | if (val) evas_object_show(ee->engine.ews.image); | ||
508 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE); | ||
509 | } | ||
510 | |||
511 | static void | ||
512 | _ecore_evas_ews_fullscreen_set(Ecore_Evas *ee, int val) | ||
513 | { | ||
514 | if (ee->prop.fullscreen == val) return; | ||
515 | ee->prop.fullscreen = val; | ||
516 | |||
517 | if (!val) | ||
518 | { | ||
519 | evas_object_move(ee->engine.ews.image, ee->x, ee->y); | ||
520 | evas_object_resize(ee->engine.ews.image, ee->w, ee->h); | ||
521 | } | ||
522 | else | ||
523 | { | ||
524 | Evas_Coord w, h; | ||
525 | ecore_evas_geometry_get(_ews_ee, NULL, NULL, &w, &h); | ||
526 | evas_object_move(ee->engine.ews.image, 0, 0); | ||
527 | evas_object_resize(ee->engine.ews.image, w, h); | ||
528 | evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); | ||
529 | } | ||
530 | |||
531 | if (ee->should_be_visible) | ||
532 | evas_object_show(ee->engine.ews.image); | ||
533 | else | ||
534 | evas_object_hide(ee->engine.ews.image); | ||
535 | |||
536 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE); | ||
537 | } | ||
538 | |||
539 | static void | ||
540 | _ecore_evas_ews_avoid_damage_set(Ecore_Evas *ee, int val) | ||
541 | { | ||
542 | if (ee->prop.avoid_damage == val) return; | ||
543 | ee->prop.avoid_damage = val; | ||
544 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
545 | } | ||
546 | |||
547 | static void | ||
548 | _ecore_evas_ews_withdrawn_set(Ecore_Evas *ee, int val) | ||
549 | { | ||
550 | if (ee->prop.withdrawn == val) return; | ||
551 | ee->prop.withdrawn = val; | ||
552 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
553 | } | ||
554 | |||
555 | static void | ||
556 | _ecore_evas_ews_sticky_set(Ecore_Evas *ee, int val) | ||
557 | { | ||
558 | if (ee->prop.sticky == val) return; | ||
559 | ee->prop.sticky = val; | ||
560 | if ((val) && (ee->func.fn_sticky)) ee->func.fn_sticky(ee); | ||
561 | else if ((!val) && (ee->func.fn_unsticky)) ee->func.fn_unsticky(ee); | ||
562 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
563 | } | ||
564 | |||
565 | static void | ||
566 | _ecore_evas_ews_ignore_events_set(Ecore_Evas *ee, int val) | ||
567 | { | ||
568 | if (ee->ignore_events == val) return; | ||
569 | ee->ignore_events = val; | ||
570 | evas_object_pass_events_set(ee->engine.ews.image, val); | ||
571 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
572 | } | ||
573 | |||
574 | static void | ||
575 | _ecore_evas_ews_alpha_set(Ecore_Evas *ee, int val) | ||
576 | { | ||
577 | if (ee->alpha == val) return; | ||
578 | ee->alpha = val; | ||
579 | evas_object_image_alpha_set(ee->engine.ews.image, val); | ||
580 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
581 | } | ||
582 | |||
583 | static void | ||
584 | _ecore_evas_ews_transparent_set(Ecore_Evas *ee, int val) | ||
585 | { | ||
586 | if (ee->transparent == val) return; | ||
587 | ee->transparent = val; | ||
588 | evas_object_image_alpha_set(ee->engine.ews.image, val); | ||
589 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); | ||
590 | } | ||
591 | |||
592 | static int | ||
593 | _ecore_evas_ews_render(Ecore_Evas *ee) | ||
594 | { | ||
595 | Eina_List *updates = NULL, *l, *ll; | ||
596 | Ecore_Evas *ee2; | ||
597 | Eina_Rectangle *r; | ||
598 | int w, h, rend = 0; | ||
599 | void *pixels; | ||
600 | |||
601 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
602 | { | ||
603 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
604 | rend |= _ecore_evas_ews_render(ee2); | ||
605 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
606 | } | ||
607 | |||
608 | evas_object_image_size_get(ee->engine.ews.image, &w, &h); | ||
609 | if ((w != ee->w) || (h != ee->h)) | ||
610 | ecore_evas_resize(ee, w, h); | ||
611 | |||
612 | pixels = evas_object_image_data_get(ee->engine.ews.image, 1); | ||
613 | if (pixels) | ||
614 | { | ||
615 | updates = evas_render_updates(ee->evas); | ||
616 | } | ||
617 | evas_object_image_data_set(ee->engine.ews.image, pixels); | ||
618 | |||
619 | EINA_LIST_FOREACH(updates, l, r) | ||
620 | evas_object_image_data_update_add(ee->engine.ews.image, | ||
621 | r->x, r->y, r->w, r->h); | ||
622 | |||
623 | if (updates) | ||
624 | { | ||
625 | evas_render_updates_free(updates); | ||
626 | _ecore_evas_idle_timeout_update(ee); | ||
627 | } | ||
628 | |||
629 | return updates ? 1 : rend; | ||
630 | } | ||
631 | |||
632 | static void | ||
633 | _ecore_evas_ews_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
634 | { | ||
635 | ecore_evas_geometry_get(_ews_ee, x, y, w, h); | ||
636 | } | ||
637 | |||
638 | static const Ecore_Evas_Engine_Func _ecore_ews_engine_func = | ||
639 | { | ||
640 | _ecore_evas_ews_free, | ||
641 | NULL, | ||
642 | NULL, | ||
643 | NULL, | ||
644 | NULL, | ||
645 | NULL, | ||
646 | NULL, | ||
647 | NULL, | ||
648 | NULL, | ||
649 | NULL, | ||
650 | NULL, | ||
651 | NULL, | ||
652 | NULL, | ||
653 | NULL, | ||
654 | NULL, | ||
655 | _ecore_evas_ews_move, | ||
656 | _ecore_evas_ews_managed_move, | ||
657 | _ecore_evas_ews_resize, | ||
658 | _ecore_evas_ews_move_resize, | ||
659 | _ecore_evas_ews_rotation_set, | ||
660 | _ecore_evas_ews_shaped_set, | ||
661 | _ecore_evas_ews_show, | ||
662 | _ecore_evas_ews_hide, | ||
663 | _ecore_evas_ews_raise, | ||
664 | _ecore_evas_ews_lower, | ||
665 | _ecore_evas_ews_activate, | ||
666 | _ecore_evas_ews_title_set, | ||
667 | _ecore_evas_ews_name_class_set, | ||
668 | _ecore_evas_ews_size_min_set, | ||
669 | _ecore_evas_ews_size_max_set, | ||
670 | _ecore_evas_ews_size_base_set, | ||
671 | _ecore_evas_ews_size_step_set, | ||
672 | _ecore_evas_ews_object_cursor_set, | ||
673 | _ecore_evas_ews_layer_set, | ||
674 | _ecore_evas_ews_focus_set, | ||
675 | _ecore_evas_ews_iconified_set, | ||
676 | _ecore_evas_ews_borderless_set, | ||
677 | _ecore_evas_ews_override_set, | ||
678 | _ecore_evas_ews_maximized_set, | ||
679 | _ecore_evas_ews_fullscreen_set, | ||
680 | _ecore_evas_ews_avoid_damage_set, | ||
681 | _ecore_evas_ews_withdrawn_set, | ||
682 | _ecore_evas_ews_sticky_set, | ||
683 | _ecore_evas_ews_ignore_events_set, | ||
684 | _ecore_evas_ews_alpha_set, | ||
685 | _ecore_evas_ews_transparent_set, | ||
686 | |||
687 | NULL, | ||
688 | NULL, | ||
689 | NULL, | ||
690 | NULL, | ||
691 | NULL, | ||
692 | NULL, | ||
693 | |||
694 | _ecore_evas_ews_render, | ||
695 | _ecore_evas_ews_screen_geometry_get | ||
696 | }; | ||
697 | |||
698 | void | ||
699 | _ecore_evas_ews_events_init(void) | ||
700 | { | ||
701 | if (ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE != 0) return; | ||
702 | ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = ecore_event_type_new(); | ||
703 | ECORE_EVAS_EWS_EVENT_ADD = ecore_event_type_new(); | ||
704 | ECORE_EVAS_EWS_EVENT_DEL = ecore_event_type_new(); | ||
705 | ECORE_EVAS_EWS_EVENT_RESIZE = ecore_event_type_new(); | ||
706 | ECORE_EVAS_EWS_EVENT_MOVE = ecore_event_type_new(); | ||
707 | ECORE_EVAS_EWS_EVENT_SHOW = ecore_event_type_new(); | ||
708 | ECORE_EVAS_EWS_EVENT_HIDE = ecore_event_type_new(); | ||
709 | ECORE_EVAS_EWS_EVENT_FOCUS = ecore_event_type_new(); | ||
710 | ECORE_EVAS_EWS_EVENT_UNFOCUS = ecore_event_type_new(); | ||
711 | ECORE_EVAS_EWS_EVENT_RAISE = ecore_event_type_new(); | ||
712 | ECORE_EVAS_EWS_EVENT_LOWER = ecore_event_type_new(); | ||
713 | ECORE_EVAS_EWS_EVENT_ACTIVATE = ecore_event_type_new(); | ||
714 | ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = ecore_event_type_new(); | ||
715 | ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = ecore_event_type_new(); | ||
716 | ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = ecore_event_type_new(); | ||
717 | ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = ecore_event_type_new(); | ||
718 | ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = ecore_event_type_new(); | ||
719 | } | ||
720 | |||
721 | static int | ||
722 | _ecore_evas_ews_init(void) | ||
723 | { | ||
724 | _ecore_evas_init_count++; | ||
725 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
726 | |||
727 | _ecore_evas_ews_env_setup(); | ||
728 | |||
729 | return _ecore_evas_init_count; | ||
730 | } | ||
731 | |||
732 | int | ||
733 | _ecore_evas_ews_shutdown(void) | ||
734 | { | ||
735 | _ecore_evas_init_count--; | ||
736 | if (_ecore_evas_init_count == 0) | ||
737 | { | ||
738 | if (_ews_ee) | ||
739 | { | ||
740 | ecore_evas_free(_ews_ee); | ||
741 | _ews_ee = NULL; | ||
742 | } | ||
743 | if (_ews_children) | ||
744 | { | ||
745 | eina_list_free(_ews_children); | ||
746 | _ews_children = NULL; | ||
747 | } | ||
748 | |||
749 | free(_ews_engine); | ||
750 | _ews_engine = NULL; | ||
751 | free(_ews_options); | ||
752 | _ews_options = NULL; | ||
753 | _ews_defaults_engine = EINA_TRUE; | ||
754 | _ews_defaults_geo = EINA_TRUE; | ||
755 | |||
756 | } | ||
757 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
758 | return _ecore_evas_init_count; | ||
759 | } | ||
760 | |||
761 | static void | ||
762 | _ecore_evas_ews_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) | ||
763 | { | ||
764 | Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; | ||
765 | |||
766 | evas_object_geometry_get(ee->engine.ews.image, &xx, &yy, &ww, &hh); | ||
767 | evas_object_image_fill_get(ee->engine.ews.image, &fx, &fy, &fw, &fh); | ||
768 | |||
769 | if (fw < 1) fw = 1; | ||
770 | if (fh < 1) fh = 1; | ||
771 | |||
772 | if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) | ||
773 | { | ||
774 | *x = (ee->w * (*x - xx)) / fw; | ||
775 | *y = (ee->h * (*y - yy)) / fh; | ||
776 | } | ||
777 | else | ||
778 | { | ||
779 | xx = (*x - xx) - fx; | ||
780 | while (xx < 0) xx += fw; | ||
781 | while (xx > fw) xx -= fw; | ||
782 | *x = (ee->w * xx) / fw; | ||
783 | |||
784 | yy = (*y - yy) - fy; | ||
785 | while (yy < 0) yy += fh; | ||
786 | while (yy > fh) yy -= fh; | ||
787 | *y = (ee->h * yy) / fh; | ||
788 | } | ||
789 | } | ||
790 | |||
791 | static void | ||
792 | _ecore_evas_ews_modifiers_apply(Ecore_Evas *ee, const Evas_Modifier *modifier) | ||
793 | { | ||
794 | Evas *e = ee->evas; | ||
795 | |||
796 | if (evas_key_modifier_is_set(modifier, "Shift")) | ||
797 | evas_key_modifier_on(e, "Shift"); | ||
798 | else evas_key_modifier_off(e, "Shift"); | ||
799 | |||
800 | if (evas_key_modifier_is_set(modifier, "Control")) | ||
801 | evas_key_modifier_on(e, "Control"); | ||
802 | else evas_key_modifier_off(e, "Control"); | ||
803 | |||
804 | if (evas_key_modifier_is_set(modifier, "Alt")) | ||
805 | evas_key_modifier_on(e, "Alt"); | ||
806 | else evas_key_modifier_off(e, "Alt"); | ||
807 | |||
808 | if (evas_key_modifier_is_set(modifier, "Super")) | ||
809 | evas_key_modifier_on(e, "Super"); | ||
810 | else evas_key_modifier_off(e, "Super"); | ||
811 | |||
812 | if (evas_key_modifier_is_set(modifier, "Hyper")) | ||
813 | evas_key_modifier_on(e, "Hyper"); | ||
814 | else evas_key_modifier_off(e, "Hyper"); | ||
815 | |||
816 | if (evas_key_modifier_is_set(modifier, "Scroll_Lock")) | ||
817 | evas_key_lock_on(e, "Scroll_Lock"); | ||
818 | else evas_key_lock_off(e, "Scroll_Lock"); | ||
819 | |||
820 | if (evas_key_modifier_is_set(modifier, "Num_Lock")) | ||
821 | evas_key_lock_on(e, "Num_Lock"); | ||
822 | else evas_key_lock_off(e, "Num_Lock"); | ||
823 | |||
824 | if (evas_key_modifier_is_set(modifier, "Caps_Lock")) | ||
825 | evas_key_lock_on(e, "Caps_Lock"); | ||
826 | else evas_key_lock_off(e, "Caps_Lock"); | ||
827 | |||
828 | if (evas_key_modifier_is_set(modifier, "Shift_Lock")) | ||
829 | evas_key_lock_on(e, "Shift_Lock"); | ||
830 | else evas_key_lock_off(e, "Shift_Lock"); | ||
831 | } | ||
832 | |||
833 | static void | ||
834 | _ecore_evas_ews_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
835 | { | ||
836 | Ecore_Evas *ee = data; | ||
837 | Evas_Event_Mouse_In *ev = event_info; | ||
838 | Evas_Coord x = ev->canvas.x; | ||
839 | Evas_Coord y = ev->canvas.y; | ||
840 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
841 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
842 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
843 | evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); | ||
844 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); | ||
845 | } | ||
846 | |||
847 | static void | ||
848 | _ecore_evas_ews_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
849 | { | ||
850 | Ecore_Evas *ee = data; | ||
851 | Evas_Event_Mouse_Out *ev = event_info; | ||
852 | Evas_Coord x = ev->canvas.x; | ||
853 | Evas_Coord y = ev->canvas.y; | ||
854 | // TODO: consider grab mode in EWS | ||
855 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
856 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
857 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
858 | evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); | ||
859 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
860 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); | ||
861 | } | ||
862 | |||
863 | static void | ||
864 | _ecore_evas_ews_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
865 | { | ||
866 | Ecore_Evas *ee = data; | ||
867 | Evas_Event_Mouse_Down *ev = event_info; | ||
868 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
869 | evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | ||
870 | } | ||
871 | |||
872 | static void | ||
873 | _ecore_evas_ews_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
874 | { | ||
875 | Ecore_Evas *ee = data; | ||
876 | Evas_Event_Mouse_Up *ev = event_info; | ||
877 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
878 | evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | ||
879 | } | ||
880 | |||
881 | static void | ||
882 | _ecore_evas_ews_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
883 | { | ||
884 | Ecore_Evas *ee = data; | ||
885 | Evas_Event_Mouse_Move *ev = event_info; | ||
886 | Evas_Coord x = ev->cur.canvas.x; | ||
887 | Evas_Coord y = ev->cur.canvas.y; | ||
888 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
889 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
890 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); | ||
891 | } | ||
892 | |||
893 | static void | ||
894 | _ecore_evas_ews_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
895 | { | ||
896 | Ecore_Evas *ee = data; | ||
897 | Evas_Event_Mouse_Wheel *ev = event_info; | ||
898 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
899 | evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL); | ||
900 | } | ||
901 | |||
902 | static void | ||
903 | _ecore_evas_ews_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
904 | { | ||
905 | Ecore_Evas *ee = data; | ||
906 | Evas_Event_Multi_Down *ev = event_info; | ||
907 | Evas_Coord x, y, xx, yy; | ||
908 | double xf, yf; | ||
909 | |||
910 | x = ev->canvas.x; | ||
911 | y = ev->canvas.y; | ||
912 | xx = x; | ||
913 | yy = y; | ||
914 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
915 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | ||
916 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | ||
917 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
918 | 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); | ||
919 | } | ||
920 | |||
921 | static void | ||
922 | _ecore_evas_ews_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
923 | { | ||
924 | Ecore_Evas *ee = data; | ||
925 | Evas_Event_Multi_Up *ev = event_info; | ||
926 | Evas_Coord x, y, xx, yy; | ||
927 | double xf, yf; | ||
928 | |||
929 | x = ev->canvas.x; | ||
930 | y = ev->canvas.y; | ||
931 | xx = x; | ||
932 | yy = y; | ||
933 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
934 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | ||
935 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | ||
936 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
937 | 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); | ||
938 | } | ||
939 | |||
940 | static void | ||
941 | _ecore_evas_ews_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
942 | { | ||
943 | Ecore_Evas *ee = data; | ||
944 | Evas_Event_Multi_Move *ev = event_info; | ||
945 | Evas_Coord x, y, xx, yy; | ||
946 | double xf, yf; | ||
947 | |||
948 | x = ev->cur.canvas.x; | ||
949 | y = ev->cur.canvas.y; | ||
950 | xx = x; | ||
951 | yy = y; | ||
952 | _ecore_evas_ews_coord_translate(ee, &x, &y); | ||
953 | xf = (ev->cur.canvas.xsub - (double)xx) + (double)x; | ||
954 | yf = (ev->cur.canvas.ysub - (double)yy) + (double)y; | ||
955 | _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); | ||
956 | 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); | ||
957 | } | ||
958 | |||
959 | static void | ||
960 | _ecore_evas_ews_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
961 | { | ||
962 | Ecore_Evas *ee = data; | ||
963 | if (ee->driver) _ecore_evas_free(ee); | ||
964 | } | ||
965 | |||
966 | static void | ||
967 | _ecore_evas_ews_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
968 | { | ||
969 | Ecore_Evas *ee = data; | ||
970 | Evas_Event_Key_Down *ev = event_info; | ||
971 | |||
972 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | ||
973 | evas_key_modifier_on(ee->evas, "Shift"); | ||
974 | else | ||
975 | evas_key_modifier_off(ee->evas, "Shift"); | ||
976 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
977 | evas_key_modifier_on(ee->evas, "Control"); | ||
978 | else | ||
979 | evas_key_modifier_off(ee->evas, "Control"); | ||
980 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
981 | evas_key_modifier_on(ee->evas, "Alt"); | ||
982 | else | ||
983 | evas_key_modifier_off(ee->evas, "Alt"); | ||
984 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
985 | evas_key_modifier_on(ee->evas, "Meta"); | ||
986 | else | ||
987 | evas_key_modifier_off(ee->evas, "Meta"); | ||
988 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
989 | evas_key_modifier_on(ee->evas, "Hyper"); | ||
990 | else | ||
991 | evas_key_modifier_off(ee->evas, "Hyper"); | ||
992 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
993 | evas_key_modifier_on(ee->evas, "Super"); | ||
994 | else | ||
995 | evas_key_modifier_off(ee->evas, "Super"); | ||
996 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
997 | evas_key_lock_on(ee->evas, "Scroll_Lock"); | ||
998 | else | ||
999 | evas_key_lock_off(ee->evas, "Scroll_Lock"); | ||
1000 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
1001 | evas_key_lock_on(ee->evas, "Num_Lock"); | ||
1002 | else | ||
1003 | evas_key_lock_off(ee->evas, "Num_Lock"); | ||
1004 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
1005 | evas_key_lock_on(ee->evas, "Caps_Lock"); | ||
1006 | else | ||
1007 | evas_key_lock_off(ee->evas, "Caps_Lock"); | ||
1008 | evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | ||
1009 | } | ||
1010 | |||
1011 | static void | ||
1012 | _ecore_evas_ews_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) | ||
1013 | { | ||
1014 | Ecore_Evas *ee = data; | ||
1015 | Evas_Event_Key_Up *ev = event_info; | ||
1016 | |||
1017 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | ||
1018 | evas_key_modifier_on(ee->evas, "Shift"); | ||
1019 | else | ||
1020 | evas_key_modifier_off(ee->evas, "Shift"); | ||
1021 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
1022 | evas_key_modifier_on(ee->evas, "Control"); | ||
1023 | else | ||
1024 | evas_key_modifier_off(ee->evas, "Control"); | ||
1025 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
1026 | evas_key_modifier_on(ee->evas, "Alt"); | ||
1027 | else | ||
1028 | evas_key_modifier_off(ee->evas, "Alt"); | ||
1029 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
1030 | evas_key_modifier_on(ee->evas, "Meta"); | ||
1031 | else | ||
1032 | evas_key_modifier_off(ee->evas, "Meta"); | ||
1033 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
1034 | evas_key_modifier_on(ee->evas, "Hyper"); | ||
1035 | else | ||
1036 | evas_key_modifier_off(ee->evas, "Hyper"); | ||
1037 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
1038 | evas_key_modifier_on(ee->evas, "Super"); | ||
1039 | else | ||
1040 | evas_key_modifier_off(ee->evas, "Super"); | ||
1041 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
1042 | evas_key_lock_on(ee->evas, "Scroll_Lock"); | ||
1043 | else | ||
1044 | evas_key_lock_off(ee->evas, "Scroll_Lock"); | ||
1045 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
1046 | evas_key_lock_on(ee->evas, "Num_Lock"); | ||
1047 | else | ||
1048 | evas_key_lock_off(ee->evas, "Num_Lock"); | ||
1049 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
1050 | evas_key_lock_on(ee->evas, "Caps_Lock"); | ||
1051 | else | ||
1052 | evas_key_lock_off(ee->evas, "Caps_Lock"); | ||
1053 | evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | ||
1054 | } | ||
1055 | |||
1056 | static void | ||
1057 | _ecore_evas_ews_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1058 | { | ||
1059 | Ecore_Evas *ee = data; | ||
1060 | ecore_evas_focus_set(ee, EINA_TRUE); | ||
1061 | } | ||
1062 | |||
1063 | static void | ||
1064 | _ecore_evas_ews_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1065 | { | ||
1066 | Ecore_Evas *ee = data; | ||
1067 | if (ee->deleted) return; | ||
1068 | ecore_evas_focus_set(ee, EINA_FALSE); | ||
1069 | } | ||
1070 | |||
1071 | static void | ||
1072 | _ecore_evas_ews_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1073 | { | ||
1074 | Ecore_Evas *ee = data; | ||
1075 | ecore_evas_show(ee); | ||
1076 | } | ||
1077 | |||
1078 | static void | ||
1079 | _ecore_evas_ews_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1080 | { | ||
1081 | Ecore_Evas *ee = data; | ||
1082 | if (ee->deleted) return; | ||
1083 | ecore_evas_hide(ee); | ||
1084 | } | ||
1085 | #endif | ||
1086 | |||
1087 | EAPI Ecore_Evas * | ||
1088 | ecore_evas_ews_new(int x, int y, int w, int h) | ||
1089 | { | ||
1090 | // basically a copy of ecore_evas_buffer_new() keep in sync... | ||
1091 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1092 | Evas_Object *o; | ||
1093 | Evas_Engine_Info_Buffer *einfo; | ||
1094 | Ecore_Evas *ee; | ||
1095 | int rmethod; | ||
1096 | |||
1097 | if (_ecore_evas_ews_init() < 1) return NULL; | ||
1098 | |||
1099 | if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new(); | ||
1100 | if (!_ews_ee) | ||
1101 | { | ||
1102 | ERR("Could not create EWS backing store"); | ||
1103 | _ecore_evas_ews_shutdown(); | ||
1104 | return NULL; | ||
1105 | } | ||
1106 | |||
1107 | rmethod = evas_render_method_lookup("buffer"); | ||
1108 | if (!rmethod) return NULL; | ||
1109 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
1110 | if (!ee) return NULL; | ||
1111 | |||
1112 | if (w < 1) w = 1; | ||
1113 | if (h < 1) h = 1; | ||
1114 | |||
1115 | o = evas_object_image_add(_ews_ee->evas); | ||
1116 | evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); | ||
1117 | evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); | ||
1118 | evas_object_image_size_set(o, w, h); | ||
1119 | evas_object_image_alpha_set(o, 1); | ||
1120 | |||
1121 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
1122 | |||
1123 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_ews_engine_func; | ||
1124 | |||
1125 | ee->driver = EWS_ENGINE_NAME; | ||
1126 | |||
1127 | ee->x = 0; | ||
1128 | ee->y = 0; | ||
1129 | ee->w = w; | ||
1130 | ee->h = h; | ||
1131 | ee->req.x = ee->x; | ||
1132 | ee->req.y = ee->y; | ||
1133 | ee->req.w = ee->w; | ||
1134 | ee->req.h = ee->h; | ||
1135 | |||
1136 | /* init evas here */ | ||
1137 | ee->evas = evas_new(); | ||
1138 | evas_data_attach_set(ee->evas, ee); | ||
1139 | evas_output_method_set(ee->evas, rmethod); | ||
1140 | evas_output_size_set(ee->evas, w, h); | ||
1141 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
1142 | |||
1143 | evas_object_move(o, x, y); | ||
1144 | evas_object_resize(o, w, h); | ||
1145 | evas_object_image_fill_set(o, 0, 0, w, h); | ||
1146 | |||
1147 | ee->engine.ews.image = o; | ||
1148 | evas_object_data_set(ee->engine.ews.image, "Ecore_Evas", ee); | ||
1149 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1150 | EVAS_CALLBACK_MOUSE_IN, | ||
1151 | _ecore_evas_ews_cb_mouse_in, ee); | ||
1152 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1153 | EVAS_CALLBACK_MOUSE_OUT, | ||
1154 | _ecore_evas_ews_cb_mouse_out, ee); | ||
1155 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1156 | EVAS_CALLBACK_MOUSE_DOWN, | ||
1157 | _ecore_evas_ews_cb_mouse_down, ee); | ||
1158 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1159 | EVAS_CALLBACK_MOUSE_UP, | ||
1160 | _ecore_evas_ews_cb_mouse_up, ee); | ||
1161 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1162 | EVAS_CALLBACK_MOUSE_MOVE, | ||
1163 | _ecore_evas_ews_cb_mouse_move, ee); | ||
1164 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1165 | EVAS_CALLBACK_MOUSE_WHEEL, | ||
1166 | _ecore_evas_ews_cb_mouse_wheel, ee); | ||
1167 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1168 | EVAS_CALLBACK_MULTI_DOWN, | ||
1169 | _ecore_evas_ews_cb_multi_down, ee); | ||
1170 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1171 | EVAS_CALLBACK_MULTI_UP, | ||
1172 | _ecore_evas_ews_cb_multi_up, ee); | ||
1173 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1174 | EVAS_CALLBACK_MULTI_MOVE, | ||
1175 | _ecore_evas_ews_cb_multi_move, ee); | ||
1176 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1177 | EVAS_CALLBACK_FREE, | ||
1178 | _ecore_evas_ews_cb_free, ee); | ||
1179 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1180 | EVAS_CALLBACK_KEY_DOWN, | ||
1181 | _ecore_evas_ews_cb_key_down, ee); | ||
1182 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1183 | EVAS_CALLBACK_KEY_UP, | ||
1184 | _ecore_evas_ews_cb_key_up, ee); | ||
1185 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1186 | EVAS_CALLBACK_FOCUS_IN, | ||
1187 | _ecore_evas_ews_cb_focus_in, ee); | ||
1188 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1189 | EVAS_CALLBACK_FOCUS_OUT, | ||
1190 | _ecore_evas_ews_cb_focus_out, ee); | ||
1191 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1192 | EVAS_CALLBACK_SHOW, | ||
1193 | _ecore_evas_ews_cb_show, ee); | ||
1194 | evas_object_event_callback_add(ee->engine.ews.image, | ||
1195 | EVAS_CALLBACK_HIDE, | ||
1196 | _ecore_evas_ews_cb_hide, ee); | ||
1197 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
1198 | if (einfo) | ||
1199 | { | ||
1200 | void *pixels = evas_object_image_data_get(o, 1); | ||
1201 | evas_object_image_data_set(o, pixels); // refcount | ||
1202 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
1203 | einfo->info.dest_buffer = pixels; | ||
1204 | einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o); | ||
1205 | einfo->info.use_color_key = 0; | ||
1206 | einfo->info.alpha_threshold = 0; | ||
1207 | einfo->info.func.new_update_region = NULL; | ||
1208 | einfo->info.func.free_update_region = NULL; | ||
1209 | evas_object_image_data_set(o, pixels); | ||
1210 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1211 | { | ||
1212 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1213 | ecore_evas_free(ee); | ||
1214 | return NULL; | ||
1215 | } | ||
1216 | } | ||
1217 | else | ||
1218 | { | ||
1219 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1220 | ecore_evas_free(ee); | ||
1221 | return NULL; | ||
1222 | } | ||
1223 | evas_key_modifier_add(ee->evas, "Shift"); | ||
1224 | evas_key_modifier_add(ee->evas, "Control"); | ||
1225 | evas_key_modifier_add(ee->evas, "Alt"); | ||
1226 | evas_key_modifier_add(ee->evas, "Meta"); | ||
1227 | evas_key_modifier_add(ee->evas, "Hyper"); | ||
1228 | evas_key_modifier_add(ee->evas, "Super"); | ||
1229 | evas_key_lock_add(ee->evas, "Caps_Lock"); | ||
1230 | evas_key_lock_add(ee->evas, "Num_Lock"); | ||
1231 | evas_key_lock_add(ee->evas, "Scroll_Lock"); | ||
1232 | |||
1233 | _ews_ee->sub_ecore_evas = eina_list_append(_ews_ee->sub_ecore_evas, ee); | ||
1234 | _ews_children = eina_list_append(_ews_children, ee); | ||
1235 | |||
1236 | _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ADD); | ||
1237 | |||
1238 | return ee; | ||
1239 | #else | ||
1240 | return NULL; | ||
1241 | (void)x; | ||
1242 | (void)y; | ||
1243 | (void)w; | ||
1244 | (void)h; | ||
1245 | #endif | ||
1246 | } | ||
1247 | |||
1248 | EAPI Evas_Object * | ||
1249 | ecore_evas_ews_backing_store_get(const Ecore_Evas *ee) | ||
1250 | { | ||
1251 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1252 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1253 | { | ||
1254 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1255 | "ecore_evas_ews_backing_store_get"); | ||
1256 | return NULL; | ||
1257 | } | ||
1258 | return ee->engine.ews.image; | ||
1259 | #else | ||
1260 | return NULL; | ||
1261 | (void)ee; | ||
1262 | #endif | ||
1263 | } | ||
1264 | |||
1265 | EAPI void | ||
1266 | ecore_evas_ews_delete_request(Ecore_Evas *ee) | ||
1267 | { | ||
1268 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1269 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
1270 | { | ||
1271 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
1272 | "ecore_evas_ews_delete_request"); | ||
1273 | return; | ||
1274 | } | ||
1275 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
1276 | else ecore_evas_free(ee); | ||
1277 | #else | ||
1278 | (void)ee; | ||
1279 | #endif | ||
1280 | } | ||
1281 | |||
1282 | |||
1283 | EAPI Eina_Bool | ||
1284 | ecore_evas_ews_engine_set(const char *engine, const char *options) | ||
1285 | { | ||
1286 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1287 | if (_ews_ee) return EINA_FALSE; | ||
1288 | |||
1289 | free(_ews_engine); | ||
1290 | free(_ews_options); | ||
1291 | |||
1292 | _ews_engine = engine ? strdup(engine) : NULL; | ||
1293 | _ews_options = options ? strdup(options) : NULL; | ||
1294 | |||
1295 | if ((engine) && (!_ews_engine)) return EINA_FALSE; | ||
1296 | if ((options) && (!_ews_options)) return EINA_FALSE; | ||
1297 | |||
1298 | _ews_defaults_engine = EINA_FALSE; | ||
1299 | return EINA_TRUE; | ||
1300 | #else | ||
1301 | return EINA_FALSE; | ||
1302 | (void)engine; | ||
1303 | (void)options; | ||
1304 | #endif | ||
1305 | } | ||
1306 | |||
1307 | EAPI Eina_Bool | ||
1308 | ecore_evas_ews_setup(int x, int y, int w, int h) | ||
1309 | { | ||
1310 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1311 | Eina_Bool ret = EINA_TRUE; | ||
1312 | |||
1313 | _ews_defaults_geo = EINA_FALSE; | ||
1314 | _ews_x = x; | ||
1315 | _ews_y = y; | ||
1316 | _ews_w = w; | ||
1317 | _ews_h = h; | ||
1318 | |||
1319 | if (!_ews_ee) return EINA_TRUE; | ||
1320 | |||
1321 | /* move-resize is not as implemented as move + resize */ | ||
1322 | ecore_evas_move(_ews_ee, x, y); | ||
1323 | ecore_evas_size_min_set(_ews_ee, w, h); | ||
1324 | ecore_evas_size_max_set(_ews_ee, w, h); | ||
1325 | ecore_evas_resize(_ews_ee, w, h); | ||
1326 | |||
1327 | ecore_evas_geometry_get(_ews_ee, &x, &y, &w, &h); | ||
1328 | |||
1329 | #define TST(n) if ((n != _ews_##n)) \ | ||
1330 | { \ | ||
1331 | WRN("Asked %d, got %d for "#n, _ews_##n, n); \ | ||
1332 | ret = EINA_FALSE; \ | ||
1333 | } | ||
1334 | TST(x); | ||
1335 | TST(y); | ||
1336 | TST(w); | ||
1337 | TST(h); | ||
1338 | #undef TST | ||
1339 | return ret; | ||
1340 | #else | ||
1341 | return EINA_FALSE; | ||
1342 | (void)x; | ||
1343 | (void)y; | ||
1344 | (void)w; | ||
1345 | (void)h; | ||
1346 | #endif | ||
1347 | } | ||
1348 | |||
1349 | EAPI Ecore_Evas * | ||
1350 | ecore_evas_ews_ecore_evas_get(void) | ||
1351 | { | ||
1352 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1353 | if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new(); | ||
1354 | return _ews_ee; | ||
1355 | #else | ||
1356 | return NULL; | ||
1357 | #endif | ||
1358 | } | ||
1359 | |||
1360 | EAPI Evas * | ||
1361 | ecore_evas_ews_evas_get(void) | ||
1362 | { | ||
1363 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1364 | return ecore_evas_get(ecore_evas_ews_ecore_evas_get()); | ||
1365 | #else | ||
1366 | return NULL; | ||
1367 | #endif | ||
1368 | } | ||
1369 | |||
1370 | EAPI Evas_Object * | ||
1371 | ecore_evas_ews_background_get(void) | ||
1372 | { | ||
1373 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1374 | return _ews_bg; | ||
1375 | #else | ||
1376 | return NULL; | ||
1377 | #endif | ||
1378 | } | ||
1379 | |||
1380 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1381 | static void | ||
1382 | _ecore_evas_ews_background_free(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) | ||
1383 | { | ||
1384 | _ews_bg = NULL; | ||
1385 | ecore_evas_ews_background_set(NULL); | ||
1386 | } | ||
1387 | #endif | ||
1388 | |||
1389 | EAPI void | ||
1390 | ecore_evas_ews_background_set(Evas_Object *o) | ||
1391 | { | ||
1392 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1393 | if ((o) && (o == _ews_bg)) return; | ||
1394 | |||
1395 | if (_ews_bg) | ||
1396 | { | ||
1397 | evas_object_del(_ews_bg); | ||
1398 | _ews_bg = NULL; | ||
1399 | } | ||
1400 | |||
1401 | if ((!o) && (_ews_ee)) | ||
1402 | { | ||
1403 | o = evas_object_rectangle_add(ecore_evas_get(_ews_ee)); | ||
1404 | evas_object_color_set(o, 0, 0, 0, 255); | ||
1405 | } | ||
1406 | |||
1407 | if (_ews_ee) | ||
1408 | { | ||
1409 | Evas_Coord w, h; | ||
1410 | Evas *e = ecore_evas_get(_ews_ee); | ||
1411 | |||
1412 | if (e != evas_object_evas_get(o)) | ||
1413 | { | ||
1414 | ERR("background not in ecore_evas_ews_evas_get() canvas!"); | ||
1415 | return; | ||
1416 | } | ||
1417 | |||
1418 | evas_output_viewport_get(e, NULL, NULL, &w, &h); | ||
1419 | evas_object_move(o, 0, 0); | ||
1420 | evas_object_resize(o, w, h); | ||
1421 | evas_object_layer_set(o, EVAS_LAYER_MIN); | ||
1422 | evas_object_lower(o); | ||
1423 | evas_object_show(o); | ||
1424 | |||
1425 | evas_object_event_callback_add | ||
1426 | (o, EVAS_CALLBACK_FREE, _ecore_evas_ews_background_free, NULL); | ||
1427 | } | ||
1428 | |||
1429 | _ews_bg = o; | ||
1430 | #else | ||
1431 | return; | ||
1432 | (void)o; | ||
1433 | #endif | ||
1434 | } | ||
1435 | |||
1436 | |||
1437 | EAPI const Eina_List * | ||
1438 | ecore_evas_ews_children_get(void) | ||
1439 | { | ||
1440 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1441 | return _ews_children; | ||
1442 | #else | ||
1443 | return NULL; | ||
1444 | #endif | ||
1445 | } | ||
1446 | |||
1447 | EAPI void | ||
1448 | ecore_evas_ews_manager_set(const void *manager) | ||
1449 | { | ||
1450 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1451 | if (_ews_manager == manager) return; | ||
1452 | _ews_manager = manager; | ||
1453 | ecore_event_add(ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE, NULL, NULL, NULL); | ||
1454 | #else | ||
1455 | (void)manager; | ||
1456 | #endif | ||
1457 | } | ||
1458 | |||
1459 | EAPI const void * | ||
1460 | ecore_evas_ews_manager_get(void) | ||
1461 | { | ||
1462 | #ifdef BUILD_ECORE_EVAS_EWS | ||
1463 | return _ews_manager; | ||
1464 | #else | ||
1465 | return NULL; | ||
1466 | #endif | ||
1467 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c deleted file mode 100644 index a7ea4c3..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c +++ /dev/null | |||
@@ -1,2169 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdio.h> | ||
6 | #include <stdlib.h> | ||
7 | #include <sys/types.h> | ||
8 | #include <unistd.h> | ||
9 | #include <math.h> | ||
10 | #include <time.h> | ||
11 | #ifdef HAVE_SYS_MMAN_H | ||
12 | # include <sys/mman.h> | ||
13 | #endif | ||
14 | #include <sys/stat.h> | ||
15 | #include <fcntl.h> | ||
16 | #include <string.h> | ||
17 | #include <sys/file.h> | ||
18 | #include <unistd.h> | ||
19 | |||
20 | #include <Ecore.h> | ||
21 | #include "ecore_private.h" | ||
22 | #include <Ecore_Input.h> | ||
23 | |||
24 | #ifdef BUILD_ECORE_EVAS_EXTN | ||
25 | |||
26 | #include <Ecore_Ipc.h> | ||
27 | |||
28 | #endif | ||
29 | |||
30 | #include "ecore_evas_private.h" | ||
31 | #include "Ecore_Evas.h" | ||
32 | |||
33 | |||
34 | #ifdef BUILD_ECORE_EVAS_EXTN | ||
35 | |||
36 | |||
37 | typedef struct _Shmfile Shmfile; | ||
38 | |||
39 | struct _Shmfile | ||
40 | { | ||
41 | int fd; | ||
42 | int size; | ||
43 | void *addr; | ||
44 | const char *file; | ||
45 | }; | ||
46 | |||
47 | static int blank = 0x00000000; | ||
48 | |||
49 | static Shmfile * | ||
50 | shmfile_new(const char *base, int id, int size, Eina_Bool sys) | ||
51 | { | ||
52 | Shmfile *sf; | ||
53 | char file[PATH_MAX]; | ||
54 | |||
55 | sf = calloc(1, sizeof(Shmfile)); | ||
56 | do | ||
57 | { | ||
58 | mode_t mode; | ||
59 | |||
60 | snprintf(file, sizeof(file), "/%s-%i-%i.%i.%i", | ||
61 | base, id, (int)time(NULL), (int)getpid(), (int)rand()); | ||
62 | mode = S_IRUSR | S_IWUSR; | ||
63 | if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; | ||
64 | sf->fd = shm_open(file, O_RDWR | O_CREAT | O_EXCL, mode); | ||
65 | } | ||
66 | while (sf->fd < 0); | ||
67 | |||
68 | sf->file = eina_stringshare_add(file); | ||
69 | if (!sf->file) | ||
70 | { | ||
71 | close(sf->fd); | ||
72 | shm_unlink(sf->file); | ||
73 | eina_stringshare_del(sf->file); | ||
74 | free(sf); | ||
75 | return NULL; | ||
76 | } | ||
77 | sf->size = size; | ||
78 | if (ftruncate(sf->fd, size) < 0) | ||
79 | { | ||
80 | close(sf->fd); | ||
81 | shm_unlink(sf->file); | ||
82 | eina_stringshare_del(sf->file); | ||
83 | free(sf); | ||
84 | return NULL; | ||
85 | } | ||
86 | sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0); | ||
87 | if (sf->addr == MAP_FAILED) | ||
88 | { | ||
89 | close(sf->fd); | ||
90 | shm_unlink(sf->file); | ||
91 | eina_stringshare_del(sf->file); | ||
92 | free(sf); | ||
93 | return NULL; | ||
94 | } | ||
95 | return sf; | ||
96 | } | ||
97 | |||
98 | void | ||
99 | shmfile_free(Shmfile *sf) | ||
100 | { | ||
101 | munmap(sf->addr, sf->size); | ||
102 | close(sf->fd); | ||
103 | shm_unlink(sf->file); | ||
104 | eina_stringshare_del(sf->file); | ||
105 | free(sf); | ||
106 | } | ||
107 | |||
108 | static Shmfile * | ||
109 | shmfile_open(const char *ref, int size, Eina_Bool sys) | ||
110 | { | ||
111 | Shmfile *sf; | ||
112 | mode_t mode; | ||
113 | |||
114 | sf = calloc(1, sizeof(Shmfile)); | ||
115 | mode = S_IRUSR | S_IWUSR; | ||
116 | if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; | ||
117 | sf->fd = shm_open(ref, O_RDWR, mode); | ||
118 | if (sf->fd < 0) | ||
119 | { | ||
120 | free(sf); | ||
121 | return NULL; | ||
122 | } | ||
123 | sf->file = eina_stringshare_add(ref); | ||
124 | if (!sf->file) | ||
125 | { | ||
126 | close(sf->fd); | ||
127 | eina_stringshare_del(sf->file); | ||
128 | free(sf); | ||
129 | return NULL; | ||
130 | } | ||
131 | sf->size = size; | ||
132 | sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0); | ||
133 | if (sf->addr == MAP_FAILED) | ||
134 | { | ||
135 | close(sf->fd); | ||
136 | eina_stringshare_del(sf->file); | ||
137 | free(sf); | ||
138 | return NULL; | ||
139 | } | ||
140 | return sf; | ||
141 | } | ||
142 | |||
143 | void | ||
144 | shmfile_close(Shmfile *sf) | ||
145 | { | ||
146 | munmap(sf->addr, sf->size); | ||
147 | close(sf->fd); | ||
148 | eina_stringshare_del(sf->file); | ||
149 | free(sf); | ||
150 | } | ||
151 | |||
152 | // procotol version - change this as needed | ||
153 | #define MAJOR 0x1011 | ||
154 | |||
155 | enum // opcodes | ||
156 | { | ||
157 | OP_RESIZE, | ||
158 | OP_SHOW, | ||
159 | OP_HIDE, | ||
160 | OP_FOCUS, | ||
161 | OP_UNFOCUS, | ||
162 | OP_UPDATE, | ||
163 | OP_UPDATE_DONE, | ||
164 | OP_LOCK_FILE, | ||
165 | OP_SHM_REF, | ||
166 | OP_EV_MOUSE_IN, | ||
167 | OP_EV_MOUSE_OUT, | ||
168 | OP_EV_MOUSE_UP, | ||
169 | OP_EV_MOUSE_DOWN, | ||
170 | OP_EV_MOUSE_MOVE, | ||
171 | OP_EV_MOUSE_WHEEL, | ||
172 | OP_EV_MULTI_UP, | ||
173 | OP_EV_MULTI_DOWN, | ||
174 | OP_EV_MULTI_MOVE, | ||
175 | OP_EV_KEY_UP, | ||
176 | OP_EV_KEY_DOWN, | ||
177 | OP_EV_HOLD | ||
178 | }; | ||
179 | |||
180 | enum | ||
181 | { | ||
182 | MOD_SHIFT = (1 << 0), | ||
183 | MOD_CTRL = (1 << 1), | ||
184 | MOD_ALT = (1 << 2), | ||
185 | MOD_META = (1 << 3), | ||
186 | MOD_HYPER = (1 << 4), | ||
187 | MOD_SUPER = (1 << 5), | ||
188 | MOD_CAPS = (1 << 6), | ||
189 | MOD_NUM = (1 << 7), | ||
190 | MOD_SCROLL = (1 << 8), | ||
191 | }; | ||
192 | |||
193 | typedef struct _Ipc_Data_Resize Ipc_Data_Resize; | ||
194 | typedef struct _Ipc_Data_Update Ipc_Data_Update; | ||
195 | typedef struct _Ipc_Data_Ev_Mouse_In Ipc_Data_Ev_Mouse_In; | ||
196 | typedef struct _Ipc_Data_Ev_Mouse_Out Ipc_Data_Ev_Mouse_Out; | ||
197 | typedef struct _Ipc_Data_Ev_Mouse_Up Ipc_Data_Ev_Mouse_Up; | ||
198 | typedef struct _Ipc_Data_Ev_Mouse_Down Ipc_Data_Ev_Mouse_Down; | ||
199 | typedef struct _Ipc_Data_Ev_Mouse_Move Ipc_Data_Ev_Mouse_Move; | ||
200 | typedef struct _Ipc_Data_Ev_Mouse_Wheel Ipc_Data_Ev_Mouse_Wheel; | ||
201 | typedef struct _Ipc_Data_Ev_Hold Ipc_Data_Ev_Hold; | ||
202 | typedef struct _Ipc_Data_Ev_Multi_Up Ipc_Data_Ev_Multi_Up; | ||
203 | typedef struct _Ipc_Data_Ev_Multi_Down Ipc_Data_Ev_Multi_Down; | ||
204 | typedef struct _Ipc_Data_Ev_Multi_Move Ipc_Data_Ev_Multi_Move; | ||
205 | typedef struct _Ipc_Data_Ev_Key_Up Ipc_Data_Ev_Key_Up; | ||
206 | typedef struct _Ipc_Data_Ev_Key_Down Ipc_Data_Ev_Key_Down; | ||
207 | |||
208 | struct _Ipc_Data_Resize | ||
209 | { | ||
210 | int w, h; | ||
211 | }; | ||
212 | |||
213 | struct _Ipc_Data_Update | ||
214 | { | ||
215 | int x, w, y, h; | ||
216 | }; | ||
217 | |||
218 | struct _Ipc_Data_Ev_Mouse_In | ||
219 | { | ||
220 | unsigned int timestamp; | ||
221 | int mask; | ||
222 | Evas_Event_Flags event_flags; | ||
223 | }; | ||
224 | |||
225 | struct _Ipc_Data_Ev_Mouse_Out | ||
226 | { | ||
227 | unsigned int timestamp; | ||
228 | int mask; | ||
229 | Evas_Event_Flags event_flags; | ||
230 | }; | ||
231 | |||
232 | struct _Ipc_Data_Ev_Mouse_Up | ||
233 | { | ||
234 | int b; | ||
235 | Evas_Button_Flags flags; | ||
236 | int mask; | ||
237 | unsigned int timestamp; | ||
238 | Evas_Event_Flags event_flags; | ||
239 | }; | ||
240 | |||
241 | struct _Ipc_Data_Ev_Mouse_Down | ||
242 | { | ||
243 | int b; | ||
244 | Evas_Button_Flags flags; | ||
245 | int mask; | ||
246 | unsigned int timestamp; | ||
247 | Evas_Event_Flags event_flags; | ||
248 | }; | ||
249 | |||
250 | struct _Ipc_Data_Ev_Mouse_Move | ||
251 | { | ||
252 | int x, y; | ||
253 | Evas_Button_Flags flags; | ||
254 | int mask; | ||
255 | unsigned int timestamp; | ||
256 | Evas_Event_Flags event_flags; | ||
257 | }; | ||
258 | |||
259 | struct _Ipc_Data_Ev_Mouse_Wheel | ||
260 | { | ||
261 | int direction, z; | ||
262 | Evas_Button_Flags flags; | ||
263 | int mask; | ||
264 | unsigned int timestamp; | ||
265 | Evas_Event_Flags event_flags; | ||
266 | }; | ||
267 | |||
268 | struct _Ipc_Data_Ev_Hold | ||
269 | { | ||
270 | int hold; | ||
271 | unsigned int timestamp; | ||
272 | Evas_Event_Flags event_flags; | ||
273 | }; | ||
274 | |||
275 | struct _Ipc_Data_Ev_Multi_Up | ||
276 | { | ||
277 | Evas_Button_Flags flags; | ||
278 | int d, x, y; | ||
279 | double rad, radx, rady, pres, ang, fx, fy; | ||
280 | int mask; | ||
281 | unsigned int timestamp; | ||
282 | Evas_Event_Flags event_flags; | ||
283 | }; | ||
284 | |||
285 | struct _Ipc_Data_Ev_Multi_Down | ||
286 | { | ||
287 | Evas_Button_Flags flags; | ||
288 | int d, x, y; | ||
289 | double rad, radx, rady, pres, ang, fx, fy; | ||
290 | int mask; | ||
291 | unsigned int timestamp; | ||
292 | Evas_Event_Flags event_flags; | ||
293 | }; | ||
294 | |||
295 | struct _Ipc_Data_Ev_Multi_Move | ||
296 | { | ||
297 | int d, x, y; | ||
298 | double rad, radx, rady, pres, ang, fx, fy; | ||
299 | int mask; | ||
300 | unsigned int timestamp; | ||
301 | Evas_Event_Flags event_flags; | ||
302 | }; | ||
303 | |||
304 | struct _Ipc_Data_Ev_Key_Up | ||
305 | { | ||
306 | const char *keyname, *key, *string, *compose; | ||
307 | int mask; | ||
308 | unsigned int timestamp; | ||
309 | Evas_Event_Flags event_flags; | ||
310 | }; | ||
311 | |||
312 | struct _Ipc_Data_Ev_Key_Down | ||
313 | { | ||
314 | const char *keyname, *key, *string, *compose; | ||
315 | int mask; | ||
316 | unsigned int timestamp; | ||
317 | Evas_Event_Flags event_flags; | ||
318 | }; | ||
319 | |||
320 | typedef struct _Extn Extn; | ||
321 | |||
322 | struct _Extn | ||
323 | { | ||
324 | struct { | ||
325 | Ecore_Ipc_Server *server; | ||
326 | Eina_List *clients; | ||
327 | Eina_List *handlers; | ||
328 | Eina_Bool am_server : 1; | ||
329 | } ipc; | ||
330 | struct { | ||
331 | const char *name; | ||
332 | int num; | ||
333 | Eina_Bool sys : 1; | ||
334 | } svc; | ||
335 | struct { | ||
336 | const char *lock; | ||
337 | int lockfd; | ||
338 | const char *shm; | ||
339 | int w, h; | ||
340 | Shmfile *shmfile; | ||
341 | Eina_List *updates; | ||
342 | Eina_Bool have_lock : 1; | ||
343 | } file; | ||
344 | }; | ||
345 | |||
346 | static Eina_List *extn_ee_list = NULL; | ||
347 | |||
348 | EAPI int ECORE_EVAS_EXTN_CLIENT_ADD = 0; | ||
349 | EAPI int ECORE_EVAS_EXTN_CLIENT_DEL = 0; | ||
350 | |||
351 | void | ||
352 | _ecore_evas_extn_init(void) | ||
353 | { | ||
354 | if (ECORE_EVAS_EXTN_CLIENT_ADD) return; | ||
355 | ECORE_EVAS_EXTN_CLIENT_ADD = ecore_event_type_new(); | ||
356 | ECORE_EVAS_EXTN_CLIENT_DEL = ecore_event_type_new(); | ||
357 | } | ||
358 | |||
359 | void | ||
360 | _ecore_evas_extn_shutdown(void) | ||
361 | { | ||
362 | } | ||
363 | |||
364 | static void | ||
365 | _ecore_evas_extn_event_free(void *data, void *ev __UNUSED__) | ||
366 | { | ||
367 | Ecore_Evas *ee = data; | ||
368 | if (ee->engine.buffer.image) | ||
369 | evas_object_unref(ee->engine.buffer.image); | ||
370 | _ecore_evas_unref(ee); | ||
371 | } | ||
372 | |||
373 | static void | ||
374 | _ecore_evas_extn_event(Ecore_Evas *ee, int event) | ||
375 | { | ||
376 | _ecore_evas_ref(ee); | ||
377 | if (ee->engine.buffer.image) | ||
378 | evas_object_ref(ee->engine.buffer.image); | ||
379 | ecore_event_add(event, ee->engine.buffer.image, | ||
380 | _ecore_evas_extn_event_free, ee); | ||
381 | } | ||
382 | |||
383 | static void | ||
384 | _ecore_evas_socket_lock(Ecore_Evas *ee) | ||
385 | { | ||
386 | Extn *extn; | ||
387 | |||
388 | extn = ee->engine.buffer.data; | ||
389 | if (!extn) return; | ||
390 | if (extn->file.lockfd < 0) return; | ||
391 | if (extn->file.have_lock) return; | ||
392 | flock(extn->file.lockfd, LOCK_EX); | ||
393 | extn->file.have_lock = EINA_TRUE; | ||
394 | } | ||
395 | |||
396 | static void | ||
397 | _ecore_evas_socket_unlock(Ecore_Evas *ee) | ||
398 | { | ||
399 | Extn *extn; | ||
400 | |||
401 | extn = ee->engine.buffer.data; | ||
402 | if (!extn) return; | ||
403 | if (extn->file.lockfd < 0) return; | ||
404 | if (!extn->file.have_lock) return; | ||
405 | flock(extn->file.lockfd, LOCK_UN); | ||
406 | extn->file.have_lock = EINA_FALSE; | ||
407 | } | ||
408 | |||
409 | static void | ||
410 | _ecore_evas_extn_plug_targer_render_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
411 | { | ||
412 | Ecore_Evas *ee = data; | ||
413 | if (ee) _ecore_evas_socket_lock(ee); | ||
414 | } | ||
415 | |||
416 | static void | ||
417 | _ecore_evas_extn_plug_targer_render_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
418 | { | ||
419 | Ecore_Evas *ee = data; | ||
420 | if (ee) _ecore_evas_socket_unlock(ee); | ||
421 | } | ||
422 | |||
423 | static void | ||
424 | _ecore_evas_extn_plug_image_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
425 | { | ||
426 | Ecore_Evas *ee = data; | ||
427 | if (ee) ecore_evas_free(ee); | ||
428 | } | ||
429 | |||
430 | static void | ||
431 | _ecore_evas_extn_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) | ||
432 | { | ||
433 | Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; | ||
434 | |||
435 | evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh); | ||
436 | evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh); | ||
437 | |||
438 | if (fw < 1) fw = 1; | ||
439 | if (fh < 1) fh = 1; | ||
440 | |||
441 | if (evas_object_map_get(ee->engine.buffer.image) && | ||
442 | evas_object_map_enable_get(ee->engine.buffer.image)) | ||
443 | { | ||
444 | fx = 0; fy = 0; | ||
445 | fw = ee->w; fh = ee->h; | ||
446 | ww = ee->w; hh = ee->h; | ||
447 | } | ||
448 | |||
449 | if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) | ||
450 | { | ||
451 | *x = (ee->w * (*x - xx)) / fw; | ||
452 | *y = (ee->h * (*y - yy)) / fh; | ||
453 | } | ||
454 | else | ||
455 | { | ||
456 | xx = (*x - xx) - fx; | ||
457 | while (xx < 0) xx += fw; | ||
458 | while (xx > fw) xx -= fw; | ||
459 | *x = (ee->w * xx) / fw; | ||
460 | |||
461 | yy = (*y - yy) - fy; | ||
462 | while (yy < 0) yy += fh; | ||
463 | while (yy > fh) yy -= fh; | ||
464 | *y = (ee->h * yy) / fh; | ||
465 | } | ||
466 | } | ||
467 | |||
468 | static void | ||
469 | _ecore_evas_extn_free(Ecore_Evas *ee) | ||
470 | { | ||
471 | Extn *extn; | ||
472 | Ecore_Ipc_Client *client; | ||
473 | |||
474 | extn = ee->engine.buffer.data; | ||
475 | if (extn) | ||
476 | { | ||
477 | Ecore_Event_Handler *hdl; | ||
478 | |||
479 | if (extn->file.have_lock) | ||
480 | _ecore_evas_socket_unlock(ee); | ||
481 | if (extn->file.lockfd) | ||
482 | { | ||
483 | close(extn->file.lockfd); | ||
484 | if (extn->ipc.am_server) | ||
485 | { | ||
486 | if (extn->file.lock) unlink(extn->file.lock); | ||
487 | } | ||
488 | } | ||
489 | if (extn->svc.name) eina_stringshare_del(extn->svc.name); | ||
490 | if (extn->ipc.clients) | ||
491 | { | ||
492 | EINA_LIST_FREE(extn->ipc.clients, client) | ||
493 | ecore_ipc_client_del(client); | ||
494 | } | ||
495 | if (extn->ipc.server) ecore_ipc_server_del(extn->ipc.server); | ||
496 | if (extn->file.lock) eina_stringshare_del(extn->file.lock); | ||
497 | if (extn->file.shm) eina_stringshare_del(extn->file.shm); | ||
498 | if (extn->file.shmfile) | ||
499 | { | ||
500 | if (extn->ipc.am_server) | ||
501 | shmfile_free(extn->file.shmfile); | ||
502 | else | ||
503 | shmfile_close(extn->file.shmfile); | ||
504 | } | ||
505 | |||
506 | EINA_LIST_FREE(extn->ipc.handlers, hdl) | ||
507 | ecore_event_handler_del(hdl); | ||
508 | free(extn); | ||
509 | ecore_ipc_shutdown(); | ||
510 | ee->engine.buffer.data = NULL; | ||
511 | } | ||
512 | if (ee->engine.buffer.image) | ||
513 | { | ||
514 | Ecore_Evas *ee2; | ||
515 | |||
516 | evas_object_event_callback_del_full(ee->engine.buffer.image, | ||
517 | EVAS_CALLBACK_DEL, | ||
518 | _ecore_evas_extn_plug_image_obj_del, | ||
519 | ee); | ||
520 | evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image), | ||
521 | EVAS_CALLBACK_RENDER_PRE, | ||
522 | _ecore_evas_extn_plug_targer_render_pre, | ||
523 | ee); | ||
524 | evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image), | ||
525 | EVAS_CALLBACK_RENDER_POST, | ||
526 | _ecore_evas_extn_plug_targer_render_post, | ||
527 | ee); | ||
528 | evas_object_del(ee->engine.buffer.image); | ||
529 | ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent"); | ||
530 | if (ee2) | ||
531 | { | ||
532 | ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee); | ||
533 | } | ||
534 | } | ||
535 | extn_ee_list = eina_list_remove(extn_ee_list, ee); | ||
536 | } | ||
537 | |||
538 | static void | ||
539 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
540 | { | ||
541 | if (w < 1) w = 1; | ||
542 | if (h < 1) h = 1; | ||
543 | ee->req.w = w; | ||
544 | ee->req.h = h; | ||
545 | if ((w == ee->w) && (h == ee->h)) return; | ||
546 | ee->w = w; | ||
547 | ee->h = h; | ||
548 | |||
549 | /* | ||
550 | * No need for it if not used later. | ||
551 | Extn *extn; | ||
552 | |||
553 | extn = ee->engine.buffer.data; | ||
554 | */ | ||
555 | if (ee->engine.buffer.image) | ||
556 | evas_object_image_size_set(ee->engine.buffer.image, ee->w, ee->h); | ||
557 | /* Server can have many plugs, so I block resize comand from client to server * | ||
558 | if ((extn) && (extn->ipc.server)) | ||
559 | { | ||
560 | Ipc_Data_Resize ipc; | ||
561 | |||
562 | ipc.w = ee->w; | ||
563 | ipc.h = ee->h; | ||
564 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_RESIZE, 0, 0, 0, &ipc, sizeof(ipc)); | ||
565 | }*/ | ||
566 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
567 | } | ||
568 | |||
569 | static void | ||
570 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
571 | { | ||
572 | _ecore_evas_resize(ee, w, h); | ||
573 | } | ||
574 | |||
575 | static int | ||
576 | _ecore_evas_modifiers_locks_mask_get(Evas *e) | ||
577 | { | ||
578 | int mask = 0; | ||
579 | |||
580 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | ||
581 | mask |= MOD_SHIFT; | ||
582 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
583 | mask |= MOD_CTRL; | ||
584 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
585 | mask |= MOD_ALT; | ||
586 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
587 | mask |= MOD_META; | ||
588 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
589 | mask |= MOD_HYPER; | ||
590 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
591 | mask |= MOD_SUPER; | ||
592 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
593 | mask |= MOD_SCROLL; | ||
594 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
595 | mask |= MOD_NUM; | ||
596 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
597 | mask |= MOD_CAPS; | ||
598 | return mask; | ||
599 | } | ||
600 | |||
601 | static void | ||
602 | _ecore_evas_modifiers_locks_mask_set(Evas *e, int mask) | ||
603 | { | ||
604 | if (mask & MOD_SHIFT) evas_key_modifier_on (e, "Shift"); | ||
605 | else evas_key_modifier_off(e, "Shift"); | ||
606 | if (mask & MOD_CTRL) evas_key_modifier_on (e, "Control"); | ||
607 | else evas_key_modifier_off(e, "Control"); | ||
608 | if (mask & MOD_ALT) evas_key_modifier_on (e, "Alt"); | ||
609 | else evas_key_modifier_off(e, "Alt"); | ||
610 | if (mask & MOD_META) evas_key_modifier_on (e, "Meta"); | ||
611 | else evas_key_modifier_off(e, "Meta"); | ||
612 | if (mask & MOD_HYPER) evas_key_modifier_on (e, "Hyper"); | ||
613 | else evas_key_modifier_off(e, "Hyper"); | ||
614 | if (mask & MOD_SUPER) evas_key_modifier_on (e, "Super"); | ||
615 | else evas_key_modifier_off(e, "Super"); | ||
616 | if (mask & MOD_SCROLL) evas_key_lock_on (e, "Scroll_Lock"); | ||
617 | else evas_key_lock_off(e, "Scroll_Lock"); | ||
618 | if (mask & MOD_NUM) evas_key_lock_on (e, "Num_Lock"); | ||
619 | else evas_key_lock_off(e, "Num_Lock"); | ||
620 | if (mask & MOD_CAPS) evas_key_lock_on (e, "Caps_Lock"); | ||
621 | else evas_key_lock_off(e, "Caps_Lock"); | ||
622 | } | ||
623 | |||
624 | static void | ||
625 | _ecore_evas_extn_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
626 | { | ||
627 | Ecore_Evas *ee = data; | ||
628 | Evas_Event_Mouse_In *ev = event_info; | ||
629 | Extn *extn; | ||
630 | |||
631 | extn = ee->engine.buffer.data; | ||
632 | if (!extn) return; | ||
633 | if (extn->ipc.server) | ||
634 | { | ||
635 | Ipc_Data_Ev_Mouse_In ipc; | ||
636 | |||
637 | ipc.timestamp = ev->timestamp; | ||
638 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
639 | ipc.event_flags = ev->event_flags; | ||
640 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_IN, 0, 0, 0, &ipc, sizeof(ipc)); | ||
641 | } | ||
642 | } | ||
643 | |||
644 | static void | ||
645 | _ecore_evas_extn_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
646 | { | ||
647 | Ecore_Evas *ee = data; | ||
648 | Evas_Event_Mouse_Out *ev = event_info; | ||
649 | Extn *extn; | ||
650 | |||
651 | extn = ee->engine.buffer.data; | ||
652 | if (!extn) return; | ||
653 | if (extn->ipc.server) | ||
654 | { | ||
655 | Ipc_Data_Ev_Mouse_Out ipc; | ||
656 | |||
657 | ipc.timestamp = ev->timestamp; | ||
658 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
659 | ipc.event_flags = ev->event_flags; | ||
660 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_OUT, 0, 0, 0, &ipc, sizeof(ipc)); | ||
661 | } | ||
662 | } | ||
663 | |||
664 | static void | ||
665 | _ecore_evas_extn_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
666 | { | ||
667 | Ecore_Evas *ee = data; | ||
668 | Evas_Event_Mouse_Down *ev = event_info; | ||
669 | Extn *extn; | ||
670 | |||
671 | extn = ee->engine.buffer.data; | ||
672 | if (!extn) return; | ||
673 | if (extn->ipc.server) | ||
674 | { | ||
675 | Ipc_Data_Ev_Mouse_Down ipc; | ||
676 | |||
677 | ipc.b = ev->button; | ||
678 | ipc.flags = ev->flags; | ||
679 | ipc.timestamp = ev->timestamp; | ||
680 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
681 | ipc.event_flags = ev->event_flags; | ||
682 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_DOWN, 0, 0, 0, &ipc, sizeof(ipc)); | ||
683 | } | ||
684 | } | ||
685 | |||
686 | static void | ||
687 | _ecore_evas_extn_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
688 | { | ||
689 | Ecore_Evas *ee = data; | ||
690 | Evas_Event_Mouse_Up *ev = event_info; | ||
691 | Extn *extn; | ||
692 | |||
693 | extn = ee->engine.buffer.data; | ||
694 | if (!extn) return; | ||
695 | if (extn->ipc.server) | ||
696 | { | ||
697 | Ipc_Data_Ev_Mouse_Up ipc; | ||
698 | |||
699 | ipc.b = ev->button; | ||
700 | ipc.flags = ev->flags; | ||
701 | ipc.timestamp = ev->timestamp; | ||
702 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
703 | ipc.event_flags = ev->event_flags; | ||
704 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_UP, 0, 0, 0, &ipc, sizeof(ipc)); | ||
705 | } | ||
706 | } | ||
707 | |||
708 | static void | ||
709 | _ecore_evas_extn_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
710 | { | ||
711 | Ecore_Evas *ee = data; | ||
712 | Evas_Event_Mouse_Move *ev = event_info; | ||
713 | Extn *extn; | ||
714 | |||
715 | extn = ee->engine.buffer.data; | ||
716 | if (!extn) return; | ||
717 | if (extn->ipc.server) | ||
718 | { | ||
719 | Ipc_Data_Ev_Mouse_Move ipc; | ||
720 | Evas_Coord x, y; | ||
721 | |||
722 | x = ev->cur.canvas.x; | ||
723 | y = ev->cur.canvas.y; | ||
724 | _ecore_evas_extn_coord_translate(ee, &x, &y); | ||
725 | ipc.x = x; | ||
726 | ipc.y = y; | ||
727 | ipc.timestamp = ev->timestamp; | ||
728 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
729 | ipc.event_flags = ev->event_flags; | ||
730 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_MOVE, 0, 0, 0, &ipc, sizeof(ipc)); | ||
731 | } | ||
732 | } | ||
733 | |||
734 | static void | ||
735 | _ecore_evas_extn_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
736 | { | ||
737 | Ecore_Evas *ee = data; | ||
738 | Evas_Event_Mouse_Wheel *ev = event_info; | ||
739 | Extn *extn; | ||
740 | |||
741 | extn = ee->engine.buffer.data; | ||
742 | if (!extn) return; | ||
743 | if (extn->ipc.server) | ||
744 | { | ||
745 | Ipc_Data_Ev_Mouse_Wheel ipc; | ||
746 | |||
747 | ipc.direction = ev->direction; | ||
748 | ipc.z = ev->z; | ||
749 | ipc.timestamp = ev->timestamp; | ||
750 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
751 | ipc.event_flags = ev->event_flags; | ||
752 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_WHEEL, 0, 0, 0, &ipc, sizeof(ipc)); | ||
753 | } | ||
754 | } | ||
755 | |||
756 | static void | ||
757 | _ecore_evas_extn_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
758 | { | ||
759 | Ecore_Evas *ee = data; | ||
760 | Evas_Event_Multi_Down *ev = event_info; | ||
761 | Extn *extn; | ||
762 | |||
763 | extn = ee->engine.buffer.data; | ||
764 | if (!extn) return; | ||
765 | if (extn->ipc.server) | ||
766 | { | ||
767 | Ipc_Data_Ev_Multi_Down ipc; | ||
768 | Evas_Coord x, y; | ||
769 | |||
770 | ipc.d = ev->device; | ||
771 | x = ev->canvas.x; | ||
772 | y = ev->canvas.y; | ||
773 | _ecore_evas_extn_coord_translate(ee, &x, &y); | ||
774 | ipc.x = x; | ||
775 | ipc.y = y; | ||
776 | ipc.rad = ev->radius; | ||
777 | ipc.radx = ev->radius_x; | ||
778 | ipc.rady = ev->radius_y; | ||
779 | ipc.pres = ev->pressure; | ||
780 | ipc.ang = ev->angle; | ||
781 | ipc.fx = ev->canvas.xsub; | ||
782 | ipc.fy = ev->canvas.ysub; | ||
783 | ipc.flags = ev->flags; | ||
784 | ipc.timestamp = ev->timestamp; | ||
785 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
786 | ipc.event_flags = ev->event_flags; | ||
787 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_DOWN, 0, 0, 0, &ipc, sizeof(ipc)); | ||
788 | } | ||
789 | } | ||
790 | |||
791 | |||
792 | static void | ||
793 | _ecore_evas_extn_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
794 | { | ||
795 | Ecore_Evas *ee = data; | ||
796 | Evas_Event_Multi_Up *ev = event_info; | ||
797 | Extn *extn; | ||
798 | |||
799 | extn = ee->engine.buffer.data; | ||
800 | if (!extn) return; | ||
801 | if (extn->ipc.server) | ||
802 | { | ||
803 | Ipc_Data_Ev_Multi_Up ipc; | ||
804 | Evas_Coord x, y; | ||
805 | |||
806 | ipc.d = ev->device; | ||
807 | x = ev->canvas.x; | ||
808 | y = ev->canvas.y; | ||
809 | _ecore_evas_extn_coord_translate(ee, &x, &y); | ||
810 | ipc.x = x; | ||
811 | ipc.y = y; | ||
812 | ipc.rad = ev->radius; | ||
813 | ipc.radx = ev->radius_x; | ||
814 | ipc.rady = ev->radius_y; | ||
815 | ipc.pres = ev->pressure; | ||
816 | ipc.ang = ev->angle; | ||
817 | ipc.fx = ev->canvas.xsub; | ||
818 | ipc.fy = ev->canvas.ysub; | ||
819 | ipc.flags = ev->flags; | ||
820 | ipc.timestamp = ev->timestamp; | ||
821 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
822 | ipc.event_flags = ev->event_flags; | ||
823 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_UP, 0, 0, 0, &ipc, sizeof(ipc)); | ||
824 | } | ||
825 | } | ||
826 | |||
827 | static void | ||
828 | _ecore_evas_extn_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
829 | { | ||
830 | Ecore_Evas *ee = data; | ||
831 | Evas_Event_Multi_Move *ev = event_info; | ||
832 | Extn *extn; | ||
833 | |||
834 | extn = ee->engine.buffer.data; | ||
835 | if (!extn) return; | ||
836 | if (extn->ipc.server) | ||
837 | { | ||
838 | Ipc_Data_Ev_Multi_Move ipc; | ||
839 | Evas_Coord x, y; | ||
840 | |||
841 | ipc.d = ev->device; | ||
842 | x = ev->cur.canvas.x; | ||
843 | y = ev->cur.canvas.y; | ||
844 | _ecore_evas_extn_coord_translate(ee, &x, &y); | ||
845 | ipc.x = x; | ||
846 | ipc.y = y; | ||
847 | ipc.rad = ev->radius; | ||
848 | ipc.radx = ev->radius_x; | ||
849 | ipc.rady = ev->radius_y; | ||
850 | ipc.pres = ev->pressure; | ||
851 | ipc.ang = ev->angle; | ||
852 | ipc.fx = ev->cur.canvas.xsub; | ||
853 | ipc.fy = ev->cur.canvas.ysub; | ||
854 | ipc.timestamp = ev->timestamp; | ||
855 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
856 | ipc.event_flags = ev->event_flags; | ||
857 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_MOVE, 0, 0, 0, &ipc, sizeof(ipc)); | ||
858 | } | ||
859 | } | ||
860 | |||
861 | static void | ||
862 | _ecore_evas_extn_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
863 | { | ||
864 | Ecore_Evas *ee; | ||
865 | |||
866 | ee = data; | ||
867 | if (ee->driver) _ecore_evas_free(ee); | ||
868 | } | ||
869 | |||
870 | static void | ||
871 | _ecore_evas_extn_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
872 | { | ||
873 | Ecore_Evas *ee = data; | ||
874 | Evas_Event_Key_Down *ev = event_info; | ||
875 | Extn *extn; | ||
876 | |||
877 | extn = ee->engine.buffer.data; | ||
878 | if (!extn) return; | ||
879 | if (extn->ipc.server) | ||
880 | { | ||
881 | Ipc_Data_Ev_Key_Down *ipc; | ||
882 | char *st, *p; | ||
883 | int len = 0; | ||
884 | |||
885 | len = sizeof(Ipc_Data_Ev_Key_Down); | ||
886 | if (ev->key) len += strlen(ev->key) + 1; | ||
887 | if (ev->keyname) len += strlen(ev->keyname) + 1; | ||
888 | if (ev->string) len += strlen(ev->string) + 1; | ||
889 | if (ev->compose) len += strlen(ev->compose) + 1; | ||
890 | len += 1; | ||
891 | st = alloca(len); | ||
892 | ipc = (Ipc_Data_Ev_Key_Down *)st; | ||
893 | memset(st, 0, len); | ||
894 | p = st + sizeof(Ipc_Data_Ev_Key_Down); | ||
895 | if (ev->key) | ||
896 | { | ||
897 | strcpy(p, ev->key); | ||
898 | ipc->key = p - (long)st; | ||
899 | p += strlen(p) + 1; | ||
900 | } | ||
901 | if (ev->keyname) | ||
902 | { | ||
903 | strcpy(p, ev->keyname); | ||
904 | ipc->keyname = p - (long)st; | ||
905 | p += strlen(p) + 1; | ||
906 | } | ||
907 | if (ev->string) | ||
908 | { | ||
909 | strcpy(p, ev->string); | ||
910 | ipc->string = p - (long)st; | ||
911 | p += strlen(p) + 1; | ||
912 | } | ||
913 | if (ev->compose) | ||
914 | { | ||
915 | strcpy(p, ev->compose); | ||
916 | ipc->compose = p - (long)st; | ||
917 | p += strlen(p) + 1; | ||
918 | } | ||
919 | ipc->timestamp = ev->timestamp; | ||
920 | ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
921 | ipc->event_flags = ev->event_flags; | ||
922 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_DOWN, 0, 0, 0, ipc, len); | ||
923 | } | ||
924 | } | ||
925 | |||
926 | static void | ||
927 | _ecore_evas_extn_cb_key_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
928 | { | ||
929 | Ecore_Evas *ee = data; | ||
930 | Evas_Event_Key_Up *ev = event_info; | ||
931 | Extn *extn; | ||
932 | |||
933 | extn = ee->engine.buffer.data; | ||
934 | if (!extn) return; | ||
935 | if (extn->ipc.server) | ||
936 | { | ||
937 | Ipc_Data_Ev_Key_Up *ipc; | ||
938 | char *st, *p; | ||
939 | int len = 0; | ||
940 | |||
941 | len = sizeof(Ipc_Data_Ev_Key_Up); | ||
942 | if (ev->key) len += strlen(ev->key) + 1; | ||
943 | if (ev->keyname) len += strlen(ev->keyname) + 1; | ||
944 | if (ev->string) len += strlen(ev->string) + 1; | ||
945 | if (ev->compose) len += strlen(ev->compose) + 1; | ||
946 | len += 1; | ||
947 | st = alloca(len); | ||
948 | ipc = (Ipc_Data_Ev_Key_Up *)st; | ||
949 | memset(st, 0, len); | ||
950 | p = st + sizeof(Ipc_Data_Ev_Key_Down); | ||
951 | if (ev->key) | ||
952 | { | ||
953 | strcpy(p, ev->key); | ||
954 | ipc->key = p - (long)st; | ||
955 | p += strlen(p) + 1; | ||
956 | } | ||
957 | if (ev->keyname) | ||
958 | { | ||
959 | strcpy(p, ev->keyname); | ||
960 | ipc->keyname = p - (long)st; | ||
961 | p += strlen(p) + 1; | ||
962 | } | ||
963 | if (ev->string) | ||
964 | { | ||
965 | strcpy(p, ev->string); | ||
966 | ipc->string = p - (long)st; | ||
967 | p += strlen(p) + 1; | ||
968 | } | ||
969 | if (ev->compose) | ||
970 | { | ||
971 | strcpy(p, ev->compose); | ||
972 | ipc->compose = p - (long)st; | ||
973 | p += strlen(p) + 1; | ||
974 | } | ||
975 | ipc->timestamp = ev->timestamp; | ||
976 | ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
977 | ipc->event_flags = ev->event_flags; | ||
978 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_UP, 0, 0, 0, ipc, len); | ||
979 | } | ||
980 | } | ||
981 | |||
982 | static void | ||
983 | _ecore_evas_extn_cb_hold(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
984 | { | ||
985 | Ecore_Evas *ee = data; | ||
986 | Evas_Event_Hold *ev = event_info; | ||
987 | Extn *extn; | ||
988 | |||
989 | extn = ee->engine.buffer.data; | ||
990 | if (!extn) return; | ||
991 | if (extn->ipc.server) | ||
992 | { | ||
993 | Ipc_Data_Ev_Hold ipc; | ||
994 | |||
995 | ipc.hold = ev->hold; | ||
996 | ipc.timestamp = ev->timestamp; | ||
997 | ipc.event_flags = ev->event_flags; | ||
998 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_HOLD, 0, 0, 0, &ipc, sizeof(ipc)); | ||
999 | } | ||
1000 | } | ||
1001 | |||
1002 | static void | ||
1003 | _ecore_evas_extn_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1004 | { | ||
1005 | Ecore_Evas *ee; | ||
1006 | Extn *extn; | ||
1007 | |||
1008 | ee = data; | ||
1009 | ee->prop.focused = 1; | ||
1010 | extn = ee->engine.buffer.data; | ||
1011 | if (!extn) return; | ||
1012 | if (!extn->ipc.server) return; | ||
1013 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_FOCUS, 0, 0, 0, NULL, 0); | ||
1014 | } | ||
1015 | |||
1016 | static void | ||
1017 | _ecore_evas_extn_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1018 | { | ||
1019 | Ecore_Evas *ee; | ||
1020 | Extn *extn; | ||
1021 | |||
1022 | ee = data; | ||
1023 | ee->prop.focused = 0; | ||
1024 | extn = ee->engine.buffer.data; | ||
1025 | if (!extn) return; | ||
1026 | if (!extn->ipc.server) return; | ||
1027 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_UNFOCUS, 0, 0, 0, NULL, 0); | ||
1028 | } | ||
1029 | |||
1030 | static void | ||
1031 | _ecore_evas_extn_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1032 | { | ||
1033 | Ecore_Evas *ee; | ||
1034 | Extn *extn; | ||
1035 | |||
1036 | ee = data; | ||
1037 | ee->visible = 1; | ||
1038 | extn = ee->engine.buffer.data; | ||
1039 | if (!extn) return; | ||
1040 | if (!extn->ipc.server) return; | ||
1041 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_SHOW, 0, 0, 0, NULL, 0); | ||
1042 | } | ||
1043 | |||
1044 | static void | ||
1045 | _ecore_evas_extn_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1046 | { | ||
1047 | Ecore_Evas *ee; | ||
1048 | Extn *extn; | ||
1049 | |||
1050 | ee = data; | ||
1051 | ee->visible = 0; | ||
1052 | extn = ee->engine.buffer.data; | ||
1053 | if (!extn) return; | ||
1054 | if (!extn->ipc.server) return; | ||
1055 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_HIDE, 0, 0, 0, NULL, 0); | ||
1056 | } | ||
1057 | |||
1058 | static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func = | ||
1059 | { | ||
1060 | _ecore_evas_extn_free, | ||
1061 | NULL, | ||
1062 | NULL, | ||
1063 | NULL, | ||
1064 | NULL, | ||
1065 | NULL, | ||
1066 | NULL, | ||
1067 | NULL, | ||
1068 | NULL, | ||
1069 | NULL, | ||
1070 | NULL, | ||
1071 | NULL, | ||
1072 | NULL, | ||
1073 | NULL, | ||
1074 | NULL, | ||
1075 | NULL, | ||
1076 | NULL, | ||
1077 | _ecore_evas_resize, | ||
1078 | _ecore_evas_move_resize, | ||
1079 | NULL, | ||
1080 | NULL, | ||
1081 | NULL, | ||
1082 | NULL, | ||
1083 | NULL, | ||
1084 | NULL, | ||
1085 | NULL, | ||
1086 | NULL, | ||
1087 | NULL, | ||
1088 | NULL, | ||
1089 | NULL, | ||
1090 | NULL, | ||
1091 | NULL, | ||
1092 | NULL, | ||
1093 | NULL, | ||
1094 | NULL, | ||
1095 | NULL, | ||
1096 | NULL, | ||
1097 | NULL, | ||
1098 | NULL, | ||
1099 | NULL, | ||
1100 | NULL, | ||
1101 | NULL, | ||
1102 | NULL, | ||
1103 | NULL, | ||
1104 | NULL, | ||
1105 | NULL, //transparent | ||
1106 | |||
1107 | NULL, | ||
1108 | NULL, | ||
1109 | NULL, | ||
1110 | NULL, | ||
1111 | NULL, | ||
1112 | NULL, | ||
1113 | |||
1114 | NULL, // render | ||
1115 | NULL // screen_geometry_get | ||
1116 | }; | ||
1117 | |||
1118 | static Eina_Bool | ||
1119 | _ipc_server_add(void *data, int type __UNUSED__, void *event) | ||
1120 | { | ||
1121 | Ecore_Ipc_Event_Server_Add *e = event; | ||
1122 | Ecore_Evas *ee = data; | ||
1123 | Extn *extn; | ||
1124 | |||
1125 | if (ee != ecore_ipc_server_data_get(e->server)) | ||
1126 | return ECORE_CALLBACK_PASS_ON; | ||
1127 | if (!eina_list_data_find(extn_ee_list, ee)) | ||
1128 | return ECORE_CALLBACK_PASS_ON; | ||
1129 | extn = ee->engine.buffer.data; | ||
1130 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1131 | //FIXME: find a way to let app know server there | ||
1132 | return ECORE_CALLBACK_PASS_ON; | ||
1133 | } | ||
1134 | |||
1135 | static Eina_Bool | ||
1136 | _ipc_server_del(void *data, int type __UNUSED__, void *event) | ||
1137 | { | ||
1138 | Ecore_Ipc_Event_Server_Del *e = event; | ||
1139 | Ecore_Evas *ee = data; | ||
1140 | Extn *extn; | ||
1141 | |||
1142 | extn = ee->engine.buffer.data; | ||
1143 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1144 | if (extn->ipc.server != e->server) return ECORE_CALLBACK_PASS_ON; | ||
1145 | evas_object_image_data_set(ee->engine.buffer.image, NULL); | ||
1146 | ee->engine.buffer.pixels = NULL; | ||
1147 | if (extn->file.shmfile) | ||
1148 | { | ||
1149 | shmfile_close(extn->file.shmfile); | ||
1150 | extn->file.shmfile = NULL; | ||
1151 | } | ||
1152 | if (extn->file.shm) | ||
1153 | { | ||
1154 | eina_stringshare_del(extn->file.shm); | ||
1155 | extn->file.shm = NULL; | ||
1156 | } | ||
1157 | extn->ipc.server = NULL; | ||
1158 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
1159 | return ECORE_CALLBACK_PASS_ON; | ||
1160 | } | ||
1161 | |||
1162 | static Eina_Bool | ||
1163 | _ipc_server_data(void *data, int type __UNUSED__, void *event) | ||
1164 | { | ||
1165 | Ecore_Ipc_Event_Server_Data *e = event; | ||
1166 | Ecore_Evas *ee = data; | ||
1167 | Extn *extn; | ||
1168 | |||
1169 | if (ee != ecore_ipc_server_data_get(e->server)) | ||
1170 | return ECORE_CALLBACK_PASS_ON; | ||
1171 | if (!eina_list_data_find(extn_ee_list, ee)) | ||
1172 | return ECORE_CALLBACK_PASS_ON; | ||
1173 | extn = ee->engine.buffer.data; | ||
1174 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1175 | if (e->major != MAJOR) | ||
1176 | return ECORE_CALLBACK_PASS_ON; | ||
1177 | switch (e->minor) | ||
1178 | { | ||
1179 | case OP_UPDATE: | ||
1180 | // add rect to update list | ||
1181 | if (e->size >= (int)sizeof(Ipc_Data_Update)) | ||
1182 | { | ||
1183 | Ipc_Data_Update *ipc = malloc(sizeof(Ipc_Data_Update)); | ||
1184 | if (ipc) | ||
1185 | { | ||
1186 | memcpy(ipc, e->data, sizeof(Ipc_Data_Update)); | ||
1187 | extn->file.updates = eina_list_append(extn->file.updates, ipc); | ||
1188 | } | ||
1189 | } | ||
1190 | break; | ||
1191 | case OP_UPDATE_DONE: | ||
1192 | // updates finished being sent - done now. frame ready | ||
1193 | { | ||
1194 | Ipc_Data_Update *ipc; | ||
1195 | |||
1196 | EINA_LIST_FREE(extn->file.updates, ipc) | ||
1197 | { | ||
1198 | if (ee->engine.buffer.image) | ||
1199 | evas_object_image_data_update_add(ee->engine.buffer.image, | ||
1200 | ipc->x, ipc->y, | ||
1201 | ipc->w, ipc->h); | ||
1202 | } | ||
1203 | } | ||
1204 | break; | ||
1205 | case OP_LOCK_FILE: | ||
1206 | if ((e->data) && (e->size > 0) && | ||
1207 | (((unsigned char *)e->data)[e->size - 1] == 0)) | ||
1208 | { | ||
1209 | if (extn->file.lockfd) close(extn->file.lockfd); | ||
1210 | if (extn->file.lock) eina_stringshare_del(extn->file.lock); | ||
1211 | extn->file.lock = eina_stringshare_add(e->data); | ||
1212 | extn->file.lockfd = open(extn->file.lock, O_RDONLY); | ||
1213 | } | ||
1214 | break; | ||
1215 | case OP_SHM_REF: | ||
1216 | // e->ref == w | ||
1217 | // e->ref_to == h | ||
1218 | // e->response == alpha | ||
1219 | // e->data = shm ref string + nul byte | ||
1220 | if ((e->data) && ((unsigned char *)e->data)[e->size - 1] == 0) | ||
1221 | { | ||
1222 | ee->engine.buffer.pixels = NULL; | ||
1223 | if (extn->file.shmfile) | ||
1224 | { | ||
1225 | shmfile_close(extn->file.shmfile); | ||
1226 | extn->file.shmfile = NULL; | ||
1227 | } | ||
1228 | if (extn->file.shm) | ||
1229 | { | ||
1230 | eina_stringshare_del(extn->file.shm); | ||
1231 | extn->file.shm = NULL; | ||
1232 | } | ||
1233 | if ((e->ref > 0) && (e->ref_to > 0)) | ||
1234 | { | ||
1235 | extn->file.w = e->ref; | ||
1236 | extn->file.h = e->ref_to; | ||
1237 | extn->file.shm = eina_stringshare_add(e->data); | ||
1238 | extn->file.shmfile = shmfile_open(extn->file.shm, | ||
1239 | extn->file.w * | ||
1240 | extn->file.h * 4, | ||
1241 | EINA_TRUE); | ||
1242 | if (extn->file.shmfile) | ||
1243 | { | ||
1244 | ee->engine.buffer.pixels = extn->file.shmfile->addr; | ||
1245 | if (ee->engine.buffer.image) | ||
1246 | { | ||
1247 | if (e->response) | ||
1248 | evas_object_image_alpha_set(ee->engine.buffer.image, | ||
1249 | EINA_TRUE); | ||
1250 | else | ||
1251 | evas_object_image_alpha_set(ee->engine.buffer.image, | ||
1252 | EINA_FALSE); | ||
1253 | evas_object_image_size_set(ee->engine.buffer.image, | ||
1254 | extn->file.w, | ||
1255 | extn->file.h); | ||
1256 | evas_object_image_data_set(ee->engine.buffer.image, | ||
1257 | ee->engine.buffer.pixels); | ||
1258 | evas_object_image_data_update_add(ee->engine.buffer.image, | ||
1259 | 0, 0, | ||
1260 | extn->file.w, | ||
1261 | extn->file.h); | ||
1262 | _ecore_evas_resize(ee, | ||
1263 | extn->file.w, | ||
1264 | extn->file.h); | ||
1265 | } | ||
1266 | else | ||
1267 | evas_object_image_data_set(ee->engine.buffer.image, NULL); | ||
1268 | } | ||
1269 | else | ||
1270 | evas_object_image_data_set(ee->engine.buffer.image, NULL); | ||
1271 | } | ||
1272 | else | ||
1273 | evas_object_image_data_set(ee->engine.buffer.image, NULL); | ||
1274 | } | ||
1275 | break; | ||
1276 | case OP_RESIZE: | ||
1277 | if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize))) | ||
1278 | { | ||
1279 | Ipc_Data_Resize *ipc = e->data; | ||
1280 | _ecore_evas_resize(ee, ipc->w, ipc->h); | ||
1281 | } | ||
1282 | break; | ||
1283 | default: | ||
1284 | break; | ||
1285 | } | ||
1286 | return ECORE_CALLBACK_PASS_ON; | ||
1287 | } | ||
1288 | #else | ||
1289 | void | ||
1290 | _ecore_evas_extn_init(void) | ||
1291 | { | ||
1292 | } | ||
1293 | |||
1294 | void | ||
1295 | _ecore_evas_extn_shutdown(void) | ||
1296 | { | ||
1297 | } | ||
1298 | |||
1299 | #endif /* BUILD_ECORE_EVAS_EXTN */ | ||
1300 | |||
1301 | EAPI Evas_Object * | ||
1302 | ecore_evas_extn_plug_new(Ecore_Evas *ee_target) | ||
1303 | { | ||
1304 | #ifdef BUILD_ECORE_EVAS_EXTN | ||
1305 | Evas_Object *o; | ||
1306 | Ecore_Evas *ee; | ||
1307 | int w = 1, h = 1; | ||
1308 | |||
1309 | if (!ee_target) return NULL; | ||
1310 | |||
1311 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
1312 | if (!ee) return NULL; | ||
1313 | |||
1314 | o = evas_object_image_filled_add(ee_target->evas); | ||
1315 | evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); | ||
1316 | evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); | ||
1317 | evas_object_image_alpha_set(o, 1); | ||
1318 | evas_object_image_size_set(o, 1, 1); | ||
1319 | evas_object_image_data_set(o, &blank); | ||
1320 | |||
1321 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
1322 | |||
1323 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_plug_engine_func; | ||
1324 | |||
1325 | ee->driver = "extn_plug"; | ||
1326 | |||
1327 | ee->rotation = 0; | ||
1328 | ee->visible = 0; | ||
1329 | ee->w = w; | ||
1330 | ee->h = h; | ||
1331 | ee->req.w = ee->w; | ||
1332 | ee->req.h = ee->h; | ||
1333 | |||
1334 | ee->prop.max.w = 0; | ||
1335 | ee->prop.max.h = 0; | ||
1336 | ee->prop.layer = 0; | ||
1337 | ee->prop.focused = 0; | ||
1338 | ee->prop.borderless = 1; | ||
1339 | ee->prop.override = 1; | ||
1340 | ee->prop.maximized = 0; | ||
1341 | ee->prop.fullscreen = 0; | ||
1342 | ee->prop.withdrawn = 0; | ||
1343 | ee->prop.sticky = 0; | ||
1344 | |||
1345 | ee->engine.buffer.image = o; | ||
1346 | evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee); | ||
1347 | evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target); | ||
1348 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1349 | EVAS_CALLBACK_MOUSE_IN, | ||
1350 | _ecore_evas_extn_cb_mouse_in, ee); | ||
1351 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1352 | EVAS_CALLBACK_MOUSE_OUT, | ||
1353 | _ecore_evas_extn_cb_mouse_out, ee); | ||
1354 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1355 | EVAS_CALLBACK_MOUSE_DOWN, | ||
1356 | _ecore_evas_extn_cb_mouse_down, ee); | ||
1357 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1358 | EVAS_CALLBACK_MOUSE_UP, | ||
1359 | _ecore_evas_extn_cb_mouse_up, ee); | ||
1360 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1361 | EVAS_CALLBACK_MOUSE_MOVE, | ||
1362 | _ecore_evas_extn_cb_mouse_move, ee); | ||
1363 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1364 | EVAS_CALLBACK_MOUSE_WHEEL, | ||
1365 | _ecore_evas_extn_cb_mouse_wheel, ee); | ||
1366 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1367 | EVAS_CALLBACK_MULTI_DOWN, | ||
1368 | _ecore_evas_extn_cb_multi_down, ee); | ||
1369 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1370 | EVAS_CALLBACK_MULTI_UP, | ||
1371 | _ecore_evas_extn_cb_multi_up, ee); | ||
1372 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1373 | EVAS_CALLBACK_MULTI_MOVE, | ||
1374 | _ecore_evas_extn_cb_multi_move, ee); | ||
1375 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1376 | EVAS_CALLBACK_FREE, | ||
1377 | _ecore_evas_extn_cb_free, ee); | ||
1378 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1379 | EVAS_CALLBACK_KEY_DOWN, | ||
1380 | _ecore_evas_extn_cb_key_down, ee); | ||
1381 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1382 | EVAS_CALLBACK_KEY_UP, | ||
1383 | _ecore_evas_extn_cb_key_up, ee); | ||
1384 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1385 | EVAS_CALLBACK_HOLD, | ||
1386 | _ecore_evas_extn_cb_hold, ee); | ||
1387 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1388 | EVAS_CALLBACK_FOCUS_IN, | ||
1389 | _ecore_evas_extn_cb_focus_in, ee); | ||
1390 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1391 | EVAS_CALLBACK_FOCUS_OUT, | ||
1392 | _ecore_evas_extn_cb_focus_out, ee); | ||
1393 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1394 | EVAS_CALLBACK_SHOW, | ||
1395 | _ecore_evas_extn_cb_show, ee); | ||
1396 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1397 | EVAS_CALLBACK_HIDE, | ||
1398 | _ecore_evas_extn_cb_hide, ee); | ||
1399 | |||
1400 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1401 | EVAS_CALLBACK_DEL, | ||
1402 | _ecore_evas_extn_plug_image_obj_del, ee); | ||
1403 | |||
1404 | |||
1405 | extn_ee_list = eina_list_append(extn_ee_list, ee); | ||
1406 | ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee); | ||
1407 | |||
1408 | evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_PRE, | ||
1409 | _ecore_evas_extn_plug_targer_render_pre, ee); | ||
1410 | evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_POST, | ||
1411 | _ecore_evas_extn_plug_targer_render_post, ee); | ||
1412 | return o; | ||
1413 | #else | ||
1414 | return NULL; | ||
1415 | #endif | ||
1416 | } | ||
1417 | |||
1418 | EAPI Eina_Bool | ||
1419 | ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys) | ||
1420 | { | ||
1421 | #ifdef BUILD_ECORE_EVAS_EXTN | ||
1422 | Extn *extn; | ||
1423 | Ecore_Evas *ee = NULL; | ||
1424 | |||
1425 | if (!obj) return EINA_FALSE; | ||
1426 | |||
1427 | ee = evas_object_data_get(obj, "Ecore_Evas"); | ||
1428 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) return EINA_FALSE; | ||
1429 | |||
1430 | extn = calloc(1, sizeof(Extn)); | ||
1431 | if (!extn) return EINA_FALSE; | ||
1432 | |||
1433 | Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER; | ||
1434 | |||
1435 | ecore_ipc_init(); | ||
1436 | extn->svc.name = eina_stringshare_add(svcname); | ||
1437 | extn->svc.num = svcnum; | ||
1438 | extn->svc.sys = svcsys; | ||
1439 | |||
1440 | if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM; | ||
1441 | extn->ipc.server = ecore_ipc_server_connect(ipctype, (char *)extn->svc.name, | ||
1442 | extn->svc.num, ee); | ||
1443 | if (!extn->ipc.server) | ||
1444 | { | ||
1445 | eina_stringshare_del(extn->svc.name); | ||
1446 | free(extn); | ||
1447 | ecore_ipc_shutdown(); | ||
1448 | return EINA_FALSE; | ||
1449 | } | ||
1450 | ee->engine.buffer.data = extn; | ||
1451 | extn->ipc.handlers = eina_list_append | ||
1452 | (extn->ipc.handlers, | ||
1453 | ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, | ||
1454 | _ipc_server_add, ee)); | ||
1455 | extn->ipc.handlers = eina_list_append | ||
1456 | (extn->ipc.handlers, | ||
1457 | ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, | ||
1458 | _ipc_server_del, ee)); | ||
1459 | extn->ipc.handlers = eina_list_append | ||
1460 | (extn->ipc.handlers, | ||
1461 | ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, | ||
1462 | _ipc_server_data, ee)); | ||
1463 | return EINA_TRUE; | ||
1464 | #else | ||
1465 | return EINA_FALSE; | ||
1466 | #endif | ||
1467 | } | ||
1468 | |||
1469 | EAPI void | ||
1470 | ecore_evas_extn_plug_object_data_lock(Evas_Object *obj) | ||
1471 | { | ||
1472 | #ifdef BUILD_ECORE_EVAS_EXTN | ||
1473 | Ecore_Evas *ee; | ||
1474 | |||
1475 | ee = ecore_evas_object_ecore_evas_get(obj); | ||
1476 | if (!ee) return; | ||
1477 | _ecore_evas_socket_lock(ee); | ||
1478 | #endif | ||
1479 | } | ||
1480 | |||
1481 | EAPI void | ||
1482 | ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj) | ||
1483 | { | ||
1484 | #ifdef BUILD_ECORE_EVAS_EXTN | ||
1485 | Ecore_Evas *ee; | ||
1486 | |||
1487 | ee = ecore_evas_object_ecore_evas_get(obj); | ||
1488 | if (!ee) return; | ||
1489 | _ecore_evas_socket_unlock(ee); | ||
1490 | #endif | ||
1491 | } | ||
1492 | |||
1493 | #ifdef BUILD_ECORE_EVAS_EXTN | ||
1494 | static void | ||
1495 | _ecore_evas_socket_resize(Ecore_Evas *ee, int w, int h) | ||
1496 | { | ||
1497 | Extn *extn; | ||
1498 | Evas_Engine_Info_Buffer *einfo; | ||
1499 | int stride = 0; | ||
1500 | |||
1501 | if (w < 1) w = 1; | ||
1502 | if (h < 1) h = 1; | ||
1503 | ee->req.w = w; | ||
1504 | ee->req.h = h; | ||
1505 | if ((w == ee->w) && (h == ee->h)) return; | ||
1506 | ee->w = w; | ||
1507 | ee->h = h; | ||
1508 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1509 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1510 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1511 | extn = ee->engine.buffer.data; | ||
1512 | if (extn) | ||
1513 | { | ||
1514 | if (extn->file.shmfile) | ||
1515 | shmfile_free(extn->file.shmfile); | ||
1516 | ee->engine.buffer.pixels = NULL; | ||
1517 | extn->file.shmfile = shmfile_new(extn->svc.name, extn->svc.num, | ||
1518 | ee->w * ee->h * 4, extn->svc.sys); | ||
1519 | if (extn->file.shmfile) | ||
1520 | ee->engine.buffer.pixels = extn->file.shmfile->addr; | ||
1521 | |||
1522 | stride = ee->w * 4; | ||
1523 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
1524 | if (einfo) | ||
1525 | { | ||
1526 | if (ee->alpha) | ||
1527 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
1528 | else | ||
1529 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
1530 | einfo->info.dest_buffer = ee->engine.buffer.pixels; | ||
1531 | einfo->info.dest_buffer_row_bytes = stride; | ||
1532 | einfo->info.use_color_key = 0; | ||
1533 | einfo->info.alpha_threshold = 0; | ||
1534 | einfo->info.func.new_update_region = NULL; | ||
1535 | einfo->info.func.free_update_region = NULL; | ||
1536 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1537 | { | ||
1538 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1539 | } | ||
1540 | } | ||
1541 | |||
1542 | if (extn->ipc.clients && extn->file.shmfile) | ||
1543 | { | ||
1544 | Ipc_Data_Resize ipc; | ||
1545 | Eina_List *l; | ||
1546 | Ecore_Ipc_Client *client; | ||
1547 | |||
1548 | EINA_LIST_FOREACH(extn->ipc.clients, l, client) | ||
1549 | ecore_ipc_client_send(client, MAJOR, OP_SHM_REF, | ||
1550 | ee->w, ee->h, ee->alpha, | ||
1551 | extn->file.shmfile->file, | ||
1552 | strlen(extn->file.shmfile->file) + 1); | ||
1553 | ipc.w = ee->w; | ||
1554 | ipc.h = ee->h; | ||
1555 | EINA_LIST_FOREACH(extn->ipc.clients, l, client) | ||
1556 | ecore_ipc_client_send(client, MAJOR, OP_RESIZE, | ||
1557 | 0, 0, 0, &ipc, sizeof(ipc)); | ||
1558 | } | ||
1559 | } | ||
1560 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1561 | } | ||
1562 | |||
1563 | static void | ||
1564 | _ecore_evas_socket_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
1565 | { | ||
1566 | _ecore_evas_socket_resize(ee, w, h); | ||
1567 | } | ||
1568 | |||
1569 | int | ||
1570 | _ecore_evas_extn_socket_render(Ecore_Evas *ee) | ||
1571 | { | ||
1572 | Eina_List *updates = NULL, *l, *ll; | ||
1573 | Ecore_Evas *ee2; | ||
1574 | int rend = 0; | ||
1575 | Eina_Rectangle *r; | ||
1576 | Extn *extn; | ||
1577 | Ecore_Ipc_Client *client; | ||
1578 | |||
1579 | extn = ee->engine.buffer.data; | ||
1580 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
1581 | { | ||
1582 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
1583 | if (ee2->engine.func->fn_render) | ||
1584 | rend |= ee2->engine.func->fn_render(ee2); | ||
1585 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
1586 | } | ||
1587 | if (ee->engine.buffer.pixels) | ||
1588 | { | ||
1589 | _ecore_evas_socket_lock(ee); | ||
1590 | updates = evas_render_updates(ee->evas); | ||
1591 | _ecore_evas_socket_unlock(ee); | ||
1592 | } | ||
1593 | EINA_LIST_FOREACH(updates, l, r) | ||
1594 | { | ||
1595 | Ipc_Data_Update ipc; | ||
1596 | |||
1597 | |||
1598 | ipc.x = r->x; | ||
1599 | ipc.y = r->y; | ||
1600 | ipc.w = r->w; | ||
1601 | ipc.h = r->h; | ||
1602 | EINA_LIST_FOREACH(extn->ipc.clients, ll, client) | ||
1603 | ecore_ipc_client_send(client, MAJOR, OP_UPDATE, 0, 0, 0, &ipc, sizeof(ipc)); | ||
1604 | } | ||
1605 | if (updates) | ||
1606 | { | ||
1607 | evas_render_updates_free(updates); | ||
1608 | _ecore_evas_idle_timeout_update(ee); | ||
1609 | EINA_LIST_FOREACH(extn->ipc.clients, ll, client) | ||
1610 | ecore_ipc_client_send(client, MAJOR, OP_UPDATE_DONE, 0, 0, 0, NULL, 0); | ||
1611 | } | ||
1612 | |||
1613 | return updates ? 1 : rend; | ||
1614 | } | ||
1615 | |||
1616 | static Eina_Bool | ||
1617 | _ipc_client_add(void *data, int type __UNUSED__, void *event) | ||
1618 | { | ||
1619 | Ecore_Ipc_Event_Client_Add *e = event; | ||
1620 | Ecore_Evas *ee = data; | ||
1621 | Extn *extn; | ||
1622 | |||
1623 | if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client))) | ||
1624 | return ECORE_CALLBACK_PASS_ON; | ||
1625 | if (!eina_list_data_find(extn_ee_list, ee)) | ||
1626 | return ECORE_CALLBACK_PASS_ON; | ||
1627 | extn = ee->engine.buffer.data; | ||
1628 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1629 | |||
1630 | extn->ipc.clients = eina_list_append(extn->ipc.clients, e->client); | ||
1631 | ecore_ipc_client_send(e->client, MAJOR, OP_LOCK_FILE, 0, 0, 0, extn->file.lock, strlen(extn->file.lock) + 1); | ||
1632 | |||
1633 | if (extn->file.shmfile) | ||
1634 | { | ||
1635 | Ipc_Data_Resize ipc; | ||
1636 | |||
1637 | ecore_ipc_client_send(e->client, MAJOR, OP_SHM_REF, | ||
1638 | ee->w, ee->h, ee->alpha, | ||
1639 | extn->file.shmfile->file, | ||
1640 | strlen(extn->file.shmfile->file) + 1); | ||
1641 | ipc.w = ee->w; | ||
1642 | ipc.h = ee->h; | ||
1643 | |||
1644 | ecore_ipc_client_send(e->client, MAJOR, OP_RESIZE, | ||
1645 | 0, 0, 0, &ipc, sizeof(ipc)); | ||
1646 | } | ||
1647 | _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_ADD); | ||
1648 | return ECORE_CALLBACK_PASS_ON; | ||
1649 | } | ||
1650 | |||
1651 | static Eina_Bool | ||
1652 | _ipc_client_del(void *data, int type __UNUSED__, void *event) | ||
1653 | { | ||
1654 | Ecore_Ipc_Event_Client_Del *e = event; | ||
1655 | Ecore_Evas *ee = data; | ||
1656 | Extn *extn; | ||
1657 | extn = ee->engine.buffer.data; | ||
1658 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1659 | if (!eina_list_data_find(extn->ipc.clients, e->client)) return ECORE_CALLBACK_PASS_ON; | ||
1660 | |||
1661 | extn->ipc.clients = eina_list_remove(extn->ipc.clients, e->client); | ||
1662 | |||
1663 | _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_DEL); | ||
1664 | return ECORE_CALLBACK_PASS_ON; | ||
1665 | } | ||
1666 | |||
1667 | static Eina_Bool | ||
1668 | _ipc_client_data(void *data, int type __UNUSED__, void *event) | ||
1669 | { | ||
1670 | Ecore_Ipc_Event_Client_Data *e = event; | ||
1671 | Ecore_Evas *ee = data; | ||
1672 | Extn *extn; | ||
1673 | |||
1674 | if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client))) | ||
1675 | return ECORE_CALLBACK_PASS_ON; | ||
1676 | if (!eina_list_data_find(extn_ee_list, ee)) | ||
1677 | return ECORE_CALLBACK_PASS_ON; | ||
1678 | extn = ee->engine.buffer.data; | ||
1679 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1680 | if (e->major != MAJOR) | ||
1681 | return ECORE_CALLBACK_PASS_ON; | ||
1682 | switch (e->minor) | ||
1683 | { | ||
1684 | case OP_RESIZE: | ||
1685 | if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize))) | ||
1686 | { | ||
1687 | |||
1688 | Ipc_Data_Resize *ipc = e->data; | ||
1689 | /* create callbacke data size changed */ | ||
1690 | _ecore_evas_socket_resize(ee, ipc->w, ipc->h); | ||
1691 | } | ||
1692 | break; | ||
1693 | case OP_SHOW: | ||
1694 | if (!ee->visible) | ||
1695 | { | ||
1696 | ee->visible = 1; | ||
1697 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
1698 | } | ||
1699 | break; | ||
1700 | case OP_HIDE: | ||
1701 | if (ee->visible) | ||
1702 | { | ||
1703 | ee->visible = 0; | ||
1704 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
1705 | } | ||
1706 | break; | ||
1707 | case OP_FOCUS: | ||
1708 | if (!ee->prop.focused) | ||
1709 | { | ||
1710 | ee->prop.focused = 1; | ||
1711 | evas_focus_in(ee->evas); | ||
1712 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
1713 | } | ||
1714 | break; | ||
1715 | case OP_UNFOCUS: | ||
1716 | if (ee->prop.focused) | ||
1717 | { | ||
1718 | ee->prop.focused = 0; | ||
1719 | evas_focus_out(ee->evas); | ||
1720 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
1721 | } | ||
1722 | break; | ||
1723 | case OP_EV_MOUSE_IN: | ||
1724 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_In)) | ||
1725 | { | ||
1726 | Ipc_Data_Ev_Mouse_In *ipc = e->data; | ||
1727 | Evas_Event_Flags flags; | ||
1728 | |||
1729 | flags = evas_event_default_flags_get(ee->evas); | ||
1730 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1731 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1732 | evas_event_feed_mouse_in(ee->evas, ipc->timestamp, NULL); | ||
1733 | evas_event_default_flags_set(ee->evas, flags); | ||
1734 | } | ||
1735 | break; | ||
1736 | case OP_EV_MOUSE_OUT: | ||
1737 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Out)) | ||
1738 | { | ||
1739 | Ipc_Data_Ev_Mouse_Out *ipc = e->data; | ||
1740 | Evas_Event_Flags flags; | ||
1741 | |||
1742 | flags = evas_event_default_flags_get(ee->evas); | ||
1743 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1744 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1745 | evas_event_feed_mouse_out(ee->evas, ipc->timestamp, NULL); | ||
1746 | evas_event_default_flags_set(ee->evas, flags); | ||
1747 | } | ||
1748 | break; | ||
1749 | case OP_EV_MOUSE_UP: | ||
1750 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Up)) | ||
1751 | { | ||
1752 | Ipc_Data_Ev_Mouse_Up *ipc = e->data; | ||
1753 | Evas_Event_Flags flags; | ||
1754 | |||
1755 | flags = evas_event_default_flags_get(ee->evas); | ||
1756 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1757 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1758 | evas_event_feed_mouse_up(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL); | ||
1759 | evas_event_default_flags_set(ee->evas, flags); | ||
1760 | } | ||
1761 | break; | ||
1762 | case OP_EV_MOUSE_DOWN: | ||
1763 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Down)) | ||
1764 | { | ||
1765 | Ipc_Data_Ev_Mouse_Up *ipc = e->data; | ||
1766 | Evas_Event_Flags flags; | ||
1767 | |||
1768 | flags = evas_event_default_flags_get(ee->evas); | ||
1769 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1770 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1771 | evas_event_feed_mouse_down(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL); | ||
1772 | evas_event_default_flags_set(ee->evas, flags); | ||
1773 | } | ||
1774 | break; | ||
1775 | case OP_EV_MOUSE_MOVE: | ||
1776 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Move)) | ||
1777 | { | ||
1778 | Ipc_Data_Ev_Mouse_Move *ipc = e->data; | ||
1779 | Evas_Event_Flags flags; | ||
1780 | |||
1781 | flags = evas_event_default_flags_get(ee->evas); | ||
1782 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1783 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1784 | evas_event_feed_mouse_move(ee->evas, ipc->x, ipc->y, ipc->timestamp, NULL); | ||
1785 | evas_event_default_flags_set(ee->evas, flags); | ||
1786 | } | ||
1787 | break; | ||
1788 | case OP_EV_MOUSE_WHEEL: | ||
1789 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Wheel)) | ||
1790 | { | ||
1791 | Ipc_Data_Ev_Mouse_Wheel *ipc = e->data; | ||
1792 | Evas_Event_Flags flags; | ||
1793 | |||
1794 | flags = evas_event_default_flags_get(ee->evas); | ||
1795 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1796 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1797 | evas_event_feed_mouse_wheel(ee->evas, ipc->direction, ipc->z, ipc->timestamp, NULL); | ||
1798 | evas_event_default_flags_set(ee->evas, flags); | ||
1799 | } | ||
1800 | break; | ||
1801 | case OP_EV_MULTI_UP: | ||
1802 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Up)) | ||
1803 | { | ||
1804 | Ipc_Data_Ev_Multi_Up *ipc = e->data; | ||
1805 | Evas_Event_Flags flags; | ||
1806 | |||
1807 | flags = evas_event_default_flags_get(ee->evas); | ||
1808 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1809 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1810 | evas_event_feed_multi_up(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL); | ||
1811 | evas_event_default_flags_set(ee->evas, flags); | ||
1812 | } | ||
1813 | break; | ||
1814 | case OP_EV_MULTI_DOWN: | ||
1815 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Down)) | ||
1816 | { | ||
1817 | Ipc_Data_Ev_Multi_Down *ipc = e->data; | ||
1818 | Evas_Event_Flags flags; | ||
1819 | |||
1820 | flags = evas_event_default_flags_get(ee->evas); | ||
1821 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1822 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1823 | evas_event_feed_multi_down(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL); | ||
1824 | evas_event_default_flags_set(ee->evas, flags); | ||
1825 | } | ||
1826 | break; | ||
1827 | case OP_EV_MULTI_MOVE: | ||
1828 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Move)) | ||
1829 | { | ||
1830 | Ipc_Data_Ev_Multi_Move *ipc = e->data; | ||
1831 | Evas_Event_Flags flags; | ||
1832 | |||
1833 | flags = evas_event_default_flags_get(ee->evas); | ||
1834 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1835 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1836 | evas_event_feed_multi_move(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->timestamp, NULL); | ||
1837 | evas_event_default_flags_set(ee->evas, flags); | ||
1838 | } | ||
1839 | break; | ||
1840 | |||
1841 | #define STRGET(val) \ | ||
1842 | do { \ | ||
1843 | if ((ipc->val) && (ipc->val < (char *)(long)(e->size - 1))) \ | ||
1844 | ipc->val = ((char *)ipc) + (long)ipc->val; \ | ||
1845 | else \ | ||
1846 | ipc->val = NULL; \ | ||
1847 | } while (0) | ||
1848 | |||
1849 | case OP_EV_KEY_UP: | ||
1850 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Up)) | ||
1851 | { | ||
1852 | if ((e->data) && (e->size > 0) && | ||
1853 | (((unsigned char *)e->data)[e->size - 1] == 0)) | ||
1854 | { | ||
1855 | Ipc_Data_Ev_Key_Up *ipc = e->data; | ||
1856 | Evas_Event_Flags flags; | ||
1857 | |||
1858 | STRGET(keyname); | ||
1859 | STRGET(key); | ||
1860 | STRGET(string); | ||
1861 | STRGET(compose); | ||
1862 | flags = evas_event_default_flags_get(ee->evas); | ||
1863 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1864 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1865 | evas_event_feed_key_up(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL); | ||
1866 | evas_event_default_flags_set(ee->evas, flags); | ||
1867 | } | ||
1868 | } | ||
1869 | break; | ||
1870 | case OP_EV_KEY_DOWN: | ||
1871 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Down)) | ||
1872 | { | ||
1873 | if ((e->data) && (e->size > 0) && | ||
1874 | (((unsigned char *)e->data)[e->size - 1] == 0)) | ||
1875 | { | ||
1876 | Ipc_Data_Ev_Key_Down *ipc = e->data; | ||
1877 | Evas_Event_Flags flags; | ||
1878 | |||
1879 | STRGET(keyname); | ||
1880 | STRGET(key); | ||
1881 | STRGET(string); | ||
1882 | STRGET(compose); | ||
1883 | flags = evas_event_default_flags_get(ee->evas); | ||
1884 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1885 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1886 | evas_event_feed_key_down(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL); | ||
1887 | evas_event_default_flags_set(ee->evas, flags); | ||
1888 | } | ||
1889 | } | ||
1890 | break; | ||
1891 | case OP_EV_HOLD: | ||
1892 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Hold)) | ||
1893 | { | ||
1894 | Ipc_Data_Ev_Hold *ipc = e->data; | ||
1895 | Evas_Event_Flags flags; | ||
1896 | |||
1897 | flags = evas_event_default_flags_get(ee->evas); | ||
1898 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1899 | evas_event_feed_hold(ee->evas, ipc->hold, ipc->timestamp, NULL); | ||
1900 | evas_event_default_flags_set(ee->evas, flags); | ||
1901 | } | ||
1902 | break; | ||
1903 | default: | ||
1904 | break; | ||
1905 | } | ||
1906 | return ECORE_CALLBACK_PASS_ON; | ||
1907 | } | ||
1908 | |||
1909 | static void | ||
1910 | _ecore_evas_extn_socket_alpha_set(Ecore_Evas *ee, int alpha) | ||
1911 | { | ||
1912 | Extn *extn; | ||
1913 | Eina_List *l; | ||
1914 | Ecore_Ipc_Client *client; | ||
1915 | |||
1916 | if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return; | ||
1917 | ee->alpha = alpha; | ||
1918 | |||
1919 | extn = ee->engine.buffer.data; | ||
1920 | if (extn) | ||
1921 | { | ||
1922 | Evas_Engine_Info_Buffer *einfo; | ||
1923 | |||
1924 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
1925 | if (einfo) | ||
1926 | { | ||
1927 | if (ee->alpha) | ||
1928 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
1929 | else | ||
1930 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
1931 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
1932 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1933 | } | ||
1934 | EINA_LIST_FOREACH(extn->ipc.clients, l, client) | ||
1935 | ecore_ipc_client_send(client, MAJOR, OP_SHM_REF, | ||
1936 | ee->w, ee->h, ee->alpha, | ||
1937 | extn->file.shmfile->file, | ||
1938 | strlen(extn->file.shmfile->file) + 1); | ||
1939 | } | ||
1940 | } | ||
1941 | |||
1942 | static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func = | ||
1943 | { | ||
1944 | _ecore_evas_extn_free, | ||
1945 | NULL, | ||
1946 | NULL, | ||
1947 | NULL, | ||
1948 | NULL, | ||
1949 | NULL, | ||
1950 | NULL, | ||
1951 | NULL, | ||
1952 | NULL, | ||
1953 | NULL, | ||
1954 | NULL, | ||
1955 | NULL, | ||
1956 | NULL, | ||
1957 | NULL, | ||
1958 | NULL, | ||
1959 | NULL, | ||
1960 | NULL, | ||
1961 | _ecore_evas_socket_resize, | ||
1962 | _ecore_evas_socket_move_resize, | ||
1963 | NULL, | ||
1964 | NULL, | ||
1965 | NULL, | ||
1966 | NULL, | ||
1967 | NULL, | ||
1968 | NULL, | ||
1969 | NULL, | ||
1970 | NULL, | ||
1971 | NULL, | ||
1972 | NULL, | ||
1973 | NULL, | ||
1974 | NULL, | ||
1975 | NULL, | ||
1976 | NULL, | ||
1977 | NULL, | ||
1978 | NULL, | ||
1979 | NULL, | ||
1980 | NULL, | ||
1981 | NULL, | ||
1982 | NULL, | ||
1983 | NULL, | ||
1984 | NULL, | ||
1985 | NULL, | ||
1986 | NULL, | ||
1987 | NULL, | ||
1988 | _ecore_evas_extn_socket_alpha_set, | ||
1989 | NULL, //transparent | ||
1990 | |||
1991 | NULL, | ||
1992 | NULL, | ||
1993 | NULL, | ||
1994 | NULL, | ||
1995 | NULL, | ||
1996 | NULL, | ||
1997 | |||
1998 | _ecore_evas_extn_socket_render, // render | ||
1999 | NULL // screen_geometry_get | ||
2000 | }; | ||
2001 | |||
2002 | #endif | ||
2003 | |||
2004 | EAPI Ecore_Evas * | ||
2005 | ecore_evas_extn_socket_new(int w, int h) | ||
2006 | { | ||
2007 | #ifdef BUILD_ECORE_EVAS_EXTN | ||
2008 | Evas_Engine_Info_Buffer *einfo; | ||
2009 | Ecore_Evas *ee; | ||
2010 | int rmethod; | ||
2011 | |||
2012 | rmethod = evas_render_method_lookup("buffer"); | ||
2013 | if (!rmethod) return NULL; | ||
2014 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
2015 | if (!ee) return NULL; | ||
2016 | |||
2017 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
2018 | |||
2019 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_socket_engine_func; | ||
2020 | |||
2021 | ee->driver = "extn_socket"; | ||
2022 | |||
2023 | ee->rotation = 0; | ||
2024 | ee->visible = 0; | ||
2025 | ee->w = w; | ||
2026 | ee->h = h; | ||
2027 | ee->req.w = ee->w; | ||
2028 | ee->req.h = ee->h; | ||
2029 | |||
2030 | ee->prop.max.w = 0; | ||
2031 | ee->prop.max.h = 0; | ||
2032 | ee->prop.layer = 0; | ||
2033 | ee->prop.focused = 0; | ||
2034 | ee->prop.borderless = 1; | ||
2035 | ee->prop.override = 1; | ||
2036 | ee->prop.maximized = 0; | ||
2037 | ee->prop.fullscreen = 0; | ||
2038 | ee->prop.withdrawn = 0; | ||
2039 | ee->prop.sticky = 0; | ||
2040 | |||
2041 | /* init evas here */ | ||
2042 | ee->evas = evas_new(); | ||
2043 | evas_data_attach_set(ee->evas, ee); | ||
2044 | evas_output_method_set(ee->evas, rmethod); | ||
2045 | evas_output_size_set(ee->evas, w, h); | ||
2046 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
2047 | |||
2048 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
2049 | if (einfo) | ||
2050 | { | ||
2051 | if (ee->alpha) | ||
2052 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
2053 | else | ||
2054 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
2055 | einfo->info.dest_buffer = NULL; | ||
2056 | einfo->info.dest_buffer_row_bytes = 0; | ||
2057 | einfo->info.use_color_key = 0; | ||
2058 | einfo->info.alpha_threshold = 0; | ||
2059 | einfo->info.func.new_update_region = NULL; | ||
2060 | einfo->info.func.free_update_region = NULL; | ||
2061 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2062 | { | ||
2063 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2064 | ecore_evas_free(ee); | ||
2065 | return NULL; | ||
2066 | } | ||
2067 | } | ||
2068 | else | ||
2069 | { | ||
2070 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
2071 | ecore_evas_free(ee); | ||
2072 | return NULL; | ||
2073 | } | ||
2074 | evas_key_modifier_add(ee->evas, "Shift"); | ||
2075 | evas_key_modifier_add(ee->evas, "Control"); | ||
2076 | evas_key_modifier_add(ee->evas, "Alt"); | ||
2077 | evas_key_modifier_add(ee->evas, "Meta"); | ||
2078 | evas_key_modifier_add(ee->evas, "Hyper"); | ||
2079 | evas_key_modifier_add(ee->evas, "Super"); | ||
2080 | evas_key_lock_add(ee->evas, "Caps_Lock"); | ||
2081 | evas_key_lock_add(ee->evas, "Num_Lock"); | ||
2082 | evas_key_lock_add(ee->evas, "Scroll_Lock"); | ||
2083 | |||
2084 | extn_ee_list = eina_list_append(extn_ee_list, ee); | ||
2085 | |||
2086 | _ecore_evas_register(ee); | ||
2087 | |||
2088 | return ee; | ||
2089 | #else | ||
2090 | return NULL; | ||
2091 | #endif | ||
2092 | } | ||
2093 | |||
2094 | EAPI Eina_Bool | ||
2095 | ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys) | ||
2096 | { | ||
2097 | #ifdef BUILD_ECORE_EVAS_EXTN | ||
2098 | Extn *extn; | ||
2099 | |||
2100 | extn = calloc(1, sizeof(Extn)); | ||
2101 | if (!extn) | ||
2102 | { | ||
2103 | return EINA_FALSE; | ||
2104 | } | ||
2105 | else | ||
2106 | { | ||
2107 | Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER; | ||
2108 | char buf[PATH_MAX]; | ||
2109 | |||
2110 | ecore_ipc_init(); | ||
2111 | extn->svc.name = eina_stringshare_add(svcname); | ||
2112 | extn->svc.num = svcnum; | ||
2113 | extn->svc.sys = svcsys; | ||
2114 | |||
2115 | snprintf(buf, sizeof(buf), "/tmp/ee-lock-XXXXXX"); | ||
2116 | extn->file.lockfd = mkstemp(buf); | ||
2117 | if (extn->file.lockfd >= 0) | ||
2118 | extn->file.lock = eina_stringshare_add(buf); | ||
2119 | if ((extn->file.lockfd < 0) || (!extn->file.lock)) | ||
2120 | { | ||
2121 | if (extn->file.lockfd) | ||
2122 | { | ||
2123 | close(extn->file.lockfd); | ||
2124 | unlink(buf); | ||
2125 | } | ||
2126 | eina_stringshare_del(extn->svc.name); | ||
2127 | if (extn->file.lock) eina_stringshare_del(extn->file.lock); | ||
2128 | free(extn); | ||
2129 | ecore_ipc_shutdown(); | ||
2130 | return EINA_FALSE; | ||
2131 | } | ||
2132 | |||
2133 | if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM; | ||
2134 | extn->ipc.am_server = EINA_TRUE; | ||
2135 | extn->ipc.server = ecore_ipc_server_add(ipctype, | ||
2136 | (char *)extn->svc.name, | ||
2137 | extn->svc.num, ee); | ||
2138 | if (!extn->ipc.server) | ||
2139 | { | ||
2140 | if (extn->file.lockfd) | ||
2141 | { | ||
2142 | close(extn->file.lockfd); | ||
2143 | if (extn->file.lock) unlink(extn->file.lock); | ||
2144 | } | ||
2145 | eina_stringshare_del(extn->svc.name); | ||
2146 | eina_stringshare_del(extn->file.lock); | ||
2147 | free(extn); | ||
2148 | ecore_ipc_shutdown(); | ||
2149 | return EINA_FALSE; | ||
2150 | } | ||
2151 | ee->engine.buffer.data = extn; | ||
2152 | extn->ipc.handlers = eina_list_append | ||
2153 | (extn->ipc.handlers, | ||
2154 | ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, | ||
2155 | _ipc_client_add, ee)); | ||
2156 | extn->ipc.handlers = eina_list_append | ||
2157 | (extn->ipc.handlers, | ||
2158 | ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, | ||
2159 | _ipc_client_del, ee)); | ||
2160 | extn->ipc.handlers = eina_list_append | ||
2161 | (extn->ipc.handlers, | ||
2162 | ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, | ||
2163 | _ipc_client_data, ee)); | ||
2164 | } | ||
2165 | return EINA_TRUE; | ||
2166 | #else | ||
2167 | return EINA_FALSE; | ||
2168 | #endif | ||
2169 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c deleted file mode 100644 index 11e2ffd..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c +++ /dev/null | |||
@@ -1,662 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <sys/types.h> | ||
7 | #include <dirent.h> | ||
8 | |||
9 | #include <Ecore.h> | ||
10 | #include "ecore_private.h" | ||
11 | #ifdef BUILD_ECORE_EVAS_FB | ||
12 | #include <Ecore_Fb.h> | ||
13 | #include <ecore_fb_private.h> | ||
14 | #endif | ||
15 | |||
16 | #include "ecore_evas_private.h" | ||
17 | #include "Ecore_Evas.h" | ||
18 | |||
19 | #ifdef BUILD_ECORE_EVAS_FB | ||
20 | static int _ecore_evas_init_count = 0; | ||
21 | |||
22 | static char *ecore_evas_default_display = "0"; | ||
23 | static Eina_List *ecore_evas_input_devices = NULL; | ||
24 | static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {NULL, NULL, NULL, NULL}; | ||
25 | |||
26 | static void | ||
27 | _ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y) | ||
28 | { | ||
29 | int fbw, fbh; | ||
30 | |||
31 | ee->mouse.x = x; | ||
32 | ee->mouse.y = y; | ||
33 | ecore_fb_size_get(&fbw, &fbh); | ||
34 | if (ee->prop.cursor.object) | ||
35 | { | ||
36 | evas_object_show(ee->prop.cursor.object); | ||
37 | if (ee->rotation == 0) | ||
38 | evas_object_move(ee->prop.cursor.object, | ||
39 | x - ee->prop.cursor.hot.x, | ||
40 | y - ee->prop.cursor.hot.y); | ||
41 | else if (ee->rotation == 90) | ||
42 | evas_object_move(ee->prop.cursor.object, | ||
43 | (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.x, | ||
44 | x - ee->prop.cursor.hot.y); | ||
45 | else if (ee->rotation == 180) | ||
46 | evas_object_move(ee->prop.cursor.object, | ||
47 | (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.x, | ||
48 | (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.y); | ||
49 | else if (ee->rotation == 270) | ||
50 | evas_object_move(ee->prop.cursor.object, | ||
51 | y - ee->prop.cursor.hot.x, | ||
52 | (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.y); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | static Ecore_Evas *fb_ee = NULL; | ||
57 | |||
58 | static Ecore_Evas * | ||
59 | _ecore_evas_fb_match(void) | ||
60 | { | ||
61 | return fb_ee; | ||
62 | } | ||
63 | |||
64 | static void | ||
65 | _ecore_evas_fb_lose(void *data __UNUSED__) | ||
66 | { | ||
67 | Eina_List *ll; | ||
68 | Ecore_Fb_Input_Device *dev; | ||
69 | |||
70 | if (fb_ee) fb_ee->visible = 0; | ||
71 | |||
72 | EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev) | ||
73 | ecore_fb_input_device_listen(dev, 0); | ||
74 | } | ||
75 | |||
76 | static void | ||
77 | _ecore_evas_fb_gain(void *data __UNUSED__) | ||
78 | { | ||
79 | Ecore_Evas *ee; | ||
80 | Eina_List *ll; | ||
81 | Ecore_Fb_Input_Device *dev; | ||
82 | |||
83 | if (fb_ee) | ||
84 | { | ||
85 | ee = fb_ee; | ||
86 | |||
87 | ee->visible = 1; | ||
88 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
89 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
90 | else | ||
91 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
92 | } | ||
93 | |||
94 | EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev) | ||
95 | ecore_fb_input_device_listen(dev, 1); | ||
96 | } | ||
97 | |||
98 | static Eina_Bool | ||
99 | _ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
100 | { | ||
101 | Ecore_Evas *ee; | ||
102 | Ecore_Event_Mouse_Button *e; | ||
103 | |||
104 | e = event; | ||
105 | ee = _ecore_evas_fb_match(); | ||
106 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
107 | _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); | ||
108 | return ECORE_CALLBACK_PASS_ON; | ||
109 | } | ||
110 | |||
111 | static Eina_Bool | ||
112 | _ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
113 | { | ||
114 | Ecore_Evas *ee; | ||
115 | Ecore_Event_Mouse_Button *e; | ||
116 | |||
117 | e = event; | ||
118 | ee = _ecore_evas_fb_match(); | ||
119 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
120 | _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); | ||
121 | return ECORE_CALLBACK_PASS_ON; | ||
122 | } | ||
123 | |||
124 | static Eina_Bool | ||
125 | _ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
126 | { | ||
127 | Ecore_Evas *ee; | ||
128 | Ecore_Event_Mouse_Move *e; | ||
129 | |||
130 | e = event; | ||
131 | ee = _ecore_evas_fb_match(); | ||
132 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
133 | _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); | ||
134 | return ECORE_CALLBACK_PASS_ON; | ||
135 | } | ||
136 | |||
137 | static Eina_Bool | ||
138 | _ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
139 | { | ||
140 | Ecore_Evas *ee; | ||
141 | Ecore_Event_Mouse_Wheel *e; | ||
142 | |||
143 | e = event; | ||
144 | ee = _ecore_evas_fb_match(); | ||
145 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
146 | _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); | ||
147 | return ECORE_CALLBACK_PASS_ON; | ||
148 | } | ||
149 | |||
150 | static int | ||
151 | _ecore_evas_fb_render(Ecore_Evas *ee) | ||
152 | { | ||
153 | int rend = 0; | ||
154 | |||
155 | if (ee->visible) | ||
156 | { | ||
157 | Eina_List *updates; | ||
158 | Eina_List *ll; | ||
159 | Ecore_Evas *ee2; | ||
160 | |||
161 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
162 | |||
163 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
164 | { | ||
165 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
166 | if (ee2->engine.func->fn_render) | ||
167 | rend |= ee2->engine.func->fn_render(ee2); | ||
168 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
169 | } | ||
170 | |||
171 | updates = evas_render_updates(ee->evas); | ||
172 | if (updates) | ||
173 | { | ||
174 | evas_render_updates_free(updates); | ||
175 | _ecore_evas_idle_timeout_update(ee); | ||
176 | rend = 1; | ||
177 | } | ||
178 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
179 | } | ||
180 | else | ||
181 | evas_norender(ee->evas); | ||
182 | return rend; | ||
183 | } | ||
184 | |||
185 | static int | ||
186 | _ecore_evas_fb_init(Ecore_Evas *ee, int w, int h) | ||
187 | { | ||
188 | Eina_File_Direct_Info *info; | ||
189 | Eina_Iterator *ls; | ||
190 | Ecore_Fb_Input_Device *device; | ||
191 | Ecore_Fb_Input_Device_Cap caps; | ||
192 | int mouse_handled = 0; | ||
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 | ls = eina_file_direct_ls("/dev/input/"); | ||
201 | |||
202 | EINA_ITERATOR_FOREACH(ls, info) | ||
203 | { | ||
204 | if (strncmp(info->path + info->name_start, "event", 5) != 0) | ||
205 | continue; | ||
206 | |||
207 | if (!(device = ecore_fb_input_device_open(info->path))) | ||
208 | continue; | ||
209 | ecore_fb_input_device_window_set(device, ee); | ||
210 | |||
211 | caps = ecore_fb_input_device_cap_get(device); | ||
212 | |||
213 | /* Mouse */ | ||
214 | #ifdef HAVE_TSLIB | ||
215 | if (caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE) | ||
216 | #else | ||
217 | if ((caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE) || (caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)) | ||
218 | #endif | ||
219 | { | ||
220 | ecore_fb_input_device_axis_size_set(device, w, h); | ||
221 | ecore_fb_input_device_listen(device,1); | ||
222 | ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); | ||
223 | if (!mouse_handled) | ||
224 | { | ||
225 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); | ||
226 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL); | ||
227 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL); | ||
228 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _ecore_evas_event_mouse_wheel, NULL); | ||
229 | mouse_handled = 1; | ||
230 | } | ||
231 | } | ||
232 | /* Keyboard */ | ||
233 | else if ((caps & ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS) && !(caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)) | ||
234 | { | ||
235 | ecore_fb_input_device_listen(device,1); | ||
236 | ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); | ||
237 | } | ||
238 | } | ||
239 | eina_iterator_free(ls); | ||
240 | |||
241 | if (!mouse_handled) | ||
242 | { | ||
243 | if (ecore_fb_ts_init()) | ||
244 | { | ||
245 | ecore_fb_ts_event_window_set(ee); | ||
246 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); | ||
247 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL); | ||
248 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL); | ||
249 | mouse_handled = 1; | ||
250 | } | ||
251 | } | ||
252 | return _ecore_evas_init_count; | ||
253 | } | ||
254 | |||
255 | static void | ||
256 | _ecore_evas_fb_free(Ecore_Evas *ee) | ||
257 | { | ||
258 | ecore_evas_input_event_unregister(ee); | ||
259 | if (fb_ee == ee) fb_ee = NULL; | ||
260 | _ecore_evas_fb_shutdown(); | ||
261 | ecore_fb_shutdown(); | ||
262 | } | ||
263 | |||
264 | static void | ||
265 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
266 | { | ||
267 | ee->req.w = w; | ||
268 | ee->req.h = h; | ||
269 | if ((w == ee->w) && (h == ee->h)) return; | ||
270 | ee->w = w; | ||
271 | ee->h = h; | ||
272 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
273 | { | ||
274 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
275 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
276 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
281 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
282 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
283 | } | ||
284 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
285 | } | ||
286 | |||
287 | static void | ||
288 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
289 | { | ||
290 | ee->req.w = w; | ||
291 | ee->req.h = h; | ||
292 | if ((w == ee->w) && (h == ee->h)) return; | ||
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 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
304 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
305 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
306 | } | ||
307 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
308 | } | ||
309 | |||
310 | static void | ||
311 | _ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize __UNUSED__) | ||
312 | { | ||
313 | Evas_Engine_Info_FB *einfo; | ||
314 | int rot_dif; | ||
315 | |||
316 | if (ee->rotation == rotation) return; | ||
317 | einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas); | ||
318 | if (!einfo) return; | ||
319 | rot_dif = ee->rotation - rotation; | ||
320 | if (rot_dif < 0) rot_dif = -rot_dif; | ||
321 | if (rot_dif != 180) | ||
322 | { | ||
323 | |||
324 | einfo->info.rotation = rotation; | ||
325 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
326 | { | ||
327 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
328 | } | ||
329 | if (!ee->prop.fullscreen) | ||
330 | { | ||
331 | int tmp; | ||
332 | |||
333 | tmp = ee->w; | ||
334 | ee->w = ee->h; | ||
335 | ee->h = tmp; | ||
336 | ee->req.w = ee->w; | ||
337 | ee->req.h = ee->h; | ||
338 | } | ||
339 | else | ||
340 | { | ||
341 | if ((rotation == 0) || (rotation == 180)) | ||
342 | { | ||
343 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
344 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
345 | } | ||
346 | else | ||
347 | { | ||
348 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
349 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
350 | } | ||
351 | } | ||
352 | ee->rotation = rotation; | ||
353 | } | ||
354 | else | ||
355 | { | ||
356 | einfo->info.rotation = rotation; | ||
357 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
358 | { | ||
359 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
360 | } | ||
361 | ee->rotation = rotation; | ||
362 | } | ||
363 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
364 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
365 | else | ||
366 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
367 | _ecore_evas_mouse_move_process_fb(ee, ee->mouse.x, ee->mouse.y); | ||
368 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
369 | } | ||
370 | |||
371 | static void | ||
372 | _ecore_evas_show(Ecore_Evas *ee) | ||
373 | { | ||
374 | if (ee->prop.focused) return; | ||
375 | ee->prop.focused = 1; | ||
376 | evas_focus_in(ee->evas); | ||
377 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
378 | } | ||
379 | |||
380 | static void | ||
381 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
382 | { | ||
383 | Ecore_Evas *ee; | ||
384 | |||
385 | ee = data; | ||
386 | if (ee) | ||
387 | ee->prop.cursor.object = NULL; | ||
388 | } | ||
389 | |||
390 | static void | ||
391 | _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
392 | { | ||
393 | int x, y; | ||
394 | |||
395 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
396 | |||
397 | if (!obj) | ||
398 | { | ||
399 | ee->prop.cursor.object = NULL; | ||
400 | ee->prop.cursor.layer = 0; | ||
401 | ee->prop.cursor.hot.x = 0; | ||
402 | ee->prop.cursor.hot.y = 0; | ||
403 | return; | ||
404 | } | ||
405 | |||
406 | ee->prop.cursor.object = obj; | ||
407 | ee->prop.cursor.layer = layer; | ||
408 | ee->prop.cursor.hot.x = hot_x; | ||
409 | ee->prop.cursor.hot.y = hot_y; | ||
410 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
411 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
412 | evas_object_move(ee->prop.cursor.object, | ||
413 | x - ee->prop.cursor.hot.x, | ||
414 | y - ee->prop.cursor.hot.y); | ||
415 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
416 | if (evas_pointer_inside_get(ee->evas)) | ||
417 | evas_object_show(ee->prop.cursor.object); | ||
418 | |||
419 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
420 | } | ||
421 | |||
422 | static void | ||
423 | _ecore_evas_fullscreen_set(Ecore_Evas *ee, int on) | ||
424 | { | ||
425 | Eina_List *l; | ||
426 | Ecore_Fb_Input_Device *dev; | ||
427 | int resized = 0; | ||
428 | |||
429 | if (((ee->prop.fullscreen) && (on)) || | ||
430 | ((!ee->prop.fullscreen) && (!on))) return; | ||
431 | if (on) | ||
432 | { | ||
433 | int w, h; | ||
434 | |||
435 | ee->engine.fb.real_w = ee->w; | ||
436 | ee->engine.fb.real_h = ee->h; | ||
437 | w = ee->w; | ||
438 | h = ee->h; | ||
439 | ecore_fb_size_get(&w, &h); | ||
440 | if ((w == 0) && (h == 0)) | ||
441 | { | ||
442 | w = ee->w; | ||
443 | h = ee->h; | ||
444 | } | ||
445 | if ((w != ee->w) || (h != ee->h)) resized = 1; | ||
446 | ee->w = w; | ||
447 | ee->h = h; | ||
448 | ee->req.w = ee->w; | ||
449 | ee->req.h = ee->h; | ||
450 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
451 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
452 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
453 | } | ||
454 | else | ||
455 | { | ||
456 | if ((ee->engine.fb.real_w != ee->w) || (ee->engine.fb.real_h != ee->h)) resized = 1; | ||
457 | ee->w = ee->engine.fb.real_w; | ||
458 | ee->h = ee->engine.fb.real_h; | ||
459 | ee->req.w = ee->w; | ||
460 | ee->req.h = ee->h; | ||
461 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
462 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
463 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
464 | } | ||
465 | ee->prop.fullscreen = on; | ||
466 | EINA_LIST_FOREACH(ecore_evas_input_devices, l, dev) | ||
467 | ecore_fb_input_device_axis_size_set(dev, ee->w, ee->h); | ||
468 | /* rescale the input device area */ | ||
469 | if (resized) | ||
470 | { | ||
471 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
472 | } | ||
473 | } | ||
474 | |||
475 | int | ||
476 | _ecore_evas_fb_shutdown(void) | ||
477 | { | ||
478 | _ecore_evas_init_count--; | ||
479 | if (_ecore_evas_init_count == 0) | ||
480 | { | ||
481 | int i; | ||
482 | |||
483 | for (i = 0; i < 4; i++) | ||
484 | { | ||
485 | if (ecore_evas_event_handlers[i]) | ||
486 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
487 | } | ||
488 | ecore_fb_ts_shutdown(); | ||
489 | ecore_event_evas_shutdown(); | ||
490 | } | ||
491 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
492 | return _ecore_evas_init_count; | ||
493 | } | ||
494 | |||
495 | static Ecore_Evas_Engine_Func _ecore_fb_engine_func = | ||
496 | { | ||
497 | _ecore_evas_fb_free, | ||
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 | _ecore_evas_resize, | ||
515 | _ecore_evas_move_resize, | ||
516 | _ecore_evas_rotation_set, | ||
517 | NULL, | ||
518 | _ecore_evas_show, | ||
519 | NULL, | ||
520 | NULL, | ||
521 | NULL, | ||
522 | NULL, | ||
523 | NULL, | ||
524 | NULL, | ||
525 | NULL, | ||
526 | NULL, | ||
527 | NULL, | ||
528 | NULL, | ||
529 | _ecore_evas_object_cursor_set, | ||
530 | NULL, | ||
531 | NULL, | ||
532 | NULL, | ||
533 | NULL, | ||
534 | NULL, | ||
535 | NULL, | ||
536 | _ecore_evas_fullscreen_set, | ||
537 | NULL, | ||
538 | NULL, | ||
539 | NULL, | ||
540 | NULL, | ||
541 | NULL, | ||
542 | NULL, //transparent | ||
543 | |||
544 | NULL, | ||
545 | NULL, | ||
546 | NULL, | ||
547 | NULL, | ||
548 | NULL, | ||
549 | NULL, | ||
550 | |||
551 | NULL, // render | ||
552 | NULL // screen_geometry_get | ||
553 | }; | ||
554 | #endif | ||
555 | |||
556 | /** | ||
557 | * To be documented. | ||
558 | * | ||
559 | * FIXME: To be fixed. | ||
560 | */ | ||
561 | #ifdef BUILD_ECORE_EVAS_FB | ||
562 | EAPI Ecore_Evas * | ||
563 | ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h) | ||
564 | { | ||
565 | Evas_Engine_Info_FB *einfo; | ||
566 | Ecore_Evas *ee; | ||
567 | |||
568 | int rmethod; | ||
569 | |||
570 | if (!disp_name) | ||
571 | disp_name = ecore_evas_default_display; | ||
572 | |||
573 | rmethod = evas_render_method_lookup("fb"); | ||
574 | if (!rmethod) return NULL; | ||
575 | |||
576 | if (!ecore_fb_init(disp_name)) return NULL; | ||
577 | ecore_fb_callback_gain_set(_ecore_evas_fb_gain, NULL); | ||
578 | ecore_fb_callback_lose_set(_ecore_evas_fb_lose, NULL); | ||
579 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
580 | if (!ee) return NULL; | ||
581 | |||
582 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
583 | |||
584 | _ecore_evas_fb_init(ee, w, h); | ||
585 | |||
586 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func; | ||
587 | |||
588 | ee->driver = "fb"; | ||
589 | if (disp_name) ee->name = strdup(disp_name); | ||
590 | |||
591 | if (w < 1) w = 1; | ||
592 | if (h < 1) h = 1; | ||
593 | ee->rotation = rotation; | ||
594 | ee->visible = 1; | ||
595 | ee->w = w; | ||
596 | ee->h = h; | ||
597 | ee->req.w = ee->w; | ||
598 | ee->req.h = ee->h; | ||
599 | |||
600 | ee->prop.max.w = 0; | ||
601 | ee->prop.max.h = 0; | ||
602 | ee->prop.layer = 0; | ||
603 | ee->prop.focused = 1; | ||
604 | ee->prop.borderless = 1; | ||
605 | ee->prop.override = 1; | ||
606 | ee->prop.maximized = 1; | ||
607 | ee->prop.fullscreen = 0; | ||
608 | ee->prop.withdrawn = 0; | ||
609 | ee->prop.sticky = 0; | ||
610 | |||
611 | /* init evas here */ | ||
612 | ee->evas = evas_new(); | ||
613 | evas_data_attach_set(ee->evas, ee); | ||
614 | evas_output_method_set(ee->evas, rmethod); | ||
615 | |||
616 | if ((rotation == 90) || (rotation == 270)) | ||
617 | { | ||
618 | evas_output_size_set(ee->evas, h, w); | ||
619 | evas_output_viewport_set(ee->evas, 0, 0, h, w); | ||
620 | } | ||
621 | else | ||
622 | { | ||
623 | evas_output_size_set(ee->evas, w, h); | ||
624 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
625 | } | ||
626 | |||
627 | einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas); | ||
628 | if (einfo) | ||
629 | { | ||
630 | einfo->info.virtual_terminal = 0; | ||
631 | einfo->info.device_number = strtol(disp_name, NULL, 10); | ||
632 | einfo->info.refresh = 0; | ||
633 | einfo->info.rotation = ee->rotation; | ||
634 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
635 | { | ||
636 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
637 | ecore_evas_free(ee); | ||
638 | return NULL; | ||
639 | } | ||
640 | } | ||
641 | else | ||
642 | { | ||
643 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
644 | ecore_evas_free(ee); | ||
645 | return NULL; | ||
646 | } | ||
647 | |||
648 | ecore_evas_input_event_register(ee); | ||
649 | |||
650 | ee->engine.func->fn_render = _ecore_evas_fb_render; | ||
651 | _ecore_evas_register(ee); | ||
652 | fb_ee = ee; | ||
653 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
654 | return ee; | ||
655 | } | ||
656 | #else | ||
657 | EAPI Ecore_Evas * | ||
658 | ecore_evas_fb_new(const char *disp_name __UNUSED__, int rotation __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
659 | { | ||
660 | return NULL; | ||
661 | } | ||
662 | #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 deleted file mode 100644 index e31653a..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h +++ /dev/null | |||
@@ -1,478 +0,0 @@ | |||
1 | #ifndef _ECORE_EVAS_PRIVATE_H | ||
2 | #define _ECORE_EVAS_PRIVATE_H | ||
3 | |||
4 | #include <Evas.h> | ||
5 | #include <Ecore.h> | ||
6 | #include <ecore_private.h> | ||
7 | #include <Ecore_Input.h> | ||
8 | #include <Ecore_Input_Evas.h> | ||
9 | |||
10 | #define ECORE_MAGIC_EVAS 0x76543211 | ||
11 | |||
12 | #ifdef BUILD_ECORE_EVAS_X11 | ||
13 | # include <Ecore_X.h> | ||
14 | # include <Ecore_X_Atoms.h> | ||
15 | # ifdef HAVE_ECORE_X_XCB | ||
16 | # include <xcb/xcb.h> | ||
17 | # endif | ||
18 | # ifdef HAVE_ECORE_X_XLIB | ||
19 | # include <X11/Xlib.h> | ||
20 | # include <X11/Xutil.h> | ||
21 | # endif | ||
22 | #endif | ||
23 | |||
24 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
25 | # include <Evas_Engine_Software_X11.h> | ||
26 | #endif | ||
27 | |||
28 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
29 | # include <Evas_Engine_GL_X11.h> | ||
30 | #endif | ||
31 | |||
32 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
33 | # include <Evas_Engine_Software_8_X11.h> | ||
34 | #endif | ||
35 | |||
36 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
37 | # include <Evas_Engine_Software_16_X11.h> | ||
38 | #endif | ||
39 | |||
40 | #ifdef BUILD_ECORE_EVAS_FB | ||
41 | # include <Evas_Engine_FB.h> | ||
42 | #endif | ||
43 | |||
44 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
45 | # include <Evas_Engine_DirectFB.h> | ||
46 | # include "Ecore_DirectFB.h" | ||
47 | #endif | ||
48 | |||
49 | #if defined(BUILD_ECORE_EVAS_SOFTWARE_BUFFER) || defined(BUILD_ECORE_EVAS_EWS) | ||
50 | # include <Evas_Engine_Buffer.h> | ||
51 | #endif | ||
52 | |||
53 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
54 | # include "Ecore_Win32.h" | ||
55 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
56 | # include <Evas_Engine_Software_Gdi.h> | ||
57 | # endif | ||
58 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
59 | # include <Evas_Engine_Software_DDraw.h> | ||
60 | # endif | ||
61 | # ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
62 | # include <Evas_Engine_Direct3D.h> | ||
63 | # endif | ||
64 | # ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
65 | # include <Evas_Engine_GL_Glew.h> | ||
66 | # endif | ||
67 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
68 | # include <Evas_Engine_Software_16_DDraw.h> | ||
69 | # endif | ||
70 | #endif | ||
71 | |||
72 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
73 | # include "Ecore_WinCE.h" | ||
74 | # include <Evas_Engine_Software_16_WinCE.h> | ||
75 | #endif | ||
76 | |||
77 | #ifdef BUILD_ECORE_EVAS_GL_COCOA | ||
78 | # include "Ecore_Cocoa.h" | ||
79 | # include <Evas_Engine_Gl_Cocoa.h> | ||
80 | #endif | ||
81 | |||
82 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
83 | # include "Ecore_Wayland.h" | ||
84 | # include <Evas_Engine_Wayland_Shm.h> | ||
85 | #endif | ||
86 | |||
87 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
88 | # include "Ecore_Wayland.h" | ||
89 | # include <Evas_Engine_Wayland_Egl.h> | ||
90 | #endif | ||
91 | |||
92 | /** Log domain macros and variables **/ | ||
93 | |||
94 | extern int _ecore_evas_log_dom; | ||
95 | |||
96 | #ifdef ECORE_EVAS_DEFAULT_LOG_COLOR | ||
97 | # undef ECORE_EVAS_DEFAULT_LOG_COLOR | ||
98 | #endif | ||
99 | #define ECORE_EVAS_DEFAULT_LOG_COLOR EINA_COLOR_BLUE | ||
100 | |||
101 | #ifdef ERR | ||
102 | # undef ERR | ||
103 | #endif | ||
104 | #define ERR(...) EINA_LOG_DOM_ERR(_ecore_evas_log_dom, __VA_ARGS__) | ||
105 | #ifdef DBG | ||
106 | # undef DBG | ||
107 | #endif | ||
108 | #define DBG(...) EINA_LOG_DOM_DBG(_ecore_evas_log_dom, __VA_ARGS__) | ||
109 | #ifdef INF | ||
110 | # undef INF | ||
111 | #endif | ||
112 | #define INF(...) EINA_LOG_DOM_INFO(_ecore_evas_log_dom, __VA_ARGS__) | ||
113 | #ifdef WRN | ||
114 | # undef WRN | ||
115 | #endif | ||
116 | #define WRN(...) EINA_LOG_DOM_WARN(_ecore_evas_log_dom, __VA_ARGS__) | ||
117 | #ifdef CRIT | ||
118 | # undef CRIT | ||
119 | #endif | ||
120 | #define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_evas_log_dom, __VA_ARGS__) | ||
121 | |||
122 | |||
123 | #define IDLE_FLUSH_TIME 0.5 | ||
124 | #ifndef _ECORE_EVAS_H | ||
125 | typedef struct _Ecore_Evas Ecore_Evas; | ||
126 | typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); | ||
127 | #endif | ||
128 | |||
129 | typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine; | ||
130 | typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func; | ||
131 | |||
132 | struct _Ecore_Evas_Engine_Func | ||
133 | { | ||
134 | void (*fn_free) (Ecore_Evas *ee); | ||
135 | void (*fn_callback_resize_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
136 | void (*fn_callback_move_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
137 | void (*fn_callback_show_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
138 | void (*fn_callback_hide_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
139 | void (*fn_callback_delete_request_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
140 | void (*fn_callback_destroy_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
141 | void (*fn_callback_focus_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
142 | void (*fn_callback_focus_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
143 | void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
144 | void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
145 | void (*fn_callback_sticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
146 | void (*fn_callback_unsticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
147 | void (*fn_callback_pre_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
148 | void (*fn_callback_post_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); | ||
149 | void (*fn_move) (Ecore_Evas *ee, int x, int y); | ||
150 | void (*fn_managed_move) (Ecore_Evas *ee, int x, int y); | ||
151 | void (*fn_resize) (Ecore_Evas *ee, int w, int h); | ||
152 | void (*fn_move_resize) (Ecore_Evas *ee, int x, int y, int w, int h); | ||
153 | void (*fn_rotation_set) (Ecore_Evas *ee, int rot, int resize); | ||
154 | void (*fn_shaped_set) (Ecore_Evas *ee, int shaped); | ||
155 | void (*fn_show) (Ecore_Evas *ee); | ||
156 | void (*fn_hide) (Ecore_Evas *ee); | ||
157 | void (*fn_raise) (Ecore_Evas *ee); | ||
158 | void (*fn_lower) (Ecore_Evas *ee); | ||
159 | void (*fn_activate) (Ecore_Evas *ee); | ||
160 | void (*fn_title_set) (Ecore_Evas *ee, const char *t); | ||
161 | void (*fn_name_class_set) (Ecore_Evas *ee, const char *n, const char *c); | ||
162 | void (*fn_size_min_set) (Ecore_Evas *ee, int w, int h); | ||
163 | void (*fn_size_max_set) (Ecore_Evas *ee, int w, int h); | ||
164 | void (*fn_size_base_set) (Ecore_Evas *ee, int w, int h); | ||
165 | void (*fn_size_step_set) (Ecore_Evas *ee, int w, int h); | ||
166 | void (*fn_object_cursor_set) (Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); | ||
167 | void (*fn_layer_set) (Ecore_Evas *ee, int layer); | ||
168 | void (*fn_focus_set) (Ecore_Evas *ee, int on); | ||
169 | void (*fn_iconified_set) (Ecore_Evas *ee, int on); | ||
170 | void (*fn_borderless_set) (Ecore_Evas *ee, int on); | ||
171 | void (*fn_override_set) (Ecore_Evas *ee, int on); | ||
172 | void (*fn_maximized_set) (Ecore_Evas *ee, int on); | ||
173 | void (*fn_fullscreen_set) (Ecore_Evas *ee, int on); | ||
174 | void (*fn_avoid_damage_set) (Ecore_Evas *ee, int on); | ||
175 | void (*fn_withdrawn_set) (Ecore_Evas *ee, int withdrawn); | ||
176 | void (*fn_sticky_set) (Ecore_Evas *ee, int sticky); | ||
177 | void (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore); | ||
178 | void (*fn_alpha_set) (Ecore_Evas *ee, int alpha); | ||
179 | void (*fn_transparent_set) (Ecore_Evas *ee, int transparent); | ||
180 | |||
181 | void (*fn_window_group_set) (Ecore_Evas *ee, const Ecore_Evas *ee_group); | ||
182 | void (*fn_aspect_set) (Ecore_Evas *ee, double aspect); | ||
183 | void (*fn_urgent_set) (Ecore_Evas *ee, int urgent); | ||
184 | void (*fn_modal_set) (Ecore_Evas *ee, int modal); | ||
185 | void (*fn_demands_attention_set) (Ecore_Evas *ee, int demand); | ||
186 | void (*fn_focus_skip_set) (Ecore_Evas *ee, int skip); | ||
187 | |||
188 | int (*fn_render) (Ecore_Evas *ee); | ||
189 | void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h); | ||
190 | }; | ||
191 | |||
192 | struct _Ecore_Evas_Engine | ||
193 | { | ||
194 | Ecore_Evas_Engine_Func *func; | ||
195 | |||
196 | /* TODO: UGLY! This should be an union or inheritance! */ | ||
197 | #ifdef BUILD_ECORE_EVAS_X11 | ||
198 | struct | ||
199 | { | ||
200 | Ecore_X_Window win_root; | ||
201 | Eina_List *win_extra; | ||
202 | Ecore_X_Pixmap pmap; | ||
203 | Ecore_X_Pixmap mask; | ||
204 | Ecore_X_GC gc; | ||
205 | Ecore_X_XRegion *damages; | ||
206 | Ecore_X_Sync_Counter sync_counter; | ||
207 | Ecore_X_Window leader; | ||
208 | Ecore_X_Sync_Counter netwm_sync_counter; | ||
209 | int netwm_sync_val_hi; | ||
210 | unsigned int netwm_sync_val_lo; | ||
211 | int sync_val; // bigger! this will screw up at 2 billion frames (414 days of continual rendering @ 60fps) | ||
212 | int screen_num; | ||
213 | int px, py, pw, ph; | ||
214 | unsigned char direct_resize : 1; | ||
215 | unsigned char using_bg_pixmap : 1; | ||
216 | unsigned char managed : 1; | ||
217 | unsigned char sync_began : 1; | ||
218 | unsigned char sync_cancel : 1; | ||
219 | unsigned char netwm_sync_set : 1; | ||
220 | unsigned char configure_coming : 1; | ||
221 | struct { | ||
222 | unsigned char modal : 1; | ||
223 | unsigned char sticky : 1; | ||
224 | unsigned char maximized_v : 1; | ||
225 | unsigned char maximized_h : 1; | ||
226 | unsigned char shaded : 1; | ||
227 | unsigned char skip_taskbar : 1; | ||
228 | unsigned char skip_pager : 1; | ||
229 | unsigned char fullscreen : 1; | ||
230 | unsigned char above : 1; | ||
231 | unsigned char below : 1; | ||
232 | } state; | ||
233 | Ecore_X_Window win_shaped_input; | ||
234 | } x; | ||
235 | #endif | ||
236 | #ifdef BUILD_ECORE_EVAS_FB | ||
237 | struct { | ||
238 | int real_w; | ||
239 | int real_h; | ||
240 | } fb; | ||
241 | #endif | ||
242 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
243 | struct { | ||
244 | void *pixels; | ||
245 | Evas_Object *image; | ||
246 | void (*free_func) (void *data, void *pix); | ||
247 | void *(*alloc_func) (void *data, int size); | ||
248 | void *data; | ||
249 | } buffer; | ||
250 | #endif | ||
251 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
252 | struct { | ||
253 | Ecore_DirectFB_Window *window; | ||
254 | } directfb; | ||
255 | #endif | ||
256 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
257 | struct { | ||
258 | Ecore_Win32_Window *parent; | ||
259 | struct { | ||
260 | unsigned char region : 1; | ||
261 | unsigned char fullscreen : 1; | ||
262 | } state; | ||
263 | } win32; | ||
264 | #endif | ||
265 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
266 | struct { | ||
267 | Ecore_WinCE_Window *window; | ||
268 | struct { | ||
269 | unsigned char fullscreen : 1; | ||
270 | } state; | ||
271 | } wince; | ||
272 | #endif | ||
273 | #ifdef BUILD_ECORE_EVAS_EWS | ||
274 | struct { | ||
275 | Evas_Object *image; | ||
276 | } ews; | ||
277 | #endif | ||
278 | |||
279 | #if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined(BUILD_ECORE_EVAS_WAYLAND_EGL) | ||
280 | struct | ||
281 | { | ||
282 | Ecore_Wl_Window *parent, *win; | ||
283 | Evas_Object *frame; | ||
284 | |||
285 | # if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) | ||
286 | struct wl_buffer *buffer; | ||
287 | # endif | ||
288 | |||
289 | } wl; | ||
290 | #endif | ||
291 | |||
292 | Ecore_Timer *idle_flush_timer; | ||
293 | }; | ||
294 | |||
295 | struct _Ecore_Evas | ||
296 | { | ||
297 | EINA_INLIST; | ||
298 | ECORE_MAGIC; | ||
299 | Evas *evas; | ||
300 | const char *driver; | ||
301 | char *name; | ||
302 | int x, y, w, h; | ||
303 | short rotation; | ||
304 | Eina_Bool shaped : 1; | ||
305 | Eina_Bool visible : 1; | ||
306 | Eina_Bool draw_ok : 1; | ||
307 | Eina_Bool should_be_visible : 1; | ||
308 | Eina_Bool alpha : 1; | ||
309 | Eina_Bool transparent : 1; | ||
310 | Eina_Bool in : 1; | ||
311 | |||
312 | Eina_Hash *data; | ||
313 | |||
314 | struct { | ||
315 | int x, y, w, h; | ||
316 | } req; | ||
317 | |||
318 | struct { | ||
319 | int x, y; | ||
320 | } mouse; | ||
321 | |||
322 | struct { | ||
323 | int w, h; | ||
324 | } expecting_resize; | ||
325 | |||
326 | struct { | ||
327 | char *title; | ||
328 | char *name; | ||
329 | char *clas; | ||
330 | struct { | ||
331 | int w, h; | ||
332 | } min, | ||
333 | max, | ||
334 | base, | ||
335 | step; | ||
336 | struct { | ||
337 | Evas_Object *object; | ||
338 | int layer; | ||
339 | struct { | ||
340 | int x, y; | ||
341 | } hot; | ||
342 | } cursor; | ||
343 | int layer; | ||
344 | Ecore_Window window; | ||
345 | unsigned char avoid_damage; | ||
346 | Ecore_Evas *group_ee; | ||
347 | Ecore_Window group_ee_win; | ||
348 | double aspect; | ||
349 | char focused : 1; | ||
350 | char iconified : 1; | ||
351 | char borderless : 1; | ||
352 | char override : 1; | ||
353 | char maximized : 1; | ||
354 | char fullscreen : 1; | ||
355 | char withdrawn : 1; | ||
356 | char sticky : 1; | ||
357 | char request_pos : 1; | ||
358 | char draw_frame : 1; | ||
359 | char hwsurface : 1; | ||
360 | char urgent : 1; | ||
361 | char modal : 1; | ||
362 | char demand_attention : 1; | ||
363 | char focus_skip : 1; | ||
364 | } prop; | ||
365 | |||
366 | struct { | ||
367 | void (*fn_resize) (Ecore_Evas *ee); | ||
368 | void (*fn_move) (Ecore_Evas *ee); | ||
369 | void (*fn_show) (Ecore_Evas *ee); | ||
370 | void (*fn_hide) (Ecore_Evas *ee); | ||
371 | void (*fn_delete_request) (Ecore_Evas *ee); | ||
372 | void (*fn_destroy) (Ecore_Evas *ee); | ||
373 | void (*fn_focus_in) (Ecore_Evas *ee); | ||
374 | void (*fn_focus_out) (Ecore_Evas *ee); | ||
375 | void (*fn_sticky) (Ecore_Evas *ee); | ||
376 | void (*fn_unsticky) (Ecore_Evas *ee); | ||
377 | void (*fn_mouse_in) (Ecore_Evas *ee); | ||
378 | void (*fn_mouse_out) (Ecore_Evas *ee); | ||
379 | void (*fn_pre_render) (Ecore_Evas *ee); | ||
380 | void (*fn_post_render) (Ecore_Evas *ee); | ||
381 | void (*fn_pre_free) (Ecore_Evas *ee); | ||
382 | void (*fn_state_change) (Ecore_Evas *ee); | ||
383 | } func; | ||
384 | |||
385 | Ecore_Evas_Engine engine; | ||
386 | Eina_List *sub_ecore_evas; | ||
387 | |||
388 | int refcount; | ||
389 | |||
390 | unsigned char ignore_events : 1; | ||
391 | unsigned char manual_render : 1; | ||
392 | unsigned char registered : 1; | ||
393 | unsigned char no_comp_sync : 1; | ||
394 | unsigned char semi_sync : 1; | ||
395 | unsigned char deleted : 1; | ||
396 | }; | ||
397 | |||
398 | void _ecore_evas_ref(Ecore_Evas *ee); | ||
399 | void _ecore_evas_unref(Ecore_Evas *ee); | ||
400 | |||
401 | #ifdef BUILD_ECORE_EVAS_X11 | ||
402 | int _ecore_evas_x_shutdown(void); | ||
403 | #endif | ||
404 | #ifdef BUILD_ECORE_EVAS_FB | ||
405 | int _ecore_evas_fb_shutdown(void); | ||
406 | #endif | ||
407 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
408 | int _ecore_evas_buffer_shutdown(void); | ||
409 | int _ecore_evas_buffer_render(Ecore_Evas *ee); | ||
410 | #endif | ||
411 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
412 | int _ecore_evas_directfb_shutdown(void); | ||
413 | #endif | ||
414 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
415 | int _ecore_evas_win32_shutdown(void); | ||
416 | #endif | ||
417 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
418 | int _ecore_evas_wince_shutdown(void); | ||
419 | #endif | ||
420 | #ifdef BUILD_ECORE_EVAS_EWS | ||
421 | void _ecore_evas_ews_events_init(void); | ||
422 | int _ecore_evas_ews_shutdown(void); | ||
423 | #endif | ||
424 | |||
425 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
426 | void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location); | ||
427 | void _ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); | ||
428 | void _ecore_evas_wayland_shm_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); | ||
429 | void _ecore_evas_wayland_shm_type_set(Ecore_Evas *ee, int type); | ||
430 | #endif | ||
431 | |||
432 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
433 | void _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location); | ||
434 | void _ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); | ||
435 | void _ecore_evas_wayland_egl_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); | ||
436 | void _ecore_evas_wayland_egl_type_set(Ecore_Evas *ee, int type); | ||
437 | #endif | ||
438 | |||
439 | void _ecore_evas_fps_debug_init(void); | ||
440 | void _ecore_evas_fps_debug_shutdown(void); | ||
441 | void _ecore_evas_fps_debug_rendertime_add(double t); | ||
442 | void _ecore_evas_register(Ecore_Evas *ee); | ||
443 | void _ecore_evas_free(Ecore_Evas *ee); | ||
444 | void _ecore_evas_idle_timeout_update(Ecore_Evas *ee); | ||
445 | void _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp); | ||
446 | void _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, | ||
447 | int x, int y, | ||
448 | double radius, | ||
449 | double radius_x, double radius_y, | ||
450 | double pressure, | ||
451 | double angle, | ||
452 | double mx, double my, | ||
453 | unsigned int timestamp); | ||
454 | void _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, | ||
455 | int x, int y, | ||
456 | double radius, | ||
457 | double radius_x, double radius_y, | ||
458 | double pressure, | ||
459 | double angle, | ||
460 | double mx, double my, | ||
461 | Evas_Button_Flags flags, | ||
462 | unsigned int timestamp); | ||
463 | void _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, | ||
464 | int x, int y, | ||
465 | double radius, | ||
466 | double radius_x, double radius_y, | ||
467 | double pressure, | ||
468 | double angle, | ||
469 | double mx, double my, | ||
470 | Evas_Button_Flags flags, | ||
471 | unsigned int timestamp); | ||
472 | |||
473 | extern Eina_Bool _ecore_evas_app_comp_sync; | ||
474 | |||
475 | void _ecore_evas_extn_init(void); | ||
476 | void _ecore_evas_extn_shutdown(void); | ||
477 | |||
478 | #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 deleted file mode 100644 index 038654a..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c +++ /dev/null | |||
@@ -1,513 +0,0 @@ | |||
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[5] = { | ||
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 Eina_Bool | ||
102 | _ecore_evas_psl1ght_event_quit (void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
103 | { | ||
104 | Ecore_Evas *ee; | ||
105 | |||
106 | ee = _ecore_evas_psl1ght_match(); | ||
107 | |||
108 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
109 | if (ee->func.fn_delete_request) | ||
110 | ee->func.fn_delete_request(ee); | ||
111 | return ECORE_CALLBACK_PASS_ON; | ||
112 | } | ||
113 | |||
114 | static int | ||
115 | _ecore_evas_render(Ecore_Evas *ee) | ||
116 | { | ||
117 | Eina_List *updates; | ||
118 | |||
119 | updates = evas_render_updates(ee->evas); | ||
120 | if (updates) | ||
121 | { | ||
122 | evas_render_updates_free(updates); | ||
123 | _ecore_evas_idle_timeout_update(ee); | ||
124 | } | ||
125 | return updates ? 1 : 0; | ||
126 | } | ||
127 | |||
128 | static int | ||
129 | _ecore_evas_psl1ght_render(Ecore_Evas *ee) | ||
130 | { | ||
131 | int rend = 0; | ||
132 | |||
133 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
134 | Eina_List *ll; | ||
135 | Ecore_Evas *ee2; | ||
136 | |||
137 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
138 | { | ||
139 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
140 | rend |= _ecore_evas_buffer_render(ee2); | ||
141 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
142 | } | ||
143 | #endif | ||
144 | |||
145 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
146 | |||
147 | if (ee->prop.avoid_damage) rend = _ecore_evas_render(ee); | ||
148 | else if ((ee->visible) || | ||
149 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
150 | ((ee->should_be_visible) && (ee->prop.override))) | ||
151 | rend |= _ecore_evas_render(ee); | ||
152 | else | ||
153 | evas_norender(ee->evas); | ||
154 | |||
155 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
156 | return rend; | ||
157 | } | ||
158 | |||
159 | static Eina_Bool | ||
160 | _ecore_evas_psl1ght_event(void *data __UNUSED__) | ||
161 | { | ||
162 | ecore_psl1ght_poll_events(); | ||
163 | return ECORE_CALLBACK_RENEW; | ||
164 | } | ||
165 | |||
166 | static int | ||
167 | _ecore_evas_psl1ght_init(int w __UNUSED__, int h __UNUSED__) | ||
168 | { | ||
169 | _ecore_evas_init_count++; | ||
170 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
171 | |||
172 | _ecore_evas_fps_debug = 1; | ||
173 | |||
174 | // this is pretty bad: poller? and set poll time? pol time is meant to be | ||
175 | // adjustable for things like polling battery state, or amoutn of spare | ||
176 | // memory etc. | ||
177 | // | ||
178 | ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_psl1ght_event, NULL); | ||
179 | ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); | ||
180 | |||
181 | if (_ecore_evas_fps_debug) | ||
182 | _ecore_evas_fps_debug_init(); | ||
183 | |||
184 | ecore_event_evas_init(); | ||
185 | |||
186 | ecore_evas_event_handlers[0] = | ||
187 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, | ||
188 | _ecore_evas_psl1ght_event_got_focus, NULL); | ||
189 | ecore_evas_event_handlers[1] = | ||
190 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, | ||
191 | _ecore_evas_psl1ght_event_lost_focus, NULL); | ||
192 | ecore_evas_event_handlers[2] = | ||
193 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE, | ||
194 | _ecore_evas_psl1ght_event_video_expose, NULL); | ||
195 | ecore_evas_event_handlers[3] = | ||
196 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, | ||
197 | _ecore_evas_psl1ght_event_key_modifiers, NULL); | ||
198 | ecore_evas_event_handlers[4] = | ||
199 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_QUIT, | ||
200 | _ecore_evas_psl1ght_event_quit, NULL); | ||
201 | |||
202 | return _ecore_evas_init_count; | ||
203 | } | ||
204 | |||
205 | static int | ||
206 | _ecore_evas_psl1ght_shutdown(void) | ||
207 | { | ||
208 | _ecore_evas_init_count--; | ||
209 | if (_ecore_evas_init_count == 0) | ||
210 | { | ||
211 | unsigned int i; | ||
212 | |||
213 | for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler *); i++) | ||
214 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
215 | ecore_event_evas_shutdown(); | ||
216 | ecore_poller_del(ecore_evas_event); | ||
217 | ecore_evas_event = NULL; | ||
218 | if (_ecore_evas_fps_debug) | ||
219 | _ecore_evas_fps_debug_shutdown(); | ||
220 | } | ||
221 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
222 | return _ecore_evas_init_count; | ||
223 | } | ||
224 | |||
225 | static void | ||
226 | _ecore_evas_psl1ght_free(Ecore_Evas *ee) | ||
227 | { | ||
228 | if (psl1ght_ee == ee) psl1ght_ee = NULL; | ||
229 | |||
230 | ecore_event_window_unregister(0); | ||
231 | _ecore_evas_psl1ght_shutdown(); | ||
232 | ecore_psl1ght_shutdown(); | ||
233 | } | ||
234 | |||
235 | static void | ||
236 | _ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
237 | { | ||
238 | ee->func.fn_delete_request = func; | ||
239 | } | ||
240 | |||
241 | static void | ||
242 | _ecore_evas_screen_resized(Ecore_Evas *ee) | ||
243 | { | ||
244 | int w, h; | ||
245 | |||
246 | /* Do not resize if the window is not fullscreen */ | ||
247 | if (ee->prop.fullscreen == 0) return; | ||
248 | |||
249 | ecore_psl1ght_screen_resolution_get (&w, &h); | ||
250 | |||
251 | if (w != ee->w || h != ee->h) | ||
252 | { | ||
253 | ee->req.w = ee->w = w; | ||
254 | ee->req.h = ee->h = h; | ||
255 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
256 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
257 | ecore_psl1ght_resolution_set (w, h); | ||
258 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
259 | |||
260 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
261 | _ecore_evas_time_get()); | ||
262 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
263 | } | ||
264 | } | ||
265 | |||
266 | static void | ||
267 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
268 | { | ||
269 | if ((w == ee->w) && (h == ee->h)) return; | ||
270 | ee->w = w; | ||
271 | ee->h = h; | ||
272 | |||
273 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
274 | |||
275 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
276 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
277 | |||
278 | ecore_psl1ght_resolution_set (w, h); | ||
279 | |||
280 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
281 | |||
282 | _ecore_evas_screen_resized (ee); | ||
283 | } | ||
284 | |||
285 | static void | ||
286 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
287 | { | ||
288 | _ecore_evas_resize (ee, w, h); | ||
289 | } | ||
290 | |||
291 | static void | ||
292 | _ecore_evas_show(Ecore_Evas *ee) | ||
293 | { | ||
294 | if (ee->prop.focused) return; | ||
295 | ee->prop.focused = 1; | ||
296 | evas_focus_in(ee->evas); | ||
297 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
298 | } | ||
299 | |||
300 | static void | ||
301 | _ecore_evas_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
302 | { | ||
303 | if (x) *x = 0; | ||
304 | if (y) *y = 0; | ||
305 | ecore_psl1ght_screen_resolution_get (w, h); | ||
306 | } | ||
307 | |||
308 | static void | ||
309 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
310 | { | ||
311 | Ecore_Evas *ee; | ||
312 | |||
313 | ee = data; | ||
314 | if (ee) | ||
315 | ee->prop.cursor.object = NULL; | ||
316 | } | ||
317 | |||
318 | static void | ||
319 | _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
320 | { | ||
321 | int x, y; | ||
322 | |||
323 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
324 | |||
325 | if (!obj) | ||
326 | { | ||
327 | ee->prop.cursor.object = NULL; | ||
328 | ee->prop.cursor.layer = 0; | ||
329 | ee->prop.cursor.hot.x = 0; | ||
330 | ee->prop.cursor.hot.y = 0; | ||
331 | return; | ||
332 | } | ||
333 | |||
334 | ee->prop.cursor.object = obj; | ||
335 | ee->prop.cursor.layer = layer; | ||
336 | ee->prop.cursor.hot.x = hot_x; | ||
337 | ee->prop.cursor.hot.y = hot_y; | ||
338 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
339 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
340 | evas_object_move(ee->prop.cursor.object, | ||
341 | x - ee->prop.cursor.hot.x, | ||
342 | y - ee->prop.cursor.hot.y); | ||
343 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
344 | if (evas_pointer_inside_get(ee->evas)) | ||
345 | evas_object_show(ee->prop.cursor.object); | ||
346 | |||
347 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
348 | } | ||
349 | |||
350 | static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = | ||
351 | { | ||
352 | _ecore_evas_psl1ght_free, | ||
353 | NULL, | ||
354 | NULL, | ||
355 | NULL, | ||
356 | NULL, | ||
357 | _ecore_evas_psl1ght_callback_delete_request_set, | ||
358 | NULL, | ||
359 | NULL, | ||
360 | NULL, | ||
361 | NULL, | ||
362 | NULL, | ||
363 | NULL, | ||
364 | NULL, | ||
365 | NULL, | ||
366 | NULL, | ||
367 | NULL, | ||
368 | NULL, | ||
369 | _ecore_evas_resize, | ||
370 | _ecore_evas_move_resize, | ||
371 | NULL, | ||
372 | NULL, | ||
373 | _ecore_evas_show, | ||
374 | NULL, | ||
375 | NULL, | ||
376 | NULL, | ||
377 | NULL, | ||
378 | NULL, | ||
379 | NULL, | ||
380 | NULL, | ||
381 | NULL, | ||
382 | NULL, | ||
383 | NULL, | ||
384 | _ecore_evas_object_cursor_set, | ||
385 | NULL, | ||
386 | NULL, | ||
387 | NULL, | ||
388 | NULL, | ||
389 | NULL, | ||
390 | NULL, | ||
391 | NULL, | ||
392 | NULL, | ||
393 | NULL, | ||
394 | NULL, | ||
395 | NULL, | ||
396 | NULL, | ||
397 | NULL, //transparent | ||
398 | |||
399 | NULL, | ||
400 | NULL, | ||
401 | NULL, | ||
402 | NULL, | ||
403 | NULL, | ||
404 | NULL, | ||
405 | |||
406 | NULL, // render | ||
407 | _ecore_evas_screen_geometry_get // screen_geometry_get | ||
408 | }; | ||
409 | |||
410 | EAPI Ecore_Evas * | ||
411 | ecore_evas_psl1ght_new(const char *name, int w, int h) | ||
412 | { | ||
413 | void *einfo; | ||
414 | Ecore_Evas *ee; | ||
415 | |||
416 | if (!name) | ||
417 | name = ecore_evas_psl1ght_default; | ||
418 | |||
419 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
420 | if (!ee) return NULL; | ||
421 | |||
422 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
423 | |||
424 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_psl1ght_engine_func; | ||
425 | |||
426 | ee->driver = "psl1ght"; | ||
427 | if (name) ee->name = strdup(name); | ||
428 | |||
429 | if (w < 1) w = 1; | ||
430 | if (h < 1) h = 1; | ||
431 | ee->visible = 1; | ||
432 | ee->w = w; | ||
433 | ee->h = h; | ||
434 | |||
435 | ee->prop.max.w = 0; | ||
436 | ee->prop.max.h = 0; | ||
437 | ee->prop.layer = 0; | ||
438 | ee->prop.focused = 1; | ||
439 | ee->prop.borderless = 1; | ||
440 | ee->prop.override = 1; | ||
441 | ee->prop.maximized = 1; | ||
442 | ee->prop.fullscreen = 0; | ||
443 | ee->prop.withdrawn = 0; | ||
444 | ee->prop.sticky = 0; | ||
445 | ee->prop.window = 0; | ||
446 | |||
447 | /* init evas here */ | ||
448 | ee->evas = evas_new(); | ||
449 | evas_data_attach_set(ee->evas, ee); | ||
450 | evas_output_method_set(ee->evas, evas_render_method_lookup("psl1ght")); | ||
451 | |||
452 | evas_output_size_set(ee->evas, w, h); | ||
453 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
454 | |||
455 | einfo = evas_engine_info_get(ee->evas); | ||
456 | if (einfo) | ||
457 | { | ||
458 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
459 | { | ||
460 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
461 | ecore_evas_free(ee); | ||
462 | return NULL; | ||
463 | } | ||
464 | } | ||
465 | else | ||
466 | { | ||
467 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
468 | ecore_evas_free(ee); | ||
469 | return NULL; | ||
470 | } | ||
471 | |||
472 | if (!ecore_psl1ght_init(name)) | ||
473 | { | ||
474 | evas_free(ee->evas); | ||
475 | if (ee->name) free(ee->name); | ||
476 | free(ee); | ||
477 | return NULL; | ||
478 | } | ||
479 | ecore_psl1ght_resolution_set (w, h); | ||
480 | |||
481 | _ecore_evas_psl1ght_init(w, h); | ||
482 | |||
483 | ecore_event_window_register(0, ee, ee->evas, | ||
484 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
485 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
486 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
487 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
488 | |||
489 | ee->engine.func->fn_render = _ecore_evas_psl1ght_render; | ||
490 | _ecore_evas_register(ee); | ||
491 | |||
492 | psl1ght_ee = ee; | ||
493 | |||
494 | _ecore_evas_screen_resized (ee); | ||
495 | |||
496 | if (getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH")) | ||
497 | ecore_evas_cursor_set(ee, getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"), EVAS_LAYER_MAX, 0, 0); | ||
498 | |||
499 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
500 | |||
501 | return ee; | ||
502 | } | ||
503 | |||
504 | #else /* BUILD_ECORE_EVAS_PSL1GHT */ | ||
505 | |||
506 | EAPI Ecore_Evas * | ||
507 | ecore_evas_psl1ght_new(const char *name __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
508 | { | ||
509 | ERR("OUTCH !"); | ||
510 | return NULL; | ||
511 | } | ||
512 | |||
513 | #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 deleted file mode 100644 index b246a26..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c +++ /dev/null | |||
@@ -1,656 +0,0 @@ | |||
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_OPENGL_SDL | ||
11 | # include <Evas_Engine_GL_SDL.h> | ||
12 | # endif | ||
13 | #endif | ||
14 | |||
15 | #include <stdlib.h> | ||
16 | #include <string.h> | ||
17 | |||
18 | #if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) | ||
19 | #include <SDL/SDL.h> | ||
20 | #endif | ||
21 | |||
22 | #include "ecore_evas_private.h" | ||
23 | #include "Ecore_Evas.h" | ||
24 | |||
25 | /** | ||
26 | ** SDL only handle one window at a time. That's by definition, there is nothing wrong here. | ||
27 | ** | ||
28 | **/ | ||
29 | |||
30 | #if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) | ||
31 | |||
32 | /* static char *ecore_evas_default_display = "0"; */ | ||
33 | /* static Ecore_List *ecore_evas_input_devices = NULL; */ | ||
34 | |||
35 | static int _ecore_evas_init_count = 0; | ||
36 | |||
37 | static Ecore_Evas *sdl_ee = NULL; | ||
38 | static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { | ||
39 | NULL, NULL, NULL, NULL | ||
40 | }; | ||
41 | |||
42 | static const char *ecore_evas_sdl_default = "EFL SDL"; | ||
43 | static int _ecore_evas_fps_debug = 0; | ||
44 | static Ecore_Poller *ecore_evas_event; | ||
45 | |||
46 | static Ecore_Evas * | ||
47 | _ecore_evas_sdl_match(void) | ||
48 | { | ||
49 | return sdl_ee; | ||
50 | } | ||
51 | |||
52 | static void * | ||
53 | _ecore_evas_sdl_switch_buffer(void *data, void *dest __UNUSED__) | ||
54 | { | ||
55 | SDL_Flip(data); | ||
56 | return ((SDL_Surface*)data)->pixels; | ||
57 | } | ||
58 | |||
59 | static Eina_Bool | ||
60 | _ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
61 | { | ||
62 | Ecore_Evas *ee; | ||
63 | |||
64 | ee = _ecore_evas_sdl_match(); | ||
65 | |||
66 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
67 | /* pass on event */ | ||
68 | ee->prop.focused = 1; | ||
69 | evas_focus_in(ee->evas); | ||
70 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
71 | return ECORE_CALLBACK_PASS_ON; | ||
72 | } | ||
73 | |||
74 | static Eina_Bool | ||
75 | _ecore_evas_sdl_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
76 | { | ||
77 | Ecore_Evas *ee; | ||
78 | |||
79 | ee = _ecore_evas_sdl_match(); | ||
80 | |||
81 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
82 | /* pass on event */ | ||
83 | ee->prop.focused = 0; | ||
84 | evas_focus_out(ee->evas); | ||
85 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
86 | return ECORE_CALLBACK_PASS_ON; | ||
87 | } | ||
88 | |||
89 | static Eina_Bool | ||
90 | _ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
91 | { | ||
92 | Ecore_Sdl_Event_Video_Resize *e; | ||
93 | Ecore_Evas *ee; | ||
94 | int rmethod; | ||
95 | |||
96 | e = event; | ||
97 | ee = _ecore_evas_sdl_match(); | ||
98 | |||
99 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
100 | |||
101 | rmethod = evas_output_method_get(ee->evas); | ||
102 | if (rmethod == evas_render_method_lookup("buffer")) | ||
103 | { | ||
104 | Evas_Engine_Info_Buffer *einfo; | ||
105 | |||
106 | einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas); | ||
107 | if (einfo) | ||
108 | { | ||
109 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
110 | einfo->info.switch_data = SDL_SetVideoMode(e->w, e->h, 32, | ||
111 | (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE) | ||
112 | | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0) | ||
113 | | (ee->alpha ? SDL_SRCALPHA : 0) | ||
114 | | SDL_DOUBLEBUF); | ||
115 | if (!einfo->info.switch_data) | ||
116 | { | ||
117 | return EINA_FALSE; | ||
118 | } | ||
119 | |||
120 | SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0); | ||
121 | SDL_FillRect(einfo->info.switch_data, NULL, 0); | ||
122 | |||
123 | einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels; | ||
124 | einfo->info.dest_buffer_row_bytes = e->w * sizeof (int); | ||
125 | einfo->info.use_color_key = 0; | ||
126 | einfo->info.alpha_threshold = 0; | ||
127 | einfo->info.func.new_update_region = NULL; | ||
128 | einfo->info.func.free_update_region = NULL; | ||
129 | einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer; | ||
130 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo)) | ||
131 | { | ||
132 | return EINA_FALSE; | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | |||
137 | ee->w = e->w; | ||
138 | ee->h = e->h; | ||
139 | |||
140 | evas_output_size_set(ee->evas, e->w, e->h); | ||
141 | evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h); | ||
142 | |||
143 | return ECORE_CALLBACK_PASS_ON; | ||
144 | } | ||
145 | |||
146 | static Eina_Bool | ||
147 | _ecore_evas_sdl_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
148 | { | ||
149 | Ecore_Evas *ee; | ||
150 | int w; | ||
151 | int h; | ||
152 | |||
153 | ee = _ecore_evas_sdl_match(); | ||
154 | |||
155 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
156 | evas_output_size_get(ee->evas, &w, &h); | ||
157 | evas_damage_rectangle_add(ee->evas, 0, 0, w, h); | ||
158 | |||
159 | return ECORE_CALLBACK_PASS_ON; | ||
160 | } | ||
161 | |||
162 | static int | ||
163 | _ecore_evas_render(Ecore_Evas *ee) | ||
164 | { | ||
165 | Eina_List *updates; | ||
166 | |||
167 | updates = evas_render_updates(ee->evas); | ||
168 | if (updates) | ||
169 | { | ||
170 | evas_render_updates_free(updates); | ||
171 | _ecore_evas_idle_timeout_update(ee); | ||
172 | } | ||
173 | return updates ? 1 : 0; | ||
174 | } | ||
175 | |||
176 | static int | ||
177 | _ecore_evas_sdl_render(Ecore_Evas *ee) | ||
178 | { | ||
179 | int rend = 0; | ||
180 | Eina_List *ll; | ||
181 | Ecore_Evas *ee2; | ||
182 | |||
183 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
184 | { | ||
185 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
186 | if (ee2->engine.func->fn_render) | ||
187 | rend |= ee2->engine.func->fn_render(ee2); | ||
188 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
189 | } | ||
190 | |||
191 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
192 | |||
193 | if (ee->prop.avoid_damage) rend = _ecore_evas_render(ee); | ||
194 | else if ((ee->visible) || | ||
195 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
196 | ((ee->should_be_visible) && (ee->prop.override))) | ||
197 | rend |= _ecore_evas_render(ee); | ||
198 | else | ||
199 | evas_norender(ee->evas); | ||
200 | |||
201 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
202 | return rend; | ||
203 | } | ||
204 | |||
205 | static Eina_Bool | ||
206 | _ecore_evas_sdl_event(void *data __UNUSED__) | ||
207 | { | ||
208 | ecore_sdl_feed_events(); | ||
209 | return ECORE_CALLBACK_RENEW; | ||
210 | } | ||
211 | |||
212 | static int | ||
213 | _ecore_evas_sdl_init(int w __UNUSED__, int h __UNUSED__) | ||
214 | { | ||
215 | _ecore_evas_init_count++; | ||
216 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
217 | |||
218 | #ifndef _WIN32 | ||
219 | if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; | ||
220 | #endif /* _WIN32 */ | ||
221 | // this is pretty bad: poller? and set poll time? pol time is meant to be | ||
222 | // adjustable for things like polling battery state, or amoutn of spare | ||
223 | // memory etc. | ||
224 | // | ||
225 | ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_sdl_event, NULL); | ||
226 | ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); | ||
227 | #ifndef _WIN32 | ||
228 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); | ||
229 | #endif /* _WIN32 */ | ||
230 | |||
231 | ecore_event_evas_init(); | ||
232 | |||
233 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_SDL_EVENT_GOT_FOCUS, _ecore_evas_sdl_event_got_focus, NULL); | ||
234 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_SDL_EVENT_LOST_FOCUS, _ecore_evas_sdl_event_lost_focus, NULL); | ||
235 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_SDL_EVENT_RESIZE, _ecore_evas_sdl_event_video_resize, NULL); | ||
236 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_SDL_EVENT_EXPOSE, _ecore_evas_sdl_event_video_expose, NULL); | ||
237 | |||
238 | return _ecore_evas_init_count; | ||
239 | } | ||
240 | |||
241 | static int | ||
242 | _ecore_evas_sdl_shutdown(void) | ||
243 | { | ||
244 | _ecore_evas_init_count--; | ||
245 | if (_ecore_evas_init_count == 0) | ||
246 | { | ||
247 | unsigned int i; | ||
248 | |||
249 | for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) | ||
250 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
251 | ecore_event_evas_shutdown(); | ||
252 | ecore_poller_del(ecore_evas_event); | ||
253 | ecore_evas_event = NULL; | ||
254 | #ifndef _WIN32 | ||
255 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); | ||
256 | #endif /* _WIN32 */ | ||
257 | } | ||
258 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
259 | return _ecore_evas_init_count; | ||
260 | } | ||
261 | |||
262 | static void | ||
263 | _ecore_evas_sdl_free(Ecore_Evas *ee) | ||
264 | { | ||
265 | if (sdl_ee == ee) sdl_ee = NULL; | ||
266 | |||
267 | ecore_event_window_unregister(0); | ||
268 | _ecore_evas_sdl_shutdown(); | ||
269 | ecore_sdl_shutdown(); | ||
270 | } | ||
271 | |||
272 | static void | ||
273 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
274 | { | ||
275 | int rmethod; | ||
276 | |||
277 | if ((w == ee->w) && (h == ee->h)) return; | ||
278 | ee->w = w; | ||
279 | ee->h = h; | ||
280 | |||
281 | rmethod = evas_output_method_get(ee->evas); | ||
282 | if (rmethod == evas_render_method_lookup("buffer")) | ||
283 | { | ||
284 | Evas_Engine_Info_Buffer *einfo; | ||
285 | |||
286 | einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas); | ||
287 | if (einfo) | ||
288 | { | ||
289 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
290 | einfo->info.switch_data = SDL_SetVideoMode(w, h, 32, | ||
291 | (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE) | ||
292 | | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0) | ||
293 | | (ee->alpha ? SDL_SRCALPHA : 0) | ||
294 | | SDL_DOUBLEBUF); | ||
295 | if (!einfo->info.switch_data) | ||
296 | { | ||
297 | return ; | ||
298 | } | ||
299 | |||
300 | SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0); | ||
301 | SDL_FillRect(einfo->info.switch_data, NULL, 0); | ||
302 | |||
303 | einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels; | ||
304 | einfo->info.dest_buffer_row_bytes = w * sizeof (int); | ||
305 | einfo->info.use_color_key = 0; | ||
306 | einfo->info.alpha_threshold = 0; | ||
307 | einfo->info.func.new_update_region = NULL; | ||
308 | einfo->info.func.free_update_region = NULL; | ||
309 | einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer; | ||
310 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo)) | ||
311 | { | ||
312 | return ; | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
318 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
319 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
320 | |||
321 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
322 | } | ||
323 | |||
324 | static void | ||
325 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
326 | { | ||
327 | if ((w == ee->w) && (h == ee->h)) return; | ||
328 | ee->w = w; | ||
329 | ee->h = h; | ||
330 | |||
331 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
332 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
333 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
334 | |||
335 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
336 | } | ||
337 | |||
338 | static void | ||
339 | _ecore_evas_show(Ecore_Evas *ee) | ||
340 | { | ||
341 | if (ee->prop.focused) return; | ||
342 | ee->prop.focused = 1; | ||
343 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
344 | } | ||
345 | |||
346 | static void | ||
347 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
348 | { | ||
349 | Ecore_Evas *ee; | ||
350 | |||
351 | ee = data; | ||
352 | if (ee) ee->prop.cursor.object = NULL; | ||
353 | } | ||
354 | |||
355 | static void | ||
356 | _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
357 | { | ||
358 | int x, y; | ||
359 | |||
360 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
361 | |||
362 | if (!obj) | ||
363 | { | ||
364 | ee->prop.cursor.object = NULL; | ||
365 | ee->prop.cursor.layer = 0; | ||
366 | ee->prop.cursor.hot.x = 0; | ||
367 | ee->prop.cursor.hot.y = 0; | ||
368 | return; | ||
369 | } | ||
370 | |||
371 | ee->prop.cursor.object = obj; | ||
372 | ee->prop.cursor.layer = layer; | ||
373 | ee->prop.cursor.hot.x = hot_x; | ||
374 | ee->prop.cursor.hot.y = hot_y; | ||
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, | ||
378 | x - ee->prop.cursor.hot.x, | ||
379 | y - ee->prop.cursor.hot.y); | ||
380 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
381 | if (evas_pointer_inside_get(ee->evas)) | ||
382 | evas_object_show(ee->prop.cursor.object); | ||
383 | |||
384 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
385 | } | ||
386 | |||
387 | static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = | ||
388 | { | ||
389 | _ecore_evas_sdl_free, | ||
390 | NULL, | ||
391 | NULL, | ||
392 | NULL, | ||
393 | NULL, | ||
394 | NULL, | ||
395 | NULL, | ||
396 | NULL, | ||
397 | NULL, | ||
398 | NULL, | ||
399 | NULL, | ||
400 | NULL, | ||
401 | NULL, | ||
402 | NULL, | ||
403 | NULL, | ||
404 | NULL, | ||
405 | NULL, | ||
406 | _ecore_evas_resize, | ||
407 | _ecore_evas_move_resize, | ||
408 | NULL, | ||
409 | NULL, | ||
410 | _ecore_evas_show, | ||
411 | NULL, | ||
412 | NULL, | ||
413 | NULL, | ||
414 | NULL, | ||
415 | NULL, | ||
416 | NULL, | ||
417 | NULL, | ||
418 | NULL, | ||
419 | NULL, | ||
420 | NULL, | ||
421 | _ecore_evas_object_cursor_set, | ||
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, //transparent | ||
435 | |||
436 | NULL, | ||
437 | NULL, | ||
438 | NULL, | ||
439 | NULL, | ||
440 | NULL, | ||
441 | NULL, | ||
442 | |||
443 | NULL, // render | ||
444 | NULL // screen_geometry_get | ||
445 | }; | ||
446 | |||
447 | static Ecore_Evas* | ||
448 | _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) | ||
449 | { | ||
450 | Ecore_Evas *ee; | ||
451 | |||
452 | if (!name) | ||
453 | name = ecore_evas_sdl_default; | ||
454 | |||
455 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
456 | if (!ee) return NULL; | ||
457 | |||
458 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
459 | |||
460 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_sdl_engine_func; | ||
461 | |||
462 | ee->driver = "sdl"; | ||
463 | if (name) ee->name = strdup(name); | ||
464 | |||
465 | if (w < 1) w = 1; | ||
466 | if (h < 1) h = 1; | ||
467 | ee->visible = 1; | ||
468 | ee->w = w; | ||
469 | ee->h = h; | ||
470 | |||
471 | ee->prop.max.w = 0; | ||
472 | ee->prop.max.h = 0; | ||
473 | ee->prop.layer = 0; | ||
474 | ee->prop.focused = 1; | ||
475 | ee->prop.borderless = 1; | ||
476 | ee->prop.override = 1; | ||
477 | ee->prop.maximized = 1; | ||
478 | ee->prop.fullscreen = fullscreen; | ||
479 | ee->prop.withdrawn = 0; | ||
480 | ee->prop.sticky = 0; | ||
481 | ee->prop.window = 0; | ||
482 | ee->alpha = alpha; | ||
483 | ee->prop.hwsurface = hwsurface; | ||
484 | |||
485 | /* init evas here */ | ||
486 | ee->evas = evas_new(); | ||
487 | evas_data_attach_set(ee->evas, ee); | ||
488 | evas_output_method_set(ee->evas, rmethod); | ||
489 | |||
490 | evas_output_size_set(ee->evas, w, h); | ||
491 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
492 | |||
493 | if (rmethod == evas_render_method_lookup("buffer")) | ||
494 | { | ||
495 | Evas_Engine_Info_Buffer *einfo; | ||
496 | |||
497 | einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas); | ||
498 | if (einfo) | ||
499 | { | ||
500 | SDL_Init(SDL_INIT_NOPARACHUTE); | ||
501 | |||
502 | if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) | ||
503 | { | ||
504 | ERR("SDL_Init failed with %s", SDL_GetError()); | ||
505 | SDL_Quit(); | ||
506 | return NULL; | ||
507 | } | ||
508 | |||
509 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
510 | einfo->info.switch_data = SDL_SetVideoMode(w, h, 32, | ||
511 | (hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE) | ||
512 | | (fullscreen ? SDL_FULLSCREEN : 0) | ||
513 | | (noframe ? SDL_NOFRAME : 0) | ||
514 | | (alpha ? SDL_SRCALPHA : 0) | ||
515 | | SDL_DOUBLEBUF); | ||
516 | if (!einfo->info.switch_data) | ||
517 | { | ||
518 | ERR("SDL_SetVideoMode failed !"); | ||
519 | ecore_evas_free(ee); | ||
520 | return NULL; | ||
521 | } | ||
522 | |||
523 | SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0); | ||
524 | SDL_FillRect(einfo->info.switch_data, NULL, 0); | ||
525 | |||
526 | einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels; | ||
527 | einfo->info.dest_buffer_row_bytes = w * sizeof (int); | ||
528 | einfo->info.use_color_key = 0; | ||
529 | einfo->info.alpha_threshold = 0; | ||
530 | einfo->info.func.new_update_region = NULL; | ||
531 | einfo->info.func.free_update_region = NULL; | ||
532 | einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer; | ||
533 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo)) | ||
534 | { | ||
535 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
536 | ecore_evas_free(ee); | ||
537 | return NULL; | ||
538 | } | ||
539 | } | ||
540 | else | ||
541 | { | ||
542 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
543 | ecore_evas_free(ee); | ||
544 | return NULL; | ||
545 | } | ||
546 | } | ||
547 | else if (rmethod == evas_render_method_lookup("gl_sdl")) | ||
548 | { | ||
549 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
550 | Evas_Engine_Info_GL_SDL *einfo; | ||
551 | |||
552 | einfo = (Evas_Engine_Info_GL_SDL *) evas_engine_info_get(ee->evas); | ||
553 | if (einfo) | ||
554 | { | ||
555 | einfo->flags.fullscreen = fullscreen; | ||
556 | einfo->flags.noframe = noframe; | ||
557 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
558 | { | ||
559 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
560 | ecore_evas_free(ee); | ||
561 | return NULL; | ||
562 | } | ||
563 | } | ||
564 | else | ||
565 | { | ||
566 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
567 | ecore_evas_free(ee); | ||
568 | return NULL; | ||
569 | } | ||
570 | #endif | ||
571 | } | ||
572 | else | ||
573 | { | ||
574 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
575 | ecore_evas_free(ee); | ||
576 | return NULL; | ||
577 | } | ||
578 | |||
579 | if (!ecore_sdl_init(name)) | ||
580 | { | ||
581 | evas_free(ee->evas); | ||
582 | if (ee->name) free(ee->name); | ||
583 | free(ee); | ||
584 | return NULL; | ||
585 | } | ||
586 | |||
587 | _ecore_evas_sdl_init(w, h); | ||
588 | |||
589 | ecore_event_window_register(0, ee, ee->evas, | ||
590 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
591 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
592 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
593 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
594 | |||
595 | SDL_ShowCursor(SDL_ENABLE); | ||
596 | |||
597 | ee->engine.func->fn_render = _ecore_evas_sdl_render; | ||
598 | _ecore_evas_register(ee); | ||
599 | |||
600 | sdl_ee = ee; | ||
601 | return ee; | ||
602 | } | ||
603 | #endif | ||
604 | |||
605 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL | ||
606 | EAPI Ecore_Evas* | ||
607 | ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) | ||
608 | { | ||
609 | Ecore_Evas *ee; | ||
610 | int rmethod; | ||
611 | |||
612 | rmethod = evas_render_method_lookup("buffer"); | ||
613 | if (!rmethod) return NULL; | ||
614 | |||
615 | ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha); | ||
616 | return ee; | ||
617 | } | ||
618 | #else | ||
619 | EAPI Ecore_Evas* | ||
620 | 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__) | ||
621 | { | ||
622 | ERR("OUTCH !"); | ||
623 | return NULL; | ||
624 | } | ||
625 | #endif | ||
626 | |||
627 | EAPI Ecore_Evas* | ||
628 | 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__) | ||
629 | { | ||
630 | ERR("OUTCH !"); | ||
631 | return NULL; | ||
632 | } | ||
633 | |||
634 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | ||
635 | EAPI Ecore_Evas* | ||
636 | ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe) | ||
637 | { | ||
638 | Ecore_Evas *ee; | ||
639 | int rmethod; | ||
640 | |||
641 | rmethod = evas_render_method_lookup("gl_sdl"); | ||
642 | if (!rmethod) return NULL; | ||
643 | |||
644 | ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, 0, noframe, 0); | ||
645 | ee->driver = "gl_sdl"; | ||
646 | return ee; | ||
647 | } | ||
648 | #else | ||
649 | EAPI Ecore_Evas* | ||
650 | ecore_evas_gl_sdl_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int noframe __UNUSED__) | ||
651 | { | ||
652 | ERR("OUTCH !"); | ||
653 | return NULL; | ||
654 | } | ||
655 | #endif | ||
656 | |||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c deleted file mode 100644 index 839f0c8..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c +++ /dev/null | |||
@@ -1,439 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | |||
8 | #include <Ecore.h> | ||
9 | #include "ecore_private.h" | ||
10 | |||
11 | #include "ecore_evas_private.h" | ||
12 | #include "Ecore_Evas.h" | ||
13 | |||
14 | static const char ASSOCIATE_KEY[] = "__Ecore_Evas_Associate"; | ||
15 | |||
16 | static void _ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags); | ||
17 | static void _ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj); | ||
18 | |||
19 | |||
20 | static Evas_Object * | ||
21 | _ecore_evas_associate_get(const Ecore_Evas *ee) | ||
22 | { | ||
23 | return ecore_evas_data_get(ee, ASSOCIATE_KEY); | ||
24 | } | ||
25 | |||
26 | static void | ||
27 | _ecore_evas_associate_set(Ecore_Evas *ee, Evas_Object *obj) | ||
28 | { | ||
29 | ecore_evas_data_set(ee, ASSOCIATE_KEY, obj); | ||
30 | } | ||
31 | |||
32 | static void | ||
33 | _ecore_evas_associate_del(Ecore_Evas *ee) | ||
34 | { | ||
35 | ecore_evas_data_set(ee, ASSOCIATE_KEY, NULL); | ||
36 | } | ||
37 | |||
38 | static Ecore_Evas * | ||
39 | _evas_object_associate_get(const Evas_Object *obj) | ||
40 | { | ||
41 | return evas_object_data_get(obj, ASSOCIATE_KEY); | ||
42 | } | ||
43 | |||
44 | static void | ||
45 | _evas_object_associate_set(Evas_Object *obj, Ecore_Evas *ee) | ||
46 | { | ||
47 | evas_object_data_set(obj, ASSOCIATE_KEY, ee); | ||
48 | } | ||
49 | |||
50 | static void | ||
51 | _evas_object_associate_del(Evas_Object *obj) | ||
52 | { | ||
53 | evas_object_data_del(obj, ASSOCIATE_KEY); | ||
54 | } | ||
55 | |||
56 | /** Associated Events: ******************************************************/ | ||
57 | |||
58 | /* Interceptors Callbacks */ | ||
59 | |||
60 | static void | ||
61 | _ecore_evas_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y) | ||
62 | { | ||
63 | Ecore_Evas *ee = data; | ||
64 | // FIXME: account for frame | ||
65 | ecore_evas_move(ee, x, y); | ||
66 | if (ecore_evas_override_get(ee)) evas_object_move(obj, x, y); | ||
67 | } | ||
68 | |||
69 | static void | ||
70 | _ecore_evas_obj_intercept_raise(void *data, Evas_Object *obj __UNUSED__) | ||
71 | { | ||
72 | Ecore_Evas *ee = data; | ||
73 | ecore_evas_raise(ee); | ||
74 | } | ||
75 | |||
76 | static void | ||
77 | _ecore_evas_obj_intercept_lower(void *data, Evas_Object *obj __UNUSED__) | ||
78 | { | ||
79 | Ecore_Evas *ee = data; | ||
80 | ecore_evas_lower(ee); | ||
81 | } | ||
82 | |||
83 | static void | ||
84 | _ecore_evas_obj_intercept_stack_above(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *above __UNUSED__) | ||
85 | { | ||
86 | INF("TODO: %s", __FUNCTION__); | ||
87 | } | ||
88 | |||
89 | static void | ||
90 | _ecore_evas_obj_intercept_stack_below(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *below __UNUSED__) | ||
91 | { | ||
92 | INF("TODO: %s", __FUNCTION__); | ||
93 | } | ||
94 | |||
95 | static void | ||
96 | _ecore_evas_obj_intercept_layer_set(void *data, Evas_Object *obj __UNUSED__, int l) | ||
97 | { | ||
98 | Ecore_Evas *ee = data; | ||
99 | ecore_evas_layer_set(ee, l); | ||
100 | } | ||
101 | |||
102 | /* Event Callbacks */ | ||
103 | |||
104 | static void | ||
105 | _ecore_evas_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
106 | { | ||
107 | Ecore_Evas *ee = data; | ||
108 | ecore_evas_show(ee); | ||
109 | } | ||
110 | |||
111 | static void | ||
112 | _ecore_evas_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
113 | { | ||
114 | Ecore_Evas *ee = data; | ||
115 | ecore_evas_hide(ee); | ||
116 | } | ||
117 | |||
118 | static void | ||
119 | _ecore_evas_obj_callback_resize(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__) | ||
120 | { | ||
121 | Ecore_Evas *ee = data; | ||
122 | Evas_Coord ow, oh, fw, fh; | ||
123 | |||
124 | evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); | ||
125 | evas_output_framespace_get(e, NULL, NULL, &fw, &fh); | ||
126 | ow += fw; | ||
127 | oh += fh; | ||
128 | ecore_evas_resize(ee, ow, oh); | ||
129 | } | ||
130 | |||
131 | static void | ||
132 | _ecore_evas_obj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) | ||
133 | { | ||
134 | Ecore_Evas *ee = data; | ||
135 | Evas_Coord w, h; | ||
136 | |||
137 | evas_object_size_hint_min_get(obj, &w, &h); | ||
138 | ecore_evas_size_min_set(ee, w, h); | ||
139 | |||
140 | evas_object_size_hint_max_get(obj, &w, &h); | ||
141 | if (w < 1) w = -1; | ||
142 | if (h < 1) h = -1; | ||
143 | ecore_evas_size_max_set(ee, w, h); | ||
144 | } | ||
145 | |||
146 | static void | ||
147 | _ecore_evas_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) | ||
148 | { | ||
149 | Ecore_Evas *ee = data; | ||
150 | _ecore_evas_object_dissociate(ee, obj); | ||
151 | ecore_evas_free(ee); | ||
152 | } | ||
153 | |||
154 | static void | ||
155 | _ecore_evas_obj_callback_del_dissociate(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) | ||
156 | { | ||
157 | Ecore_Evas *ee = data; | ||
158 | _ecore_evas_object_dissociate(ee, obj); | ||
159 | } | ||
160 | |||
161 | static void | ||
162 | _ecore_evas_delete_request(Ecore_Evas *ee) | ||
163 | { | ||
164 | Evas_Object *obj = _ecore_evas_associate_get(ee); | ||
165 | _ecore_evas_object_dissociate(ee, obj); | ||
166 | evas_object_del(obj); | ||
167 | ecore_evas_free(ee); | ||
168 | } | ||
169 | |||
170 | static void | ||
171 | _ecore_evas_destroy(Ecore_Evas *ee) | ||
172 | { | ||
173 | Evas_Object *obj = _ecore_evas_associate_get(ee); | ||
174 | if (!obj) | ||
175 | return; | ||
176 | _ecore_evas_object_dissociate(ee, obj); | ||
177 | evas_object_del(obj); | ||
178 | } | ||
179 | |||
180 | static void | ||
181 | _ecore_evas_resize(Ecore_Evas *ee) | ||
182 | { | ||
183 | Evas_Object *obj = _ecore_evas_associate_get(ee); | ||
184 | Evas_Coord w, h; | ||
185 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
186 | evas_object_resize(obj, w, h); | ||
187 | } | ||
188 | |||
189 | static void | ||
190 | _ecore_evas_pre_free(Ecore_Evas *ee) | ||
191 | { | ||
192 | Evas_Object *obj = _ecore_evas_associate_get(ee); | ||
193 | if (!obj) | ||
194 | return; | ||
195 | _ecore_evas_object_dissociate(ee, obj); | ||
196 | evas_object_del(obj); | ||
197 | } | ||
198 | |||
199 | static int | ||
200 | _ecore_evas_object_evas_check(const char *function, const Ecore_Evas *ee, const Evas_Object *obj) | ||
201 | { | ||
202 | const char *name, *type; | ||
203 | Evas *e; | ||
204 | |||
205 | e = evas_object_evas_get(obj); | ||
206 | if (e == ee->evas) | ||
207 | return 1; | ||
208 | |||
209 | name = evas_object_name_get(obj); | ||
210 | type = evas_object_type_get(obj); | ||
211 | |||
212 | ERR("ERROR: %s(): object %p (name=\"%s\", type=\"%s\") evas " | ||
213 | "is not the same as this Ecore_Evas evas: %p != %p", | ||
214 | function, obj, | ||
215 | name ? name : "", type ? type : "", e, ee->evas); | ||
216 | fflush(stderr); | ||
217 | if (getenv("ECORE_ERROR_ABORT")) abort(); | ||
218 | |||
219 | return 0; | ||
220 | } | ||
221 | |||
222 | EAPI Eina_Bool | ||
223 | ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags) | ||
224 | { | ||
225 | Ecore_Evas *old_ee; | ||
226 | Evas_Object *old_obj; | ||
227 | |||
228 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
229 | { | ||
230 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); | ||
231 | return EINA_FALSE; | ||
232 | } | ||
233 | |||
234 | CHECK_PARAM_POINTER_RETURN("obj", obj, EINA_FALSE); | ||
235 | if (!_ecore_evas_object_evas_check(__FUNCTION__, ee, obj)) | ||
236 | return EINA_FALSE; | ||
237 | |||
238 | old_ee = _evas_object_associate_get(obj);; | ||
239 | if (old_ee) | ||
240 | ecore_evas_object_dissociate(old_ee, obj); | ||
241 | |||
242 | old_obj = _ecore_evas_associate_get(ee); | ||
243 | if (old_obj) | ||
244 | ecore_evas_object_dissociate(ee, old_obj); | ||
245 | |||
246 | _ecore_evas_object_associate(ee, obj, flags); | ||
247 | return EINA_TRUE; | ||
248 | } | ||
249 | |||
250 | EAPI Eina_Bool | ||
251 | ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj) | ||
252 | { | ||
253 | Ecore_Evas *old_ee; | ||
254 | Evas_Object *old_obj; | ||
255 | |||
256 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
257 | { | ||
258 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); | ||
259 | return EINA_FALSE; | ||
260 | } | ||
261 | |||
262 | CHECK_PARAM_POINTER_RETURN("obj", obj, EINA_FALSE); | ||
263 | old_ee = _evas_object_associate_get(obj); | ||
264 | if (ee != old_ee) { | ||
265 | ERR("ERROR: trying to dissociate object that is not using " | ||
266 | "this Ecore_Evas: %p != %p", ee, old_ee); | ||
267 | return EINA_FALSE; | ||
268 | } | ||
269 | |||
270 | old_obj = _ecore_evas_associate_get(ee); | ||
271 | if (old_obj != obj) { | ||
272 | ERR("ERROR: trying to dissociate object that is not being " | ||
273 | "used by this Ecore_Evas: %p != %p", old_obj, obj); | ||
274 | return EINA_FALSE; | ||
275 | } | ||
276 | |||
277 | _ecore_evas_object_dissociate(ee, obj); | ||
278 | |||
279 | return EINA_TRUE; | ||
280 | } | ||
281 | |||
282 | EAPI Evas_Object * | ||
283 | ecore_evas_object_associate_get(const Ecore_Evas *ee) | ||
284 | { | ||
285 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
286 | { | ||
287 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); | ||
288 | return NULL; | ||
289 | } | ||
290 | return _ecore_evas_associate_get(ee); | ||
291 | } | ||
292 | |||
293 | static void | ||
294 | _ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags) | ||
295 | { | ||
296 | evas_object_event_callback_add | ||
297 | (obj, EVAS_CALLBACK_SHOW, | ||
298 | _ecore_evas_obj_callback_show, ee); | ||
299 | evas_object_event_callback_add | ||
300 | (obj, EVAS_CALLBACK_HIDE, | ||
301 | _ecore_evas_obj_callback_hide, ee); | ||
302 | evas_object_event_callback_add | ||
303 | (obj, EVAS_CALLBACK_RESIZE, | ||
304 | _ecore_evas_obj_callback_resize, ee); | ||
305 | evas_object_event_callback_add | ||
306 | (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, | ||
307 | _ecore_evas_obj_callback_changed_size_hints, ee); | ||
308 | if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_DEL) | ||
309 | evas_object_event_callback_add | ||
310 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del, ee); | ||
311 | else | ||
312 | evas_object_event_callback_add | ||
313 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del_dissociate, ee); | ||
314 | |||
315 | evas_object_intercept_move_callback_add | ||
316 | (obj, _ecore_evas_obj_intercept_move, ee); | ||
317 | |||
318 | if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_STACK) | ||
319 | { | ||
320 | evas_object_intercept_raise_callback_add | ||
321 | (obj, _ecore_evas_obj_intercept_raise, ee); | ||
322 | evas_object_intercept_lower_callback_add | ||
323 | (obj, _ecore_evas_obj_intercept_lower, ee); | ||
324 | evas_object_intercept_stack_above_callback_add | ||
325 | (obj, _ecore_evas_obj_intercept_stack_above, ee); | ||
326 | evas_object_intercept_stack_below_callback_add | ||
327 | (obj, _ecore_evas_obj_intercept_stack_below, ee); | ||
328 | } | ||
329 | |||
330 | if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_LAYER) | ||
331 | evas_object_intercept_layer_set_callback_add | ||
332 | (obj, _ecore_evas_obj_intercept_layer_set, ee); | ||
333 | |||
334 | if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_DEL) | ||
335 | { | ||
336 | ecore_evas_callback_delete_request_set(ee, _ecore_evas_delete_request); | ||
337 | ecore_evas_callback_destroy_set(ee, _ecore_evas_destroy); | ||
338 | } | ||
339 | ecore_evas_callback_pre_free_set(ee, _ecore_evas_pre_free); | ||
340 | ecore_evas_callback_resize_set(ee, _ecore_evas_resize); | ||
341 | |||
342 | _evas_object_associate_set(obj, ee); | ||
343 | _ecore_evas_associate_set(ee, obj); | ||
344 | } | ||
345 | |||
346 | static void | ||
347 | _ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj) | ||
348 | { | ||
349 | evas_object_event_callback_del_full | ||
350 | (obj, EVAS_CALLBACK_SHOW, | ||
351 | _ecore_evas_obj_callback_show, ee); | ||
352 | evas_object_event_callback_del_full | ||
353 | (obj, EVAS_CALLBACK_HIDE, | ||
354 | _ecore_evas_obj_callback_hide, ee); | ||
355 | evas_object_event_callback_del_full | ||
356 | (obj, EVAS_CALLBACK_RESIZE, | ||
357 | _ecore_evas_obj_callback_resize, ee); | ||
358 | evas_object_event_callback_del_full | ||
359 | (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, | ||
360 | _ecore_evas_obj_callback_changed_size_hints, ee); | ||
361 | evas_object_event_callback_del_full | ||
362 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del, ee); | ||
363 | evas_object_event_callback_del_full | ||
364 | (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del_dissociate, ee); | ||
365 | |||
366 | evas_object_intercept_move_callback_del | ||
367 | (obj, _ecore_evas_obj_intercept_move); | ||
368 | |||
369 | evas_object_intercept_raise_callback_del | ||
370 | (obj, _ecore_evas_obj_intercept_raise); | ||
371 | evas_object_intercept_lower_callback_del | ||
372 | (obj, _ecore_evas_obj_intercept_lower); | ||
373 | evas_object_intercept_stack_above_callback_del | ||
374 | (obj, _ecore_evas_obj_intercept_stack_above); | ||
375 | evas_object_intercept_stack_below_callback_del | ||
376 | (obj, _ecore_evas_obj_intercept_stack_below); | ||
377 | |||
378 | evas_object_intercept_layer_set_callback_del | ||
379 | (obj, _ecore_evas_obj_intercept_layer_set); | ||
380 | |||
381 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
382 | { | ||
383 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); | ||
384 | } | ||
385 | else | ||
386 | { | ||
387 | if (ee->func.fn_delete_request == _ecore_evas_delete_request) | ||
388 | ecore_evas_callback_delete_request_set(ee, NULL); | ||
389 | if (ee->func.fn_destroy == _ecore_evas_destroy) | ||
390 | ecore_evas_callback_destroy_set(ee, NULL); | ||
391 | if (ee->func.fn_resize == _ecore_evas_resize) | ||
392 | ecore_evas_callback_resize_set(ee, NULL); | ||
393 | if (ee->func.fn_pre_free == _ecore_evas_pre_free) | ||
394 | ecore_evas_callback_pre_free_set(ee, NULL); | ||
395 | |||
396 | _ecore_evas_associate_del(ee); | ||
397 | } | ||
398 | |||
399 | _evas_object_associate_del(obj); | ||
400 | } | ||
401 | |||
402 | /** | ||
403 | * Helper ecore_getopt callback to list available Ecore_Evas engines. | ||
404 | * | ||
405 | * This will list all available engines except buffer, this is useful | ||
406 | * for applications to let user choose how they should create windows | ||
407 | * with ecore_evas_new(). | ||
408 | * | ||
409 | * @c callback_data value is used as @c FILE* and says where to output | ||
410 | * messages, by default it is @c stdout. You can specify this value | ||
411 | * with ECORE_GETOPT_CALLBACK_FULL() or ECORE_GETOPT_CALLBACK_ARGS(). | ||
412 | * | ||
413 | * If there is a boolean storage provided, then it is marked with 1 | ||
414 | * when this option is executed. | ||
415 | */ | ||
416 | unsigned char | ||
417 | 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) | ||
418 | { | ||
419 | Eina_List *lst, *n; | ||
420 | const char *engine; | ||
421 | FILE *fp = data; | ||
422 | |||
423 | if (!fp) | ||
424 | fp = stdout; | ||
425 | |||
426 | lst = ecore_evas_engines_get(); | ||
427 | |||
428 | fputs("supported engines:\n", fp); | ||
429 | EINA_LIST_FOREACH(lst, n, engine) | ||
430 | if (strcmp(engine, "buffer") != 0) | ||
431 | fprintf(fp, "\t%s\n", engine); | ||
432 | |||
433 | ecore_evas_engines_free(lst); | ||
434 | |||
435 | if (storage->boolp) | ||
436 | *storage->boolp = 1; | ||
437 | |||
438 | return 1; | ||
439 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c deleted file mode 100644 index e88fc35..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c +++ /dev/null | |||
@@ -1,1017 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif | ||
4 | |||
5 | //#define LOGFNS 1 | ||
6 | |||
7 | #ifdef LOGFNS | ||
8 | # include <stdio.h> | ||
9 | # define LOGFN(fl, ln, fn) \ | ||
10 | printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn); | ||
11 | #else | ||
12 | # define LOGFN(fl, ln, fn) | ||
13 | #endif | ||
14 | |||
15 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
16 | # include <stdlib.h> | ||
17 | # include <string.h> | ||
18 | # include <unistd.h> | ||
19 | # include <sys/types.h> | ||
20 | # include <sys/mman.h> | ||
21 | #endif | ||
22 | |||
23 | #include <Eina.h> | ||
24 | #include <Evas.h> | ||
25 | #include <Ecore.h> | ||
26 | |||
27 | #include "ecore_evas_private.h" | ||
28 | #include "Ecore_Evas.h" | ||
29 | |||
30 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
31 | # include <Evas_Engine_Wayland_Egl.h> | ||
32 | # include <Ecore_Wayland.h> | ||
33 | |||
34 | /* local structures */ | ||
35 | typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data; | ||
36 | struct _EE_Wl_Smart_Data | ||
37 | { | ||
38 | Evas_Object *frame; | ||
39 | Evas_Object *text; | ||
40 | Evas_Coord x, y, w, h; | ||
41 | }; | ||
42 | |||
43 | /* local function prototypes */ | ||
44 | static int _ecore_evas_wl_init(void); | ||
45 | static int _ecore_evas_wl_shutdown(void); | ||
46 | static void _ecore_evas_wl_pre_free(Ecore_Evas *ee); | ||
47 | static void _ecore_evas_wl_free(Ecore_Evas *ee); | ||
48 | static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
49 | static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
50 | static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
51 | static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
52 | static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
53 | static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
54 | static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
55 | static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y); | ||
56 | static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h); | ||
57 | static void _ecore_evas_wl_show(Ecore_Evas *ee); | ||
58 | static void _ecore_evas_wl_hide(Ecore_Evas *ee); | ||
59 | static void _ecore_evas_wl_raise(Ecore_Evas *ee); | ||
60 | static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title); | ||
61 | static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c); | ||
62 | static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h); | ||
63 | static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h); | ||
64 | static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h); | ||
65 | static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h); | ||
66 | static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer); | ||
67 | static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify); | ||
68 | static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max); | ||
69 | static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full); | ||
70 | static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore); | ||
71 | static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha); | ||
72 | static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent); | ||
73 | static int _ecore_evas_wl_render(Ecore_Evas *ee); | ||
74 | static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h); | ||
75 | |||
76 | static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
77 | static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
78 | static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
79 | static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
80 | static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
81 | |||
82 | /* SMART stuff for frame */ | ||
83 | static Evas_Smart *_ecore_evas_wl_smart = NULL; | ||
84 | |||
85 | static void _ecore_evas_wl_smart_init(void); | ||
86 | static void _ecore_evas_wl_smart_add(Evas_Object *obj); | ||
87 | static void _ecore_evas_wl_smart_del(Evas_Object *obj); | ||
88 | static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); | ||
89 | static void _ecore_evas_wl_smart_show(Evas_Object *obj); | ||
90 | static void _ecore_evas_wl_smart_hide(Evas_Object *obj); | ||
91 | |||
92 | static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas); | ||
93 | |||
94 | /* local variables */ | ||
95 | static int _ecore_evas_wl_init_count = 0; | ||
96 | static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5]; | ||
97 | |||
98 | static Ecore_Evas_Engine_Func _ecore_wl_engine_func = | ||
99 | { | ||
100 | _ecore_evas_wl_free, | ||
101 | _ecore_evas_wl_callback_resize_set, | ||
102 | _ecore_evas_wl_callback_move_set, | ||
103 | NULL, | ||
104 | NULL, | ||
105 | _ecore_evas_wl_callback_delete_request_set, | ||
106 | NULL, | ||
107 | _ecore_evas_wl_callback_focus_in_set, | ||
108 | _ecore_evas_wl_callback_focus_out_set, | ||
109 | _ecore_evas_wl_callback_mouse_in_set, | ||
110 | _ecore_evas_wl_callback_mouse_out_set, | ||
111 | NULL, // sticky_set | ||
112 | NULL, // unsticky_set | ||
113 | NULL, // pre_render_set | ||
114 | NULL, // post_render_set | ||
115 | _ecore_evas_wl_move, | ||
116 | NULL, // managed_move | ||
117 | _ecore_evas_wl_resize, | ||
118 | NULL, // move_resize | ||
119 | NULL, // rotation_set | ||
120 | NULL, // shaped_set | ||
121 | _ecore_evas_wl_show, | ||
122 | _ecore_evas_wl_hide, | ||
123 | _ecore_evas_wl_raise, | ||
124 | NULL, // lower | ||
125 | NULL, // activate | ||
126 | _ecore_evas_wl_title_set, | ||
127 | _ecore_evas_wl_name_class_set, | ||
128 | _ecore_evas_wl_size_min_set, | ||
129 | _ecore_evas_wl_size_max_set, | ||
130 | _ecore_evas_wl_size_base_set, | ||
131 | _ecore_evas_wl_size_step_set, | ||
132 | NULL, // object_cursor_set | ||
133 | _ecore_evas_wl_layer_set, | ||
134 | NULL, // focus set | ||
135 | _ecore_evas_wl_iconified_set, | ||
136 | NULL, // borderless set | ||
137 | NULL, // override set | ||
138 | _ecore_evas_wl_maximized_set, | ||
139 | _ecore_evas_wl_fullscreen_set, | ||
140 | NULL, // func avoid_damage set | ||
141 | NULL, // func withdrawn set | ||
142 | NULL, // func sticky set | ||
143 | _ecore_evas_wl_ignore_events_set, | ||
144 | _ecore_evas_wl_alpha_set, | ||
145 | _ecore_evas_wl_transparent_set, | ||
146 | NULL, | ||
147 | NULL, | ||
148 | NULL, | ||
149 | NULL, | ||
150 | NULL, | ||
151 | NULL, | ||
152 | _ecore_evas_wl_render, | ||
153 | _ecore_evas_wl_screen_geometry_get | ||
154 | }; | ||
155 | |||
156 | /* external variables */ | ||
157 | |||
158 | /* external functions */ | ||
159 | EAPI Ecore_Evas * | ||
160 | ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame) | ||
161 | { | ||
162 | Ecore_Wl_Window *p = NULL; | ||
163 | Evas_Engine_Info_Wayland_Egl *einfo; | ||
164 | Ecore_Evas *ee; | ||
165 | int method = 0; | ||
166 | |||
167 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
168 | |||
169 | if (!(method = evas_render_method_lookup("wayland_egl"))) | ||
170 | { | ||
171 | ERR("Render method lookup failed for Wayland_Egl"); | ||
172 | return NULL; | ||
173 | } | ||
174 | |||
175 | if (!ecore_wl_init(disp_name)) | ||
176 | { | ||
177 | ERR("Failed to initialize Ecore_Wayland"); | ||
178 | return NULL; | ||
179 | } | ||
180 | |||
181 | if (!(ee = calloc(1, sizeof(Ecore_Evas)))) | ||
182 | { | ||
183 | ERR("Failed to allocate Ecore_Evas"); | ||
184 | ecore_wl_shutdown(); | ||
185 | return NULL; | ||
186 | } | ||
187 | |||
188 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
189 | |||
190 | _ecore_evas_wl_init(); | ||
191 | |||
192 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func; | ||
193 | |||
194 | ee->driver = "wayland_egl"; | ||
195 | if (disp_name) ee->name = strdup(disp_name); | ||
196 | |||
197 | if (w < 1) w = 1; | ||
198 | if (h < 1) h = 1; | ||
199 | |||
200 | ee->x = x; | ||
201 | ee->y = y; | ||
202 | ee->w = w; | ||
203 | ee->h = h; | ||
204 | ee->req.x = ee->x; | ||
205 | ee->req.y = ee->y; | ||
206 | ee->req.w = ee->w; | ||
207 | ee->req.h = ee->h; | ||
208 | ee->rotation = 0; | ||
209 | ee->prop.max.w = 32767; | ||
210 | ee->prop.max.h = 32767; | ||
211 | ee->prop.layer = 4; | ||
212 | ee->prop.request_pos = 0; | ||
213 | ee->prop.sticky = 0; | ||
214 | ee->prop.draw_frame = frame; | ||
215 | ee->alpha = EINA_FALSE; | ||
216 | |||
217 | ee->evas = evas_new(); | ||
218 | evas_data_attach_set(ee->evas, ee); | ||
219 | evas_output_method_set(ee->evas, method); | ||
220 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
221 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
222 | |||
223 | /* FIXME: This needs to be set based on theme & scale */ | ||
224 | if (ee->prop.draw_frame) | ||
225 | evas_output_framespace_set(ee->evas, 4, 18, 8, 22); | ||
226 | |||
227 | if (parent) | ||
228 | p = ecore_wl_window_find(parent); | ||
229 | |||
230 | /* FIXME: Get if parent is alpha, and set */ | ||
231 | |||
232 | ee->engine.wl.parent = p; | ||
233 | ee->engine.wl.win = | ||
234 | ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW); | ||
235 | ee->prop.window = ee->engine.wl.win->id; | ||
236 | |||
237 | if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) | ||
238 | { | ||
239 | einfo->info.display = ecore_wl_display_get(); | ||
240 | einfo->info.destination_alpha = EINA_FALSE; | ||
241 | einfo->info.rotation = ee->rotation; | ||
242 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
243 | { | ||
244 | ERR("Failed to set Evas Engine Info for '%s'", ee->driver); | ||
245 | ecore_evas_free(ee); | ||
246 | _ecore_evas_wl_shutdown(); | ||
247 | ecore_wl_shutdown(); | ||
248 | return NULL; | ||
249 | } | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | ERR("Failed to get Evas Engine Info for '%s'", ee->driver); | ||
254 | ecore_evas_free(ee); | ||
255 | _ecore_evas_wl_shutdown(); | ||
256 | ecore_wl_shutdown(); | ||
257 | return NULL; | ||
258 | } | ||
259 | |||
260 | ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free); | ||
261 | |||
262 | if (ee->prop.draw_frame) | ||
263 | { | ||
264 | ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas); | ||
265 | evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE); | ||
266 | evas_object_move(ee->engine.wl.frame, 0, 0); | ||
267 | } | ||
268 | |||
269 | ecore_evas_input_event_register(ee); | ||
270 | _ecore_evas_register(ee); | ||
271 | |||
272 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
273 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
274 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
275 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
276 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
277 | |||
278 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
279 | |||
280 | return ee; | ||
281 | } | ||
282 | |||
283 | /* local functions */ | ||
284 | static int | ||
285 | _ecore_evas_wl_init(void) | ||
286 | { | ||
287 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
288 | |||
289 | if (++_ecore_evas_wl_init_count != 1) | ||
290 | return _ecore_evas_wl_init_count; | ||
291 | |||
292 | _ecore_evas_wl_event_hdls[0] = | ||
293 | ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, | ||
294 | _ecore_evas_wl_cb_mouse_in, NULL); | ||
295 | _ecore_evas_wl_event_hdls[1] = | ||
296 | ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, | ||
297 | _ecore_evas_wl_cb_mouse_out, NULL); | ||
298 | _ecore_evas_wl_event_hdls[2] = | ||
299 | ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, | ||
300 | _ecore_evas_wl_cb_focus_in, NULL); | ||
301 | _ecore_evas_wl_event_hdls[3] = | ||
302 | ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, | ||
303 | _ecore_evas_wl_cb_focus_out, NULL); | ||
304 | _ecore_evas_wl_event_hdls[4] = | ||
305 | ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, | ||
306 | _ecore_evas_wl_cb_window_configure, NULL); | ||
307 | |||
308 | ecore_event_evas_init(); | ||
309 | |||
310 | return _ecore_evas_wl_init_count; | ||
311 | } | ||
312 | |||
313 | static int | ||
314 | _ecore_evas_wl_shutdown(void) | ||
315 | { | ||
316 | unsigned int i = 0; | ||
317 | |||
318 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
319 | |||
320 | if (--_ecore_evas_wl_init_count != 0) | ||
321 | return _ecore_evas_wl_init_count; | ||
322 | |||
323 | for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++) | ||
324 | { | ||
325 | if (_ecore_evas_wl_event_hdls[i]) | ||
326 | ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]); | ||
327 | } | ||
328 | |||
329 | ecore_event_evas_shutdown(); | ||
330 | |||
331 | return _ecore_evas_wl_init_count; | ||
332 | } | ||
333 | |||
334 | static void | ||
335 | _ecore_evas_wl_pre_free(Ecore_Evas *ee) | ||
336 | { | ||
337 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
338 | |||
339 | if (!ee) return; | ||
340 | if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame); | ||
341 | } | ||
342 | |||
343 | static void | ||
344 | _ecore_evas_wl_free(Ecore_Evas *ee) | ||
345 | { | ||
346 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
347 | |||
348 | if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win); | ||
349 | ee->engine.wl.win = NULL; | ||
350 | |||
351 | ecore_event_window_unregister(ee->prop.window); | ||
352 | ecore_evas_input_event_unregister(ee); | ||
353 | |||
354 | _ecore_evas_wl_shutdown(); | ||
355 | ecore_wl_shutdown(); | ||
356 | } | ||
357 | |||
358 | static void | ||
359 | _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
360 | { | ||
361 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
362 | |||
363 | if (!ee) return; | ||
364 | ee->func.fn_resize = func; | ||
365 | } | ||
366 | |||
367 | static void | ||
368 | _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
369 | { | ||
370 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
371 | |||
372 | if (!ee) return; | ||
373 | ee->func.fn_move = func; | ||
374 | } | ||
375 | |||
376 | static void | ||
377 | _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
378 | { | ||
379 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
380 | |||
381 | if (!ee) return; | ||
382 | ee->func.fn_delete_request = func; | ||
383 | } | ||
384 | |||
385 | static void | ||
386 | _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
387 | { | ||
388 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
389 | |||
390 | if (!ee) return; | ||
391 | ee->func.fn_focus_in = func; | ||
392 | } | ||
393 | |||
394 | static void | ||
395 | _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
396 | { | ||
397 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
398 | |||
399 | if (!ee) return; | ||
400 | ee->func.fn_focus_out = func; | ||
401 | } | ||
402 | |||
403 | static void | ||
404 | _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
405 | { | ||
406 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
407 | |||
408 | if (!ee) return; | ||
409 | ee->func.fn_mouse_in = func; | ||
410 | } | ||
411 | |||
412 | static void | ||
413 | _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
414 | { | ||
415 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
416 | |||
417 | if (!ee) return; | ||
418 | ee->func.fn_mouse_out = func; | ||
419 | } | ||
420 | |||
421 | static void | ||
422 | _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) | ||
423 | { | ||
424 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
425 | |||
426 | if (!ee) return; | ||
427 | ee->req.x = x; | ||
428 | ee->req.y = y; | ||
429 | ee->x = x; | ||
430 | ee->y = y; | ||
431 | if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y); | ||
432 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
433 | } | ||
434 | |||
435 | static void | ||
436 | _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) | ||
437 | { | ||
438 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
439 | |||
440 | if (!ee) return; | ||
441 | if (w < 1) w = 1; | ||
442 | if (h < 1) h = 1; | ||
443 | // if ((ee->w == w) && (ee->h == h)) return; | ||
444 | |||
445 | if (ee->prop.min.w > w) w = ee->prop.min.w; | ||
446 | else if (w > ee->prop.max.w) w = ee->prop.max.w; | ||
447 | if (ee->prop.min.h > h) h = ee->prop.min.h; | ||
448 | else if (h > ee->prop.max.h) h = ee->prop.max.h; | ||
449 | |||
450 | ee->req.w = w; | ||
451 | ee->req.h = h; | ||
452 | |||
453 | // ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); | ||
454 | |||
455 | ee->w = w; | ||
456 | ee->h = h; | ||
457 | |||
458 | /* change evas output & viewport sizes */ | ||
459 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
460 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
461 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
462 | if (ee->engine.wl.frame) | ||
463 | evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); | ||
464 | |||
465 | /* set new engine destination */ | ||
466 | /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */ | ||
467 | |||
468 | /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */ | ||
469 | ecore_wl_flush(); | ||
470 | |||
471 | ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h); | ||
472 | |||
473 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
474 | } | ||
475 | |||
476 | static void | ||
477 | _ecore_evas_wl_show(Ecore_Evas *ee) | ||
478 | { | ||
479 | Evas_Engine_Info_Wayland_Egl *einfo; | ||
480 | |||
481 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
482 | |||
483 | if ((!ee) || (ee->visible)) return; | ||
484 | |||
485 | if (ee->engine.wl.win) | ||
486 | { | ||
487 | ecore_wl_window_show(ee->engine.wl.win); | ||
488 | ecore_wl_flush(); | ||
489 | } | ||
490 | |||
491 | einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); | ||
492 | if (!einfo) | ||
493 | { | ||
494 | ERR("Failed to get Evas Engine Info for '%s'", ee->driver); | ||
495 | return; | ||
496 | } | ||
497 | |||
498 | einfo->info.surface = ecore_wl_window_surface_get(ee->engine.wl.win); | ||
499 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
500 | |||
501 | if (ee->engine.wl.frame) | ||
502 | { | ||
503 | evas_object_show(ee->engine.wl.frame); | ||
504 | evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); | ||
505 | } | ||
506 | |||
507 | /* ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); */ | ||
508 | |||
509 | ee->visible = 1; | ||
510 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
511 | } | ||
512 | |||
513 | static void | ||
514 | _ecore_evas_wl_hide(Ecore_Evas *ee) | ||
515 | { | ||
516 | Evas_Engine_Info_Wayland_Egl *einfo; | ||
517 | |||
518 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
519 | |||
520 | if ((!ee) || (!ee->visible)) return; | ||
521 | |||
522 | if (ee->engine.wl.win) | ||
523 | { | ||
524 | ecore_wl_window_hide(ee->engine.wl.win); | ||
525 | ecore_wl_flush(); | ||
526 | } | ||
527 | |||
528 | einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); | ||
529 | if (einfo) | ||
530 | { | ||
531 | einfo->info.surface = NULL; | ||
532 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
533 | } | ||
534 | |||
535 | ee->visible = 0; | ||
536 | ee->should_be_visible = 0; | ||
537 | |||
538 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
539 | } | ||
540 | |||
541 | static void | ||
542 | _ecore_evas_wl_raise(Ecore_Evas *ee) | ||
543 | { | ||
544 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
545 | |||
546 | if ((!ee) || (!ee->visible)) return; | ||
547 | ecore_wl_window_raise(ee->engine.wl.win); | ||
548 | } | ||
549 | |||
550 | static void | ||
551 | _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title) | ||
552 | { | ||
553 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
554 | |||
555 | if (!ee) return; | ||
556 | if (ee->prop.title) free(ee->prop.title); | ||
557 | ee->prop.title = NULL; | ||
558 | if (title) ee->prop.title = strdup(title); | ||
559 | if ((ee->prop.draw_frame) && (ee->engine.wl.frame)) | ||
560 | { | ||
561 | EE_Wl_Smart_Data *sd; | ||
562 | |||
563 | if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return; | ||
564 | evas_object_text_text_set(sd->text, ee->prop.title); | ||
565 | } | ||
566 | } | ||
567 | |||
568 | static void | ||
569 | _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
570 | { | ||
571 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
572 | |||
573 | if (!ee) return; | ||
574 | if (ee->prop.name) free(ee->prop.name); | ||
575 | if (ee->prop.clas) free(ee->prop.clas); | ||
576 | ee->prop.name = NULL; | ||
577 | ee->prop.clas = NULL; | ||
578 | if (n) ee->prop.name = strdup(n); | ||
579 | if (c) ee->prop.clas = strdup(c); | ||
580 | /* FIXME: Forward these changes to Wayland somehow */ | ||
581 | } | ||
582 | |||
583 | static void | ||
584 | _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h) | ||
585 | { | ||
586 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
587 | |||
588 | if (!ee) return; | ||
589 | if (w < 0) w = 0; | ||
590 | if (h < 0) h = 0; | ||
591 | if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; | ||
592 | ee->prop.min.w = w; | ||
593 | ee->prop.min.h = h; | ||
594 | } | ||
595 | |||
596 | static void | ||
597 | _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h) | ||
598 | { | ||
599 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
600 | |||
601 | if (!ee) return; | ||
602 | if (w < 0) w = 0; | ||
603 | if (h < 0) h = 0; | ||
604 | if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; | ||
605 | ee->prop.max.w = w; | ||
606 | ee->prop.max.h = h; | ||
607 | } | ||
608 | |||
609 | static void | ||
610 | _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h) | ||
611 | { | ||
612 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
613 | |||
614 | if (!ee) return; | ||
615 | if (w < 0) w = 0; | ||
616 | if (h < 0) h = 0; | ||
617 | if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; | ||
618 | ee->prop.base.w = w; | ||
619 | ee->prop.base.h = h; | ||
620 | } | ||
621 | |||
622 | static void | ||
623 | _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h) | ||
624 | { | ||
625 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
626 | |||
627 | if (!ee) return; | ||
628 | if (w < 0) w = 0; | ||
629 | if (h < 0) h = 0; | ||
630 | if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; | ||
631 | ee->prop.step.w = w; | ||
632 | ee->prop.step.h = h; | ||
633 | } | ||
634 | |||
635 | static void | ||
636 | _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) | ||
637 | { | ||
638 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
639 | |||
640 | if (!ee) return; | ||
641 | if (ee->prop.layer == layer) return; | ||
642 | if (layer < 1) layer = 1; | ||
643 | else if (layer > 255) layer = 255; | ||
644 | ee->prop.layer = layer; | ||
645 | } | ||
646 | |||
647 | static void | ||
648 | _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) | ||
649 | { | ||
650 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
651 | |||
652 | if (!ee) return; | ||
653 | if (ee->prop.iconified == iconify) return; | ||
654 | ee->prop.iconified = iconify; | ||
655 | /* FIXME: Implement this in Wayland someshow */ | ||
656 | } | ||
657 | |||
658 | static void | ||
659 | _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) | ||
660 | { | ||
661 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
662 | |||
663 | if (!ee) return; | ||
664 | if (ee->prop.maximized == max) return; | ||
665 | ee->prop.maximized = max; | ||
666 | ecore_wl_window_maximized_set(ee->engine.wl.win, max); | ||
667 | } | ||
668 | |||
669 | static void | ||
670 | _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full) | ||
671 | { | ||
672 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
673 | |||
674 | if ((!ee) || (!ee->visible)) return; | ||
675 | if (ee->prop.fullscreen == full) return; | ||
676 | ee->prop.fullscreen = full; | ||
677 | ecore_wl_window_fullscreen_set(ee->engine.wl.win, full); | ||
678 | } | ||
679 | |||
680 | static void | ||
681 | _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore) | ||
682 | { | ||
683 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
684 | |||
685 | if (!ee) return; | ||
686 | ee->ignore_events = ignore; | ||
687 | /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */ | ||
688 | } | ||
689 | |||
690 | static void | ||
691 | _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha) | ||
692 | { | ||
693 | Evas_Engine_Info_Wayland_Egl *einfo; | ||
694 | |||
695 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
696 | |||
697 | if (!ee) return; | ||
698 | if ((ee->alpha == alpha)) return; | ||
699 | ee->alpha = alpha; | ||
700 | if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) | ||
701 | { | ||
702 | einfo->info.destination_alpha = alpha; | ||
703 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
704 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
705 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
706 | } | ||
707 | } | ||
708 | |||
709 | static void | ||
710 | _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent) | ||
711 | { | ||
712 | Evas_Engine_Info_Wayland_Egl *einfo; | ||
713 | |||
714 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
715 | |||
716 | if (!ee) return; | ||
717 | if ((ee->transparent == transparent)) return; | ||
718 | ee->transparent = transparent; | ||
719 | if (!ee->visible) return; | ||
720 | if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) | ||
721 | { | ||
722 | einfo->info.destination_alpha = transparent; | ||
723 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
724 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
725 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
726 | } | ||
727 | } | ||
728 | |||
729 | static int | ||
730 | _ecore_evas_wl_render(Ecore_Evas *ee) | ||
731 | { | ||
732 | int rend = 0; | ||
733 | |||
734 | if (!ee) return 0; | ||
735 | if (!ee->visible) | ||
736 | evas_norender(ee->evas); | ||
737 | else | ||
738 | { | ||
739 | Eina_List *ll = NULL, *updates = NULL; | ||
740 | Ecore_Evas *ee2 = NULL; | ||
741 | |||
742 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
743 | |||
744 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
745 | { | ||
746 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
747 | if (ee2->engine.func->fn_render) | ||
748 | rend |= ee2->engine.func->fn_render(ee2); | ||
749 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
750 | } | ||
751 | |||
752 | if ((updates = evas_render_updates(ee->evas))) | ||
753 | { | ||
754 | Eina_List *l = NULL; | ||
755 | Eina_Rectangle *r; | ||
756 | |||
757 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
758 | |||
759 | EINA_LIST_FOREACH(updates, l, r) | ||
760 | ecore_wl_window_damage(ee->engine.wl.win, | ||
761 | r->x, r->y, r->w, r->h); | ||
762 | |||
763 | ecore_wl_flush(); | ||
764 | |||
765 | evas_render_updates_free(updates); | ||
766 | _ecore_evas_idle_timeout_update(ee); | ||
767 | rend = 1; | ||
768 | } | ||
769 | |||
770 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
771 | } | ||
772 | return rend; | ||
773 | } | ||
774 | |||
775 | static void | ||
776 | _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
777 | { | ||
778 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
779 | |||
780 | if (x) *x = 0; | ||
781 | if (y) *y = 0; | ||
782 | ecore_wl_screen_size_get(w, h); | ||
783 | } | ||
784 | |||
785 | void | ||
786 | _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location) | ||
787 | { | ||
788 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
789 | |||
790 | if (!ee) return; | ||
791 | if (ee->engine.wl.win) | ||
792 | ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location); | ||
793 | } | ||
794 | |||
795 | static Eina_Bool | ||
796 | _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
797 | { | ||
798 | Ecore_Evas *ee; | ||
799 | Ecore_Wl_Event_Mouse_In *ev; | ||
800 | |||
801 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
802 | |||
803 | ev = event; | ||
804 | ee = ecore_event_window_match(ev->win); | ||
805 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
806 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
807 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
808 | ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); | ||
809 | evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); | ||
810 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); | ||
811 | return ECORE_CALLBACK_PASS_ON; | ||
812 | } | ||
813 | |||
814 | static Eina_Bool | ||
815 | _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
816 | { | ||
817 | Ecore_Evas *ee; | ||
818 | Ecore_Wl_Event_Mouse_Out *ev; | ||
819 | |||
820 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
821 | |||
822 | ev = event; | ||
823 | ee = ecore_event_window_match(ev->win); | ||
824 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
825 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
826 | ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); | ||
827 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); | ||
828 | evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); | ||
829 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
830 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
831 | return ECORE_CALLBACK_PASS_ON; | ||
832 | } | ||
833 | |||
834 | static Eina_Bool | ||
835 | _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
836 | { | ||
837 | Ecore_Evas *ee; | ||
838 | Ecore_Wl_Event_Focus_In *ev; | ||
839 | |||
840 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
841 | |||
842 | ev = event; | ||
843 | ee = ecore_event_window_match(ev->win); | ||
844 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
845 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
846 | ee->prop.focused = 1; | ||
847 | evas_focus_in(ee->evas); | ||
848 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
849 | return ECORE_CALLBACK_PASS_ON; | ||
850 | } | ||
851 | |||
852 | static Eina_Bool | ||
853 | _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
854 | { | ||
855 | Ecore_Evas *ee; | ||
856 | Ecore_Wl_Event_Focus_In *ev; | ||
857 | |||
858 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
859 | |||
860 | ev = event; | ||
861 | ee = ecore_event_window_match(ev->win); | ||
862 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
863 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
864 | evas_focus_out(ee->evas); | ||
865 | ee->prop.focused = 0; | ||
866 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
867 | return ECORE_CALLBACK_PASS_ON; | ||
868 | } | ||
869 | |||
870 | static Eina_Bool | ||
871 | _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
872 | { | ||
873 | Ecore_Evas *ee; | ||
874 | Ecore_Wl_Event_Window_Configure *ev; | ||
875 | |||
876 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
877 | |||
878 | ev = event; | ||
879 | ee = ecore_event_window_match(ev->win); | ||
880 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
881 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
882 | if ((ee->x != ev->x) || (ee->y != ev->y)) | ||
883 | { | ||
884 | ee->x = ev->x; | ||
885 | ee->y = ev->y; | ||
886 | ee->req.x = ee->x; | ||
887 | ee->req.y = ee->y; | ||
888 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
889 | } | ||
890 | if ((ee->req.w != ev->w) || (ee->req.h != ev->h)) | ||
891 | { | ||
892 | ee->req.w = ev->w; | ||
893 | ee->req.h = ev->h; | ||
894 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
895 | } | ||
896 | |||
897 | return ECORE_CALLBACK_PASS_ON; | ||
898 | } | ||
899 | |||
900 | static void | ||
901 | _ecore_evas_wl_smart_init(void) | ||
902 | { | ||
903 | if (_ecore_evas_wl_smart) return; | ||
904 | { | ||
905 | static const Evas_Smart_Class sc = | ||
906 | { | ||
907 | "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION, | ||
908 | _ecore_evas_wl_smart_add, | ||
909 | _ecore_evas_wl_smart_del, | ||
910 | NULL, | ||
911 | _ecore_evas_wl_smart_resize, | ||
912 | _ecore_evas_wl_smart_show, | ||
913 | _ecore_evas_wl_smart_hide, | ||
914 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL | ||
915 | }; | ||
916 | _ecore_evas_wl_smart = evas_smart_class_new(&sc); | ||
917 | } | ||
918 | } | ||
919 | |||
920 | static void | ||
921 | _ecore_evas_wl_smart_add(Evas_Object *obj) | ||
922 | { | ||
923 | EE_Wl_Smart_Data *sd; | ||
924 | Evas *evas; | ||
925 | |||
926 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
927 | |||
928 | if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return; | ||
929 | |||
930 | evas = evas_object_evas_get(obj); | ||
931 | |||
932 | sd->x = 0; | ||
933 | sd->y = 0; | ||
934 | sd->w = 1; | ||
935 | sd->h = 1; | ||
936 | |||
937 | sd->frame = evas_object_rectangle_add(evas); | ||
938 | evas_object_is_frame_object_set(sd->frame, EINA_TRUE); | ||
939 | evas_object_color_set(sd->frame, 249, 249, 249, 255); | ||
940 | evas_object_smart_member_add(sd->frame, obj); | ||
941 | |||
942 | sd->text = evas_object_text_add(evas); | ||
943 | evas_object_color_set(sd->text, 0, 0, 0, 255); | ||
944 | evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN); | ||
945 | evas_object_text_font_set(sd->text, "Sans", 10); | ||
946 | evas_object_text_text_set(sd->text, "Smart Test"); | ||
947 | |||
948 | evas_object_smart_data_set(obj, sd); | ||
949 | } | ||
950 | |||
951 | static void | ||
952 | _ecore_evas_wl_smart_del(Evas_Object *obj) | ||
953 | { | ||
954 | EE_Wl_Smart_Data *sd; | ||
955 | |||
956 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
957 | |||
958 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
959 | evas_object_del(sd->text); | ||
960 | evas_object_del(sd->frame); | ||
961 | free(sd); | ||
962 | } | ||
963 | |||
964 | static void | ||
965 | _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | ||
966 | { | ||
967 | EE_Wl_Smart_Data *sd; | ||
968 | |||
969 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
970 | |||
971 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
972 | if ((sd->w == w) && (sd->h == h)) return; | ||
973 | sd->w = w; | ||
974 | sd->h = h; | ||
975 | evas_object_resize(sd->frame, w, h); | ||
976 | } | ||
977 | |||
978 | static void | ||
979 | _ecore_evas_wl_smart_show(Evas_Object *obj) | ||
980 | { | ||
981 | EE_Wl_Smart_Data *sd; | ||
982 | |||
983 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
984 | |||
985 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
986 | evas_object_show(sd->frame); | ||
987 | evas_object_show(sd->text); | ||
988 | } | ||
989 | |||
990 | static void | ||
991 | _ecore_evas_wl_smart_hide(Evas_Object *obj) | ||
992 | { | ||
993 | EE_Wl_Smart_Data *sd; | ||
994 | |||
995 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
996 | |||
997 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
998 | evas_object_hide(sd->text); | ||
999 | evas_object_hide(sd->frame); | ||
1000 | } | ||
1001 | |||
1002 | static Evas_Object * | ||
1003 | _ecore_evas_wl_frame_add(Evas *evas) | ||
1004 | { | ||
1005 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1006 | |||
1007 | _ecore_evas_wl_smart_init(); | ||
1008 | return evas_object_smart_add(evas, _ecore_evas_wl_smart); | ||
1009 | } | ||
1010 | |||
1011 | #else | ||
1012 | EAPI Ecore_Evas * | ||
1013 | ecore_evas_wayland_egl_new(const char *disp_name __UNUSED__, unsigned int parent __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, Eina_Bool frame __UNUSED__) | ||
1014 | { | ||
1015 | return NULL; | ||
1016 | } | ||
1017 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c deleted file mode 100644 index 4c7ee2d..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c +++ /dev/null | |||
@@ -1,1114 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif | ||
4 | |||
5 | #define LOGFNS 1 | ||
6 | |||
7 | #ifdef LOGFNS | ||
8 | # include <stdio.h> | ||
9 | # define LOGFN(fl, ln, fn) \ | ||
10 | printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn); | ||
11 | #else | ||
12 | # define LOGFN(fl, ln, fn) | ||
13 | #endif | ||
14 | |||
15 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
16 | # include <stdlib.h> | ||
17 | # include <string.h> | ||
18 | # include <unistd.h> | ||
19 | # include <sys/types.h> | ||
20 | # include <sys/mman.h> | ||
21 | #endif | ||
22 | |||
23 | #include <Eina.h> | ||
24 | #include <Evas.h> | ||
25 | #include <Ecore.h> | ||
26 | |||
27 | #include "ecore_evas_private.h" | ||
28 | #include "Ecore_Evas.h" | ||
29 | |||
30 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
31 | # include <Evas_Engine_Wayland_Shm.h> | ||
32 | # include <Ecore_Wayland.h> | ||
33 | |||
34 | /* local structures */ | ||
35 | typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data; | ||
36 | struct _EE_Wl_Smart_Data | ||
37 | { | ||
38 | Evas_Object *frame; | ||
39 | Evas_Object *text; | ||
40 | Evas_Coord x, y, w, h; | ||
41 | }; | ||
42 | |||
43 | /* local function prototypes */ | ||
44 | static int _ecore_evas_wl_init(void); | ||
45 | static int _ecore_evas_wl_shutdown(void); | ||
46 | static void _ecore_evas_wl_pre_free(Ecore_Evas *ee); | ||
47 | static void _ecore_evas_wl_free(Ecore_Evas *ee); | ||
48 | static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
49 | static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
50 | static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
51 | static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
52 | static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
53 | static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
54 | static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
55 | static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y); | ||
56 | static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h); | ||
57 | static void _ecore_evas_wl_show(Ecore_Evas *ee); | ||
58 | static void _ecore_evas_wl_hide(Ecore_Evas *ee); | ||
59 | static void _ecore_evas_wl_raise(Ecore_Evas *ee); | ||
60 | static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title); | ||
61 | static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c); | ||
62 | static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h); | ||
63 | static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h); | ||
64 | static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h); | ||
65 | static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h); | ||
66 | static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer); | ||
67 | static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify); | ||
68 | static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max); | ||
69 | static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full); | ||
70 | static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore); | ||
71 | static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha); | ||
72 | static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent); | ||
73 | static int _ecore_evas_wl_render(Ecore_Evas *ee); | ||
74 | static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h); | ||
75 | static void _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest); | ||
76 | |||
77 | static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
78 | static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
79 | static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
80 | static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
81 | static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
82 | |||
83 | /* SMART stuff for frame */ | ||
84 | static Evas_Smart *_ecore_evas_wl_smart = NULL; | ||
85 | |||
86 | static void _ecore_evas_wl_smart_init(void); | ||
87 | static void _ecore_evas_wl_smart_add(Evas_Object *obj); | ||
88 | static void _ecore_evas_wl_smart_del(Evas_Object *obj); | ||
89 | static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); | ||
90 | static void _ecore_evas_wl_smart_show(Evas_Object *obj); | ||
91 | static void _ecore_evas_wl_smart_hide(Evas_Object *obj); | ||
92 | |||
93 | static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas); | ||
94 | |||
95 | /* local variables */ | ||
96 | static int _ecore_evas_wl_init_count = 0; | ||
97 | static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5]; | ||
98 | |||
99 | static Ecore_Evas_Engine_Func _ecore_wl_engine_func = | ||
100 | { | ||
101 | _ecore_evas_wl_free, | ||
102 | _ecore_evas_wl_callback_resize_set, | ||
103 | _ecore_evas_wl_callback_move_set, | ||
104 | NULL, | ||
105 | NULL, | ||
106 | _ecore_evas_wl_callback_delete_request_set, | ||
107 | NULL, | ||
108 | _ecore_evas_wl_callback_focus_in_set, | ||
109 | _ecore_evas_wl_callback_focus_out_set, | ||
110 | _ecore_evas_wl_callback_mouse_in_set, | ||
111 | _ecore_evas_wl_callback_mouse_out_set, | ||
112 | NULL, // sticky_set | ||
113 | NULL, // unsticky_set | ||
114 | NULL, // pre_render_set | ||
115 | NULL, // post_render_set | ||
116 | _ecore_evas_wl_move, | ||
117 | NULL, // managed_move | ||
118 | _ecore_evas_wl_resize, | ||
119 | NULL, // move_resize | ||
120 | NULL, // rotation_set | ||
121 | NULL, // shaped_set | ||
122 | _ecore_evas_wl_show, | ||
123 | _ecore_evas_wl_hide, | ||
124 | _ecore_evas_wl_raise, | ||
125 | NULL, // lower | ||
126 | NULL, // activate | ||
127 | _ecore_evas_wl_title_set, | ||
128 | _ecore_evas_wl_name_class_set, | ||
129 | _ecore_evas_wl_size_min_set, | ||
130 | _ecore_evas_wl_size_max_set, | ||
131 | _ecore_evas_wl_size_base_set, | ||
132 | _ecore_evas_wl_size_step_set, | ||
133 | NULL, // object_cursor_set | ||
134 | _ecore_evas_wl_layer_set, | ||
135 | NULL, // focus set | ||
136 | _ecore_evas_wl_iconified_set, | ||
137 | NULL, // borderless set | ||
138 | NULL, // override set | ||
139 | _ecore_evas_wl_maximized_set, | ||
140 | _ecore_evas_wl_fullscreen_set, | ||
141 | NULL, // func avoid_damage set | ||
142 | NULL, // func withdrawn set | ||
143 | NULL, // func sticky set | ||
144 | _ecore_evas_wl_ignore_events_set, | ||
145 | _ecore_evas_wl_alpha_set, | ||
146 | _ecore_evas_wl_transparent_set, | ||
147 | NULL, | ||
148 | NULL, | ||
149 | NULL, | ||
150 | NULL, | ||
151 | NULL, | ||
152 | NULL, | ||
153 | _ecore_evas_wl_render, | ||
154 | _ecore_evas_wl_screen_geometry_get | ||
155 | }; | ||
156 | |||
157 | /* external variables */ | ||
158 | |||
159 | /* external functions */ | ||
160 | EAPI Ecore_Evas * | ||
161 | ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame) | ||
162 | { | ||
163 | Ecore_Wl_Window *p = NULL; | ||
164 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
165 | Ecore_Evas *ee; | ||
166 | int method = 0; | ||
167 | |||
168 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
169 | |||
170 | if (!(method = evas_render_method_lookup("wayland_shm"))) | ||
171 | { | ||
172 | ERR("Render method lookup failed for Wayland_Shm"); | ||
173 | return NULL; | ||
174 | } | ||
175 | |||
176 | if (!ecore_wl_init(disp_name)) | ||
177 | { | ||
178 | ERR("Failed to initialize Ecore_Wayland"); | ||
179 | return NULL; | ||
180 | } | ||
181 | |||
182 | if (!(ee = calloc(1, sizeof(Ecore_Evas)))) | ||
183 | { | ||
184 | ERR("Failed to allocate Ecore_Evas"); | ||
185 | ecore_wl_shutdown(); | ||
186 | return NULL; | ||
187 | } | ||
188 | |||
189 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
190 | |||
191 | _ecore_evas_wl_init(); | ||
192 | |||
193 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func; | ||
194 | |||
195 | ee->driver = "wayland_shm"; | ||
196 | if (disp_name) ee->name = strdup(disp_name); | ||
197 | |||
198 | if (w < 1) w = 1; | ||
199 | if (h < 1) h = 1; | ||
200 | |||
201 | ee->x = x; | ||
202 | ee->y = y; | ||
203 | ee->w = w; | ||
204 | ee->h = h; | ||
205 | ee->req.x = ee->x; | ||
206 | ee->req.y = ee->y; | ||
207 | ee->req.w = ee->w; | ||
208 | ee->req.h = ee->h; | ||
209 | ee->rotation = 0; | ||
210 | ee->prop.max.w = 32767; | ||
211 | ee->prop.max.h = 32767; | ||
212 | ee->prop.layer = 4; | ||
213 | ee->prop.request_pos = 0; | ||
214 | ee->prop.sticky = 0; | ||
215 | ee->prop.draw_frame = frame; | ||
216 | |||
217 | ee->evas = evas_new(); | ||
218 | evas_data_attach_set(ee->evas, ee); | ||
219 | evas_output_method_set(ee->evas, method); | ||
220 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
221 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
222 | |||
223 | /* FIXME: This needs to be set based on theme & scale */ | ||
224 | if (ee->prop.draw_frame) | ||
225 | evas_output_framespace_set(ee->evas, 4, 18, 8, 22); | ||
226 | |||
227 | if (parent) | ||
228 | p = ecore_wl_window_find(parent); | ||
229 | |||
230 | /* FIXME: Get if parent is alpha, and set */ | ||
231 | |||
232 | ee->engine.wl.parent = p; | ||
233 | ee->engine.wl.win = | ||
234 | ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_SHM); | ||
235 | ee->prop.window = ee->engine.wl.win->id; | ||
236 | |||
237 | if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) | ||
238 | { | ||
239 | einfo->info.rotation = ee->rotation; | ||
240 | einfo->info.debug = EINA_FALSE; | ||
241 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
242 | { | ||
243 | ERR("Failed to set Evas Engine Info for '%s'", ee->driver); | ||
244 | ecore_evas_free(ee); | ||
245 | _ecore_evas_wl_shutdown(); | ||
246 | ecore_wl_shutdown(); | ||
247 | return NULL; | ||
248 | } | ||
249 | } | ||
250 | else | ||
251 | { | ||
252 | ERR("Failed to get Evas Engine Info for '%s'", ee->driver); | ||
253 | ecore_evas_free(ee); | ||
254 | _ecore_evas_wl_shutdown(); | ||
255 | ecore_wl_shutdown(); | ||
256 | return NULL; | ||
257 | } | ||
258 | |||
259 | ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free); | ||
260 | |||
261 | if (ee->prop.draw_frame) | ||
262 | { | ||
263 | ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas); | ||
264 | evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE); | ||
265 | evas_object_move(ee->engine.wl.frame, 0, 0); | ||
266 | } | ||
267 | |||
268 | ecore_evas_input_event_register(ee); | ||
269 | _ecore_evas_register(ee); | ||
270 | |||
271 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
272 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
273 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
274 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
275 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
276 | |||
277 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
278 | |||
279 | return ee; | ||
280 | } | ||
281 | |||
282 | /* local functions */ | ||
283 | static int | ||
284 | _ecore_evas_wl_init(void) | ||
285 | { | ||
286 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
287 | |||
288 | if (++_ecore_evas_wl_init_count != 1) | ||
289 | return _ecore_evas_wl_init_count; | ||
290 | |||
291 | _ecore_evas_wl_event_hdls[0] = | ||
292 | ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, | ||
293 | _ecore_evas_wl_cb_mouse_in, NULL); | ||
294 | _ecore_evas_wl_event_hdls[1] = | ||
295 | ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, | ||
296 | _ecore_evas_wl_cb_mouse_out, NULL); | ||
297 | _ecore_evas_wl_event_hdls[2] = | ||
298 | ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, | ||
299 | _ecore_evas_wl_cb_focus_in, NULL); | ||
300 | _ecore_evas_wl_event_hdls[3] = | ||
301 | ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, | ||
302 | _ecore_evas_wl_cb_focus_out, NULL); | ||
303 | _ecore_evas_wl_event_hdls[4] = | ||
304 | ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, | ||
305 | _ecore_evas_wl_cb_window_configure, NULL); | ||
306 | |||
307 | ecore_event_evas_init(); | ||
308 | |||
309 | return _ecore_evas_wl_init_count; | ||
310 | } | ||
311 | |||
312 | static int | ||
313 | _ecore_evas_wl_shutdown(void) | ||
314 | { | ||
315 | unsigned int i = 0; | ||
316 | |||
317 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
318 | |||
319 | if (--_ecore_evas_wl_init_count != 0) | ||
320 | return _ecore_evas_wl_init_count; | ||
321 | |||
322 | for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++) | ||
323 | { | ||
324 | if (_ecore_evas_wl_event_hdls[i]) | ||
325 | ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]); | ||
326 | } | ||
327 | |||
328 | ecore_event_evas_shutdown(); | ||
329 | |||
330 | return _ecore_evas_wl_init_count; | ||
331 | } | ||
332 | |||
333 | static void | ||
334 | _ecore_evas_wl_pre_free(Ecore_Evas *ee) | ||
335 | { | ||
336 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
337 | |||
338 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
339 | |||
340 | if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame); | ||
341 | |||
342 | einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); | ||
343 | if ((einfo) && (einfo->info.dest)) | ||
344 | { | ||
345 | int ret = 0; | ||
346 | |||
347 | ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); | ||
348 | if (!ret) ERR("Failed to unmap engine destination: %m"); | ||
349 | } | ||
350 | } | ||
351 | |||
352 | static void | ||
353 | _ecore_evas_wl_free(Ecore_Evas *ee) | ||
354 | { | ||
355 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
356 | |||
357 | if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); | ||
358 | ee->engine.wl.buffer = NULL; | ||
359 | |||
360 | if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win); | ||
361 | ee->engine.wl.win = NULL; | ||
362 | |||
363 | ecore_event_window_unregister(ee->prop.window); | ||
364 | ecore_evas_input_event_unregister(ee); | ||
365 | |||
366 | _ecore_evas_wl_shutdown(); | ||
367 | ecore_wl_shutdown(); | ||
368 | } | ||
369 | |||
370 | static void | ||
371 | _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
372 | { | ||
373 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
374 | |||
375 | if (!ee) return; | ||
376 | ee->func.fn_resize = func; | ||
377 | } | ||
378 | |||
379 | static void | ||
380 | _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
381 | { | ||
382 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
383 | |||
384 | if (!ee) return; | ||
385 | ee->func.fn_move = func; | ||
386 | } | ||
387 | |||
388 | static void | ||
389 | _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
390 | { | ||
391 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
392 | |||
393 | if (!ee) return; | ||
394 | ee->func.fn_delete_request = func; | ||
395 | } | ||
396 | |||
397 | static void | ||
398 | _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
399 | { | ||
400 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
401 | |||
402 | if (!ee) return; | ||
403 | ee->func.fn_focus_in = func; | ||
404 | } | ||
405 | |||
406 | static void | ||
407 | _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
408 | { | ||
409 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
410 | |||
411 | if (!ee) return; | ||
412 | ee->func.fn_focus_out = func; | ||
413 | } | ||
414 | |||
415 | static void | ||
416 | _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
417 | { | ||
418 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
419 | |||
420 | if (!ee) return; | ||
421 | ee->func.fn_mouse_in = func; | ||
422 | } | ||
423 | |||
424 | static void | ||
425 | _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
426 | { | ||
427 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
428 | |||
429 | if (!ee) return; | ||
430 | ee->func.fn_mouse_out = func; | ||
431 | } | ||
432 | |||
433 | static void | ||
434 | _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) | ||
435 | { | ||
436 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
437 | |||
438 | if (!ee) return; | ||
439 | ee->req.x = x; | ||
440 | ee->req.y = y; | ||
441 | ee->x = x; | ||
442 | ee->y = y; | ||
443 | if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y); | ||
444 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
445 | } | ||
446 | |||
447 | static void | ||
448 | _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) | ||
449 | { | ||
450 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
451 | |||
452 | if (!ee) return; | ||
453 | if (w < 1) w = 1; | ||
454 | if (h < 1) h = 1; | ||
455 | // if ((ee->w == w) && (ee->h == h)) return; | ||
456 | |||
457 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
458 | |||
459 | if (ee->prop.min.w > w) w = ee->prop.min.w; | ||
460 | else if (w > ee->prop.max.w) w = ee->prop.max.w; | ||
461 | if (ee->prop.min.h > h) h = ee->prop.min.h; | ||
462 | else if (h > ee->prop.max.h) h = ee->prop.max.h; | ||
463 | |||
464 | ee->req.w = w; | ||
465 | ee->req.h = h; | ||
466 | |||
467 | // ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); | ||
468 | |||
469 | einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); | ||
470 | if ((einfo) && (einfo->info.dest)) | ||
471 | { | ||
472 | int ret = 0; | ||
473 | |||
474 | ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); | ||
475 | if (!ret) ERR("Failed to unmap engine destination: %m"); | ||
476 | } | ||
477 | else if (!einfo) | ||
478 | { | ||
479 | ERR("Failed to get Evas Engine Info for '%s'", ee->driver); | ||
480 | return; | ||
481 | } | ||
482 | |||
483 | if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); | ||
484 | ee->engine.wl.buffer = NULL; | ||
485 | |||
486 | ee->w = w; | ||
487 | ee->h = h; | ||
488 | |||
489 | _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); | ||
490 | ecore_wl_flush(); | ||
491 | |||
492 | /* change evas output & viewport sizes */ | ||
493 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
494 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
495 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
496 | if (ee->engine.wl.frame) | ||
497 | evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); | ||
498 | |||
499 | /* set new engine destination */ | ||
500 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
501 | |||
502 | /* damage buffer */ | ||
503 | // wl_buffer_damage(ee->engine.wl.buffer, 0, 0, ee->w, ee->h); | ||
504 | |||
505 | ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); | ||
506 | /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */ | ||
507 | /* ecore_wl_flush(); */ | ||
508 | |||
509 | ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h); | ||
510 | |||
511 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
512 | } | ||
513 | |||
514 | static void | ||
515 | _ecore_evas_wl_show(Ecore_Evas *ee) | ||
516 | { | ||
517 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
518 | |||
519 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
520 | |||
521 | if ((!ee) || (ee->visible)) return; | ||
522 | |||
523 | if (ee->engine.wl.win) | ||
524 | ecore_wl_window_show(ee->engine.wl.win); | ||
525 | |||
526 | einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); | ||
527 | if (!einfo) | ||
528 | { | ||
529 | ERR("Failed to get Evas Engine Info for '%s'", ee->driver); | ||
530 | return; | ||
531 | } | ||
532 | |||
533 | _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); | ||
534 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
535 | |||
536 | if (ee->engine.wl.frame) | ||
537 | { | ||
538 | evas_object_show(ee->engine.wl.frame); | ||
539 | evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); | ||
540 | } | ||
541 | |||
542 | ecore_wl_flush(); | ||
543 | |||
544 | if (ee->engine.wl.win) | ||
545 | ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); | ||
546 | |||
547 | ee->visible = 1; | ||
548 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
549 | } | ||
550 | |||
551 | static void | ||
552 | _ecore_evas_wl_hide(Ecore_Evas *ee) | ||
553 | { | ||
554 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
555 | |||
556 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
557 | |||
558 | if ((!ee) || (!ee->visible)) return; | ||
559 | |||
560 | einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); | ||
561 | if ((einfo) && (einfo->info.dest)) | ||
562 | { | ||
563 | int ret = 0; | ||
564 | |||
565 | ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); | ||
566 | if (!ret) ERR("Failed to unmap engine destination: %m"); | ||
567 | } | ||
568 | |||
569 | if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); | ||
570 | ee->engine.wl.buffer = NULL; | ||
571 | |||
572 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
573 | |||
574 | ecore_wl_window_hide(ee->engine.wl.win); | ||
575 | |||
576 | ee->visible = 0; | ||
577 | ee->should_be_visible = 0; | ||
578 | |||
579 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
580 | } | ||
581 | |||
582 | static void | ||
583 | _ecore_evas_wl_raise(Ecore_Evas *ee) | ||
584 | { | ||
585 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
586 | |||
587 | if ((!ee) || (!ee->visible)) return; | ||
588 | ecore_wl_window_raise(ee->engine.wl.win); | ||
589 | } | ||
590 | |||
591 | static void | ||
592 | _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title) | ||
593 | { | ||
594 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
595 | |||
596 | if (!ee) return; | ||
597 | if (ee->prop.title) free(ee->prop.title); | ||
598 | ee->prop.title = NULL; | ||
599 | if (title) ee->prop.title = strdup(title); | ||
600 | if ((ee->prop.draw_frame) && (ee->engine.wl.frame)) | ||
601 | { | ||
602 | EE_Wl_Smart_Data *sd; | ||
603 | |||
604 | if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return; | ||
605 | evas_object_text_text_set(sd->text, ee->prop.title); | ||
606 | } | ||
607 | } | ||
608 | |||
609 | static void | ||
610 | _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
611 | { | ||
612 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
613 | |||
614 | if (!ee) return; | ||
615 | if (ee->prop.name) free(ee->prop.name); | ||
616 | if (ee->prop.clas) free(ee->prop.clas); | ||
617 | ee->prop.name = NULL; | ||
618 | ee->prop.clas = NULL; | ||
619 | if (n) ee->prop.name = strdup(n); | ||
620 | if (c) ee->prop.clas = strdup(c); | ||
621 | /* FIXME: Forward these changes to Wayland somehow */ | ||
622 | } | ||
623 | |||
624 | static void | ||
625 | _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h) | ||
626 | { | ||
627 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
628 | |||
629 | if (!ee) return; | ||
630 | if (w < 0) w = 0; | ||
631 | if (h < 0) h = 0; | ||
632 | if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; | ||
633 | ee->prop.min.w = w; | ||
634 | ee->prop.min.h = h; | ||
635 | } | ||
636 | |||
637 | static void | ||
638 | _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h) | ||
639 | { | ||
640 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
641 | |||
642 | if (!ee) return; | ||
643 | if (w < 0) w = 0; | ||
644 | if (h < 0) h = 0; | ||
645 | if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; | ||
646 | ee->prop.max.w = w; | ||
647 | ee->prop.max.h = h; | ||
648 | } | ||
649 | |||
650 | static void | ||
651 | _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h) | ||
652 | { | ||
653 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
654 | |||
655 | if (!ee) return; | ||
656 | if (w < 0) w = 0; | ||
657 | if (h < 0) h = 0; | ||
658 | if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; | ||
659 | ee->prop.base.w = w; | ||
660 | ee->prop.base.h = h; | ||
661 | } | ||
662 | |||
663 | static void | ||
664 | _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h) | ||
665 | { | ||
666 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
667 | |||
668 | if (!ee) return; | ||
669 | if (w < 0) w = 0; | ||
670 | if (h < 0) h = 0; | ||
671 | if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; | ||
672 | ee->prop.step.w = w; | ||
673 | ee->prop.step.h = h; | ||
674 | } | ||
675 | |||
676 | static void | ||
677 | _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) | ||
678 | { | ||
679 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
680 | |||
681 | if (!ee) return; | ||
682 | if (ee->prop.layer == layer) return; | ||
683 | if (layer < 1) layer = 1; | ||
684 | else if (layer > 255) layer = 255; | ||
685 | ee->prop.layer = layer; | ||
686 | } | ||
687 | |||
688 | static void | ||
689 | _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) | ||
690 | { | ||
691 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
692 | |||
693 | if (!ee) return; | ||
694 | if (ee->prop.iconified == iconify) return; | ||
695 | ee->prop.iconified = iconify; | ||
696 | /* FIXME: Implement this in Wayland someshow */ | ||
697 | } | ||
698 | |||
699 | static void | ||
700 | _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) | ||
701 | { | ||
702 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
703 | |||
704 | if (!ee) return; | ||
705 | if (ee->prop.maximized == max) return; | ||
706 | ee->prop.maximized = max; | ||
707 | ecore_wl_window_maximized_set(ee->engine.wl.win, max); | ||
708 | } | ||
709 | |||
710 | static void | ||
711 | _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full) | ||
712 | { | ||
713 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
714 | |||
715 | if ((!ee) || (!ee->visible)) return; | ||
716 | if (ee->prop.fullscreen == full) return; | ||
717 | ee->prop.fullscreen = full; | ||
718 | ecore_wl_window_fullscreen_set(ee->engine.wl.win, full); | ||
719 | } | ||
720 | |||
721 | static void | ||
722 | _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore) | ||
723 | { | ||
724 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
725 | |||
726 | if (!ee) return; | ||
727 | ee->ignore_events = ignore; | ||
728 | /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */ | ||
729 | } | ||
730 | |||
731 | static void | ||
732 | _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha) | ||
733 | { | ||
734 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
735 | |||
736 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
737 | |||
738 | if (!ee) return; | ||
739 | if ((ee->alpha == alpha)) return; | ||
740 | ee->alpha = alpha; | ||
741 | if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) | ||
742 | { | ||
743 | einfo->info.destination_alpha = alpha; | ||
744 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
745 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
746 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
747 | } | ||
748 | } | ||
749 | |||
750 | static void | ||
751 | _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent) | ||
752 | { | ||
753 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
754 | |||
755 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
756 | |||
757 | if (!ee) return; | ||
758 | if ((ee->transparent == transparent)) return; | ||
759 | ee->transparent = transparent; | ||
760 | if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) | ||
761 | { | ||
762 | einfo->info.destination_alpha = transparent; | ||
763 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
764 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
765 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
766 | } | ||
767 | } | ||
768 | |||
769 | static int | ||
770 | _ecore_evas_wl_render(Ecore_Evas *ee) | ||
771 | { | ||
772 | int rend = 0; | ||
773 | |||
774 | if (!ee) return 0; | ||
775 | if (!ee->visible) | ||
776 | evas_norender(ee->evas); | ||
777 | else | ||
778 | { | ||
779 | Eina_List *ll = NULL, *updates = NULL; | ||
780 | Ecore_Evas *ee2 = NULL; | ||
781 | |||
782 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
783 | |||
784 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
785 | { | ||
786 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
787 | if (ee2->engine.func->fn_render) | ||
788 | rend |= ee2->engine.func->fn_render(ee2); | ||
789 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
790 | } | ||
791 | |||
792 | if ((updates = evas_render_updates(ee->evas))) | ||
793 | { | ||
794 | Eina_List *l = NULL; | ||
795 | Eina_Rectangle *r; | ||
796 | |||
797 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
798 | |||
799 | EINA_LIST_FOREACH(updates, l, r) | ||
800 | { | ||
801 | if (ee->engine.wl.buffer) | ||
802 | wl_buffer_damage(ee->engine.wl.buffer, | ||
803 | r->x, r->y, r->w, r->h); | ||
804 | |||
805 | ecore_wl_window_damage(ee->engine.wl.win, | ||
806 | r->x, r->y, r->w, r->h); | ||
807 | } | ||
808 | |||
809 | ecore_wl_flush(); | ||
810 | |||
811 | evas_render_updates_free(updates); | ||
812 | _ecore_evas_idle_timeout_update(ee); | ||
813 | rend = 1; | ||
814 | } | ||
815 | |||
816 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
817 | } | ||
818 | return rend; | ||
819 | } | ||
820 | |||
821 | static void | ||
822 | _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
823 | { | ||
824 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
825 | |||
826 | if (x) *x = 0; | ||
827 | if (y) *y = 0; | ||
828 | ecore_wl_screen_size_get(w, h); | ||
829 | } | ||
830 | |||
831 | static void | ||
832 | _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest) | ||
833 | { | ||
834 | struct wl_shm *shm; | ||
835 | static unsigned int format; | ||
836 | char tmp[PATH_MAX]; | ||
837 | int fd = -1, stride = 0, size = 0; | ||
838 | void *ret; | ||
839 | |||
840 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
841 | |||
842 | if (dest) *dest = NULL; | ||
843 | if (!(shm = ecore_wl_shm_get())) return; | ||
844 | if (!format) format = WL_SHM_FORMAT_ARGB8888; //ecore_wl_format_get(); | ||
845 | |||
846 | strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX"); | ||
847 | if ((fd = mkstemp(tmp)) < 0) | ||
848 | { | ||
849 | ERR("Could not create temporary file."); | ||
850 | return; | ||
851 | } | ||
852 | |||
853 | stride = (ee->w * sizeof(int)); | ||
854 | size = (stride * ee->h); | ||
855 | if (ftruncate(fd, size) < 0) | ||
856 | { | ||
857 | ERR("Could not truncate temporary file."); | ||
858 | close(fd); | ||
859 | return; | ||
860 | } | ||
861 | |||
862 | ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0); | ||
863 | unlink(tmp); | ||
864 | |||
865 | if (ret == MAP_FAILED) | ||
866 | { | ||
867 | ERR("mmap of temporary file failed."); | ||
868 | close(fd); | ||
869 | return; | ||
870 | } | ||
871 | |||
872 | if (dest) *dest = ret; | ||
873 | |||
874 | ee->engine.wl.buffer = | ||
875 | wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format); | ||
876 | |||
877 | close(fd); | ||
878 | } | ||
879 | |||
880 | void | ||
881 | _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location) | ||
882 | { | ||
883 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
884 | |||
885 | if (!ee) return; | ||
886 | if (ee->engine.wl.win) | ||
887 | ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location); | ||
888 | } | ||
889 | |||
890 | static Eina_Bool | ||
891 | _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
892 | { | ||
893 | Ecore_Evas *ee; | ||
894 | Ecore_Wl_Event_Mouse_In *ev; | ||
895 | |||
896 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
897 | |||
898 | ev = event; | ||
899 | ee = ecore_event_window_match(ev->win); | ||
900 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
901 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
902 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
903 | ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); | ||
904 | evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); | ||
905 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); | ||
906 | return ECORE_CALLBACK_PASS_ON; | ||
907 | } | ||
908 | |||
909 | static Eina_Bool | ||
910 | _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
911 | { | ||
912 | Ecore_Evas *ee; | ||
913 | Ecore_Wl_Event_Mouse_Out *ev; | ||
914 | |||
915 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
916 | |||
917 | ev = event; | ||
918 | ee = ecore_event_window_match(ev->win); | ||
919 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
920 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
921 | ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); | ||
922 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); | ||
923 | evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); | ||
924 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
925 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
926 | return ECORE_CALLBACK_PASS_ON; | ||
927 | } | ||
928 | |||
929 | static Eina_Bool | ||
930 | _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
931 | { | ||
932 | Ecore_Evas *ee; | ||
933 | Ecore_Wl_Event_Focus_In *ev; | ||
934 | |||
935 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
936 | |||
937 | ev = event; | ||
938 | ee = ecore_event_window_match(ev->win); | ||
939 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
940 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
941 | ee->prop.focused = 1; | ||
942 | evas_focus_in(ee->evas); | ||
943 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
944 | return ECORE_CALLBACK_PASS_ON; | ||
945 | } | ||
946 | |||
947 | static Eina_Bool | ||
948 | _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
949 | { | ||
950 | Ecore_Evas *ee; | ||
951 | Ecore_Wl_Event_Focus_In *ev; | ||
952 | |||
953 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
954 | |||
955 | ev = event; | ||
956 | ee = ecore_event_window_match(ev->win); | ||
957 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
958 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
959 | evas_focus_out(ee->evas); | ||
960 | ee->prop.focused = 0; | ||
961 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
962 | return ECORE_CALLBACK_PASS_ON; | ||
963 | } | ||
964 | |||
965 | static Eina_Bool | ||
966 | _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
967 | { | ||
968 | Ecore_Evas *ee; | ||
969 | Ecore_Wl_Event_Window_Configure *ev; | ||
970 | |||
971 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
972 | |||
973 | ev = event; | ||
974 | ee = ecore_event_window_match(ev->win); | ||
975 | if (!ee) return ECORE_CALLBACK_PASS_ON; | ||
976 | if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
977 | if ((ee->x != ev->x) || (ee->y != ev->y)) | ||
978 | { | ||
979 | ee->x = ev->x; | ||
980 | ee->y = ev->y; | ||
981 | ee->req.x = ee->x; | ||
982 | ee->req.y = ee->y; | ||
983 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
984 | } | ||
985 | if ((ee->req.w != ev->w) || (ee->req.h != ev->h)) | ||
986 | { | ||
987 | /* ee->w = ev->w; */ | ||
988 | /* ee->h = ev->h; */ | ||
989 | ee->req.w = ev->w; | ||
990 | ee->req.h = ev->h; | ||
991 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
992 | } | ||
993 | |||
994 | return ECORE_CALLBACK_PASS_ON; | ||
995 | } | ||
996 | |||
997 | static void | ||
998 | _ecore_evas_wl_smart_init(void) | ||
999 | { | ||
1000 | if (_ecore_evas_wl_smart) return; | ||
1001 | { | ||
1002 | static const Evas_Smart_Class sc = | ||
1003 | { | ||
1004 | "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION, | ||
1005 | _ecore_evas_wl_smart_add, | ||
1006 | _ecore_evas_wl_smart_del, | ||
1007 | NULL, | ||
1008 | _ecore_evas_wl_smart_resize, | ||
1009 | _ecore_evas_wl_smart_show, | ||
1010 | _ecore_evas_wl_smart_hide, | ||
1011 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL | ||
1012 | }; | ||
1013 | _ecore_evas_wl_smart = evas_smart_class_new(&sc); | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | static void | ||
1018 | _ecore_evas_wl_smart_add(Evas_Object *obj) | ||
1019 | { | ||
1020 | EE_Wl_Smart_Data *sd; | ||
1021 | Evas *evas; | ||
1022 | |||
1023 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1024 | |||
1025 | if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return; | ||
1026 | |||
1027 | evas = evas_object_evas_get(obj); | ||
1028 | |||
1029 | sd->x = 0; | ||
1030 | sd->y = 0; | ||
1031 | sd->w = 1; | ||
1032 | sd->h = 1; | ||
1033 | |||
1034 | sd->frame = evas_object_rectangle_add(evas); | ||
1035 | evas_object_is_frame_object_set(sd->frame, EINA_TRUE); | ||
1036 | evas_object_color_set(sd->frame, 249, 249, 249, 255); | ||
1037 | evas_object_smart_member_add(sd->frame, obj); | ||
1038 | |||
1039 | sd->text = evas_object_text_add(evas); | ||
1040 | evas_object_color_set(sd->text, 0, 0, 0, 255); | ||
1041 | evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN); | ||
1042 | evas_object_text_font_set(sd->text, "Sans", 10); | ||
1043 | evas_object_text_text_set(sd->text, "Smart Test"); | ||
1044 | |||
1045 | evas_object_smart_data_set(obj, sd); | ||
1046 | } | ||
1047 | |||
1048 | static void | ||
1049 | _ecore_evas_wl_smart_del(Evas_Object *obj) | ||
1050 | { | ||
1051 | EE_Wl_Smart_Data *sd; | ||
1052 | |||
1053 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1054 | |||
1055 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1056 | evas_object_del(sd->text); | ||
1057 | evas_object_del(sd->frame); | ||
1058 | free(sd); | ||
1059 | } | ||
1060 | |||
1061 | static void | ||
1062 | _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | ||
1063 | { | ||
1064 | EE_Wl_Smart_Data *sd; | ||
1065 | |||
1066 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1067 | |||
1068 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1069 | if ((sd->w == w) && (sd->h == h)) return; | ||
1070 | sd->w = w; | ||
1071 | sd->h = h; | ||
1072 | evas_object_resize(sd->frame, w, h); | ||
1073 | } | ||
1074 | |||
1075 | static void | ||
1076 | _ecore_evas_wl_smart_show(Evas_Object *obj) | ||
1077 | { | ||
1078 | EE_Wl_Smart_Data *sd; | ||
1079 | |||
1080 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1081 | |||
1082 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1083 | evas_object_show(sd->frame); | ||
1084 | evas_object_show(sd->text); | ||
1085 | } | ||
1086 | |||
1087 | static void | ||
1088 | _ecore_evas_wl_smart_hide(Evas_Object *obj) | ||
1089 | { | ||
1090 | EE_Wl_Smart_Data *sd; | ||
1091 | |||
1092 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1093 | |||
1094 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1095 | evas_object_hide(sd->text); | ||
1096 | evas_object_hide(sd->frame); | ||
1097 | } | ||
1098 | |||
1099 | static Evas_Object * | ||
1100 | _ecore_evas_wl_frame_add(Evas *evas) | ||
1101 | { | ||
1102 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1103 | |||
1104 | _ecore_evas_wl_smart_init(); | ||
1105 | return evas_object_smart_add(evas, _ecore_evas_wl_smart); | ||
1106 | } | ||
1107 | |||
1108 | #else | ||
1109 | EAPI Ecore_Evas * | ||
1110 | ecore_evas_wayland_shm_new(const char *disp_name __UNUSED__, unsigned int parent __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, Eina_Bool frame __UNUSED__) | ||
1111 | { | ||
1112 | return NULL; | ||
1113 | } | ||
1114 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c deleted file mode 100644 index 32132b3..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c +++ /dev/null | |||
@@ -1,1452 +0,0 @@ | |||
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->timestamp, NULL); | ||
151 | evas_focus_in(ee->evas); | ||
152 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp); | ||
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->timestamp); | ||
173 | |||
174 | evas_event_feed_mouse_out(ee->evas, e->timestamp, 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 | Ecore_Evas_Event_Cb func) | ||
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((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((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_fullscreen_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
883 | on); | ||
884 | } | ||
885 | else | ||
886 | { | ||
887 | ecore_win32_window_fullscreen_set(window, on); | ||
888 | } | ||
889 | |||
890 | /* Nothing to be done for the GDI backend at the evas level */ | ||
891 | |||
892 | #ifdef BUILD_ECORE_EVAS_SOFTWRE_DDRAW | ||
893 | if (strcmp(ee->driver, "software_ddraw") == 0) | ||
894 | { | ||
895 | Evas_Engine_Info_Software_DDraw *einfo; | ||
896 | |||
897 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee)); | ||
898 | if (einfo) | ||
899 | { | ||
900 | einfo->info.fullscreen = !!on; | ||
901 | /* einfo->info.layered = window->shape.layered; */ | ||
902 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
903 | { | ||
904 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
905 | } | ||
906 | } | ||
907 | } | ||
908 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
909 | |||
910 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
911 | if (strcmp(ee->driver, "direct3d") == 0) | ||
912 | { | ||
913 | Evas_Engine_Info_Direct3D *einfo; | ||
914 | |||
915 | einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ecore_evas_get(ee)); | ||
916 | if (einfo) | ||
917 | { | ||
918 | einfo->info.fullscreen = !!on; | ||
919 | einfo->info.layered = window->shape.layered; | ||
920 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
921 | { | ||
922 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
923 | } | ||
924 | } | ||
925 | } | ||
926 | #endif /* BUILD_ECORE_EVAS_DIRECT3D */ | ||
927 | } | ||
928 | |||
929 | |||
930 | static Ecore_Evas_Engine_Func _ecore_win32_engine_func = | ||
931 | { | ||
932 | _ecore_evas_win32_free, | ||
933 | NULL, | ||
934 | NULL, | ||
935 | NULL, | ||
936 | NULL, | ||
937 | _ecore_evas_win32_callback_delete_request_set, | ||
938 | NULL, | ||
939 | NULL, | ||
940 | NULL, | ||
941 | NULL, | ||
942 | NULL, | ||
943 | NULL, | ||
944 | NULL, | ||
945 | NULL, | ||
946 | NULL, | ||
947 | _ecore_evas_win32_move, | ||
948 | NULL, | ||
949 | _ecore_evas_win32_resize, | ||
950 | _ecore_evas_win32_move_resize, | ||
951 | _ecore_evas_win32_rotation_set, | ||
952 | _ecore_evas_win32_shaped_set, | ||
953 | _ecore_evas_win32_show, | ||
954 | _ecore_evas_win32_hide, | ||
955 | _ecore_evas_win32_raise, | ||
956 | _ecore_evas_win32_lower, | ||
957 | _ecore_evas_win32_activate, | ||
958 | _ecore_evas_win32_title_set, | ||
959 | NULL, /* _ecore_evas_x_name_class_set */ | ||
960 | _ecore_evas_win32_size_min_set, | ||
961 | _ecore_evas_win32_size_max_set, | ||
962 | _ecore_evas_win32_size_base_set, | ||
963 | _ecore_evas_win32_size_step_set, | ||
964 | _ecore_evas_win32_cursor_set, | ||
965 | NULL, /* _ecore_evas_x_layer_set */ | ||
966 | _ecore_evas_win32_focus_set, | ||
967 | _ecore_evas_win32_iconified_set, | ||
968 | _ecore_evas_win32_borderless_set, | ||
969 | NULL, /* _ecore_evas_x_override_set */ | ||
970 | NULL, | ||
971 | _ecore_evas_win32_fullscreen_set, | ||
972 | NULL, /* _ecore_evas_x_avoid_damage_set */ | ||
973 | NULL, /* _ecore_evas_x_withdrawn_set */ | ||
974 | NULL, /* _ecore_evas_x_sticky_set */ | ||
975 | NULL, /* _ecore_evas_x_ignore_events_set */ | ||
976 | NULL, /* _ecore_evas_x_alpha_set */ | ||
977 | NULL, //transparent | ||
978 | |||
979 | NULL, | ||
980 | NULL, | ||
981 | NULL, | ||
982 | NULL, | ||
983 | NULL, | ||
984 | NULL, | ||
985 | |||
986 | NULL, // render | ||
987 | NULL //screen_geometry_get | ||
988 | }; | ||
989 | |||
990 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
991 | |||
992 | /* API */ | ||
993 | |||
994 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
995 | static int | ||
996 | _ecore_evas_engine_software_gdi_init(Ecore_Evas *ee) | ||
997 | { | ||
998 | Evas_Engine_Info_Software_Gdi *einfo; | ||
999 | const char *driver; | ||
1000 | int rmethod; | ||
1001 | |||
1002 | driver = "software_gdi"; | ||
1003 | |||
1004 | rmethod = evas_render_method_lookup(driver); | ||
1005 | if (!rmethod) | ||
1006 | return 0; | ||
1007 | |||
1008 | ee->driver = driver; | ||
1009 | evas_output_method_set(ee->evas, rmethod); | ||
1010 | |||
1011 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
1012 | if (einfo) | ||
1013 | { | ||
1014 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1015 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1016 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1017 | einfo->info.rotation = 0; | ||
1018 | einfo->info.borderless = 0; | ||
1019 | einfo->info.fullscreen = 0; | ||
1020 | einfo->info.region = 0; | ||
1021 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1022 | { | ||
1023 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1024 | return 0; | ||
1025 | } | ||
1026 | } | ||
1027 | else | ||
1028 | { | ||
1029 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1030 | return 0; | ||
1031 | } | ||
1032 | |||
1033 | return 1; | ||
1034 | } | ||
1035 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
1036 | |||
1037 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
1038 | static int | ||
1039 | _ecore_evas_engine_software_ddraw_init(Ecore_Evas *ee) | ||
1040 | { | ||
1041 | Evas_Engine_Info_Software_DDraw *einfo; | ||
1042 | const char *driver; | ||
1043 | int rmethod; | ||
1044 | |||
1045 | driver = "software_ddraw"; | ||
1046 | |||
1047 | rmethod = evas_render_method_lookup(driver); | ||
1048 | if (!rmethod) | ||
1049 | return 0; | ||
1050 | |||
1051 | ee->driver = driver; | ||
1052 | evas_output_method_set(ee->evas, rmethod); | ||
1053 | |||
1054 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas); | ||
1055 | if (einfo) | ||
1056 | { | ||
1057 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1058 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1059 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1060 | einfo->info.rotation = 0; | ||
1061 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1062 | { | ||
1063 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1064 | return 0; | ||
1065 | } | ||
1066 | } | ||
1067 | else | ||
1068 | { | ||
1069 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1070 | return 0; | ||
1071 | } | ||
1072 | |||
1073 | return 1; | ||
1074 | } | ||
1075 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
1076 | |||
1077 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
1078 | static int | ||
1079 | _ecore_evas_engine_direct3d_init(Ecore_Evas *ee) | ||
1080 | { | ||
1081 | Evas_Engine_Info_Direct3D *einfo; | ||
1082 | const char *driver; | ||
1083 | int rmethod; | ||
1084 | |||
1085 | driver = "direct3d"; | ||
1086 | |||
1087 | rmethod = evas_render_method_lookup(driver); | ||
1088 | if (!rmethod) | ||
1089 | return 0; | ||
1090 | |||
1091 | ee->driver = driver; | ||
1092 | evas_output_method_set(ee->evas, rmethod); | ||
1093 | |||
1094 | einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ee->evas); | ||
1095 | if (einfo) | ||
1096 | { | ||
1097 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1098 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1099 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1100 | einfo->info.rotation = 0; | ||
1101 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1102 | { | ||
1103 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1104 | return 0; | ||
1105 | } | ||
1106 | } | ||
1107 | else | ||
1108 | { | ||
1109 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1110 | return 0; | ||
1111 | } | ||
1112 | |||
1113 | return 1; | ||
1114 | } | ||
1115 | #endif /* BUILD_ECORE_EVAS_DIRECT3D */ | ||
1116 | |||
1117 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
1118 | static int | ||
1119 | _ecore_evas_engine_opengl_glew_init(Ecore_Evas *ee) | ||
1120 | { | ||
1121 | Evas_Engine_Info_GL_Glew *einfo; | ||
1122 | const char *driver; | ||
1123 | int rmethod; | ||
1124 | |||
1125 | driver = "gl_glew"; | ||
1126 | |||
1127 | rmethod = evas_render_method_lookup(driver); | ||
1128 | if (!rmethod) | ||
1129 | return 0; | ||
1130 | |||
1131 | ee->driver = driver; | ||
1132 | evas_output_method_set(ee->evas, rmethod); | ||
1133 | |||
1134 | einfo = (Evas_Engine_Info_GL_Glew *)evas_engine_info_get(ee->evas); | ||
1135 | if (einfo) | ||
1136 | { | ||
1137 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1138 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1139 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1140 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1141 | { | ||
1142 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1143 | return 0; | ||
1144 | } | ||
1145 | } | ||
1146 | else | ||
1147 | { | ||
1148 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1149 | return 0; | ||
1150 | } | ||
1151 | |||
1152 | return 1; | ||
1153 | } | ||
1154 | #endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ | ||
1155 | |||
1156 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
1157 | static int | ||
1158 | _ecore_evas_engine_software_16_ddraw_init(Ecore_Evas *ee) | ||
1159 | { | ||
1160 | Evas_Engine_Info_Software_DDraw *einfo; | ||
1161 | const char *driver; | ||
1162 | int rmethod; | ||
1163 | |||
1164 | driver = "software_16_ddraw"; | ||
1165 | |||
1166 | rmethod = evas_render_method_lookup(driver); | ||
1167 | if (!rmethod) | ||
1168 | return 0; | ||
1169 | |||
1170 | ee->driver = driver; | ||
1171 | evas_output_method_set(ee->evas, rmethod); | ||
1172 | |||
1173 | if (ecore_win32_screen_depth_get() != 16) | ||
1174 | return 0; | ||
1175 | |||
1176 | einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(ee->evas); | ||
1177 | if (einfo) | ||
1178 | { | ||
1179 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1180 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1181 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1182 | einfo->info.rotation = 0; | ||
1183 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1184 | { | ||
1185 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1186 | return 0; | ||
1187 | } | ||
1188 | } | ||
1189 | else | ||
1190 | { | ||
1191 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1192 | return 0; | ||
1193 | } | ||
1194 | |||
1195 | return 1; | ||
1196 | } | ||
1197 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ | ||
1198 | |||
1199 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
1200 | static Ecore_Evas * | ||
1201 | _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee), | ||
1202 | Ecore_Win32_Window *parent, | ||
1203 | int x, | ||
1204 | int y, | ||
1205 | int width, | ||
1206 | int height) | ||
1207 | { | ||
1208 | Ecore_Evas *ee; | ||
1209 | |||
1210 | if (!ecore_win32_init()) | ||
1211 | return NULL; | ||
1212 | |||
1213 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
1214 | if (!ee) | ||
1215 | return NULL; | ||
1216 | |||
1217 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
1218 | |||
1219 | _ecore_evas_win32_init(); | ||
1220 | |||
1221 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_win32_engine_func; | ||
1222 | |||
1223 | if (width < 1) width = 1; | ||
1224 | if (height < 1) height = 1; | ||
1225 | ee->x = x; | ||
1226 | ee->y = y; | ||
1227 | ee->w = width; | ||
1228 | ee->h = height; | ||
1229 | ee->req.x = ee->x; | ||
1230 | ee->req.y = ee->y; | ||
1231 | ee->req.w = ee->w; | ||
1232 | ee->req.h = ee->h; | ||
1233 | |||
1234 | ee->prop.max.w = 32767; | ||
1235 | ee->prop.max.h = 32767; | ||
1236 | ee->prop.layer = 4; | ||
1237 | ee->prop.request_pos = 0; | ||
1238 | ee->prop.sticky = 0; | ||
1239 | /* FIXME: sticky to add */ | ||
1240 | ee->prop.window = 0; | ||
1241 | |||
1242 | /* init evas here */ | ||
1243 | ee->evas = evas_new(); | ||
1244 | evas_data_attach_set(ee->evas, ee); | ||
1245 | evas_output_size_set(ee->evas, width, height); | ||
1246 | evas_output_viewport_set(ee->evas, 0, 0, width, height); | ||
1247 | |||
1248 | ee->engine.win32.parent = parent; | ||
1249 | ee->prop.window = (Ecore_Window)ecore_win32_window_new(parent, x, y, width, height); | ||
1250 | if (!ee->prop.window) | ||
1251 | { | ||
1252 | _ecore_evas_win32_shutdown(); | ||
1253 | free(ee); | ||
1254 | return NULL; | ||
1255 | } | ||
1256 | |||
1257 | if (!_ecore_evas_engine_init(ee)) | ||
1258 | { | ||
1259 | _ecore_evas_win32_shutdown(); | ||
1260 | free(ee); | ||
1261 | return NULL; | ||
1262 | } | ||
1263 | |||
1264 | ee->engine.func->fn_render = _ecore_evas_win32_render; | ||
1265 | _ecore_evas_register(ee); | ||
1266 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
1267 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
1268 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
1269 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
1270 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
1271 | |||
1272 | return ee; | ||
1273 | } | ||
1274 | |||
1275 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
1276 | |||
1277 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
1278 | |||
1279 | EAPI Ecore_Evas * | ||
1280 | ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, | ||
1281 | int x, | ||
1282 | int y, | ||
1283 | int width, | ||
1284 | int height) | ||
1285 | { | ||
1286 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_gdi_init, | ||
1287 | parent, | ||
1288 | x, | ||
1289 | y, | ||
1290 | width, | ||
1291 | height); | ||
1292 | } | ||
1293 | |||
1294 | #else | ||
1295 | |||
1296 | EAPI Ecore_Evas * | ||
1297 | ecore_evas_software_gdi_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1298 | int x __UNUSED__, | ||
1299 | int y __UNUSED__, | ||
1300 | int width __UNUSED__, | ||
1301 | int height __UNUSED__) | ||
1302 | { | ||
1303 | return NULL; | ||
1304 | } | ||
1305 | |||
1306 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
1307 | |||
1308 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
1309 | |||
1310 | EAPI Ecore_Evas * | ||
1311 | ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, | ||
1312 | int x, | ||
1313 | int y, | ||
1314 | int width, | ||
1315 | int height) | ||
1316 | { | ||
1317 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_ddraw_init, | ||
1318 | parent, | ||
1319 | x, | ||
1320 | y, | ||
1321 | width, | ||
1322 | height); | ||
1323 | } | ||
1324 | |||
1325 | #else | ||
1326 | |||
1327 | EAPI Ecore_Evas * | ||
1328 | ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1329 | int x __UNUSED__, | ||
1330 | int y __UNUSED__, | ||
1331 | int width __UNUSED__, | ||
1332 | int height __UNUSED__) | ||
1333 | { | ||
1334 | return NULL; | ||
1335 | } | ||
1336 | |||
1337 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
1338 | |||
1339 | |||
1340 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
1341 | |||
1342 | EAPI Ecore_Evas * | ||
1343 | ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent, | ||
1344 | int x, | ||
1345 | int y, | ||
1346 | int width, | ||
1347 | int height) | ||
1348 | { | ||
1349 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_16_ddraw_init, | ||
1350 | parent, | ||
1351 | x, | ||
1352 | y, | ||
1353 | width, | ||
1354 | height); | ||
1355 | } | ||
1356 | |||
1357 | #else | ||
1358 | |||
1359 | EAPI Ecore_Evas * | ||
1360 | ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1361 | int x __UNUSED__, | ||
1362 | int y __UNUSED__, | ||
1363 | int width __UNUSED__, | ||
1364 | int height __UNUSED__) | ||
1365 | { | ||
1366 | return NULL; | ||
1367 | } | ||
1368 | |||
1369 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ | ||
1370 | |||
1371 | |||
1372 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
1373 | |||
1374 | EAPI Ecore_Evas * | ||
1375 | ecore_evas_direct3d_new(Ecore_Win32_Window *parent, | ||
1376 | int x, | ||
1377 | int y, | ||
1378 | int width, | ||
1379 | int height) | ||
1380 | { | ||
1381 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_direct3d_init, | ||
1382 | parent, | ||
1383 | x, | ||
1384 | y, | ||
1385 | width, | ||
1386 | height); | ||
1387 | } | ||
1388 | |||
1389 | #else | ||
1390 | |||
1391 | EAPI Ecore_Evas * | ||
1392 | ecore_evas_direct3d_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1393 | int x __UNUSED__, | ||
1394 | int y __UNUSED__, | ||
1395 | int width __UNUSED__, | ||
1396 | int height __UNUSED__) | ||
1397 | { | ||
1398 | return NULL; | ||
1399 | } | ||
1400 | |||
1401 | #endif /* ! BUILD_ECORE_EVAS_DIRECT3D */ | ||
1402 | |||
1403 | |||
1404 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
1405 | |||
1406 | EAPI Ecore_Evas * | ||
1407 | ecore_evas_gl_glew_new(Ecore_Win32_Window *parent, | ||
1408 | int x, | ||
1409 | int y, | ||
1410 | int width, | ||
1411 | int height) | ||
1412 | { | ||
1413 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_opengl_glew_init, | ||
1414 | parent, | ||
1415 | x, | ||
1416 | y, | ||
1417 | width, | ||
1418 | height); | ||
1419 | } | ||
1420 | |||
1421 | #else | ||
1422 | |||
1423 | EAPI Ecore_Evas * | ||
1424 | ecore_evas_gl_glew_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1425 | int x __UNUSED__, | ||
1426 | int y __UNUSED__, | ||
1427 | int width __UNUSED__, | ||
1428 | int height __UNUSED__) | ||
1429 | { | ||
1430 | return NULL; | ||
1431 | } | ||
1432 | |||
1433 | #endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ | ||
1434 | |||
1435 | |||
1436 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
1437 | |||
1438 | EAPI Ecore_Win32_Window * | ||
1439 | ecore_evas_win32_window_get(const Ecore_Evas *ee) | ||
1440 | { | ||
1441 | return (Ecore_Win32_Window *) ecore_evas_window_get(ee); | ||
1442 | } | ||
1443 | |||
1444 | #else | ||
1445 | |||
1446 | EAPI Ecore_Win32_Window * | ||
1447 | ecore_evas_win32_window_get(const Ecore_Evas *ee __UNUSED__) | ||
1448 | { | ||
1449 | return NULL; | ||
1450 | } | ||
1451 | |||
1452 | #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 deleted file mode 100644 index fecf26b..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c +++ /dev/null | |||
@@ -1,992 +0,0 @@ | |||
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 | Ecore_Evas_Event_Cb func) | ||
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(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 | _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, | ||
777 | NULL, | ||
778 | NULL, | ||
779 | NULL, | ||
780 | NULL, | ||
781 | NULL, | ||
782 | |||
783 | NULL, // render | ||
784 | NULL // screen_geometry_get | ||
785 | }; | ||
786 | |||
787 | /* API */ | ||
788 | |||
789 | static Ecore_Evas * | ||
790 | ecore_evas_software_wince_new_internal(int backend, | ||
791 | Ecore_WinCE_Window *parent, | ||
792 | int x, | ||
793 | int y, | ||
794 | int width, | ||
795 | int height, | ||
796 | int fullscreen) | ||
797 | { | ||
798 | Evas_Engine_Info_Software_16_WinCE *einfo; | ||
799 | Ecore_Evas *ee; | ||
800 | int rmethod; | ||
801 | |||
802 | rmethod = evas_render_method_lookup("software_16_wince"); | ||
803 | if (!rmethod) | ||
804 | return NULL; | ||
805 | |||
806 | if (!ecore_wince_init()) | ||
807 | return NULL; | ||
808 | |||
809 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
810 | if (!ee) | ||
811 | { | ||
812 | ecore_wince_shutdown(); | ||
813 | return NULL; | ||
814 | } | ||
815 | |||
816 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
817 | |||
818 | if (!_ecore_evas_wince_init()) | ||
819 | { | ||
820 | free(ee); | ||
821 | ecore_wince_shutdown(); | ||
822 | return NULL; | ||
823 | } | ||
824 | |||
825 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wince_engine_func; | ||
826 | |||
827 | ee->driver = "software_16_wince"; | ||
828 | |||
829 | if (width < 1) width = 1; | ||
830 | if (height < 1) height = 1; | ||
831 | ee->x = x; | ||
832 | ee->y = y; | ||
833 | ee->w = width; | ||
834 | ee->h = height; | ||
835 | ee->req.x = ee->x; | ||
836 | ee->req.y = ee->y; | ||
837 | ee->req.w = ee->w; | ||
838 | ee->req.h = ee->h; | ||
839 | |||
840 | ee->prop.max.w = 32767; | ||
841 | ee->prop.max.h = 32767; | ||
842 | ee->prop.layer = 4; | ||
843 | ee->prop.request_pos = 0; | ||
844 | ee->prop.sticky = 0; | ||
845 | /* FIXME: sticky to add */ | ||
846 | |||
847 | ee->prop.window = (Ecore_Window)ecore_wince_window_new((Ecore_WinCE_Window *)parent, x, y, width, height); | ||
848 | if (!ee->prop.window) | ||
849 | { | ||
850 | _ecore_evas_wince_shutdown(); | ||
851 | free(ee); | ||
852 | ecore_wince_shutdown(); | ||
853 | return NULL; | ||
854 | } | ||
855 | |||
856 | ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, fullscreen); | ||
857 | |||
858 | /* init evas here */ | ||
859 | ee->evas = evas_new(); | ||
860 | evas_data_attach_set(ee->evas, ee); | ||
861 | evas_output_method_set(ee->evas, rmethod); | ||
862 | evas_output_size_set(ee->evas, width, height); | ||
863 | evas_output_viewport_set(ee->evas, 0, 0, width, height); | ||
864 | |||
865 | einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas); | ||
866 | if (einfo) | ||
867 | { | ||
868 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
869 | einfo->info.window = ((struct _Ecore_WinCE_Window *)ee->prop.window)->window; | ||
870 | einfo->info.width = width; | ||
871 | einfo->info.height = height; | ||
872 | einfo->info.backend = backend; | ||
873 | einfo->info.rotation = 0; | ||
874 | einfo->info.fullscreen = fullscreen; | ||
875 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
876 | { | ||
877 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
878 | _ecore_evas_wince_shutdown(); | ||
879 | free(ee); | ||
880 | ecore_wince_shutdown(); | ||
881 | return NULL; | ||
882 | } | ||
883 | |||
884 | ecore_wince_window_backend_set((Ecore_WinCE_Window *)ee->prop.window, backend); | ||
885 | ecore_wince_window_suspend_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.suspend); | ||
886 | ecore_wince_window_resume_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.resume); | ||
887 | } | ||
888 | else | ||
889 | { | ||
890 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
891 | _ecore_evas_wince_shutdown(); | ||
892 | free(ee); | ||
893 | ecore_wince_shutdown(); | ||
894 | return NULL; | ||
895 | } | ||
896 | |||
897 | ee->engine.func->fn_render = _ecore_evas_wince_render; | ||
898 | _ecore_evas_register(ee); | ||
899 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
900 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
901 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
902 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
903 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
904 | evas_focus_in(ee->evas); | ||
905 | |||
906 | return ee; | ||
907 | } | ||
908 | |||
909 | #else | ||
910 | |||
911 | static Ecore_Evas * | ||
912 | ecore_evas_software_wince_new_internal(int backend __UNUSED__, | ||
913 | Ecore_WinCE_Window *parent __UNUSED__, | ||
914 | int x __UNUSED__, | ||
915 | int y __UNUSED__, | ||
916 | int width __UNUSED__, | ||
917 | int height __UNUSED__, | ||
918 | int fullscreen __UNUSED__) | ||
919 | { | ||
920 | return NULL; | ||
921 | } | ||
922 | |||
923 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */ | ||
924 | |||
925 | |||
926 | EAPI Ecore_Evas * | ||
927 | ecore_evas_software_wince_new(Ecore_WinCE_Window *parent, | ||
928 | int x, | ||
929 | int y, | ||
930 | int width, | ||
931 | int height) | ||
932 | { | ||
933 | return ecore_evas_software_wince_new_internal(0, parent, x, y, width, height, 1); | ||
934 | } | ||
935 | |||
936 | EAPI Ecore_Evas * | ||
937 | ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent, | ||
938 | int x, | ||
939 | int y, | ||
940 | int width, | ||
941 | int height) | ||
942 | { | ||
943 | return ecore_evas_software_wince_new_internal(1, parent, x, y, width, height, 1); | ||
944 | } | ||
945 | |||
946 | EAPI Ecore_Evas * | ||
947 | ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent, | ||
948 | int x, | ||
949 | int y, | ||
950 | int width, | ||
951 | int height) | ||
952 | { | ||
953 | return ecore_evas_software_wince_new_internal(2, parent, x, y, width, height, 1); | ||
954 | } | ||
955 | |||
956 | EAPI Ecore_Evas * | ||
957 | ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent, | ||
958 | int x, | ||
959 | int y, | ||
960 | int width, | ||
961 | int height) | ||
962 | { | ||
963 | return ecore_evas_software_wince_new_internal(3, parent, x, y, width, height, 1); | ||
964 | } | ||
965 | |||
966 | EAPI Ecore_Evas * | ||
967 | ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent, | ||
968 | int x, | ||
969 | int y, | ||
970 | int width, | ||
971 | int height) | ||
972 | { | ||
973 | return ecore_evas_software_wince_new_internal(4, parent, x, y, width, height, 0); | ||
974 | } | ||
975 | |||
976 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | ||
977 | |||
978 | EAPI Ecore_WinCE_Window * | ||
979 | ecore_evas_software_wince_window_get(const Ecore_Evas *ee) | ||
980 | { | ||
981 | return (Ecore_WinCE_Window *) ecore_evas_window_get(ee); | ||
982 | } | ||
983 | |||
984 | #else | ||
985 | |||
986 | EAPI Ecore_WinCE_Window * | ||
987 | ecore_evas_software_wince_window_get(const Ecore_Evas *ee __UNUSED__) | ||
988 | { | ||
989 | return NULL; | ||
990 | } | ||
991 | |||
992 | #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 deleted file mode 100644 index 6dd13de..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c +++ /dev/null | |||
@@ -1,4445 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | |||
8 | #include <Eina.h> | ||
9 | #include <Ecore.h> | ||
10 | |||
11 | #include "ecore_evas_private.h" | ||
12 | #include "Ecore_Evas.h" | ||
13 | |||
14 | #ifdef BUILD_ECORE_EVAS_X11 | ||
15 | static int _ecore_evas_init_count = 0; | ||
16 | |||
17 | static Ecore_Event_Handler *ecore_evas_event_handlers[13]; | ||
18 | |||
19 | static int leader_ref = 0; | ||
20 | static Ecore_X_Window leader_win = 0; | ||
21 | |||
22 | static void | ||
23 | _ecore_evas_x_hints_update(Ecore_Evas *ee) | ||
24 | { | ||
25 | ecore_x_icccm_hints_set | ||
26 | (ee->prop.window, | ||
27 | !ee->prop.focus_skip /* accepts_focus */, | ||
28 | ee->prop.iconified ? ECORE_X_WINDOW_STATE_HINT_ICONIC : | ||
29 | ee->prop.withdrawn ? ECORE_X_WINDOW_STATE_HINT_WITHDRAWN : | ||
30 | ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, | ||
31 | 0 /* icon_pixmap */, | ||
32 | 0 /* icon_mask */, | ||
33 | 0 /* icon_window */, | ||
34 | ee->prop.group_ee_win /* window_group */, | ||
35 | ee->prop.urgent /* is_urgent */); | ||
36 | } | ||
37 | |||
38 | static void | ||
39 | _ecore_evas_x_group_leader_set(Ecore_Evas *ee) | ||
40 | { | ||
41 | leader_ref++; | ||
42 | if (leader_ref == 1) | ||
43 | { | ||
44 | char *id = NULL; | ||
45 | |||
46 | leader_win = | ||
47 | ecore_x_window_override_new(ee->engine.x.win_root, 1234, 5678, 1, 2); | ||
48 | ecore_x_window_defaults_set(leader_win); | ||
49 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
50 | ecore_x_netwm_startup_id_set(leader_win,id); | ||
51 | ecore_x_icccm_client_leader_set(leader_win, leader_win); | ||
52 | } | ||
53 | ee->engine.x.leader = leader_win; | ||
54 | ecore_x_icccm_client_leader_set(ee->prop.window, leader_win); | ||
55 | } | ||
56 | |||
57 | static void | ||
58 | _ecore_evas_x_group_leader_unset(Ecore_Evas *ee) | ||
59 | { | ||
60 | ecore_x_window_prop_property_del(ee->prop.window, | ||
61 | ECORE_X_ATOM_WM_CLIENT_LEADER); | ||
62 | if (ee->engine.x.leader == leader_win) | ||
63 | { | ||
64 | leader_ref--; | ||
65 | if (leader_ref <= 0) | ||
66 | { | ||
67 | ecore_x_window_free(leader_win); | ||
68 | leader_win = 0; | ||
69 | } | ||
70 | ee->engine.x.leader = 0; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | static void | ||
75 | _ecore_evas_x_group_leader_update(Ecore_Evas *ee) | ||
76 | { | ||
77 | if (ee->engine.x.leader) | ||
78 | ecore_x_icccm_client_leader_set(ee->prop.window, ee->engine.x.leader); | ||
79 | } | ||
80 | |||
81 | static void | ||
82 | _ecore_evas_x_protocols_set(Ecore_Evas *ee) | ||
83 | { | ||
84 | Ecore_X_Atom protos[3]; | ||
85 | unsigned int num = 0, tmp = 0; | ||
86 | |||
87 | if (ee->func.fn_delete_request) | ||
88 | protos[num++] = ECORE_X_ATOM_WM_DELETE_WINDOW; | ||
89 | protos[num++] = ECORE_X_ATOM_NET_WM_PING; | ||
90 | protos[num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; | ||
91 | ecore_x_icccm_protocol_atoms_set(ee->prop.window, protos, num); | ||
92 | |||
93 | if (!ee->engine.x.netwm_sync_counter) | ||
94 | ee->engine.x.netwm_sync_counter = ecore_x_sync_counter_new(0); | ||
95 | |||
96 | tmp = ee->engine.x.netwm_sync_counter; | ||
97 | ecore_x_window_prop_card32_set(ee->prop.window, | ||
98 | ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, | ||
99 | &tmp, 1); | ||
100 | } | ||
101 | |||
102 | static void | ||
103 | _ecore_evas_x_sync_set(Ecore_Evas *ee) | ||
104 | { | ||
105 | if (((ee->should_be_visible) || (ee->visible)) && | ||
106 | ((ecore_x_e_comp_sync_supported_get(ee->engine.x.win_root)) && | ||
107 | (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync))) | ||
108 | { | ||
109 | if (!ee->engine.x.sync_counter) | ||
110 | ee->engine.x.sync_counter = ecore_x_sync_counter_new(0); | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | if (ee->engine.x.sync_counter) | ||
115 | ecore_x_sync_counter_free(ee->engine.x.sync_counter); | ||
116 | ee->engine.x.sync_counter = 0; | ||
117 | } | ||
118 | ecore_x_e_comp_sync_counter_set(ee->prop.window, ee->engine.x.sync_counter); | ||
119 | } | ||
120 | |||
121 | static void | ||
122 | _ecore_evas_x_sync_clear(Ecore_Evas *ee) | ||
123 | { | ||
124 | if (!ee->engine.x.sync_counter) return; | ||
125 | ecore_x_sync_counter_free(ee->engine.x.sync_counter); | ||
126 | ee->engine.x.sync_counter = 0; | ||
127 | } | ||
128 | |||
129 | # ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
130 | static Ecore_X_Window | ||
131 | _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) | ||
132 | { | ||
133 | Evas_Engine_Info_GL_X11 *einfo; | ||
134 | Ecore_X_Window win; | ||
135 | |||
136 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
137 | if (einfo) | ||
138 | { | ||
139 | int screen; | ||
140 | |||
141 | if (opt) | ||
142 | { | ||
143 | int op; | ||
144 | |||
145 | for (op = 0; opt[op]; op++) | ||
146 | { | ||
147 | if (opt[op] == ECORE_EVAS_GL_X11_OPT_INDIRECT) | ||
148 | { | ||
149 | op++; | ||
150 | einfo->indirect = opt[op]; | ||
151 | } | ||
152 | else if (opt[op] == ECORE_EVAS_GL_X11_OPT_VSYNC) | ||
153 | { | ||
154 | op++; | ||
155 | einfo->vsync = opt[op]; | ||
156 | } | ||
157 | } | ||
158 | } | ||
159 | |||
160 | /* FIXME: this is inefficient as its 1 or more round trips */ | ||
161 | screen = ecore_x_screen_index_get(ecore_x_default_screen_get()); | ||
162 | if (ecore_x_screen_count_get() > 1) | ||
163 | { | ||
164 | Ecore_X_Window *roots; | ||
165 | int num, i; | ||
166 | |||
167 | num = 0; | ||
168 | roots = ecore_x_window_root_list(&num); | ||
169 | if (roots) | ||
170 | { | ||
171 | Ecore_X_Window root; | ||
172 | |||
173 | root = ecore_x_window_root_get(parent); | ||
174 | for (i = 0; i < num; i++) | ||
175 | { | ||
176 | if (root == roots[i]) | ||
177 | { | ||
178 | screen = i; | ||
179 | break; | ||
180 | } | ||
181 | } | ||
182 | free(roots); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | einfo->info.display = ecore_x_display_get(); | ||
187 | einfo->info.screen = screen; | ||
188 | |||
189 | einfo->info.destination_alpha = argb; | ||
190 | |||
191 | einfo->info.visual = einfo->func.best_visual_get(einfo); | ||
192 | einfo->info.colormap = einfo->func.best_colormap_get(einfo); | ||
193 | einfo->info.depth = einfo->func.best_depth_get(einfo); | ||
194 | |||
195 | if ((!einfo->info.visual) || | ||
196 | (!einfo->info.colormap) || (!einfo->info.depth)) | ||
197 | { | ||
198 | WRN("OpenGL X11 init engine '%s' failed - no visual, colormap or depth.", ee->driver); | ||
199 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
200 | { | ||
201 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
202 | return 0; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | if (argb) | ||
207 | { | ||
208 | if (override) | ||
209 | win = ecore_x_window_override_argb_new(parent, x, y, w, h); | ||
210 | else | ||
211 | win = ecore_x_window_argb_new(parent, x, y, w, h); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | if (override) | ||
216 | win = ecore_x_window_override_new(parent, x, y, w, h); | ||
217 | else | ||
218 | win = ecore_x_window_new(parent, x, y, w, h); | ||
219 | } | ||
220 | |||
221 | ecore_x_window_pixel_gravity_set(win, ECORE_X_GRAVITY_FORGET); | ||
222 | |||
223 | /* attr.backing_store = NotUseful; */ | ||
224 | /* attr.override_redirect = override; */ | ||
225 | /* attr.colormap = einfo->info.colormap; */ | ||
226 | /* attr.border_pixel = 0; */ | ||
227 | /* attr.background_pixmap = None; */ | ||
228 | /* attr.event_mask = */ | ||
229 | /* KeyPressMask | KeyReleaseMask | */ | ||
230 | /* ExposureMask | ButtonPressMask | ButtonReleaseMask | */ | ||
231 | /* EnterWindowMask | LeaveWindowMask | */ | ||
232 | /* PointerMotionMask | StructureNotifyMask | VisibilityChangeMask | */ | ||
233 | /* FocusChangeMask | PropertyChangeMask | ColormapChangeMask; */ | ||
234 | /* attr.bit_gravity = ForgetGravity; */ | ||
235 | |||
236 | /* win = */ | ||
237 | /* XCreateWindow(einfo->info.display, parent, x, y, w, h, 0, */ | ||
238 | /* einfo->info.depth, InputOutput, einfo->info.visual, */ | ||
239 | /* CWBackingStore | CWColormap | CWBackPixmap | */ | ||
240 | /* CWBorderPixel | CWBitGravity | CWEventMask | */ | ||
241 | /* CWOverrideRedirect, &attr); */ | ||
242 | |||
243 | einfo->info.drawable = win; | ||
244 | |||
245 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
246 | { | ||
247 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
248 | ecore_x_window_free(win); | ||
249 | return 0; | ||
250 | } | ||
251 | } | ||
252 | else | ||
253 | win = 0; | ||
254 | |||
255 | return win; | ||
256 | } | ||
257 | #endif | ||
258 | |||
259 | static int | ||
260 | _ecore_evas_x_render(Ecore_Evas *ee) | ||
261 | { | ||
262 | int rend = 0; | ||
263 | Eina_List *updates = NULL; | ||
264 | Eina_List *ll; | ||
265 | Ecore_Evas *ee2; | ||
266 | |||
267 | if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync) && | ||
268 | (ee->engine.x.sync_counter) && (!ee->engine.x.sync_began) && | ||
269 | (!ee->engine.x.sync_cancel)) | ||
270 | return 0; | ||
271 | |||
272 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
273 | { | ||
274 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
275 | if (ee2->engine.func->fn_render) | ||
276 | rend |= ee2->engine.func->fn_render(ee2); | ||
277 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
278 | } | ||
279 | |||
280 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
281 | updates = evas_render_updates(ee->evas); | ||
282 | if (ee->prop.avoid_damage) | ||
283 | { | ||
284 | if (ee->engine.x.using_bg_pixmap) | ||
285 | { | ||
286 | if (updates) | ||
287 | { | ||
288 | Eina_List *l = NULL; | ||
289 | Eina_Rectangle *r; | ||
290 | |||
291 | EINA_LIST_FOREACH(updates, l, r) | ||
292 | ecore_x_window_area_clear(ee->prop.window, | ||
293 | r->x, r->y, r->w, r->h); | ||
294 | if (ee->shaped) | ||
295 | { | ||
296 | #ifdef EVAS_FRAME_QUEUING | ||
297 | evas_sync(ee->evas); | ||
298 | #endif | ||
299 | ecore_x_window_shape_mask_set(ee->prop.window, | ||
300 | ee->engine.x.mask); | ||
301 | } | ||
302 | if (ee->alpha) | ||
303 | { | ||
304 | #ifdef EVAS_FRAME_QUEUING | ||
305 | /* wait until ee->engine.x.mask being updated */ | ||
306 | // evas_sync(ee->evas); | ||
307 | #endif | ||
308 | // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); | ||
309 | } | ||
310 | evas_render_updates_free(updates); | ||
311 | _ecore_evas_idle_timeout_update(ee); | ||
312 | rend = 1; | ||
313 | } | ||
314 | } | ||
315 | else | ||
316 | { | ||
317 | if (updates) | ||
318 | { | ||
319 | Eina_List *l = NULL; | ||
320 | Eina_Rectangle *r; | ||
321 | |||
322 | EINA_LIST_FOREACH(updates, l, r) | ||
323 | { | ||
324 | Ecore_X_Rectangle rect; | ||
325 | Ecore_X_XRegion *tmpr; | ||
326 | |||
327 | if (!ee->engine.x.damages) | ||
328 | ee->engine.x.damages = ecore_x_xregion_new(); | ||
329 | tmpr = ecore_x_xregion_new(); | ||
330 | if (ee->rotation == 0) | ||
331 | { | ||
332 | rect.x = r->x; | ||
333 | rect.y = r->y; | ||
334 | rect.width = r->w; | ||
335 | rect.height = r->h; | ||
336 | } | ||
337 | else if (ee->rotation == 90) | ||
338 | { | ||
339 | rect.x = r->y; | ||
340 | rect.y = ee->h - r->x - r->w; | ||
341 | rect.width = r->h; | ||
342 | rect.height = r->w; | ||
343 | } | ||
344 | else if (ee->rotation == 180) | ||
345 | { | ||
346 | rect.x = ee->w - r->x - r->w; | ||
347 | rect.y = ee->h - r->y - r->h; | ||
348 | rect.width = r->w; | ||
349 | rect.height = r->h; | ||
350 | } | ||
351 | else if (ee->rotation == 270) | ||
352 | { | ||
353 | rect.x = ee->w - r->y - r->h; | ||
354 | rect.y = r->x; | ||
355 | rect.width = r->h; | ||
356 | rect.height = r->w; | ||
357 | } | ||
358 | ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, | ||
359 | &rect); | ||
360 | ecore_x_xregion_free(ee->engine.x.damages); | ||
361 | ee->engine.x.damages = tmpr; | ||
362 | } | ||
363 | if (ee->engine.x.damages) | ||
364 | { | ||
365 | /* if we have a damage pixmap - we can avoid exposures by | ||
366 | * disabling them just for setting the mask */ | ||
367 | ecore_x_event_mask_set(ee->prop.window, | ||
368 | ECORE_X_EVENT_MASK_KEY_DOWN | | ||
369 | ECORE_X_EVENT_MASK_KEY_UP | | ||
370 | ECORE_X_EVENT_MASK_MOUSE_DOWN | | ||
371 | ECORE_X_EVENT_MASK_MOUSE_UP | | ||
372 | ECORE_X_EVENT_MASK_MOUSE_IN | | ||
373 | ECORE_X_EVENT_MASK_MOUSE_OUT | | ||
374 | ECORE_X_EVENT_MASK_MOUSE_MOVE | | ||
375 | // ECORE_X_EVENT_MASK_WINDOW_DAMAGE | | ||
376 | ECORE_X_EVENT_MASK_WINDOW_VISIBILITY | | ||
377 | ECORE_X_EVENT_MASK_WINDOW_CONFIGURE | | ||
378 | ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE | | ||
379 | ECORE_X_EVENT_MASK_WINDOW_PROPERTY | | ||
380 | ECORE_X_EVENT_MASK_WINDOW_COLORMAP | ||
381 | ); | ||
382 | if (ee->shaped) | ||
383 | ecore_x_window_shape_mask_set(ee->prop.window, | ||
384 | ee->engine.x.mask); | ||
385 | /* and re-enable them again */ | ||
386 | ecore_x_event_mask_set(ee->prop.window, | ||
387 | ECORE_X_EVENT_MASK_KEY_DOWN | | ||
388 | ECORE_X_EVENT_MASK_KEY_UP | | ||
389 | ECORE_X_EVENT_MASK_MOUSE_DOWN | | ||
390 | ECORE_X_EVENT_MASK_MOUSE_UP | | ||
391 | ECORE_X_EVENT_MASK_MOUSE_IN | | ||
392 | ECORE_X_EVENT_MASK_MOUSE_OUT | | ||
393 | ECORE_X_EVENT_MASK_MOUSE_MOVE | | ||
394 | ECORE_X_EVENT_MASK_WINDOW_DAMAGE | | ||
395 | ECORE_X_EVENT_MASK_WINDOW_VISIBILITY | | ||
396 | ECORE_X_EVENT_MASK_WINDOW_CONFIGURE | | ||
397 | ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE | | ||
398 | ECORE_X_EVENT_MASK_WINDOW_PROPERTY | | ||
399 | ECORE_X_EVENT_MASK_WINDOW_COLORMAP | ||
400 | ); | ||
401 | ecore_x_xregion_set(ee->engine.x.damages, ee->engine.x.gc); | ||
402 | ecore_x_pixmap_paste(ee->engine.x.pmap, ee->prop.window, | ||
403 | ee->engine.x.gc, 0, 0, ee->w, ee->h, | ||
404 | 0, 0); | ||
405 | ecore_x_xregion_free(ee->engine.x.damages); | ||
406 | ee->engine.x.damages = NULL; | ||
407 | } | ||
408 | evas_render_updates_free(updates); | ||
409 | _ecore_evas_idle_timeout_update(ee); | ||
410 | rend = 1; | ||
411 | } | ||
412 | } | ||
413 | } | ||
414 | else if (((ee->visible) && (ee->draw_ok)) || | ||
415 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
416 | ((ee->should_be_visible) && (ee->prop.override))) | ||
417 | { | ||
418 | if (updates) | ||
419 | { | ||
420 | if (ee->shaped) | ||
421 | { | ||
422 | #ifdef EVAS_FRAME_QUEUING | ||
423 | evas_sync(ee->evas); | ||
424 | #endif | ||
425 | ecore_x_window_shape_mask_set(ee->prop.window, | ||
426 | ee->engine.x.mask); | ||
427 | } | ||
428 | if (ee->alpha) | ||
429 | { | ||
430 | #ifdef EVAS_FRAME_QUEUING | ||
431 | /* wait until ee->engine.x.mask being updated */ | ||
432 | // evas_sync(ee->evas); | ||
433 | #endif | ||
434 | // ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); | ||
435 | } | ||
436 | evas_render_updates_free(updates); | ||
437 | _ecore_evas_idle_timeout_update(ee); | ||
438 | rend = 1; | ||
439 | } | ||
440 | } | ||
441 | else | ||
442 | evas_norender(ee->evas); | ||
443 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
444 | /* | ||
445 | if (rend) | ||
446 | { | ||
447 | static int frames = 0; | ||
448 | static double t0 = 0.0; | ||
449 | double t, td; | ||
450 | |||
451 | t = ecore_time_get(); | ||
452 | frames++; | ||
453 | if ((t - t0) > 1.0) | ||
454 | { | ||
455 | td = t - t0; | ||
456 | printf("FPS: %3.3f\n", (double)frames / td); | ||
457 | frames = 0; | ||
458 | t0 = t; | ||
459 | } | ||
460 | } | ||
461 | */ | ||
462 | |||
463 | return rend; | ||
464 | } | ||
465 | |||
466 | static void | ||
467 | _ecore_evas_x_resize_shape(Ecore_Evas *ee) | ||
468 | { | ||
469 | if (!strcmp(ee->driver, "software_x11")) | ||
470 | { | ||
471 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
472 | Evas_Engine_Info_Software_X11 *einfo; | ||
473 | |||
474 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
475 | if (einfo) | ||
476 | { | ||
477 | unsigned int foreground; | ||
478 | Ecore_X_GC gc; | ||
479 | |||
480 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
481 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
482 | foreground = 0; | ||
483 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
484 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
485 | &foreground); | ||
486 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
487 | 0, 0, ee->w, ee->h); | ||
488 | ecore_x_gc_free(gc); | ||
489 | einfo->info.mask = ee->engine.x.mask; | ||
490 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
491 | { | ||
492 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
493 | } | ||
494 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
495 | } | ||
496 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
497 | } | ||
498 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
499 | { | ||
500 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
501 | # if 0 /* XXX no shaped window support for software_16_x11 */ | ||
502 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
503 | |||
504 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
505 | if (einfo) | ||
506 | { | ||
507 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
508 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
509 | einfo->info.mask = ee->engine.x.mask; | ||
510 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
511 | { | ||
512 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
513 | } | ||
514 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
515 | } | ||
516 | # endif /* XXX no shaped window support for software_16_x11 */ | ||
517 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
518 | } | ||
519 | if (!strcmp(ee->driver, "software_8_x11")) | ||
520 | { | ||
521 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
522 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
523 | |||
524 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
525 | if (einfo) | ||
526 | { | ||
527 | unsigned int foreground; | ||
528 | Ecore_X_GC gc; | ||
529 | |||
530 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
531 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
532 | foreground = 0; | ||
533 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
534 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
535 | &foreground); | ||
536 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
537 | 0, 0, ee->w, ee->h); | ||
538 | ecore_x_gc_free(gc); | ||
539 | einfo->info.mask = ee->engine.x.mask; | ||
540 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
541 | { | ||
542 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
543 | } | ||
544 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
545 | } | ||
546 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
547 | } | ||
548 | } | ||
549 | |||
550 | /* TODO: we need to make this work for all the states, not just sticky */ | ||
551 | static Eina_Bool | ||
552 | _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
553 | { | ||
554 | Ecore_Evas *ee; | ||
555 | Ecore_X_Event_Window_Property *e; | ||
556 | int state_change = 0; | ||
557 | |||
558 | e = event; | ||
559 | ee = ecore_event_window_match(e->win); | ||
560 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
561 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
562 | if (e->atom == ECORE_X_ATOM_NET_WM_STATE) | ||
563 | { | ||
564 | unsigned int i, num; | ||
565 | Ecore_X_Window_State *state; | ||
566 | struct { | ||
567 | struct { | ||
568 | unsigned char modal : 1; | ||
569 | unsigned char sticky : 1; | ||
570 | unsigned char maximized_v : 1; | ||
571 | unsigned char maximized_h : 1; | ||
572 | unsigned char shaded : 1; | ||
573 | unsigned char skip_taskbar : 1; | ||
574 | unsigned char skip_pager : 1; | ||
575 | unsigned char fullscreen : 1; | ||
576 | unsigned char above : 1; | ||
577 | unsigned char below : 1; | ||
578 | } x; | ||
579 | struct { | ||
580 | char modal : 1; | ||
581 | char maximized : 1; | ||
582 | char sticky : 1; | ||
583 | char fullscreen : 1; | ||
584 | char focus_skip : 1; | ||
585 | } prop; | ||
586 | } prev; | ||
587 | |||
588 | prev.x.modal = ee->engine.x.state.modal; | ||
589 | prev.x.sticky = ee->engine.x.state.sticky; | ||
590 | prev.x.maximized_v = ee->engine.x.state.maximized_v; | ||
591 | prev.x.maximized_h = ee->engine.x.state.maximized_h; | ||
592 | prev.x.shaded = ee->engine.x.state.shaded; | ||
593 | prev.x.skip_taskbar = ee->engine.x.state.skip_taskbar; | ||
594 | prev.x.skip_pager = ee->engine.x.state.skip_pager; | ||
595 | prev.x.fullscreen = ee->engine.x.state.fullscreen; | ||
596 | prev.x.above = ee->engine.x.state.above; | ||
597 | prev.x.below = ee->engine.x.state.below; | ||
598 | |||
599 | prev.prop.modal = ee->prop.modal; | ||
600 | prev.prop.maximized = ee->prop.maximized; | ||
601 | prev.prop.sticky = ee->prop.sticky; | ||
602 | prev.prop.fullscreen = ee->prop.fullscreen; | ||
603 | prev.prop.focus_skip = ee->prop.focus_skip; | ||
604 | |||
605 | ee->engine.x.state.modal = 0; | ||
606 | ee->engine.x.state.sticky = 0; | ||
607 | ee->engine.x.state.maximized_v = 0; | ||
608 | ee->engine.x.state.maximized_h = 0; | ||
609 | ee->engine.x.state.shaded = 0; | ||
610 | ee->engine.x.state.skip_taskbar = 0; | ||
611 | ee->engine.x.state.skip_pager = 0; | ||
612 | ee->engine.x.state.fullscreen = 0; | ||
613 | ee->engine.x.state.above = 0; | ||
614 | ee->engine.x.state.below = 0; | ||
615 | |||
616 | ee->prop.modal = 0; | ||
617 | ee->prop.maximized = 0; | ||
618 | ee->prop.sticky = 0; | ||
619 | ee->prop.fullscreen = 0; | ||
620 | ee->prop.focus_skip = 0; | ||
621 | |||
622 | ecore_x_netwm_window_state_get(e->win, &state, &num); | ||
623 | if (state) | ||
624 | { | ||
625 | for (i = 0; i < num; i++) | ||
626 | { | ||
627 | switch (state[i]) | ||
628 | { | ||
629 | case ECORE_X_WINDOW_STATE_MODAL: | ||
630 | ee->engine.x.state.modal = 1; | ||
631 | ee->prop.modal = 1; | ||
632 | break; | ||
633 | case ECORE_X_WINDOW_STATE_STICKY: | ||
634 | ee->prop.sticky = 1; | ||
635 | ee->engine.x.state.sticky = 1; | ||
636 | break; | ||
637 | case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: | ||
638 | ee->engine.x.state.maximized_v = 1; | ||
639 | ee->prop.maximized = 1; | ||
640 | break; | ||
641 | case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: | ||
642 | ee->engine.x.state.maximized_h = 1; | ||
643 | ee->prop.maximized = 1; | ||
644 | break; | ||
645 | case ECORE_X_WINDOW_STATE_SHADED: | ||
646 | ee->engine.x.state.shaded = 1; | ||
647 | break; | ||
648 | case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: | ||
649 | ee->engine.x.state.skip_taskbar = 1; | ||
650 | ee->prop.focus_skip = 1; | ||
651 | break; | ||
652 | case ECORE_X_WINDOW_STATE_SKIP_PAGER: | ||
653 | ee->engine.x.state.skip_pager = 1; | ||
654 | ee->prop.focus_skip = 1; | ||
655 | break; | ||
656 | case ECORE_X_WINDOW_STATE_FULLSCREEN: | ||
657 | ee->prop.fullscreen = 1; | ||
658 | ee->engine.x.state.fullscreen = 1; | ||
659 | break; | ||
660 | case ECORE_X_WINDOW_STATE_ABOVE: | ||
661 | ee->engine.x.state.above = 1; | ||
662 | break; | ||
663 | case ECORE_X_WINDOW_STATE_BELOW: | ||
664 | ee->engine.x.state.below = 1; | ||
665 | break; | ||
666 | default: | ||
667 | break; | ||
668 | } | ||
669 | } | ||
670 | free(state); | ||
671 | } | ||
672 | if ( | ||
673 | // (prev.x.modal != ee->engine.x.state.modal) || | ||
674 | (prev.x.sticky != ee->engine.x.state.sticky) || | ||
675 | (prev.x.maximized_v != ee->engine.x.state.maximized_v) || | ||
676 | (prev.x.maximized_h != ee->engine.x.state.maximized_h) || | ||
677 | // (prev.x.shaded != ee->engine.x.state.shaded) || | ||
678 | // (prev.x.skip_taskbar != ee->engine.x.state.skip_taskbar) || | ||
679 | // (prev.x.skip_pager != ee->engine.x.state.skip_pager) || | ||
680 | (prev.x.fullscreen != ee->engine.x.state.fullscreen) || | ||
681 | // (prev.x.above != ee->engine.x.state.above) || | ||
682 | // (prev.x.below != ee->engine.x.state.below) || | ||
683 | // (prev.prop.modal != ee->prop.modal) || | ||
684 | (prev.prop.maximized != ee->prop.maximized) || | ||
685 | (prev.prop.sticky != ee->prop.sticky) || | ||
686 | (prev.prop.fullscreen != ee->prop.fullscreen) || | ||
687 | (prev.prop.focus_skip != ee->prop.focus_skip)) | ||
688 | state_change = 1; | ||
689 | } | ||
690 | else if (e->atom == ECORE_X_ATOM_WM_STATE) | ||
691 | { | ||
692 | Ecore_X_Window_State_Hint state; | ||
693 | |||
694 | // handle WM_STATE changes | ||
695 | state = ecore_x_icccm_state_get(e->win); | ||
696 | switch (state) | ||
697 | { | ||
698 | case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN: | ||
699 | if ((!ee->prop.withdrawn) || (ee->prop.iconified)) | ||
700 | { | ||
701 | state_change = 1; | ||
702 | ee->prop.withdrawn = 1; | ||
703 | ee->prop.iconified = 0; | ||
704 | } | ||
705 | break; | ||
706 | case ECORE_X_WINDOW_STATE_HINT_ICONIC: | ||
707 | if ((!ee->prop.iconified) || (ee->prop.withdrawn)) | ||
708 | { | ||
709 | state_change = 1; | ||
710 | ee->prop.iconified = 1; | ||
711 | ee->prop.withdrawn = 0; | ||
712 | } | ||
713 | break; | ||
714 | case ECORE_X_WINDOW_STATE_HINT_NORMAL: | ||
715 | if ((ee->prop.iconified) || (ee->prop.withdrawn)) | ||
716 | { | ||
717 | state_change = 1; | ||
718 | ee->prop.iconified = 0; | ||
719 | ee->prop.withdrawn = 0; | ||
720 | } | ||
721 | break; | ||
722 | default: | ||
723 | break; | ||
724 | } | ||
725 | } | ||
726 | if (state_change) | ||
727 | { | ||
728 | if (ee->func.fn_state_change) ee->func.fn_state_change(ee); | ||
729 | } | ||
730 | |||
731 | return ECORE_CALLBACK_PASS_ON; | ||
732 | } | ||
733 | |||
734 | static Eina_Bool | ||
735 | _ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
736 | { | ||
737 | Ecore_Evas *ee; | ||
738 | Ecore_X_Event_Window_Visibility_Change *e; | ||
739 | |||
740 | e = event; | ||
741 | ee = ecore_event_window_match(e->win); | ||
742 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
743 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
744 | // printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured); | ||
745 | if (e->fully_obscured) | ||
746 | { | ||
747 | /* FIXME: round trip */ | ||
748 | if (!ecore_x_screen_is_composited(ee->engine.x.screen_num)) | ||
749 | ee->draw_ok = 0; | ||
750 | } | ||
751 | else | ||
752 | ee->draw_ok = 1; | ||
753 | return ECORE_CALLBACK_PASS_ON; | ||
754 | } | ||
755 | |||
756 | static Eina_Bool | ||
757 | _ecore_evas_x_event_client_message(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
758 | { | ||
759 | Ecore_Evas *ee; | ||
760 | Ecore_X_Event_Client_Message *e; | ||
761 | |||
762 | e = event; | ||
763 | if (e->format != 32) return ECORE_CALLBACK_PASS_ON; | ||
764 | if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_BEGIN) | ||
765 | { | ||
766 | ee = ecore_event_window_match(e->data.l[0]); | ||
767 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
768 | if (e->data.l[0] != (long)ee->prop.window) | ||
769 | return ECORE_CALLBACK_PASS_ON; | ||
770 | if (!ee->engine.x.sync_began) | ||
771 | { | ||
772 | // qeue a damage + draw. work around an event re-ordering thing. | ||
773 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
774 | } | ||
775 | ee->engine.x.sync_began = 1; | ||
776 | ee->engine.x.sync_cancel = 0; | ||
777 | } | ||
778 | else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_END) | ||
779 | { | ||
780 | ee = ecore_event_window_match(e->data.l[0]); | ||
781 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
782 | if (e->data.l[0] != (long)ee->prop.window) | ||
783 | return ECORE_CALLBACK_PASS_ON; | ||
784 | ee->engine.x.sync_began = 0; | ||
785 | ee->engine.x.sync_cancel = 0; | ||
786 | } | ||
787 | else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_CANCEL) | ||
788 | { | ||
789 | ee = ecore_event_window_match(e->data.l[0]); | ||
790 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
791 | if (e->data.l[0] != (long)ee->prop.window) | ||
792 | return ECORE_CALLBACK_PASS_ON; | ||
793 | ee->engine.x.sync_began = 0; | ||
794 | ee->engine.x.sync_cancel = 1; | ||
795 | } | ||
796 | else if ((e->message_type == ECORE_X_ATOM_WM_PROTOCOLS) && | ||
797 | (e->data.l[0] == (int)ECORE_X_ATOM_NET_WM_SYNC_REQUEST)) | ||
798 | { | ||
799 | ee = ecore_event_window_match(e->win); | ||
800 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
801 | ee->engine.x.netwm_sync_val_lo = (unsigned int)e->data.l[2]; | ||
802 | ee->engine.x.netwm_sync_val_hi = (int)e->data.l[3]; | ||
803 | ee->engine.x.netwm_sync_set = 1; | ||
804 | } | ||
805 | return ECORE_CALLBACK_PASS_ON; | ||
806 | } | ||
807 | |||
808 | static Eina_Bool | ||
809 | _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
810 | { | ||
811 | Ecore_Evas *ee; | ||
812 | Ecore_X_Event_Mouse_In *e; | ||
813 | |||
814 | e = event; | ||
815 | ee = ecore_event_window_match(e->win); | ||
816 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
817 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
818 | /* { */ | ||
819 | /* time_t t; */ | ||
820 | /* char *ct; */ | ||
821 | |||
822 | /* const char *modes[] = { */ | ||
823 | /* "MODE_NORMAL", */ | ||
824 | /* "MODE_WHILE_GRABBED", */ | ||
825 | /* "MODE_GRAB", */ | ||
826 | /* "MODE_UNGRAB" */ | ||
827 | /* }; */ | ||
828 | /* const char *details[] = { */ | ||
829 | /* "DETAIL_ANCESTOR", */ | ||
830 | /* "DETAIL_VIRTUAL", */ | ||
831 | /* "DETAIL_INFERIOR", */ | ||
832 | /* "DETAIL_NON_LINEAR", */ | ||
833 | /* "DETAIL_NON_LINEAR_VIRTUAL", */ | ||
834 | /* "DETAIL_POINTER", */ | ||
835 | /* "DETAIL_POINTER_ROOT", */ | ||
836 | /* "DETAIL_DETAIL_NONE" */ | ||
837 | /* }; */ | ||
838 | /* t = time(NULL); */ | ||
839 | /* ct = ctime(&t); */ | ||
840 | /* ct[strlen(ct) - 1] = 0; */ | ||
841 | /* printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n", */ | ||
842 | /* e->win, e->event_win, */ | ||
843 | /* ct, */ | ||
844 | /* modes[e->mode], */ | ||
845 | /* details[e->detail]); */ | ||
846 | /* } */ | ||
847 | // disable. causes more problems than it fixes | ||
848 | // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || | ||
849 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) | ||
850 | // return 0; | ||
851 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ | ||
852 | if (!ee->in) | ||
853 | { | ||
854 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
855 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | ||
856 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | ||
857 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
858 | ee->in = EINA_TRUE; | ||
859 | } | ||
860 | return ECORE_CALLBACK_PASS_ON; | ||
861 | } | ||
862 | |||
863 | static Eina_Bool | ||
864 | _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
865 | { | ||
866 | Ecore_Evas *ee; | ||
867 | Ecore_X_Event_Mouse_Out *e; | ||
868 | |||
869 | e = event; | ||
870 | ee = ecore_event_window_match(e->win); | ||
871 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
872 | /* pass on event */ | ||
873 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
874 | /* { */ | ||
875 | /* time_t t; */ | ||
876 | /* char *ct; */ | ||
877 | |||
878 | /* const char *modes[] = { */ | ||
879 | /* "MODE_NORMAL", */ | ||
880 | /* "MODE_WHILE_GRABBED", */ | ||
881 | /* "MODE_GRAB", */ | ||
882 | /* "MODE_UNGRAB" */ | ||
883 | /* }; */ | ||
884 | /* const char *details[] = { */ | ||
885 | /* "DETAIL_ANCESTOR", */ | ||
886 | /* "DETAIL_VIRTUAL", */ | ||
887 | /* "DETAIL_INFERIOR", */ | ||
888 | /* "DETAIL_NON_LINEAR", */ | ||
889 | /* "DETAIL_NON_LINEAR_VIRTUAL", */ | ||
890 | /* "DETAIL_POINTER", */ | ||
891 | /* "DETAIL_POINTER_ROOT", */ | ||
892 | /* "DETAIL_DETAIL_NONE" */ | ||
893 | /* }; */ | ||
894 | /* t = time(NULL); */ | ||
895 | /* ct = ctime(&t); */ | ||
896 | /* ct[strlen(ct) - 1] = 0; */ | ||
897 | /* printf("@@ ->OUT 0x%x 0x%x %s md=%s dt=%s\n", */ | ||
898 | /* e->win, e->event_win, */ | ||
899 | /* ct, */ | ||
900 | /* modes[e->mode], */ | ||
901 | /* details[e->detail]); */ | ||
902 | /* } */ | ||
903 | // disable. causes more problems than it fixes | ||
904 | // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || | ||
905 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) | ||
906 | // return 0; | ||
907 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ | ||
908 | // printf("OUT: ee->in=%i, e->mode=%i, e->detail=%i, dount_count=%i\n", | ||
909 | // ee->in, e->mode, e->detail, evas_event_down_count_get(ee->evas)); | ||
910 | if (ee->in) | ||
911 | { | ||
912 | if ((evas_event_down_count_get(ee->evas) > 0) && | ||
913 | (!((e->mode == ECORE_X_EVENT_MODE_GRAB) && | ||
914 | (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)))) | ||
915 | return ECORE_CALLBACK_PASS_ON; | ||
916 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | ||
917 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
918 | if (e->mode == ECORE_X_EVENT_MODE_GRAB) | ||
919 | evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); | ||
920 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
921 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
922 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
923 | ee->in = EINA_FALSE; | ||
924 | } | ||
925 | return ECORE_CALLBACK_PASS_ON; | ||
926 | } | ||
927 | |||
928 | static Eina_Bool | ||
929 | _ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
930 | { | ||
931 | Ecore_Evas *ee; | ||
932 | Ecore_X_Event_Window_Focus_In *e; | ||
933 | |||
934 | e = event; | ||
935 | ee = ecore_event_window_match(e->win); | ||
936 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
937 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
938 | //xx// filtering with these doesnt help | ||
939 | //xx// if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON; | ||
940 | ee->prop.focused = 1; | ||
941 | evas_focus_in(ee->evas); | ||
942 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
943 | return ECORE_CALLBACK_PASS_ON; | ||
944 | } | ||
945 | |||
946 | static Eina_Bool | ||
947 | _ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
948 | { | ||
949 | Ecore_Evas *ee; | ||
950 | Ecore_X_Event_Window_Focus_Out *e; | ||
951 | |||
952 | e = event; | ||
953 | ee = ecore_event_window_match(e->win); | ||
954 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
955 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
956 | //xx// filtering with these doesnt help | ||
957 | //xx// if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON; | ||
958 | |||
959 | // if (ee->prop.fullscreen) | ||
960 | // ecore_x_window_focus(ee->prop.window); | ||
961 | evas_focus_out(ee->evas); | ||
962 | ee->prop.focused = 0; | ||
963 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
964 | return ECORE_CALLBACK_PASS_ON; | ||
965 | } | ||
966 | |||
967 | static Eina_Bool | ||
968 | _ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
969 | { | ||
970 | Ecore_Evas *ee; | ||
971 | Ecore_X_Event_Window_Damage *e; | ||
972 | |||
973 | e = event; | ||
974 | ee = ecore_event_window_match(e->win); | ||
975 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
976 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
977 | if (ee->engine.x.using_bg_pixmap) return ECORE_CALLBACK_PASS_ON; | ||
978 | // printf("EXPOSE %p [%i] %i %i %ix%i\n", ee, ee->prop.avoid_damage, e->x, e->y, e->w, e->h); | ||
979 | if (ee->prop.avoid_damage) | ||
980 | { | ||
981 | Ecore_X_Rectangle rect; | ||
982 | Ecore_X_XRegion *tmpr; | ||
983 | |||
984 | if (!ee->engine.x.damages) | ||
985 | ee->engine.x.damages = ecore_x_xregion_new(); | ||
986 | tmpr = ecore_x_xregion_new(); | ||
987 | rect.x = e->x; | ||
988 | rect.y = e->y; | ||
989 | rect.width = e->w; | ||
990 | rect.height = e->h; | ||
991 | ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect); | ||
992 | ecore_x_xregion_free(ee->engine.x.damages); | ||
993 | ee->engine.x.damages = tmpr; | ||
994 | /* no - this breaks things badly. disable. Ecore_X_Rectangle != XRectangle - see | ||
995 | * the typedefs in x's headers and ecore_x's. also same with Region - it's a pointer in x - not an X ID | ||
996 | Ecore_X_Rectangle rect; | ||
997 | Ecore_X_XRegion *tmpr; | ||
998 | |||
999 | if (!ee->engine.x.damages) ee->engine.x.damages = ecore_x_xregion_new(); | ||
1000 | tmpr = ecore_x_xregion_new(); | ||
1001 | rect.x = e->x; | ||
1002 | rect.y = e->y; | ||
1003 | rect.width = e->w; | ||
1004 | rect.height = e->h; | ||
1005 | ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect); | ||
1006 | ecore_x_xregion_free(ee->engine.x.damages); | ||
1007 | ee->engine.x.damages = tmpr; | ||
1008 | */ | ||
1009 | } | ||
1010 | else | ||
1011 | { | ||
1012 | if (ee->rotation == 0) | ||
1013 | evas_damage_rectangle_add(ee->evas, e->x, e->y, e->w, e->h); | ||
1014 | else if (ee->rotation == 90) | ||
1015 | evas_damage_rectangle_add(ee->evas, | ||
1016 | ee->h - e->y - e->h, e->x, e->h, e->w); | ||
1017 | else if (ee->rotation == 180) | ||
1018 | evas_damage_rectangle_add(ee->evas, ee->w - e->x - e->w, | ||
1019 | ee->h - e->y - e->h, e->w, e->h); | ||
1020 | else if (ee->rotation == 270) | ||
1021 | evas_damage_rectangle_add(ee->evas, e->y, ee->w - e->x - e->w, | ||
1022 | e->h, e->w); | ||
1023 | } | ||
1024 | return ECORE_CALLBACK_PASS_ON; | ||
1025 | } | ||
1026 | |||
1027 | static Eina_Bool | ||
1028 | _ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1029 | { | ||
1030 | Ecore_Evas *ee; | ||
1031 | Ecore_X_Event_Window_Destroy *e; | ||
1032 | |||
1033 | e = event; | ||
1034 | ee = ecore_event_window_match(e->win); | ||
1035 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1036 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1037 | if (ee->func.fn_destroy) ee->func.fn_destroy(ee); | ||
1038 | _ecore_evas_x_sync_clear(ee); | ||
1039 | ecore_evas_free(ee); | ||
1040 | return ECORE_CALLBACK_PASS_ON; | ||
1041 | } | ||
1042 | |||
1043 | static Eina_Bool | ||
1044 | _ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1045 | { | ||
1046 | Ecore_Evas *ee; | ||
1047 | Ecore_X_Event_Window_Configure *e; | ||
1048 | |||
1049 | e = event; | ||
1050 | ee = ecore_event_window_match(e->win); | ||
1051 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1052 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1053 | if (ee->engine.x.direct_resize) return ECORE_CALLBACK_PASS_ON; | ||
1054 | |||
1055 | ee->engine.x.configure_coming = 0; | ||
1056 | if ((e->from_wm) || (ee->prop.override)) | ||
1057 | { | ||
1058 | if ((ee->x != e->x) || (ee->y != e->y)) | ||
1059 | { | ||
1060 | ee->x = e->x; | ||
1061 | ee->y = e->y; | ||
1062 | ee->req.x = ee->x; | ||
1063 | ee->req.y = ee->y; | ||
1064 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1065 | } | ||
1066 | } | ||
1067 | if ((ee->w != e->w) || (ee->h != e->h)) | ||
1068 | { | ||
1069 | ee->w = e->w; | ||
1070 | ee->h = e->h; | ||
1071 | ee->req.w = ee->w; | ||
1072 | ee->req.h = ee->h; | ||
1073 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1074 | { | ||
1075 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1076 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1077 | } | ||
1078 | else | ||
1079 | { | ||
1080 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1081 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1082 | } | ||
1083 | if (ee->prop.avoid_damage) | ||
1084 | { | ||
1085 | int pdam; | ||
1086 | |||
1087 | pdam = ecore_evas_avoid_damage_get(ee); | ||
1088 | ecore_evas_avoid_damage_set(ee, 0); | ||
1089 | ecore_evas_avoid_damage_set(ee, pdam); | ||
1090 | } | ||
1091 | if ((ee->shaped) || (ee->alpha)) | ||
1092 | _ecore_evas_x_resize_shape(ee); | ||
1093 | if ((ee->expecting_resize.w > 0) && (ee->expecting_resize.h > 0)) | ||
1094 | { | ||
1095 | if ((ee->expecting_resize.w == ee->w) && | ||
1096 | (ee->expecting_resize.h == ee->h)) | ||
1097 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
1098 | ecore_x_current_time_get()); | ||
1099 | ee->expecting_resize.w = 0; | ||
1100 | ee->expecting_resize.h = 0; | ||
1101 | } | ||
1102 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1103 | } | ||
1104 | return ECORE_CALLBACK_PASS_ON; | ||
1105 | } | ||
1106 | |||
1107 | static Eina_Bool | ||
1108 | _ecore_evas_x_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1109 | { | ||
1110 | Ecore_Evas *ee; | ||
1111 | Ecore_X_Event_Window_Delete_Request *e; | ||
1112 | |||
1113 | e = event; | ||
1114 | ee = ecore_event_window_match(e->win); | ||
1115 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1116 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1117 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
1118 | return ECORE_CALLBACK_PASS_ON; | ||
1119 | } | ||
1120 | |||
1121 | static Eina_Bool | ||
1122 | _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1123 | { | ||
1124 | Ecore_Evas *ee; | ||
1125 | Ecore_X_Event_Window_Show *e; | ||
1126 | static int first_map_bug = -1; | ||
1127 | |||
1128 | e = event; | ||
1129 | ee = ecore_event_window_match(e->win); | ||
1130 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1131 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1132 | if (first_map_bug < 0) | ||
1133 | { | ||
1134 | char *bug = NULL; | ||
1135 | |||
1136 | if ((bug = getenv("ECORE_EVAS_GL_FIRST_MAP_BUG"))) | ||
1137 | first_map_bug = atoi(bug); | ||
1138 | else | ||
1139 | first_map_bug = 0; | ||
1140 | } | ||
1141 | if ((first_map_bug) && (!strcmp(ee->driver, "opengl_x11"))) | ||
1142 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1143 | if (ee->visible) return ECORE_CALLBACK_PASS_ON; | ||
1144 | // if (ee->visible) return ECORE_CALLBACK_DONE; | ||
1145 | // printf("SHOW EVENT %p\n", ee); | ||
1146 | ee->visible = 1; | ||
1147 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
1148 | return ECORE_CALLBACK_PASS_ON; | ||
1149 | } | ||
1150 | |||
1151 | static Eina_Bool | ||
1152 | _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1153 | { | ||
1154 | Ecore_Evas *ee; | ||
1155 | Ecore_X_Event_Window_Hide *e; | ||
1156 | |||
1157 | e = event; | ||
1158 | ee = ecore_event_window_match(e->win); | ||
1159 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
1160 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1161 | if (ee->in) | ||
1162 | { | ||
1163 | evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); | ||
1164 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
1165 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
1166 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
1167 | ee->in = EINA_FALSE; | ||
1168 | } | ||
1169 | if (!ee->visible) return ECORE_CALLBACK_PASS_ON; | ||
1170 | // if (!ee->visible) return ECORE_CALLBACK_DONE; | ||
1171 | // printf("HIDE EVENT %p\n", ee); | ||
1172 | ee->visible = 0; | ||
1173 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
1174 | return ECORE_CALLBACK_PASS_ON; | ||
1175 | } | ||
1176 | |||
1177 | /* FIXME, should be in idler */ | ||
1178 | /* FIXME, round trip */ | ||
1179 | static void | ||
1180 | _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee) | ||
1181 | { | ||
1182 | ecore_x_icccm_size_pos_hints_set(ee->prop.window, | ||
1183 | ee->prop.request_pos /*request_pos */, | ||
1184 | ECORE_X_GRAVITY_NW /* gravity */, | ||
1185 | ee->prop.min.w /* min_w */, | ||
1186 | ee->prop.min.h /* min_h */, | ||
1187 | ee->prop.max.w /* max_w */, | ||
1188 | ee->prop.max.h /* max_h */, | ||
1189 | ee->prop.base.w /* base_w */, | ||
1190 | ee->prop.base.h /* base_h */, | ||
1191 | ee->prop.step.w /* step_x */, | ||
1192 | ee->prop.step.h /* step_y */, | ||
1193 | ee->prop.aspect /* min_aspect */, | ||
1194 | ee->prop.aspect /* max_aspect */); | ||
1195 | } | ||
1196 | |||
1197 | /* FIXME, should be in idler */ | ||
1198 | static void | ||
1199 | _ecore_evas_x_state_update(Ecore_Evas *ee) | ||
1200 | { | ||
1201 | Ecore_X_Window_State state[10]; | ||
1202 | int num = 0; | ||
1203 | |||
1204 | if (ee->prop.modal) | ||
1205 | state[num++] = ECORE_X_WINDOW_STATE_MODAL; | ||
1206 | if (ee->prop.sticky) | ||
1207 | state[num++] = ECORE_X_WINDOW_STATE_STICKY; | ||
1208 | if (ee->prop.maximized) | ||
1209 | state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; | ||
1210 | if (ee->prop.maximized) | ||
1211 | state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; | ||
1212 | // if (bd->client.netwm.state.shaded) | ||
1213 | // state[num++] = ECORE_X_WINDOW_STATE_SHADED; | ||
1214 | if (ee->prop.focus_skip) | ||
1215 | state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; | ||
1216 | if (ee->prop.focus_skip) | ||
1217 | state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER; | ||
1218 | // if (bd->client.netwm.state.hidden) | ||
1219 | // state[num++] = ECORE_X_WINDOW_STATE_HIDDEN; | ||
1220 | if (ee->engine.x.state.fullscreen) | ||
1221 | state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN; | ||
1222 | if (ee->engine.x.state.above) | ||
1223 | state[num++] = ECORE_X_WINDOW_STATE_ABOVE; | ||
1224 | if (ee->engine.x.state.below) | ||
1225 | state[num++] = ECORE_X_WINDOW_STATE_BELOW; | ||
1226 | if (ee->prop.demand_attention) | ||
1227 | state[num++] = ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION; | ||
1228 | |||
1229 | ecore_x_netwm_window_state_set(ee->prop.window, state, num); | ||
1230 | } | ||
1231 | |||
1232 | static void | ||
1233 | _ecore_evas_x_layer_update(Ecore_Evas *ee) | ||
1234 | { | ||
1235 | if (ee->should_be_visible) | ||
1236 | { | ||
1237 | /* We need to send a netwm request to the wm */ | ||
1238 | /* FIXME: Do we have to remove old state before adding new? */ | ||
1239 | if (ee->prop.layer < 3) | ||
1240 | { | ||
1241 | if (ee->engine.x.state.above) | ||
1242 | { | ||
1243 | ee->engine.x.state.above = 0; | ||
1244 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1245 | ee->engine.x.win_root, | ||
1246 | ECORE_X_WINDOW_STATE_ABOVE, -1, 0); | ||
1247 | } | ||
1248 | if (!ee->engine.x.state.below) | ||
1249 | { | ||
1250 | ee->engine.x.state.below = 1; | ||
1251 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1252 | ee->engine.x.win_root, | ||
1253 | ECORE_X_WINDOW_STATE_BELOW, -1, 1); | ||
1254 | } | ||
1255 | } | ||
1256 | else if (ee->prop.layer > 5) | ||
1257 | { | ||
1258 | if (ee->engine.x.state.below) | ||
1259 | { | ||
1260 | ee->engine.x.state.below = 0; | ||
1261 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1262 | ee->engine.x.win_root, | ||
1263 | ECORE_X_WINDOW_STATE_BELOW, -1, 0); | ||
1264 | } | ||
1265 | if (!ee->engine.x.state.above) | ||
1266 | { | ||
1267 | ee->engine.x.state.above = 1; | ||
1268 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1269 | ee->engine.x.win_root, | ||
1270 | ECORE_X_WINDOW_STATE_ABOVE, -1, 1); | ||
1271 | } | ||
1272 | } | ||
1273 | else | ||
1274 | { | ||
1275 | if (ee->engine.x.state.below) | ||
1276 | { | ||
1277 | ee->engine.x.state.below = 0; | ||
1278 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1279 | ee->engine.x.win_root, | ||
1280 | ECORE_X_WINDOW_STATE_BELOW, -1, 0); | ||
1281 | } | ||
1282 | if (ee->engine.x.state.above) | ||
1283 | { | ||
1284 | ee->engine.x.state.above = 0; | ||
1285 | ecore_x_netwm_state_request_send(ee->prop.window, | ||
1286 | ee->engine.x.win_root, | ||
1287 | ECORE_X_WINDOW_STATE_ABOVE, -1, 0); | ||
1288 | } | ||
1289 | } | ||
1290 | } | ||
1291 | else | ||
1292 | { | ||
1293 | /* Just set the state */ | ||
1294 | if (ee->prop.layer < 3) | ||
1295 | { | ||
1296 | if ((ee->engine.x.state.above) || (!ee->engine.x.state.below)) | ||
1297 | { | ||
1298 | ee->engine.x.state.above = 0; | ||
1299 | ee->engine.x.state.below = 1; | ||
1300 | _ecore_evas_x_state_update(ee); | ||
1301 | } | ||
1302 | } | ||
1303 | else if (ee->prop.layer > 5) | ||
1304 | { | ||
1305 | if ((!ee->engine.x.state.above) || (ee->engine.x.state.below)) | ||
1306 | { | ||
1307 | ee->engine.x.state.above = 1; | ||
1308 | ee->engine.x.state.below = 0; | ||
1309 | _ecore_evas_x_state_update(ee); | ||
1310 | } | ||
1311 | } | ||
1312 | else | ||
1313 | { | ||
1314 | if ((ee->engine.x.state.above) || (ee->engine.x.state.below)) | ||
1315 | { | ||
1316 | ee->engine.x.state.above = 0; | ||
1317 | ee->engine.x.state.below = 0; | ||
1318 | _ecore_evas_x_state_update(ee); | ||
1319 | } | ||
1320 | } | ||
1321 | } | ||
1322 | /* FIXME: Set gnome layer */ | ||
1323 | } | ||
1324 | |||
1325 | static int | ||
1326 | _ecore_evas_x_init(void) | ||
1327 | { | ||
1328 | _ecore_evas_init_count++; | ||
1329 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
1330 | ecore_evas_event_handlers[0] = | ||
1331 | ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, | ||
1332 | _ecore_evas_x_event_mouse_in, NULL); | ||
1333 | ecore_evas_event_handlers[1] = | ||
1334 | ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, | ||
1335 | _ecore_evas_x_event_mouse_out, NULL); | ||
1336 | ecore_evas_event_handlers[2] = | ||
1337 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, | ||
1338 | _ecore_evas_x_event_window_focus_in, NULL); | ||
1339 | ecore_evas_event_handlers[3] = | ||
1340 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, | ||
1341 | _ecore_evas_x_event_window_focus_out, NULL); | ||
1342 | ecore_evas_event_handlers[4] = | ||
1343 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, | ||
1344 | _ecore_evas_x_event_window_damage, NULL); | ||
1345 | ecore_evas_event_handlers[5] = | ||
1346 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, | ||
1347 | _ecore_evas_x_event_window_destroy, NULL); | ||
1348 | ecore_evas_event_handlers[6] = | ||
1349 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, | ||
1350 | _ecore_evas_x_event_window_configure, NULL); | ||
1351 | ecore_evas_event_handlers[7] = | ||
1352 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, | ||
1353 | _ecore_evas_x_event_window_delete_request, NULL); | ||
1354 | ecore_evas_event_handlers[8] = | ||
1355 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, | ||
1356 | _ecore_evas_x_event_window_show, NULL); | ||
1357 | ecore_evas_event_handlers[9] = | ||
1358 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, | ||
1359 | _ecore_evas_x_event_window_hide, NULL); | ||
1360 | ecore_evas_event_handlers[10] = | ||
1361 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, | ||
1362 | _ecore_evas_x_event_property_change, NULL); | ||
1363 | ecore_evas_event_handlers[11] = | ||
1364 | ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, | ||
1365 | _ecore_evas_x_event_visibility_change, NULL); | ||
1366 | ecore_evas_event_handlers[12] = | ||
1367 | ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, | ||
1368 | _ecore_evas_x_event_client_message, NULL); | ||
1369 | ecore_event_evas_init(); | ||
1370 | return _ecore_evas_init_count; | ||
1371 | } | ||
1372 | |||
1373 | static void | ||
1374 | _ecore_evas_x_free(Ecore_Evas *ee) | ||
1375 | { | ||
1376 | _ecore_evas_x_group_leader_unset(ee); | ||
1377 | _ecore_evas_x_sync_set(ee); | ||
1378 | if (ee->engine.x.win_shaped_input) | ||
1379 | ecore_x_window_free(ee->engine.x.win_shaped_input); | ||
1380 | ecore_x_window_free(ee->prop.window); | ||
1381 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
1382 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1383 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
1384 | if (ee->engine.x.damages) ecore_x_xregion_free(ee->engine.x.damages); | ||
1385 | ee->engine.x.pmap = 0; | ||
1386 | ee->engine.x.mask = 0; | ||
1387 | ee->engine.x.gc = 0; | ||
1388 | ee->engine.x.damages = NULL; | ||
1389 | ecore_event_window_unregister(ee->prop.window); | ||
1390 | while (ee->engine.x.win_extra) | ||
1391 | { | ||
1392 | Ecore_X_Window *winp; | ||
1393 | |||
1394 | winp = ee->engine.x.win_extra->data; | ||
1395 | ee->engine.x.win_extra = | ||
1396 | eina_list_remove_list(ee->engine.x.win_extra, ee->engine.x.win_extra); | ||
1397 | ecore_event_window_unregister(*winp); | ||
1398 | free(winp); | ||
1399 | } | ||
1400 | _ecore_evas_x_shutdown(); | ||
1401 | ecore_x_shutdown(); | ||
1402 | } | ||
1403 | |||
1404 | static void | ||
1405 | _ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) | ||
1406 | { | ||
1407 | ee->func.fn_delete_request = func; | ||
1408 | _ecore_evas_x_protocols_set(ee); | ||
1409 | _ecore_evas_x_sync_set(ee); | ||
1410 | } | ||
1411 | |||
1412 | static void | ||
1413 | _ecore_evas_x_move(Ecore_Evas *ee, int x, int y) | ||
1414 | { | ||
1415 | ee->req.x = x; | ||
1416 | ee->req.y = y; | ||
1417 | if (ee->engine.x.direct_resize) | ||
1418 | { | ||
1419 | if (!ee->engine.x.managed) | ||
1420 | { | ||
1421 | if ((x != ee->x) || (y != ee->y)) | ||
1422 | { | ||
1423 | ee->x = x; | ||
1424 | ee->y = y; | ||
1425 | ecore_x_window_move(ee->prop.window, x, y); | ||
1426 | if (!ee->should_be_visible) | ||
1427 | { | ||
1428 | /* We need to request pos */ | ||
1429 | ee->prop.request_pos = 1; | ||
1430 | _ecore_evas_x_size_pos_hints_update(ee); | ||
1431 | } | ||
1432 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1433 | } | ||
1434 | } | ||
1435 | } | ||
1436 | else | ||
1437 | { | ||
1438 | if (((ee->x != x) || (ee->y != y)) || | ||
1439 | (ee->engine.x.configure_coming)) | ||
1440 | { | ||
1441 | ee->engine.x.configure_coming = 1; | ||
1442 | if (!ee->engine.x.managed) | ||
1443 | { | ||
1444 | ee->x = x; | ||
1445 | ee->y = y; | ||
1446 | } | ||
1447 | ecore_x_window_move(ee->prop.window, x, y); | ||
1448 | } | ||
1449 | if (!ee->should_be_visible) | ||
1450 | { | ||
1451 | /* We need to request pos */ | ||
1452 | ee->prop.request_pos = 1; | ||
1453 | _ecore_evas_x_size_pos_hints_update(ee); | ||
1454 | } | ||
1455 | } | ||
1456 | } | ||
1457 | |||
1458 | static void | ||
1459 | _ecore_evas_x_managed_move(Ecore_Evas *ee, int x, int y) | ||
1460 | { | ||
1461 | ee->req.x = x; | ||
1462 | ee->req.y = y; | ||
1463 | if (ee->engine.x.direct_resize) | ||
1464 | { | ||
1465 | ee->engine.x.managed = 1; | ||
1466 | if ((x != ee->x) || (y != ee->y)) | ||
1467 | { | ||
1468 | ee->x = x; | ||
1469 | ee->y = y; | ||
1470 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1471 | } | ||
1472 | } | ||
1473 | } | ||
1474 | |||
1475 | static void | ||
1476 | _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h) | ||
1477 | { | ||
1478 | ee->req.w = w; | ||
1479 | ee->req.h = h; | ||
1480 | if (ee->engine.x.direct_resize) | ||
1481 | { | ||
1482 | if ((ee->w != w) || (ee->h != h)) | ||
1483 | { | ||
1484 | ee->w = w; | ||
1485 | ee->h = h; | ||
1486 | ecore_x_window_resize(ee->prop.window, w, h); | ||
1487 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1488 | { | ||
1489 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1490 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1491 | } | ||
1492 | else | ||
1493 | { | ||
1494 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1495 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1496 | } | ||
1497 | if (ee->prop.avoid_damage) | ||
1498 | { | ||
1499 | int pdam; | ||
1500 | |||
1501 | pdam = ecore_evas_avoid_damage_get(ee); | ||
1502 | ecore_evas_avoid_damage_set(ee, 0); | ||
1503 | ecore_evas_avoid_damage_set(ee, pdam); | ||
1504 | } | ||
1505 | if ((ee->shaped) || (ee->alpha)) | ||
1506 | _ecore_evas_x_resize_shape(ee); | ||
1507 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1508 | } | ||
1509 | } | ||
1510 | else if (((ee->w != w) || (ee->h != h)) || | ||
1511 | (ee->engine.x.configure_coming)) | ||
1512 | { | ||
1513 | ee->engine.x.configure_coming = 1; | ||
1514 | ecore_x_window_resize(ee->prop.window, w, h); | ||
1515 | } | ||
1516 | } | ||
1517 | |||
1518 | static void | ||
1519 | _ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) | ||
1520 | { | ||
1521 | ee->req.x = x; | ||
1522 | ee->req.y = y; | ||
1523 | ee->req.w = w; | ||
1524 | ee->req.h = h; | ||
1525 | if (ee->engine.x.direct_resize) | ||
1526 | { | ||
1527 | if ((ee->w != w) || (ee->h != h) || (x != ee->x) || (y != ee->y)) | ||
1528 | { | ||
1529 | int change_size = 0, change_pos = 0; | ||
1530 | |||
1531 | if ((ee->w != w) || (ee->h != h)) change_size = 1; | ||
1532 | if (!ee->engine.x.managed) | ||
1533 | { | ||
1534 | if ((x != ee->x) || (y != ee->y)) change_pos = 1; | ||
1535 | } | ||
1536 | ecore_x_window_move_resize(ee->prop.window, x, y, w, h); | ||
1537 | if (!ee->engine.x.managed) | ||
1538 | { | ||
1539 | ee->x = x; | ||
1540 | ee->y = y; | ||
1541 | } | ||
1542 | ee->w = w; | ||
1543 | ee->h = h; | ||
1544 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1545 | { | ||
1546 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1547 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1548 | } | ||
1549 | else | ||
1550 | { | ||
1551 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1552 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1553 | } | ||
1554 | if (ee->prop.avoid_damage) | ||
1555 | { | ||
1556 | int pdam; | ||
1557 | |||
1558 | pdam = ecore_evas_avoid_damage_get(ee); | ||
1559 | ecore_evas_avoid_damage_set(ee, 0); | ||
1560 | ecore_evas_avoid_damage_set(ee, pdam); | ||
1561 | } | ||
1562 | if ((ee->shaped) || (ee->alpha)) | ||
1563 | _ecore_evas_x_resize_shape(ee); | ||
1564 | if (change_pos) | ||
1565 | { | ||
1566 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
1567 | } | ||
1568 | if (change_size) | ||
1569 | { | ||
1570 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1571 | } | ||
1572 | } | ||
1573 | } | ||
1574 | else if (((ee->w != w) || (ee->h != h) || (ee->x != x) || (ee->y != y)) || | ||
1575 | (ee->engine.x.configure_coming)) | ||
1576 | { | ||
1577 | ee->engine.x.configure_coming = 1; | ||
1578 | ecore_x_window_move_resize(ee->prop.window, x, y, w, h); | ||
1579 | if (!ee->engine.x.managed) | ||
1580 | { | ||
1581 | ee->x = x; | ||
1582 | ee->y = y; | ||
1583 | } | ||
1584 | } | ||
1585 | } | ||
1586 | |||
1587 | static void | ||
1588 | _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize, | ||
1589 | Evas_Engine_Info *einfo) | ||
1590 | { | ||
1591 | int rot_dif; | ||
1592 | |||
1593 | rot_dif = ee->rotation - rotation; | ||
1594 | if (rot_dif < 0) rot_dif = -rot_dif; | ||
1595 | |||
1596 | if (rot_dif != 180) | ||
1597 | { | ||
1598 | int minw, minh, maxw, maxh, basew, baseh, stepw, steph; | ||
1599 | |||
1600 | if (!evas_engine_info_set(ee->evas, einfo)) | ||
1601 | { | ||
1602 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1603 | } | ||
1604 | |||
1605 | if (!resize) | ||
1606 | { | ||
1607 | ee->engine.x.configure_coming = 1; | ||
1608 | if (!ee->prop.fullscreen) | ||
1609 | { | ||
1610 | ecore_x_window_resize(ee->prop.window, ee->req.h, ee->req.w); | ||
1611 | ee->expecting_resize.w = ee->h; | ||
1612 | ee->expecting_resize.h = ee->w; | ||
1613 | } | ||
1614 | else | ||
1615 | { | ||
1616 | int w, h; | ||
1617 | |||
1618 | ecore_x_window_size_get(ee->prop.window, &w, &h); | ||
1619 | ecore_x_window_resize(ee->prop.window, h, w); | ||
1620 | if ((rotation == 0) || (rotation == 180)) | ||
1621 | { | ||
1622 | evas_output_size_set(ee->evas, ee->req.w, ee->req.h); | ||
1623 | evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1624 | } | ||
1625 | else | ||
1626 | { | ||
1627 | evas_output_size_set(ee->evas, ee->req.h, ee->req.w); | ||
1628 | evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w); | ||
1629 | } | ||
1630 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1631 | } | ||
1632 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1633 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w); | ||
1634 | else | ||
1635 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1636 | } | ||
1637 | else | ||
1638 | { | ||
1639 | /* int w, h; */ | ||
1640 | |||
1641 | /* ecore_x_window_size_get(ee->prop.window, &w, &h); */ | ||
1642 | if ((rotation == 0) || (rotation == 180)) | ||
1643 | { | ||
1644 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1645 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1646 | } | ||
1647 | else | ||
1648 | { | ||
1649 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
1650 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
1651 | } | ||
1652 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1653 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1654 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1655 | else | ||
1656 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1657 | } | ||
1658 | ecore_evas_size_min_get(ee, &minw, &minh); | ||
1659 | ecore_evas_size_max_get(ee, &maxw, &maxh); | ||
1660 | ecore_evas_size_base_get(ee, &basew, &baseh); | ||
1661 | ecore_evas_size_step_get(ee, &stepw, &steph); | ||
1662 | ee->rotation = rotation; | ||
1663 | ecore_evas_size_min_set(ee, minh, minw); | ||
1664 | ecore_evas_size_max_set(ee, maxh, maxw); | ||
1665 | ecore_evas_size_base_set(ee, baseh, basew); | ||
1666 | ecore_evas_size_step_set(ee, steph, stepw); | ||
1667 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
1668 | ecore_x_current_time_get()); | ||
1669 | } | ||
1670 | else | ||
1671 | { | ||
1672 | if (!evas_engine_info_set(ee->evas, einfo)) | ||
1673 | { | ||
1674 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1675 | } | ||
1676 | ee->rotation = rotation; | ||
1677 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
1678 | ecore_x_current_time_get()); | ||
1679 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1680 | |||
1681 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
1682 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
1683 | else | ||
1684 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1685 | } | ||
1686 | } | ||
1687 | |||
1688 | static void | ||
1689 | _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) | ||
1690 | { | ||
1691 | int angles[2]; | ||
1692 | angles[0] = rotation; | ||
1693 | angles[1] = ee->rotation; | ||
1694 | |||
1695 | if (ee->rotation == rotation) return; | ||
1696 | if (!strcmp(ee->driver, "opengl_x11")) | ||
1697 | { | ||
1698 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
1699 | Evas_Engine_Info_GL_X11 *einfo; | ||
1700 | |||
1701 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
1702 | if (!einfo) return; | ||
1703 | einfo->info.rotation = rotation; | ||
1704 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1705 | (Evas_Engine_Info *)einfo); | ||
1706 | ecore_x_window_prop_property_set(ee->prop.window, | ||
1707 | ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, | ||
1708 | ECORE_X_ATOM_CARDINAL, 32, &angles, 2); | ||
1709 | #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
1710 | } | ||
1711 | else if (!strcmp(ee->driver, "software_x11")) | ||
1712 | { | ||
1713 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
1714 | Evas_Engine_Info_Software_X11 *einfo; | ||
1715 | |||
1716 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
1717 | if (!einfo) return; | ||
1718 | einfo->info.rotation = rotation; | ||
1719 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1720 | (Evas_Engine_Info *)einfo); | ||
1721 | ecore_x_window_prop_property_set(ee->prop.window, | ||
1722 | ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, | ||
1723 | ECORE_X_ATOM_CARDINAL, 32, &angles, 2); | ||
1724 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
1725 | } | ||
1726 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
1727 | { | ||
1728 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
1729 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
1730 | |||
1731 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
1732 | if (!einfo) return; | ||
1733 | einfo->info.rotation = rotation; | ||
1734 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1735 | (Evas_Engine_Info *)einfo); | ||
1736 | ecore_x_window_prop_property_set(ee->prop.window, | ||
1737 | ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, | ||
1738 | ECORE_X_ATOM_CARDINAL, 32, &angles, 2); | ||
1739 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
1740 | } | ||
1741 | else if (!strcmp(ee->driver, "software_8_x11")) | ||
1742 | { | ||
1743 | #if BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
1744 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
1745 | |||
1746 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
1747 | if (!einfo) return; | ||
1748 | einfo->info.rotation = rotation; | ||
1749 | _ecore_evas_x_rotation_set_internal(ee, rotation, resize, | ||
1750 | (Evas_Engine_Info *)einfo); | ||
1751 | ecore_x_window_prop_property_set(ee->prop.window, | ||
1752 | ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, | ||
1753 | ECORE_X_ATOM_CARDINAL, 32, &angles, 2); | ||
1754 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
1755 | } | ||
1756 | } | ||
1757 | |||
1758 | static void | ||
1759 | _ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) | ||
1760 | { | ||
1761 | if ((ee->shaped == shaped)) return; | ||
1762 | if (!strcmp(ee->driver, "opengl_x11")) return; | ||
1763 | if (!strcmp(ee->driver, "software_x11")) | ||
1764 | { | ||
1765 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
1766 | Evas_Engine_Info_Software_X11 *einfo; | ||
1767 | |||
1768 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
1769 | ee->shaped = shaped; | ||
1770 | if (einfo) | ||
1771 | { | ||
1772 | if (ee->shaped) | ||
1773 | { | ||
1774 | unsigned int foreground; | ||
1775 | Ecore_X_GC gc; | ||
1776 | |||
1777 | if (!ee->engine.x.mask) | ||
1778 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
1779 | foreground = 0; | ||
1780 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
1781 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
1782 | &foreground); | ||
1783 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
1784 | 0, 0, ee->w, ee->h); | ||
1785 | ecore_x_gc_free(gc); | ||
1786 | einfo->info.mask = ee->engine.x.mask; | ||
1787 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1788 | { | ||
1789 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1790 | } | ||
1791 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1792 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1793 | } | ||
1794 | else | ||
1795 | { | ||
1796 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1797 | ee->engine.x.mask = 0; | ||
1798 | einfo->info.mask = 0; | ||
1799 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1800 | { | ||
1801 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1802 | } | ||
1803 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1804 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1805 | } | ||
1806 | } | ||
1807 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
1808 | } | ||
1809 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
1810 | { | ||
1811 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
1812 | # if 0 /* XXX no shaped window support for software_16_x11 */ | ||
1813 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
1814 | |||
1815 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
1816 | ee->shaped = shaped; | ||
1817 | if (einfo) | ||
1818 | { | ||
1819 | if (ee->shaped) | ||
1820 | { | ||
1821 | ee->engine.x.mask = | ||
1822 | ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
1823 | einfo->info.mask = ee->engine.x.mask; | ||
1824 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1825 | { | ||
1826 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1827 | } | ||
1828 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1829 | } | ||
1830 | else | ||
1831 | { | ||
1832 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1833 | ee->engine.x.mask = 0; | ||
1834 | einfo->info.mask = 0; | ||
1835 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1836 | { | ||
1837 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1838 | } | ||
1839 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1840 | } | ||
1841 | } | ||
1842 | # endif /* XXX no shaped window support for software_16_x11 */ | ||
1843 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
1844 | } | ||
1845 | if (!strcmp(ee->driver, "software_8_x11")) | ||
1846 | { | ||
1847 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
1848 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
1849 | |||
1850 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
1851 | ee->shaped = shaped; | ||
1852 | if (einfo) | ||
1853 | { | ||
1854 | if (ee->shaped) | ||
1855 | { | ||
1856 | unsigned int foreground; | ||
1857 | Ecore_X_GC gc; | ||
1858 | |||
1859 | if (!ee->engine.x.mask) | ||
1860 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); | ||
1861 | foreground = 0; | ||
1862 | gc = ecore_x_gc_new(ee->engine.x.mask, | ||
1863 | ECORE_X_GC_VALUE_MASK_FOREGROUND, | ||
1864 | &foreground); | ||
1865 | ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, | ||
1866 | 0, 0, ee->w, ee->h); | ||
1867 | ecore_x_gc_free(gc); | ||
1868 | einfo->info.mask = ee->engine.x.mask; | ||
1869 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1870 | { | ||
1871 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1872 | } | ||
1873 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1874 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1875 | } | ||
1876 | else | ||
1877 | { | ||
1878 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1879 | ee->engine.x.mask = 0; | ||
1880 | einfo->info.mask = 0; | ||
1881 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1882 | { | ||
1883 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1884 | } | ||
1885 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1886 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1887 | } | ||
1888 | } | ||
1889 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
1890 | } | ||
1891 | } | ||
1892 | |||
1893 | /* FIXME, round trip */ | ||
1894 | static void | ||
1895 | _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) | ||
1896 | { | ||
1897 | Ecore_X_Window_Attributes att; | ||
1898 | char *id = NULL; | ||
1899 | |||
1900 | if ((ee->alpha == alpha)) return; | ||
1901 | |||
1902 | if (!strcmp(ee->driver, "software_x11")) | ||
1903 | { | ||
1904 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
1905 | Evas_Engine_Info_Software_X11 *einfo; | ||
1906 | |||
1907 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
1908 | if (!einfo) return; | ||
1909 | |||
1910 | if (!ecore_x_composite_query()) return; | ||
1911 | |||
1912 | ee->shaped = 0; | ||
1913 | ee->alpha = alpha; | ||
1914 | ecore_x_window_free(ee->prop.window); | ||
1915 | ecore_event_window_unregister(ee->prop.window); | ||
1916 | if (ee->alpha) | ||
1917 | { | ||
1918 | if (ee->prop.override) | ||
1919 | 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); | ||
1920 | else | ||
1921 | 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); | ||
1922 | if (!ee->engine.x.mask) | ||
1923 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
1924 | } | ||
1925 | else | ||
1926 | { | ||
1927 | if (ee->prop.override) | ||
1928 | 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); | ||
1929 | else | ||
1930 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
1931 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1932 | ee->engine.x.mask = 0; | ||
1933 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
1934 | } | ||
1935 | |||
1936 | einfo->info.destination_alpha = alpha; | ||
1937 | |||
1938 | ecore_x_window_attributes_get(ee->prop.window, &att); | ||
1939 | einfo->info.visual = att.visual; | ||
1940 | einfo->info.colormap = att.colormap; | ||
1941 | einfo->info.depth = att.depth; | ||
1942 | |||
1943 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
1944 | // ee->engine.x.mask = 0; | ||
1945 | einfo->info.mask = ee->engine.x.mask; | ||
1946 | einfo->info.drawable = ee->prop.window; | ||
1947 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1948 | { | ||
1949 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1950 | } | ||
1951 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
1952 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
1953 | ecore_x_input_multi_select(ee->prop.window); | ||
1954 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
1955 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
1956 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
1957 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
1958 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
1959 | if (ee->prop.borderless) | ||
1960 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
1961 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
1962 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
1963 | if (ee->prop.title) | ||
1964 | { | ||
1965 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
1966 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
1967 | } | ||
1968 | _ecore_evas_x_hints_update(ee); | ||
1969 | _ecore_evas_x_group_leader_update(ee); | ||
1970 | ecore_x_window_defaults_set(ee->prop.window); | ||
1971 | _ecore_evas_x_protocols_set(ee); | ||
1972 | _ecore_evas_x_sync_set(ee); | ||
1973 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
1974 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
1975 | { | ||
1976 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
1977 | /* NB: on linux this may simply empty the env as opposed to completely | ||
1978 | * unset it to being empty - unsure as solartis libc crashes looking | ||
1979 | * for the '=' char */ | ||
1980 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
1981 | } | ||
1982 | } | ||
1983 | else if (!strcmp(ee->driver, "opengl_x11")) | ||
1984 | { | ||
1985 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
1986 | Evas_Engine_Info_GL_X11 *einfo; | ||
1987 | |||
1988 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
1989 | if (!einfo) return; | ||
1990 | |||
1991 | if (!ecore_x_composite_query()) return; | ||
1992 | |||
1993 | ee->shaped = 0; | ||
1994 | ee->alpha = alpha; | ||
1995 | ecore_x_window_free(ee->prop.window); | ||
1996 | ecore_event_window_unregister(ee->prop.window); | ||
1997 | ee->prop.window = 0; | ||
1998 | |||
1999 | einfo->info.destination_alpha = alpha; | ||
2000 | |||
2001 | if (ee->engine.x.win_root != 0) | ||
2002 | { | ||
2003 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
2004 | if (ecore_x_window_argb_get(ee->engine.x.win_root)) | ||
2005 | { | ||
2006 | ee->prop.window = | ||
2007 | _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, | ||
2008 | ee->req.x, ee->req.y, | ||
2009 | ee->req.w, ee->req.h, | ||
2010 | ee->prop.override, 1, NULL); | ||
2011 | } | ||
2012 | else | ||
2013 | { | ||
2014 | ee->prop.window = | ||
2015 | _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, | ||
2016 | ee->req.x, ee->req.y, | ||
2017 | ee->req.w, ee->req.h, | ||
2018 | ee->prop.override, ee->alpha, | ||
2019 | NULL); | ||
2020 | } | ||
2021 | } | ||
2022 | else | ||
2023 | { | ||
2024 | ee->prop.window = | ||
2025 | _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, | ||
2026 | ee->req.x, ee->req.y, | ||
2027 | ee->req.w, ee->req.h, | ||
2028 | ee->prop.override, ee->alpha, NULL); | ||
2029 | } | ||
2030 | |||
2031 | if (!ee->prop.window) return; | ||
2032 | /* | ||
2033 | if (ee->alpha) | ||
2034 | { | ||
2035 | if (ee->prop.override) | ||
2036 | 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); | ||
2037 | else | ||
2038 | 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); | ||
2039 | if (!ee->engine.x.mask) | ||
2040 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
2041 | } | ||
2042 | else | ||
2043 | { | ||
2044 | if (ee->prop.override) | ||
2045 | 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); | ||
2046 | else | ||
2047 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2048 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2049 | ee->engine.x.mask = 0; | ||
2050 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
2051 | } | ||
2052 | */ | ||
2053 | |||
2054 | ecore_x_window_attributes_get(ee->prop.window, &att); | ||
2055 | einfo->info.visual = att.visual; | ||
2056 | einfo->info.colormap = att.colormap; | ||
2057 | einfo->info.depth = att.depth; | ||
2058 | |||
2059 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2060 | // ee->engine.x.mask = 0; | ||
2061 | // einfo->info.mask = ee->engine.x.mask; | ||
2062 | einfo->info.drawable = ee->prop.window; | ||
2063 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2064 | { | ||
2065 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2066 | } | ||
2067 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
2068 | // ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
2069 | ecore_x_input_multi_select(ee->prop.window); | ||
2070 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
2071 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2072 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2073 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2074 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2075 | if (ee->prop.borderless) | ||
2076 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2077 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
2078 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2079 | if (ee->prop.title) | ||
2080 | { | ||
2081 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2082 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2083 | } | ||
2084 | _ecore_evas_x_hints_update(ee); | ||
2085 | _ecore_evas_x_group_leader_update(ee); | ||
2086 | ecore_x_window_defaults_set(ee->prop.window); | ||
2087 | _ecore_evas_x_protocols_set(ee); | ||
2088 | _ecore_evas_x_sync_set(ee); | ||
2089 | #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
2090 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
2091 | { | ||
2092 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
2093 | /* NB: on linux this may simply empty the env as opposed to completely | ||
2094 | * unset it to being empty - unsure as solartis libc crashes looking | ||
2095 | * for the '=' char */ | ||
2096 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
2097 | } | ||
2098 | } | ||
2099 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
2100 | { | ||
2101 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
2102 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
2103 | |||
2104 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
2105 | if (!einfo) return; | ||
2106 | |||
2107 | ee->shaped = 0; | ||
2108 | ee->alpha = alpha; | ||
2109 | ecore_x_window_free(ee->prop.window); | ||
2110 | ecore_event_window_unregister(ee->prop.window); | ||
2111 | if (ee->alpha) | ||
2112 | { | ||
2113 | if (ee->prop.override) | ||
2114 | 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); | ||
2115 | else | ||
2116 | 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); | ||
2117 | if (!ee->engine.x.mask) | ||
2118 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
2119 | } | ||
2120 | else | ||
2121 | { | ||
2122 | if (ee->prop.override) | ||
2123 | 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); | ||
2124 | else | ||
2125 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2126 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2127 | ee->engine.x.mask = 0; | ||
2128 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
2129 | } | ||
2130 | |||
2131 | # if 0 /* XXX no alpha window support for software_16_x11 */ | ||
2132 | einfo->info.destination_alpha = alpha; | ||
2133 | # endif /* XXX no alpha window support for software_16_x11 */ | ||
2134 | |||
2135 | # if 0 /* XXX no shaped window support for software_16_x11 */ | ||
2136 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2137 | // ee->engine.x.mask = 0; | ||
2138 | einfo->info.mask = ee->engine.x.mask; | ||
2139 | # endif /* XXX no shaped window support for software_16_x11 */ | ||
2140 | |||
2141 | einfo->info.drawable = ee->prop.window; | ||
2142 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2143 | { | ||
2144 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2145 | } | ||
2146 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
2147 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
2148 | ecore_x_input_multi_select(ee->prop.window); | ||
2149 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
2150 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2151 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2152 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2153 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2154 | if (ee->prop.borderless) | ||
2155 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2156 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
2157 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2158 | if (ee->prop.title) | ||
2159 | { | ||
2160 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2161 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2162 | } | ||
2163 | _ecore_evas_x_hints_update(ee); | ||
2164 | _ecore_evas_x_group_leader_update(ee); | ||
2165 | ecore_x_window_defaults_set(ee->prop.window); | ||
2166 | _ecore_evas_x_protocols_set(ee); | ||
2167 | _ecore_evas_x_sync_set(ee); | ||
2168 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
2169 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
2170 | { | ||
2171 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
2172 | /* NB: on linux this may simply empty the env as opposed to completely | ||
2173 | * unset it to being empty - unsure as solartis libc crashes looking | ||
2174 | * for the '=' char */ | ||
2175 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
2176 | } | ||
2177 | } | ||
2178 | else if (!strcmp(ee->driver, "software_8_x11")) | ||
2179 | { | ||
2180 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
2181 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
2182 | |||
2183 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
2184 | if (!einfo) return; | ||
2185 | |||
2186 | ee->shaped = 0; | ||
2187 | ee->alpha = alpha; | ||
2188 | ecore_x_window_free(ee->prop.window); | ||
2189 | ecore_event_window_unregister(ee->prop.window); | ||
2190 | if (ee->alpha) | ||
2191 | { | ||
2192 | if (ee->prop.override) | ||
2193 | 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); | ||
2194 | else | ||
2195 | 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); | ||
2196 | if (!ee->engine.x.mask) | ||
2197 | ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); | ||
2198 | } | ||
2199 | else | ||
2200 | { | ||
2201 | if (ee->prop.override) | ||
2202 | 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); | ||
2203 | else | ||
2204 | ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); | ||
2205 | if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2206 | ee->engine.x.mask = 0; | ||
2207 | ecore_x_window_shape_input_mask_set(ee->prop.window, 0); | ||
2208 | } | ||
2209 | |||
2210 | einfo->info.destination_alpha = alpha; | ||
2211 | |||
2212 | ecore_x_window_attributes_get(ee->prop.window, &att); | ||
2213 | einfo->info.visual = att.visual; | ||
2214 | einfo->info.colormap = att.colormap; | ||
2215 | einfo->info.depth = att.depth; | ||
2216 | |||
2217 | // if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); | ||
2218 | // ee->engine.x.mask = 0; | ||
2219 | einfo->info.mask = ee->engine.x.mask; | ||
2220 | einfo->info.drawable = ee->prop.window; | ||
2221 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2222 | { | ||
2223 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2224 | } | ||
2225 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); | ||
2226 | ecore_x_window_shape_mask_set(ee->prop.window, 0); | ||
2227 | ecore_x_input_multi_select(ee->prop.window); | ||
2228 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
2229 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
2230 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
2231 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
2232 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
2233 | if (ee->prop.borderless) | ||
2234 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2235 | if (ee->visible) ecore_x_window_show(ee->prop.window); | ||
2236 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2237 | if (ee->prop.title) | ||
2238 | { | ||
2239 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2240 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2241 | } | ||
2242 | _ecore_evas_x_hints_update(ee); | ||
2243 | _ecore_evas_x_group_leader_update(ee); | ||
2244 | ecore_x_window_defaults_set(ee->prop.window); | ||
2245 | _ecore_evas_x_protocols_set(ee); | ||
2246 | _ecore_evas_x_sync_set(ee); | ||
2247 | |||
2248 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
2249 | { | ||
2250 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
2251 | /* NB: on linux this may simply empty the env as opposed to completely | ||
2252 | * unset it to being empty - unsure as solartis libc crashes looking | ||
2253 | * for the '=' char */ | ||
2254 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
2255 | } | ||
2256 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
2257 | } | ||
2258 | } | ||
2259 | |||
2260 | static void | ||
2261 | _ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent) | ||
2262 | { | ||
2263 | if ((ee->transparent == transparent)) return; | ||
2264 | |||
2265 | if (!strcmp(ee->driver, "software_x11")) | ||
2266 | { | ||
2267 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
2268 | Evas_Engine_Info_Software_X11 *einfo; | ||
2269 | |||
2270 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2271 | if (!einfo) return; | ||
2272 | |||
2273 | ee->transparent = transparent; | ||
2274 | einfo->info.destination_alpha = transparent; | ||
2275 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2276 | { | ||
2277 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2278 | } | ||
2279 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2280 | #endif | ||
2281 | } | ||
2282 | } | ||
2283 | |||
2284 | static void | ||
2285 | _ecore_evas_x_window_group_set(Ecore_Evas *ee, const Ecore_Evas *group_ee) | ||
2286 | { | ||
2287 | if (ee->prop.group_ee == group_ee) return; | ||
2288 | |||
2289 | ee->prop.group_ee = (Ecore_Evas *)group_ee; | ||
2290 | if (ee->prop.group_ee) | ||
2291 | ee->prop.group_ee_win = group_ee->prop.window; | ||
2292 | else | ||
2293 | ee->prop.group_ee_win = 0; | ||
2294 | _ecore_evas_x_hints_update(ee); | ||
2295 | } | ||
2296 | |||
2297 | static void | ||
2298 | _ecore_evas_x_aspect_set(Ecore_Evas *ee, double aspect) | ||
2299 | { | ||
2300 | if (ee->prop.aspect == aspect) return; | ||
2301 | |||
2302 | ee->prop.aspect = aspect; | ||
2303 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2304 | // netwm state | ||
2305 | // if (ee->should_be_visible) | ||
2306 | // ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2307 | // ECORE_X_WINDOW_STATE_STICKY, -1, sticky); | ||
2308 | // else | ||
2309 | // _ecore_evas_x_state_update(ee); | ||
2310 | } | ||
2311 | |||
2312 | static void | ||
2313 | _ecore_evas_x_urgent_set(Ecore_Evas *ee, int urgent) | ||
2314 | { | ||
2315 | if (ee->prop.urgent == urgent) return; | ||
2316 | |||
2317 | ee->prop.urgent = urgent; | ||
2318 | _ecore_evas_x_hints_update(ee); | ||
2319 | } | ||
2320 | |||
2321 | static void | ||
2322 | _ecore_evas_x_modal_set(Ecore_Evas *ee, int modal) | ||
2323 | { | ||
2324 | if (ee->prop.modal == modal) return; | ||
2325 | |||
2326 | ee->prop.modal = modal; | ||
2327 | if (ee->should_be_visible) | ||
2328 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2329 | ECORE_X_WINDOW_STATE_MODAL, -1, modal); | ||
2330 | else | ||
2331 | _ecore_evas_x_state_update(ee); | ||
2332 | } | ||
2333 | |||
2334 | static void | ||
2335 | _ecore_evas_x_demand_attention_set(Ecore_Evas *ee, int demand) | ||
2336 | { | ||
2337 | if (ee->prop.demand_attention == demand) return; | ||
2338 | |||
2339 | ee->prop.demand_attention = demand; | ||
2340 | if (ee->should_be_visible) | ||
2341 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2342 | ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION, -1, demand); | ||
2343 | else | ||
2344 | _ecore_evas_x_state_update(ee); | ||
2345 | } | ||
2346 | |||
2347 | static void | ||
2348 | _ecore_evas_x_focus_skip_set(Ecore_Evas *ee, int skip) | ||
2349 | { | ||
2350 | if (ee->prop.focus_skip == skip) return; | ||
2351 | |||
2352 | ee->prop.focus_skip = skip; | ||
2353 | if (ee->should_be_visible) | ||
2354 | { | ||
2355 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2356 | ECORE_X_WINDOW_STATE_SKIP_TASKBAR, -1, skip); | ||
2357 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2358 | ECORE_X_WINDOW_STATE_SKIP_PAGER, -1, skip); | ||
2359 | } | ||
2360 | else | ||
2361 | _ecore_evas_x_state_update(ee); | ||
2362 | _ecore_evas_x_hints_update(ee); | ||
2363 | } | ||
2364 | |||
2365 | #endif /* BUILD_ECORE_EVAS_X11 */ | ||
2366 | |||
2367 | #ifdef BUILD_ECORE_EVAS_X11 | ||
2368 | static void | ||
2369 | _ecore_evas_x_show(Ecore_Evas *ee) | ||
2370 | { | ||
2371 | ee->should_be_visible = 1; | ||
2372 | if (ee->prop.avoid_damage) | ||
2373 | _ecore_evas_x_render(ee); | ||
2374 | _ecore_evas_x_sync_set(ee); | ||
2375 | ecore_x_window_show(ee->prop.window); | ||
2376 | if (ee->prop.fullscreen) | ||
2377 | ecore_x_window_focus(ee->prop.window); | ||
2378 | } | ||
2379 | |||
2380 | static void | ||
2381 | _ecore_evas_x_hide(Ecore_Evas *ee) | ||
2382 | { | ||
2383 | ecore_x_window_hide(ee->prop.window); | ||
2384 | ee->should_be_visible = 0; | ||
2385 | _ecore_evas_x_sync_set(ee); | ||
2386 | } | ||
2387 | |||
2388 | static void | ||
2389 | _ecore_evas_x_raise(Ecore_Evas *ee) | ||
2390 | { | ||
2391 | ecore_x_window_raise(ee->prop.window); | ||
2392 | } | ||
2393 | |||
2394 | static void | ||
2395 | _ecore_evas_x_lower(Ecore_Evas *ee) | ||
2396 | { | ||
2397 | ecore_x_window_lower(ee->prop.window); | ||
2398 | } | ||
2399 | |||
2400 | static void | ||
2401 | _ecore_evas_x_activate(Ecore_Evas *ee) | ||
2402 | { | ||
2403 | ecore_x_netwm_client_active_request(ee->engine.x.win_root, | ||
2404 | ee->prop.window, 2, 0); | ||
2405 | } | ||
2406 | |||
2407 | static void | ||
2408 | _ecore_evas_x_title_set(Ecore_Evas *ee, const char *t) | ||
2409 | { | ||
2410 | if (ee->prop.title) free(ee->prop.title); | ||
2411 | ee->prop.title = NULL; | ||
2412 | if (t) ee->prop.title = strdup(t); | ||
2413 | ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); | ||
2414 | ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); | ||
2415 | } | ||
2416 | |||
2417 | static void | ||
2418 | _ecore_evas_x_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
2419 | { | ||
2420 | if (ee->prop.name) free(ee->prop.name); | ||
2421 | if (ee->prop.clas) free(ee->prop.clas); | ||
2422 | ee->prop.name = NULL; | ||
2423 | ee->prop.clas = NULL; | ||
2424 | if (n) ee->prop.name = strdup(n); | ||
2425 | if (c) ee->prop.clas = strdup(c); | ||
2426 | ecore_x_icccm_name_class_set(ee->prop.window, ee->prop.name, ee->prop.clas); | ||
2427 | } | ||
2428 | |||
2429 | static void | ||
2430 | _ecore_evas_x_size_min_set(Ecore_Evas *ee, int w, int h) | ||
2431 | { | ||
2432 | if (w < 0) w = 0; | ||
2433 | if (h < 0) h = 0; | ||
2434 | if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; | ||
2435 | ee->prop.min.w = w; | ||
2436 | ee->prop.min.h = h; | ||
2437 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2438 | } | ||
2439 | |||
2440 | static void | ||
2441 | _ecore_evas_x_size_max_set(Ecore_Evas *ee, int w, int h) | ||
2442 | { | ||
2443 | if (w < 0) w = 0; | ||
2444 | if (h < 0) h = 0; | ||
2445 | if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; | ||
2446 | ee->prop.max.w = w; | ||
2447 | ee->prop.max.h = h; | ||
2448 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2449 | } | ||
2450 | |||
2451 | static void | ||
2452 | _ecore_evas_x_size_base_set(Ecore_Evas *ee, int w, int h) | ||
2453 | { | ||
2454 | if (w < 0) w = 0; | ||
2455 | if (h < 0) h = 0; | ||
2456 | if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; | ||
2457 | ee->prop.base.w = w; | ||
2458 | ee->prop.base.h = h; | ||
2459 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2460 | } | ||
2461 | |||
2462 | static void | ||
2463 | _ecore_evas_x_size_step_set(Ecore_Evas *ee, int w, int h) | ||
2464 | { | ||
2465 | if (w < 1) w = 1; | ||
2466 | if (h < 1) h = 1; | ||
2467 | if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; | ||
2468 | ee->prop.step.w = w; | ||
2469 | ee->prop.step.h = h; | ||
2470 | _ecore_evas_x_size_pos_hints_update(ee); | ||
2471 | } | ||
2472 | |||
2473 | static void | ||
2474 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
2475 | { | ||
2476 | Ecore_Evas *ee; | ||
2477 | |||
2478 | ee = data; | ||
2479 | if (ee) ee->prop.cursor.object = NULL; | ||
2480 | } | ||
2481 | |||
2482 | static void | ||
2483 | _ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
2484 | { | ||
2485 | int x, y; | ||
2486 | |||
2487 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
2488 | |||
2489 | if (!obj) | ||
2490 | { | ||
2491 | ee->prop.cursor.object = NULL; | ||
2492 | ee->prop.cursor.layer = 0; | ||
2493 | ee->prop.cursor.hot.x = 0; | ||
2494 | ee->prop.cursor.hot.y = 0; | ||
2495 | ecore_x_window_cursor_show(ee->prop.window, 1); | ||
2496 | return; | ||
2497 | } | ||
2498 | |||
2499 | ee->prop.cursor.object = obj; | ||
2500 | ee->prop.cursor.layer = layer; | ||
2501 | ee->prop.cursor.hot.x = hot_x; | ||
2502 | ee->prop.cursor.hot.y = hot_y; | ||
2503 | |||
2504 | ecore_x_window_cursor_show(ee->prop.window, 0); | ||
2505 | |||
2506 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
2507 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
2508 | evas_object_move(ee->prop.cursor.object, | ||
2509 | x - ee->prop.cursor.hot.x, | ||
2510 | y - ee->prop.cursor.hot.y); | ||
2511 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
2512 | if (evas_pointer_inside_get(ee->evas)) | ||
2513 | evas_object_show(ee->prop.cursor.object); | ||
2514 | |||
2515 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
2516 | } | ||
2517 | |||
2518 | /* | ||
2519 | * @param ee | ||
2520 | * @param layer If < 3, @a ee will be put below all other windows. | ||
2521 | * If > 5, @a ee will be "always-on-top" | ||
2522 | * If = 4, @a ee will be put in the default layer. | ||
2523 | * Acceptable values range from 1 to 255 (0 reserved for | ||
2524 | * desktop windows) | ||
2525 | */ | ||
2526 | static void | ||
2527 | _ecore_evas_x_layer_set(Ecore_Evas *ee, int layer) | ||
2528 | { | ||
2529 | if (ee->prop.layer == layer) return; | ||
2530 | |||
2531 | /* FIXME: Should this logic be here? */ | ||
2532 | if (layer < 1) | ||
2533 | layer = 1; | ||
2534 | else if (layer > 255) | ||
2535 | layer = 255; | ||
2536 | |||
2537 | ee->prop.layer = layer; | ||
2538 | _ecore_evas_x_layer_update(ee); | ||
2539 | } | ||
2540 | |||
2541 | static void | ||
2542 | _ecore_evas_x_focus_set(Ecore_Evas *ee, int on __UNUSED__) | ||
2543 | { | ||
2544 | ecore_x_window_focus(ee->prop.window); | ||
2545 | } | ||
2546 | |||
2547 | static void | ||
2548 | _ecore_evas_x_iconified_set(Ecore_Evas *ee, int on) | ||
2549 | { | ||
2550 | if (ee->prop.iconified == on) return; | ||
2551 | ee->prop.iconified = on; | ||
2552 | _ecore_evas_x_hints_update(ee); | ||
2553 | if (on) | ||
2554 | ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root); | ||
2555 | else | ||
2556 | ecore_evas_show(ee); | ||
2557 | } | ||
2558 | |||
2559 | static void | ||
2560 | _ecore_evas_x_borderless_set(Ecore_Evas *ee, int on) | ||
2561 | { | ||
2562 | if (ee->prop.borderless == on) return; | ||
2563 | ee->prop.borderless = on; | ||
2564 | ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); | ||
2565 | } | ||
2566 | |||
2567 | /* FIXME: This function changes the initial state of the ee | ||
2568 | * whilest the iconic function changes the current state! */ | ||
2569 | static void | ||
2570 | _ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn) | ||
2571 | { | ||
2572 | if (ee->prop.withdrawn == withdrawn) return; | ||
2573 | ee->prop.withdrawn = withdrawn; | ||
2574 | _ecore_evas_x_hints_update(ee); | ||
2575 | } | ||
2576 | |||
2577 | static void | ||
2578 | _ecore_evas_x_sticky_set(Ecore_Evas *ee, int sticky) | ||
2579 | { | ||
2580 | if (ee->prop.sticky == sticky) return; | ||
2581 | |||
2582 | /* We dont want to set prop.sticky here as it will cause | ||
2583 | * the sticky callback not to get called. Its set on the | ||
2584 | * property change event. | ||
2585 | * ee->prop.sticky = sticky; | ||
2586 | */ | ||
2587 | ee->engine.x.state.sticky = sticky; | ||
2588 | if (ee->should_be_visible) | ||
2589 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2590 | ECORE_X_WINDOW_STATE_STICKY, -1, sticky); | ||
2591 | else | ||
2592 | _ecore_evas_x_state_update(ee); | ||
2593 | } | ||
2594 | |||
2595 | static void | ||
2596 | _ecore_evas_x_ignore_events_set(Ecore_Evas *ee, int ignore) | ||
2597 | { | ||
2598 | if (ee->ignore_events == ignore) return; | ||
2599 | |||
2600 | ee->ignore_events = ignore; | ||
2601 | if (ee->prop.window) | ||
2602 | ecore_x_window_ignore_set(ee->prop.window, ignore); | ||
2603 | } | ||
2604 | |||
2605 | /* | ||
2606 | static void | ||
2607 | _ecore_evas_x_reinit_win(Ecore_Evas *ee) | ||
2608 | { | ||
2609 | if (!strcmp(ee->driver, "software_x11")) | ||
2610 | { | ||
2611 | #ifdef BUILD_ECORE_EVAS_X11 | ||
2612 | Evas_Engine_Info_Software_X11 *einfo; | ||
2613 | |||
2614 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2615 | if (einfo) | ||
2616 | { | ||
2617 | einfo->info.drawable = ee->prop.window; | ||
2618 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
2619 | } | ||
2620 | #endif | ||
2621 | } | ||
2622 | else if (!strcmp(ee->driver, "opengl_x11")) | ||
2623 | { | ||
2624 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
2625 | Evas_Engine_Info_GL_X11 *einfo; | ||
2626 | |||
2627 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
2628 | if (einfo) | ||
2629 | { | ||
2630 | einfo->info.drawable = ee->prop.window; | ||
2631 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
2632 | } | ||
2633 | #endif | ||
2634 | } | ||
2635 | } | ||
2636 | */ | ||
2637 | |||
2638 | static void | ||
2639 | _ecore_evas_x_override_set(Ecore_Evas *ee, int on) | ||
2640 | { | ||
2641 | if (ee->prop.override == on) return; | ||
2642 | if (ee->should_be_visible) ecore_x_window_hide(ee->prop.window); | ||
2643 | ecore_x_window_override_set(ee->prop.window, on); | ||
2644 | if (ee->should_be_visible) ecore_x_window_show(ee->prop.window); | ||
2645 | if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); | ||
2646 | ee->prop.override = on; | ||
2647 | } | ||
2648 | |||
2649 | static void | ||
2650 | _ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on) | ||
2651 | { | ||
2652 | if (ee->prop.fullscreen == on) return; | ||
2653 | |||
2654 | /* FIXME: Detect if WM is EWMH compliant and handle properly if not, | ||
2655 | * i.e. reposition, resize, and change borderless hint */ | ||
2656 | ee->engine.x.state.fullscreen = on; | ||
2657 | if (ee->should_be_visible) | ||
2658 | ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, | ||
2659 | ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on); | ||
2660 | else | ||
2661 | _ecore_evas_x_state_update(ee); | ||
2662 | } | ||
2663 | |||
2664 | static void | ||
2665 | _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) | ||
2666 | { | ||
2667 | if (ee->prop.avoid_damage == on) return; | ||
2668 | if (!strcmp(ee->driver, "opengl_x11")) return; | ||
2669 | |||
2670 | if (!strcmp(ee->driver, "software_x11")) | ||
2671 | { | ||
2672 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
2673 | Evas_Engine_Info_Software_X11 *einfo; | ||
2674 | |||
2675 | ee->prop.avoid_damage = on; | ||
2676 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
2677 | if (einfo) | ||
2678 | { | ||
2679 | if (ee->prop.avoid_damage) | ||
2680 | { | ||
2681 | ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth); | ||
2682 | ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); | ||
2683 | einfo->info.drawable = ee->engine.x.pmap; | ||
2684 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2685 | { | ||
2686 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2687 | } | ||
2688 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
2689 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
2690 | else | ||
2691 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2692 | if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN) | ||
2693 | { | ||
2694 | ee->engine.x.using_bg_pixmap = 1; | ||
2695 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2696 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2697 | } | ||
2698 | if (ee->engine.x.direct_resize) | ||
2699 | { | ||
2700 | /* Turn this off for now | ||
2701 | ee->engine.x.using_bg_pixmap = 1; | ||
2702 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2703 | */ | ||
2704 | } | ||
2705 | } | ||
2706 | else | ||
2707 | { | ||
2708 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
2709 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
2710 | if (ee->engine.x.using_bg_pixmap) | ||
2711 | { | ||
2712 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
2713 | ee->engine.x.using_bg_pixmap = 0; | ||
2714 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2715 | } | ||
2716 | ee->engine.x.pmap = 0; | ||
2717 | ee->engine.x.gc = 0; | ||
2718 | einfo->info.drawable = ee->prop.window; | ||
2719 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2720 | { | ||
2721 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2722 | } | ||
2723 | } | ||
2724 | } | ||
2725 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ | ||
2726 | } | ||
2727 | else if (!strcmp(ee->driver, "software_16_x11")) | ||
2728 | { | ||
2729 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
2730 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
2731 | |||
2732 | ee->prop.avoid_damage = on; | ||
2733 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
2734 | if (einfo) | ||
2735 | { | ||
2736 | if (ee->prop.avoid_damage) | ||
2737 | { | ||
2738 | ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 16); | ||
2739 | ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); | ||
2740 | einfo->info.drawable = ee->engine.x.pmap; | ||
2741 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2742 | { | ||
2743 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2744 | } | ||
2745 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
2746 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
2747 | else | ||
2748 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2749 | if (ee->engine.x.direct_resize) | ||
2750 | { | ||
2751 | /* Turn this off for now | ||
2752 | ee->engine.x.using_bg_pixmap = 1; | ||
2753 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2754 | */ | ||
2755 | } | ||
2756 | } | ||
2757 | else | ||
2758 | { | ||
2759 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
2760 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
2761 | if (ee->engine.x.using_bg_pixmap) | ||
2762 | { | ||
2763 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
2764 | ee->engine.x.using_bg_pixmap = 0; | ||
2765 | } | ||
2766 | ee->engine.x.pmap = 0; | ||
2767 | ee->engine.x.gc = 0; | ||
2768 | einfo->info.drawable = ee->prop.window; | ||
2769 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2770 | { | ||
2771 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2772 | } | ||
2773 | } | ||
2774 | } | ||
2775 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
2776 | } | ||
2777 | else if (!strcmp(ee->driver, "software_8_x11")) | ||
2778 | { | ||
2779 | #if BUILD_ECORE_EVAS_SOFTWARE_8_X11 | ||
2780 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
2781 | |||
2782 | ee->prop.avoid_damage = on; | ||
2783 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
2784 | if (einfo) | ||
2785 | { | ||
2786 | if (ee->prop.avoid_damage) | ||
2787 | { | ||
2788 | ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth); | ||
2789 | ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); | ||
2790 | einfo->info.drawable = ee->engine.x.pmap; | ||
2791 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2792 | { | ||
2793 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2794 | } | ||
2795 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
2796 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
2797 | else | ||
2798 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
2799 | if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN) | ||
2800 | { | ||
2801 | ee->engine.x.using_bg_pixmap = 1; | ||
2802 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2803 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2804 | } | ||
2805 | if (ee->engine.x.direct_resize) | ||
2806 | { | ||
2807 | /* Turn this off for now | ||
2808 | ee->engine.x.using_bg_pixmap = 1; | ||
2809 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
2810 | */ | ||
2811 | } | ||
2812 | } | ||
2813 | else | ||
2814 | { | ||
2815 | if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); | ||
2816 | if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); | ||
2817 | if (ee->engine.x.using_bg_pixmap) | ||
2818 | { | ||
2819 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
2820 | ee->engine.x.using_bg_pixmap = 0; | ||
2821 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
2822 | } | ||
2823 | ee->engine.x.pmap = 0; | ||
2824 | ee->engine.x.gc = 0; | ||
2825 | einfo->info.drawable = ee->prop.window; | ||
2826 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2827 | { | ||
2828 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2829 | } | ||
2830 | } | ||
2831 | } | ||
2832 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
2833 | } | ||
2834 | } | ||
2835 | |||
2836 | static void | ||
2837 | _ecore_evas_x_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
2838 | { | ||
2839 | if (x) *x = 0; | ||
2840 | if (y) *y = 0; | ||
2841 | ecore_x_screen_size_get(ecore_x_default_screen_get(), w, h); | ||
2842 | } | ||
2843 | |||
2844 | int | ||
2845 | _ecore_evas_x_shutdown(void) | ||
2846 | { | ||
2847 | _ecore_evas_init_count--; | ||
2848 | if (_ecore_evas_init_count == 0) | ||
2849 | { | ||
2850 | unsigned int i; | ||
2851 | |||
2852 | for (i = 0; i < sizeof(ecore_evas_event_handlers) / sizeof(Ecore_Event_Handler*); i++) | ||
2853 | { | ||
2854 | if (ecore_evas_event_handlers[i]) | ||
2855 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
2856 | } | ||
2857 | ecore_event_evas_shutdown(); | ||
2858 | } | ||
2859 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
2860 | return _ecore_evas_init_count; | ||
2861 | } | ||
2862 | |||
2863 | static Ecore_Evas_Engine_Func _ecore_x_engine_func = | ||
2864 | { | ||
2865 | _ecore_evas_x_free, | ||
2866 | NULL, | ||
2867 | NULL, | ||
2868 | NULL, | ||
2869 | NULL, | ||
2870 | _ecore_evas_x_callback_delete_request_set, | ||
2871 | NULL, | ||
2872 | NULL, | ||
2873 | NULL, | ||
2874 | NULL, | ||
2875 | NULL, | ||
2876 | NULL, | ||
2877 | NULL, | ||
2878 | NULL, | ||
2879 | NULL, | ||
2880 | _ecore_evas_x_move, | ||
2881 | _ecore_evas_x_managed_move, | ||
2882 | _ecore_evas_x_resize, | ||
2883 | _ecore_evas_x_move_resize, | ||
2884 | _ecore_evas_x_rotation_set, | ||
2885 | _ecore_evas_x_shaped_set, | ||
2886 | _ecore_evas_x_show, | ||
2887 | _ecore_evas_x_hide, | ||
2888 | _ecore_evas_x_raise, | ||
2889 | _ecore_evas_x_lower, | ||
2890 | _ecore_evas_x_activate, | ||
2891 | _ecore_evas_x_title_set, | ||
2892 | _ecore_evas_x_name_class_set, | ||
2893 | _ecore_evas_x_size_min_set, | ||
2894 | _ecore_evas_x_size_max_set, | ||
2895 | _ecore_evas_x_size_base_set, | ||
2896 | _ecore_evas_x_size_step_set, | ||
2897 | _ecore_evas_x_object_cursor_set, | ||
2898 | _ecore_evas_x_layer_set, | ||
2899 | _ecore_evas_x_focus_set, | ||
2900 | _ecore_evas_x_iconified_set, | ||
2901 | _ecore_evas_x_borderless_set, | ||
2902 | _ecore_evas_x_override_set, | ||
2903 | NULL, | ||
2904 | _ecore_evas_x_fullscreen_set, | ||
2905 | _ecore_evas_x_avoid_damage_set, | ||
2906 | _ecore_evas_x_withdrawn_set, | ||
2907 | _ecore_evas_x_sticky_set, | ||
2908 | _ecore_evas_x_ignore_events_set, | ||
2909 | _ecore_evas_x_alpha_set, | ||
2910 | _ecore_evas_x_transparent_set, | ||
2911 | |||
2912 | _ecore_evas_x_window_group_set, | ||
2913 | _ecore_evas_x_aspect_set, | ||
2914 | _ecore_evas_x_urgent_set, | ||
2915 | _ecore_evas_x_modal_set, | ||
2916 | _ecore_evas_x_demand_attention_set, | ||
2917 | _ecore_evas_x_focus_skip_set, | ||
2918 | |||
2919 | NULL, // render | ||
2920 | _ecore_evas_x_screen_geometry_get | ||
2921 | }; | ||
2922 | #endif /* BUILD_ECORE_EVAS_X11 */ | ||
2923 | |||
2924 | /* | ||
2925 | * FIXME: there are some round trips. Especially, we can split | ||
2926 | * ecore_x_init in 2 functions and suppress some round trips. | ||
2927 | */ | ||
2928 | |||
2929 | #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) | ||
2930 | static void | ||
2931 | _ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
2932 | { | ||
2933 | Ecore_Evas *ee = data; | ||
2934 | |||
2935 | if (ee->no_comp_sync) return; | ||
2936 | if (!_ecore_evas_app_comp_sync) return; | ||
2937 | if (ee->engine.x.sync_counter) | ||
2938 | { | ||
2939 | if (ee->engine.x.sync_began) | ||
2940 | { | ||
2941 | ee->engine.x.sync_val++; | ||
2942 | if (!ee->engine.x.sync_cancel) | ||
2943 | { | ||
2944 | if (!ee->semi_sync) | ||
2945 | ecore_x_sync_counter_val_wait(ee->engine.x.sync_counter, | ||
2946 | ee->engine.x.sync_val); | ||
2947 | } | ||
2948 | } | ||
2949 | } | ||
2950 | } | ||
2951 | |||
2952 | static void | ||
2953 | _ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
2954 | { | ||
2955 | Ecore_Evas *ee = data; | ||
2956 | |||
2957 | if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync)) | ||
2958 | { | ||
2959 | if (ee->engine.x.sync_counter) | ||
2960 | { | ||
2961 | if (ee->engine.x.sync_began) | ||
2962 | { | ||
2963 | if (!ee->engine.x.sync_cancel) | ||
2964 | { | ||
2965 | ecore_x_e_comp_sync_draw_size_done_send | ||
2966 | (ee->engine.x.win_root, ee->prop.window, ee->w, ee->h); | ||
2967 | } | ||
2968 | } | ||
2969 | } | ||
2970 | } | ||
2971 | if (ee->engine.x.netwm_sync_set) | ||
2972 | { | ||
2973 | ecore_x_sync_counter_2_set(ee->engine.x.netwm_sync_counter, | ||
2974 | ee->engine.x.netwm_sync_val_hi, | ||
2975 | ee->engine.x.netwm_sync_val_lo); | ||
2976 | ee->engine.x.netwm_sync_set = 0; | ||
2977 | } | ||
2978 | } | ||
2979 | #endif | ||
2980 | |||
2981 | /** | ||
2982 | * To be documented. | ||
2983 | * | ||
2984 | * FIXME: To be fixed. | ||
2985 | */ | ||
2986 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
2987 | EAPI Ecore_Evas * | ||
2988 | ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, | ||
2989 | int x, int y, int w, int h) | ||
2990 | { | ||
2991 | Evas_Engine_Info_Software_X11 *einfo; | ||
2992 | Ecore_Evas *ee; | ||
2993 | int argb = 0, rmethod; | ||
2994 | static int redraw_debug = -1; | ||
2995 | char *id = NULL; | ||
2996 | |||
2997 | rmethod = evas_render_method_lookup("software_x11"); | ||
2998 | if (!rmethod) return NULL; | ||
2999 | if (!ecore_x_init(disp_name)) return NULL; | ||
3000 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3001 | if (!ee) return NULL; | ||
3002 | |||
3003 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3004 | |||
3005 | _ecore_evas_x_init(); | ||
3006 | |||
3007 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3008 | |||
3009 | ee->driver = "software_x11"; | ||
3010 | if (disp_name) ee->name = strdup(disp_name); | ||
3011 | |||
3012 | if (w < 1) w = 1; | ||
3013 | if (h < 1) h = 1; | ||
3014 | ee->x = x; | ||
3015 | ee->y = y; | ||
3016 | ee->w = w; | ||
3017 | ee->h = h; | ||
3018 | ee->req.x = ee->x; | ||
3019 | ee->req.y = ee->y; | ||
3020 | ee->req.w = ee->w; | ||
3021 | ee->req.h = ee->h; | ||
3022 | |||
3023 | ee->prop.max.w = 32767; | ||
3024 | ee->prop.max.h = 32767; | ||
3025 | ee->prop.layer = 4; | ||
3026 | ee->prop.request_pos = 0; | ||
3027 | ee->prop.sticky = 0; | ||
3028 | ee->engine.x.state.sticky = 0; | ||
3029 | |||
3030 | /* init evas here */ | ||
3031 | ee->evas = evas_new(); | ||
3032 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, | ||
3033 | _ecore_evas_x_flush_pre, ee); | ||
3034 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, | ||
3035 | _ecore_evas_x_flush_post, ee); | ||
3036 | evas_data_attach_set(ee->evas, ee); | ||
3037 | evas_output_method_set(ee->evas, rmethod); | ||
3038 | evas_output_size_set(ee->evas, w, h); | ||
3039 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3040 | |||
3041 | ee->engine.x.win_root = parent; | ||
3042 | ee->engine.x.screen_num = 0; | ||
3043 | |||
3044 | if (parent != 0) | ||
3045 | { | ||
3046 | ee->engine.x.screen_num = 1; /* FIXME: get real scren # */ | ||
3047 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3048 | if (ecore_x_window_argb_get(parent)) | ||
3049 | { | ||
3050 | ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); | ||
3051 | argb = 1; | ||
3052 | } | ||
3053 | else | ||
3054 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3055 | } | ||
3056 | else | ||
3057 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3058 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
3059 | { | ||
3060 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
3061 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3062 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3063 | * for the '=' char */ | ||
3064 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3065 | } | ||
3066 | einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); | ||
3067 | if (einfo) | ||
3068 | { | ||
3069 | Ecore_X_Screen *screen; | ||
3070 | |||
3071 | /* FIXME: this is inefficient as its 1 or more round trips */ | ||
3072 | screen = ecore_x_default_screen_get(); | ||
3073 | if (ecore_x_screen_count_get() > 1) | ||
3074 | { | ||
3075 | Ecore_X_Window *roots; | ||
3076 | int num, i; | ||
3077 | |||
3078 | num = 0; | ||
3079 | roots = ecore_x_window_root_list(&num); | ||
3080 | if (roots) | ||
3081 | { | ||
3082 | Ecore_X_Window root; | ||
3083 | |||
3084 | root = ecore_x_window_root_get(parent); | ||
3085 | for (i = 0; i < num; i++) | ||
3086 | { | ||
3087 | if (root == roots[i]) | ||
3088 | { | ||
3089 | screen = ecore_x_screen_get(i); | ||
3090 | break; | ||
3091 | } | ||
3092 | } | ||
3093 | free(roots); | ||
3094 | } | ||
3095 | } | ||
3096 | |||
3097 | einfo->info.destination_alpha = argb; | ||
3098 | |||
3099 | if (redraw_debug < 0) | ||
3100 | { | ||
3101 | if (getenv("REDRAW_DEBUG")) | ||
3102 | redraw_debug = atoi(getenv("REDRAW_DEBUG")); | ||
3103 | else | ||
3104 | redraw_debug = 0; | ||
3105 | } | ||
3106 | |||
3107 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB | ||
3108 | einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB; | ||
3109 | einfo->info.connection = ecore_x_connection_get(); | ||
3110 | einfo->info.screen = screen; | ||
3111 | # else | ||
3112 | einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB; | ||
3113 | einfo->info.connection = ecore_x_display_get(); | ||
3114 | einfo->info.screen = NULL; | ||
3115 | # endif | ||
3116 | einfo->info.drawable = ee->prop.window; | ||
3117 | |||
3118 | # ifdef EVAS_FRAME_QUEUING | ||
3119 | { | ||
3120 | char *render_mode; | ||
3121 | |||
3122 | render_mode = getenv("EVAS_RENDER_MODE"); | ||
3123 | if ((render_mode) && (!strcmp(render_mode, "non-blocking"))) | ||
3124 | einfo->render_mode = EVAS_RENDER_MODE_NONBLOCKING; | ||
3125 | } | ||
3126 | # endif | ||
3127 | |||
3128 | if (argb) | ||
3129 | { | ||
3130 | Ecore_X_Window_Attributes at; | ||
3131 | |||
3132 | ecore_x_window_attributes_get(ee->prop.window, &at); | ||
3133 | einfo->info.visual = at.visual; | ||
3134 | einfo->info.colormap = at.colormap; | ||
3135 | einfo->info.depth = at.depth; | ||
3136 | einfo->info.destination_alpha = 1; | ||
3137 | } | ||
3138 | else | ||
3139 | { | ||
3140 | einfo->info.visual = | ||
3141 | ecore_x_default_visual_get(einfo->info.connection, screen); | ||
3142 | einfo->info.colormap = | ||
3143 | ecore_x_default_colormap_get(einfo->info.connection, screen); | ||
3144 | einfo->info.depth = | ||
3145 | ecore_x_default_depth_get(einfo->info.connection, screen); | ||
3146 | einfo->info.destination_alpha = 0; | ||
3147 | } | ||
3148 | |||
3149 | einfo->info.rotation = 0; | ||
3150 | einfo->info.debug = redraw_debug; | ||
3151 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
3152 | { | ||
3153 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3154 | ecore_evas_free(ee); | ||
3155 | return NULL; | ||
3156 | } | ||
3157 | } | ||
3158 | |||
3159 | _ecore_evas_x_hints_update(ee); | ||
3160 | _ecore_evas_x_group_leader_set(ee); | ||
3161 | ecore_x_window_defaults_set(ee->prop.window); | ||
3162 | _ecore_evas_x_protocols_set(ee); | ||
3163 | _ecore_evas_x_sync_set(ee); | ||
3164 | |||
3165 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
3166 | _ecore_evas_register(ee); | ||
3167 | ecore_x_input_multi_select(ee->prop.window); | ||
3168 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
3169 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3170 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3171 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3172 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3173 | return ee; | ||
3174 | } | ||
3175 | #else | ||
3176 | EAPI Ecore_Evas * | ||
3177 | ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3178 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3179 | { | ||
3180 | return NULL; | ||
3181 | } | ||
3182 | #endif | ||
3183 | |||
3184 | /** | ||
3185 | * To be documented. | ||
3186 | * | ||
3187 | * FIXME: To be fixed. | ||
3188 | */ | ||
3189 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3190 | EAPI Ecore_X_Window | ||
3191 | ecore_evas_software_x11_window_get(const Ecore_Evas *ee) | ||
3192 | { | ||
3193 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3194 | } | ||
3195 | #else | ||
3196 | EAPI Ecore_X_Window | ||
3197 | ecore_evas_software_x11_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3198 | { | ||
3199 | return 0; | ||
3200 | } | ||
3201 | #endif | ||
3202 | |||
3203 | /** | ||
3204 | * To be documented. | ||
3205 | * | ||
3206 | * FIXME: To be fixed. | ||
3207 | */ | ||
3208 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3209 | EAPI void | ||
3210 | ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3211 | { | ||
3212 | ee->engine.x.direct_resize = on; | ||
3213 | if (ee->prop.avoid_damage) | ||
3214 | { | ||
3215 | if (ee->engine.x.direct_resize) | ||
3216 | { | ||
3217 | /* turn this off for now | ||
3218 | ee->engine.x.using_bg_pixmap = 1; | ||
3219 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
3220 | */ | ||
3221 | } | ||
3222 | else | ||
3223 | { | ||
3224 | /* turn this off too- bg pixmap is controlled by avoid damage directly | ||
3225 | ee->engine.x.using_bg_pixmap = 0; | ||
3226 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
3227 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
3228 | */ | ||
3229 | } | ||
3230 | } | ||
3231 | } | ||
3232 | #else | ||
3233 | EAPI void | ||
3234 | ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3235 | { | ||
3236 | } | ||
3237 | #endif | ||
3238 | |||
3239 | /** | ||
3240 | * To be documented. | ||
3241 | * | ||
3242 | * FIXME: To be fixed. | ||
3243 | */ | ||
3244 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3245 | EAPI Eina_Bool | ||
3246 | ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee) | ||
3247 | { | ||
3248 | return ee->engine.x.direct_resize; | ||
3249 | } | ||
3250 | #else | ||
3251 | EAPI Eina_Bool | ||
3252 | ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3253 | { | ||
3254 | return 0; | ||
3255 | } | ||
3256 | #endif | ||
3257 | |||
3258 | /** | ||
3259 | * To be documented. | ||
3260 | * | ||
3261 | * FIXME: To be fixed. | ||
3262 | */ | ||
3263 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 | ||
3264 | EAPI void | ||
3265 | ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3266 | { | ||
3267 | Ecore_X_Window *winp; | ||
3268 | |||
3269 | winp = malloc(sizeof(Ecore_X_Window)); | ||
3270 | if (winp) | ||
3271 | { | ||
3272 | *winp = win; | ||
3273 | ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); | ||
3274 | ecore_x_input_multi_select(win); | ||
3275 | ecore_event_window_register(win, ee, ee->evas, | ||
3276 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3277 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3278 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3279 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3280 | } | ||
3281 | } | ||
3282 | #else | ||
3283 | EAPI void | ||
3284 | ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3285 | { | ||
3286 | } | ||
3287 | #endif | ||
3288 | |||
3289 | /** | ||
3290 | * To be documented. | ||
3291 | * | ||
3292 | * FIXME: To be fixed. | ||
3293 | */ | ||
3294 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3295 | EAPI Ecore_Evas * | ||
3296 | ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, | ||
3297 | int x, int y, int w, int h) | ||
3298 | { | ||
3299 | return ecore_evas_gl_x11_options_new(disp_name, parent, x, y, w, h, NULL); | ||
3300 | } | ||
3301 | |||
3302 | EAPI Ecore_Evas * | ||
3303 | ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, | ||
3304 | int x, int y, int w, int h, const int *opt) | ||
3305 | { | ||
3306 | Ecore_Evas *ee; | ||
3307 | int rmethod; | ||
3308 | char *id = NULL; | ||
3309 | |||
3310 | rmethod = evas_render_method_lookup("gl_x11"); | ||
3311 | if (!rmethod) return NULL; | ||
3312 | if (!ecore_x_init(disp_name)) return NULL; | ||
3313 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3314 | if (!ee) return NULL; | ||
3315 | |||
3316 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3317 | |||
3318 | _ecore_evas_x_init(); | ||
3319 | |||
3320 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3321 | |||
3322 | ee->driver = "opengl_x11"; | ||
3323 | if (!getenv("ECORE_EVAS_COMP_NOSEMISYNC")) | ||
3324 | ee->semi_sync = 1; // gl engine doesn't need to sync - its whole swaps | ||
3325 | // ee->no_comp_sync = 1; // gl engine doesn't need to sync - its whole swaps | ||
3326 | if (disp_name) ee->name = strdup(disp_name); | ||
3327 | |||
3328 | if (w < 1) w = 1; | ||
3329 | if (h < 1) h = 1; | ||
3330 | ee->x = x; | ||
3331 | ee->y = y; | ||
3332 | ee->w = w; | ||
3333 | ee->h = h; | ||
3334 | ee->req.x = ee->x; | ||
3335 | ee->req.y = ee->y; | ||
3336 | ee->req.w = ee->w; | ||
3337 | ee->req.h = ee->h; | ||
3338 | |||
3339 | ee->prop.max.w = 32767; | ||
3340 | ee->prop.max.h = 32767; | ||
3341 | ee->prop.layer = 4; | ||
3342 | ee->prop.request_pos = 0; | ||
3343 | ee->prop.sticky = 0; | ||
3344 | ee->engine.x.state.sticky = 0; | ||
3345 | |||
3346 | /* init evas here */ | ||
3347 | ee->evas = evas_new(); | ||
3348 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); | ||
3349 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); | ||
3350 | evas_data_attach_set(ee->evas, ee); | ||
3351 | evas_output_method_set(ee->evas, rmethod); | ||
3352 | evas_output_size_set(ee->evas, w, h); | ||
3353 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3354 | |||
3355 | if (parent == 0) parent = DefaultRootWindow(ecore_x_display_get()); | ||
3356 | ee->engine.x.win_root = parent; | ||
3357 | |||
3358 | if (ee->engine.x.win_root != 0) | ||
3359 | { | ||
3360 | ee->engine.x.screen_num = 1; /* FIXME: get real scren # */ | ||
3361 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3362 | if (ecore_x_window_argb_get(ee->engine.x.win_root)) | ||
3363 | { | ||
3364 | ee->prop.window = _ecore_evas_x_gl_window_new | ||
3365 | (ee, ee->engine.x.win_root, x, y, w, h, 0, 1, opt); | ||
3366 | } | ||
3367 | else | ||
3368 | ee->prop.window = _ecore_evas_x_gl_window_new | ||
3369 | (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt); | ||
3370 | } | ||
3371 | else | ||
3372 | ee->prop.window = _ecore_evas_x_gl_window_new | ||
3373 | (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt); | ||
3374 | if (!ee->prop.window) | ||
3375 | { | ||
3376 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3377 | ecore_evas_free(ee); | ||
3378 | return NULL; | ||
3379 | } | ||
3380 | if ((id = getenv("DESKTOP_STARTUP_ID"))) | ||
3381 | { | ||
3382 | ecore_x_netwm_startup_id_set(ee->prop.window, id); | ||
3383 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3384 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3385 | * for the '=' char */ | ||
3386 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3387 | } | ||
3388 | |||
3389 | _ecore_evas_x_hints_update(ee); | ||
3390 | _ecore_evas_x_group_leader_set(ee); | ||
3391 | ecore_x_window_defaults_set(ee->prop.window); | ||
3392 | _ecore_evas_x_protocols_set(ee); | ||
3393 | _ecore_evas_x_sync_set(ee); | ||
3394 | |||
3395 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
3396 | _ecore_evas_register(ee); | ||
3397 | ecore_x_input_multi_select(ee->prop.window); | ||
3398 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
3399 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3400 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3401 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3402 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3403 | |||
3404 | return ee; | ||
3405 | } | ||
3406 | #else | ||
3407 | EAPI Ecore_Evas * | ||
3408 | ecore_evas_gl_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3409 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3410 | { | ||
3411 | return NULL; | ||
3412 | } | ||
3413 | EAPI Ecore_Evas * | ||
3414 | ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3415 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, const int *opt __UNUSED__) | ||
3416 | { | ||
3417 | return NULL; | ||
3418 | } | ||
3419 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3420 | |||
3421 | /** | ||
3422 | * To be documented. | ||
3423 | * | ||
3424 | * FIXME: To be fixed. | ||
3425 | */ | ||
3426 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3427 | EAPI Ecore_X_Window | ||
3428 | ecore_evas_gl_x11_window_get(const Ecore_Evas *ee) | ||
3429 | { | ||
3430 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3431 | } | ||
3432 | #else | ||
3433 | EAPI Ecore_X_Window | ||
3434 | ecore_evas_gl_x11_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3435 | { | ||
3436 | return 0; | ||
3437 | } | ||
3438 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3439 | |||
3440 | /** | ||
3441 | * To be documented. | ||
3442 | * | ||
3443 | * FIXME: To be fixed. | ||
3444 | */ | ||
3445 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3446 | EAPI void | ||
3447 | ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3448 | { | ||
3449 | ee->engine.x.direct_resize = on; | ||
3450 | } | ||
3451 | #else | ||
3452 | EAPI void | ||
3453 | ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3454 | { | ||
3455 | } | ||
3456 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3457 | |||
3458 | /** | ||
3459 | * To be documented. | ||
3460 | * | ||
3461 | * FIXME: To be fixed. | ||
3462 | */ | ||
3463 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3464 | EAPI Eina_Bool | ||
3465 | ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee) | ||
3466 | { | ||
3467 | return ee->engine.x.direct_resize; | ||
3468 | } | ||
3469 | #else | ||
3470 | EAPI Eina_Bool | ||
3471 | ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3472 | { | ||
3473 | return 0; | ||
3474 | } | ||
3475 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3476 | |||
3477 | /** | ||
3478 | * To be documented. | ||
3479 | * | ||
3480 | * FIXME: To be fixed. | ||
3481 | */ | ||
3482 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3483 | EAPI void | ||
3484 | ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3485 | { | ||
3486 | ecore_evas_software_x11_extra_event_window_add(ee, win); | ||
3487 | } | ||
3488 | #else | ||
3489 | EAPI void | ||
3490 | ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3491 | { | ||
3492 | } | ||
3493 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3494 | |||
3495 | /** | ||
3496 | * To be documented. | ||
3497 | * | ||
3498 | * FIXME: To be fixed. | ||
3499 | */ | ||
3500 | #ifdef BUILD_ECORE_EVAS_OPENGL_X11 | ||
3501 | EAPI void | ||
3502 | 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)) | ||
3503 | { | ||
3504 | Evas_Engine_Info_GL_X11 *einfo; | ||
3505 | |||
3506 | if (!(!strcmp(ee->driver, "opengl_x11"))) return; | ||
3507 | |||
3508 | einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); | ||
3509 | if (einfo) | ||
3510 | { | ||
3511 | einfo->callback.pre_swap = pre_cb; | ||
3512 | einfo->callback.post_swap = post_cb; | ||
3513 | einfo->callback.data = data; | ||
3514 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
3515 | { | ||
3516 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
3517 | } | ||
3518 | } | ||
3519 | } | ||
3520 | #else | ||
3521 | EAPI void | ||
3522 | 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__) | ||
3523 | { | ||
3524 | return; | ||
3525 | } | ||
3526 | #endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ | ||
3527 | |||
3528 | /** | ||
3529 | * To be documented. | ||
3530 | * | ||
3531 | * FIXME: To be fixed or maybe removed rather? | ||
3532 | */ | ||
3533 | EAPI Ecore_Evas * | ||
3534 | ecore_evas_xrender_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3535 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3536 | { | ||
3537 | return NULL; | ||
3538 | } | ||
3539 | |||
3540 | /** | ||
3541 | * To be documented. | ||
3542 | * | ||
3543 | * FIXME: To be fixed or maybe removed rather? | ||
3544 | */ | ||
3545 | EAPI Ecore_X_Window | ||
3546 | ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3547 | { | ||
3548 | return 0; | ||
3549 | } | ||
3550 | |||
3551 | /** | ||
3552 | * To be documented. | ||
3553 | * | ||
3554 | * FIXME: To be fixed. | ||
3555 | */ | ||
3556 | EAPI void | ||
3557 | ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3558 | { | ||
3559 | } | ||
3560 | |||
3561 | /** | ||
3562 | * To be documented. | ||
3563 | * | ||
3564 | * FIXME: To be fixed. | ||
3565 | */ | ||
3566 | EAPI Eina_Bool | ||
3567 | ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3568 | { | ||
3569 | return 0; | ||
3570 | } | ||
3571 | |||
3572 | /** | ||
3573 | * To be documented. | ||
3574 | * | ||
3575 | * FIXME: To be fixed. | ||
3576 | */ | ||
3577 | EAPI void | ||
3578 | ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3579 | { | ||
3580 | } | ||
3581 | |||
3582 | /** | ||
3583 | * To be documented. | ||
3584 | * | ||
3585 | * FIXME: To be fixed. | ||
3586 | */ | ||
3587 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3588 | EAPI Ecore_Evas * | ||
3589 | ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, | ||
3590 | int x, int y, int w, int h) | ||
3591 | { | ||
3592 | Evas_Engine_Info_Software_16_X11 *einfo; | ||
3593 | Ecore_Evas *ee; | ||
3594 | int rmethod; | ||
3595 | static int redraw_debug = -1; | ||
3596 | |||
3597 | rmethod = evas_render_method_lookup("software_16_x11"); | ||
3598 | if (!rmethod) return NULL; | ||
3599 | if (!ecore_x_init(disp_name)) return NULL; | ||
3600 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3601 | if (!ee) return NULL; | ||
3602 | |||
3603 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3604 | |||
3605 | _ecore_evas_x_init(); | ||
3606 | |||
3607 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3608 | |||
3609 | ee->driver = "software_16_x11"; | ||
3610 | if (disp_name) ee->name = strdup(disp_name); | ||
3611 | |||
3612 | if (w < 1) w = 1; | ||
3613 | if (h < 1) h = 1; | ||
3614 | ee->x = x; | ||
3615 | ee->y = y; | ||
3616 | ee->w = w; | ||
3617 | ee->h = h; | ||
3618 | ee->req.x = ee->x; | ||
3619 | ee->req.y = ee->y; | ||
3620 | ee->req.w = ee->w; | ||
3621 | ee->req.h = ee->h; | ||
3622 | |||
3623 | ee->prop.max.w = 32767; | ||
3624 | ee->prop.max.h = 32767; | ||
3625 | ee->prop.layer = 4; | ||
3626 | ee->prop.request_pos = 0; | ||
3627 | ee->prop.sticky = 0; | ||
3628 | ee->engine.x.state.sticky = 0; | ||
3629 | |||
3630 | /* init evas here */ | ||
3631 | ee->evas = evas_new(); | ||
3632 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); | ||
3633 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); | ||
3634 | evas_data_attach_set(ee->evas, ee); | ||
3635 | evas_output_method_set(ee->evas, rmethod); | ||
3636 | evas_output_size_set(ee->evas, w, h); | ||
3637 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3638 | |||
3639 | ee->engine.x.win_root = parent; | ||
3640 | if (parent != 0) | ||
3641 | { | ||
3642 | /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3643 | if (ecore_x_window_argb_get(parent)) | ||
3644 | { | ||
3645 | ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); | ||
3646 | } | ||
3647 | else | ||
3648 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3649 | } | ||
3650 | else | ||
3651 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3652 | if (getenv("DESKTOP_STARTUP_ID")) | ||
3653 | { | ||
3654 | ecore_x_netwm_startup_id_set(ee->prop.window, | ||
3655 | getenv("DESKTOP_STARTUP_ID")); | ||
3656 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3657 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3658 | * for the '=' char */ | ||
3659 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3660 | } | ||
3661 | einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); | ||
3662 | |||
3663 | if (einfo) | ||
3664 | { | ||
3665 | if (ScreenCount(ecore_x_display_get()) > 1) | ||
3666 | { | ||
3667 | Ecore_X_Window *roots; | ||
3668 | int num, i; | ||
3669 | |||
3670 | num = 0; | ||
3671 | roots = ecore_x_window_root_list(&num); | ||
3672 | if (roots) | ||
3673 | { | ||
3674 | XWindowAttributes at; | ||
3675 | |||
3676 | if (XGetWindowAttributes(ecore_x_display_get(), | ||
3677 | parent, &at)) | ||
3678 | { | ||
3679 | for (i = 0; i < num; i++) | ||
3680 | { | ||
3681 | if (at.root == roots[i]) | ||
3682 | break; | ||
3683 | } | ||
3684 | } | ||
3685 | free(roots); | ||
3686 | } | ||
3687 | } | ||
3688 | |||
3689 | if (redraw_debug < 0) | ||
3690 | { | ||
3691 | if (getenv("REDRAW_DEBUG")) | ||
3692 | redraw_debug = atoi(getenv("REDRAW_DEBUG")); | ||
3693 | else | ||
3694 | redraw_debug = 0; | ||
3695 | } | ||
3696 | einfo->info.display = ecore_x_display_get(); | ||
3697 | einfo->info.drawable = ee->prop.window; | ||
3698 | |||
3699 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
3700 | { | ||
3701 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3702 | ecore_evas_free(ee); | ||
3703 | return NULL; | ||
3704 | } | ||
3705 | } | ||
3706 | else | ||
3707 | { | ||
3708 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
3709 | ecore_evas_free(ee); | ||
3710 | return NULL; | ||
3711 | } | ||
3712 | |||
3713 | _ecore_evas_x_hints_update(ee); | ||
3714 | _ecore_evas_x_group_leader_set(ee); | ||
3715 | ecore_x_window_defaults_set(ee->prop.window); | ||
3716 | _ecore_evas_x_protocols_set(ee); | ||
3717 | _ecore_evas_x_sync_set(ee); | ||
3718 | |||
3719 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
3720 | _ecore_evas_register(ee); | ||
3721 | ecore_x_input_multi_select(ee->prop.window); | ||
3722 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
3723 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3724 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3725 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3726 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3727 | return ee; | ||
3728 | } | ||
3729 | #else | ||
3730 | EAPI Ecore_Evas * | ||
3731 | ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, | ||
3732 | int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
3733 | { | ||
3734 | return NULL; | ||
3735 | } | ||
3736 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3737 | |||
3738 | /** | ||
3739 | * To be documented. | ||
3740 | * | ||
3741 | * FIXME: To be fixed. | ||
3742 | */ | ||
3743 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3744 | EAPI Ecore_X_Window | ||
3745 | ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee) | ||
3746 | { | ||
3747 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
3748 | } | ||
3749 | #else | ||
3750 | EAPI Ecore_X_Window | ||
3751 | ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee __UNUSED__) | ||
3752 | { | ||
3753 | return 0; | ||
3754 | } | ||
3755 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3756 | |||
3757 | /** | ||
3758 | * To be documented. | ||
3759 | * | ||
3760 | * FIXME: To be fixed. | ||
3761 | */ | ||
3762 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3763 | EAPI void | ||
3764 | ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
3765 | { | ||
3766 | ee->engine.x.direct_resize = on; | ||
3767 | if (ee->prop.avoid_damage) | ||
3768 | { | ||
3769 | if (ee->engine.x.direct_resize) | ||
3770 | { | ||
3771 | /* turn this off for now | ||
3772 | ee->engine.x.using_bg_pixmap = 1; | ||
3773 | ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); | ||
3774 | */ | ||
3775 | } | ||
3776 | else | ||
3777 | { | ||
3778 | /* turn this off too- bg pixmap is controlled by avoid damage directly | ||
3779 | ee->engine.x.using_bg_pixmap = 0; | ||
3780 | ecore_x_window_pixmap_set(ee->prop.window, 0); | ||
3781 | ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); | ||
3782 | */ | ||
3783 | } | ||
3784 | } | ||
3785 | } | ||
3786 | #else | ||
3787 | EAPI void | ||
3788 | ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) | ||
3789 | { | ||
3790 | } | ||
3791 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3792 | |||
3793 | /** | ||
3794 | * To be documented. | ||
3795 | * | ||
3796 | * FIXME: To be fixed. | ||
3797 | */ | ||
3798 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3799 | EAPI Eina_Bool | ||
3800 | ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee) | ||
3801 | { | ||
3802 | return ee->engine.x.direct_resize; | ||
3803 | } | ||
3804 | #else | ||
3805 | EAPI Eina_Bool | ||
3806 | ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee __UNUSED__) | ||
3807 | { | ||
3808 | return 0; | ||
3809 | } | ||
3810 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3811 | |||
3812 | /** | ||
3813 | * To be documented. | ||
3814 | * | ||
3815 | * FIXME: To be fixed. | ||
3816 | */ | ||
3817 | #if BUILD_ECORE_EVAS_SOFTWARE_16_X11 | ||
3818 | EAPI void | ||
3819 | ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
3820 | { | ||
3821 | Ecore_X_Window *winp; | ||
3822 | |||
3823 | winp = malloc(sizeof(Ecore_X_Window)); | ||
3824 | if (winp) | ||
3825 | { | ||
3826 | *winp = win; | ||
3827 | ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); | ||
3828 | ecore_x_input_multi_select(win); | ||
3829 | ecore_event_window_register(win, ee, ee->evas, | ||
3830 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
3831 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
3832 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
3833 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
3834 | } | ||
3835 | } | ||
3836 | #else | ||
3837 | EAPI void | ||
3838 | ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) | ||
3839 | { | ||
3840 | } | ||
3841 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ | ||
3842 | |||
3843 | |||
3844 | /** | ||
3845 | * To be documented. | ||
3846 | * | ||
3847 | * FIXME: To be fixed. | ||
3848 | */ | ||
3849 | EAPI Ecore_Evas * | ||
3850 | ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, | ||
3851 | int x, int y, int w, int h) | ||
3852 | { | ||
3853 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
3854 | Evas_Engine_Info_Software_8_X11 *einfo; | ||
3855 | Ecore_Evas *ee; | ||
3856 | int argb = 0; | ||
3857 | int rmethod; | ||
3858 | static int redraw_debug = -1; | ||
3859 | |||
3860 | rmethod = evas_render_method_lookup("software_8_x11"); | ||
3861 | if (!rmethod) return NULL; | ||
3862 | if (!ecore_x_init(disp_name)) return NULL; | ||
3863 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
3864 | if (!ee) return NULL; | ||
3865 | |||
3866 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
3867 | |||
3868 | _ecore_evas_x_init(); | ||
3869 | |||
3870 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; | ||
3871 | |||
3872 | ee->driver = "software_8_x11"; | ||
3873 | if (disp_name) ee->name = strdup(disp_name); | ||
3874 | |||
3875 | if (w < 1) w = 1; | ||
3876 | if (h < 1) h = 1; | ||
3877 | ee->x = x; | ||
3878 | ee->y = y; | ||
3879 | ee->w = w; | ||
3880 | ee->h = h; | ||
3881 | ee->req.x = ee->x; | ||
3882 | ee->req.y = ee->y; | ||
3883 | ee->req.w = ee->w; | ||
3884 | ee->req.h = ee->h; | ||
3885 | |||
3886 | ee->prop.max.w = 32767; | ||
3887 | ee->prop.max.h = 32767; | ||
3888 | ee->prop.layer = 4; | ||
3889 | ee->prop.request_pos = 0; | ||
3890 | ee->prop.sticky = 0; | ||
3891 | ee->engine.x.state.sticky = 0; | ||
3892 | |||
3893 | /* init evas here */ | ||
3894 | ee->evas = evas_new(); | ||
3895 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); | ||
3896 | evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); | ||
3897 | evas_data_attach_set(ee->evas, ee); | ||
3898 | evas_output_method_set(ee->evas, rmethod); | ||
3899 | evas_output_size_set(ee->evas, w, h); | ||
3900 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
3901 | |||
3902 | ee->engine.x.win_root = parent; | ||
3903 | // if (parent != 0) | ||
3904 | // { | ||
3905 | // /* FIXME: round trip in ecore_x_window_argb_get */ | ||
3906 | // if (ecore_x_window_argb_get(parent)) | ||
3907 | // { | ||
3908 | // ee->engine.x.win = ecore_x_window_argb_new(parent, x, y, w, h); | ||
3909 | // argb = 1; | ||
3910 | // } | ||
3911 | // else | ||
3912 | // ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h); | ||
3913 | // } | ||
3914 | // else | ||
3915 | ee->prop.window = ecore_x_window_new(parent, x, y, w, h); | ||
3916 | if (getenv("DESKTOP_STARTUP_ID")) | ||
3917 | { | ||
3918 | ecore_x_netwm_startup_id_set(ee->prop.window, | ||
3919 | getenv("DESKTOP_STARTUP_ID")); | ||
3920 | /* NB: on linux this may simply empty the env as opposed to completely | ||
3921 | * unset it to being empty - unsure as solartis libc crashes looking | ||
3922 | * for the '=' char */ | ||
3923 | // putenv((char*)"DESKTOP_STARTUP_ID="); | ||
3924 | } | ||
3925 | einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); | ||
3926 | if (einfo) | ||
3927 | { | ||
3928 | xcb_screen_iterator_t iter; | ||
3929 | xcb_screen_t *screen; | ||
3930 | |||
3931 | /* FIXME: this is inefficient as its a round trip */ | ||
3932 | //einfo->info.backend = 1; | ||
3933 | screen = ecore_x_default_screen_get(); | ||
3934 | iter = xcb_setup_roots_iterator (xcb_get_setup (ecore_x_connection_get())); | ||
3935 | if (iter.rem > 1) | ||
3936 | { | ||
3937 | xcb_get_geometry_cookie_t cookie; | ||
3938 | xcb_get_geometry_reply_t *reply; | ||
3939 | Ecore_X_Window *roots; | ||
3940 | int num; | ||
3941 | uint8_t i; | ||
3942 | |||
3943 | num = 0; | ||
3944 | cookie = xcb_get_geometry_unchecked(ecore_x_connection_get(), parent); | ||
3945 | roots = ecore_x_window_root_list(&num); | ||
3946 | if (roots) | ||
3947 | { | ||
3948 | reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL); | ||
3949 | |||
3950 | if (reply) | ||
3951 | { | ||
3952 | for (i = 0; i < num; xcb_screen_next (&iter), i++) | ||
3953 | { | ||
3954 | if (reply->root == roots[i]) | ||
3955 | { | ||
3956 | screen = iter.data; | ||
3957 | break; | ||
3958 | } | ||
3959 | } | ||
3960 | free(reply); | ||
3961 | } | ||
3962 | free(roots); | ||
3963 | } | ||
3964 | else | ||
3965 | { | ||
3966 | reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL); | ||
3967 | if (reply) free(reply); | ||
3968 | } | ||
3969 | } | ||
3970 | |||
3971 | if (redraw_debug < 0) | ||
3972 | { | ||
3973 | if (getenv("REDRAW_DEBUG")) | ||
3974 | redraw_debug = atoi(getenv("REDRAW_DEBUG")); | ||
3975 | else | ||
3976 | redraw_debug = 0; | ||
3977 | } | ||
3978 | einfo->info.connection = ecore_x_connection_get(); | ||
3979 | einfo->info.screen = screen; | ||
3980 | einfo->info.drawable = ee->prop.window; | ||
3981 | if (argb) | ||
3982 | { | ||
3983 | /* FIXME: round trip */ | ||
3984 | xcb_get_geometry_cookie_t cookie_geom; | ||
3985 | xcb_get_window_attributes_cookie_t cookie_attr; | ||
3986 | xcb_get_geometry_reply_t *reply_geom; | ||
3987 | xcb_get_window_attributes_reply_t *reply_attr; | ||
3988 | |||
3989 | cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window); | ||
3990 | cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window); | ||
3991 | |||
3992 | reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL); | ||
3993 | reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL); | ||
3994 | if (reply_attr && reply_geom) | ||
3995 | { | ||
3996 | einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual); | ||
3997 | einfo->info.colormap = reply_attr->colormap; | ||
3998 | einfo->info.depth = reply_geom->depth; | ||
3999 | einfo->info.destination_alpha = 1; | ||
4000 | free(reply_geom); | ||
4001 | free(reply_attr); | ||
4002 | } | ||
4003 | } | ||
4004 | else | ||
4005 | { | ||
4006 | xcb_screen_t *screen; | ||
4007 | |||
4008 | screen = ecore_x_default_screen_get(); | ||
4009 | einfo->info.visual = xcb_visualtype_get(screen, screen->root_visual); | ||
4010 | einfo->info.colormap = screen->default_colormap; | ||
4011 | einfo->info.depth = screen->root_depth; | ||
4012 | einfo->info.destination_alpha = 0; | ||
4013 | } | ||
4014 | einfo->info.rotation = 0; | ||
4015 | einfo->info.debug = redraw_debug; | ||
4016 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
4017 | { | ||
4018 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
4019 | ecore_evas_free(ee); | ||
4020 | return NULL; | ||
4021 | } | ||
4022 | } | ||
4023 | else | ||
4024 | { | ||
4025 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
4026 | ecore_evas_free(ee); | ||
4027 | return NULL; | ||
4028 | } | ||
4029 | |||
4030 | _ecore_evas_x_hints_update(ee); | ||
4031 | _ecore_evas_x_group_leader_set(ee); | ||
4032 | ecore_x_window_defaults_set(ee->prop.window); | ||
4033 | _ecore_evas_x_protocols_set(ee); | ||
4034 | _ecore_evas_x_sync_set(ee); | ||
4035 | |||
4036 | ee->engine.func->fn_render = _ecore_evas_x_render; | ||
4037 | _ecore_evas_register(ee); | ||
4038 | ecore_x_input_multi_select(ee->prop.window); | ||
4039 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
4040 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
4041 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
4042 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
4043 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
4044 | |||
4045 | return ee; | ||
4046 | #else | ||
4047 | return NULL; | ||
4048 | (void)(disp_name); | ||
4049 | (void)(parent); | ||
4050 | (void)(x); | ||
4051 | (void)(y); | ||
4052 | (void)(w); | ||
4053 | (void)(h); | ||
4054 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ | ||
4055 | } | ||
4056 | |||
4057 | /** | ||
4058 | * To be documented. | ||
4059 | * | ||
4060 | * FIXME: To be fixed. | ||
4061 | */ | ||
4062 | EAPI Ecore_X_Window | ||
4063 | ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee) | ||
4064 | { | ||
4065 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4066 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
4067 | #else | ||
4068 | return 0; | ||
4069 | (void)(ee); | ||
4070 | #endif | ||
4071 | } | ||
4072 | |||
4073 | /** | ||
4074 | * To be documented. | ||
4075 | * | ||
4076 | * FIXME: To be fixed. | ||
4077 | */ | ||
4078 | EAPI Ecore_X_Window | ||
4079 | ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee) | ||
4080 | { | ||
4081 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4082 | return (Ecore_X_Window) ecore_evas_window_get(ee); | ||
4083 | #else | ||
4084 | return 0; | ||
4085 | (void)(ee); | ||
4086 | #endif | ||
4087 | } | ||
4088 | |||
4089 | /** | ||
4090 | * To be documented. | ||
4091 | * | ||
4092 | * FIXME: To be fixed. | ||
4093 | */ | ||
4094 | EAPI void | ||
4095 | ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) | ||
4096 | { | ||
4097 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4098 | ee->engine.x.direct_resize = on; | ||
4099 | if (ee->prop.avoid_damage) | ||
4100 | { | ||
4101 | if (ee->engine.x.direct_resize) | ||
4102 | { | ||
4103 | /* turn this off for now | ||
4104 | ee->engine.x.using_bg_pixmap = 1; | ||
4105 | ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap); | ||
4106 | */ | ||
4107 | } | ||
4108 | else | ||
4109 | { | ||
4110 | /* turn this off too- bg pixmap is controlled by avoid damage directly | ||
4111 | ee->engine.x.using_bg_pixmap = 0; | ||
4112 | ecore_x_window_pixmap_set(ee->engine.x.win, 0); | ||
4113 | ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h); | ||
4114 | */ | ||
4115 | } | ||
4116 | } | ||
4117 | #else | ||
4118 | return; | ||
4119 | (void)(ee); | ||
4120 | (void)(on); | ||
4121 | #endif | ||
4122 | } | ||
4123 | |||
4124 | /** | ||
4125 | * To be documented. | ||
4126 | * | ||
4127 | * FIXME: To be fixed. | ||
4128 | */ | ||
4129 | EAPI Eina_Bool | ||
4130 | ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee) | ||
4131 | { | ||
4132 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4133 | return ee->engine.x.direct_resize; | ||
4134 | #else | ||
4135 | return 0; | ||
4136 | (void)(ee); | ||
4137 | #endif | ||
4138 | } | ||
4139 | |||
4140 | /** | ||
4141 | * To be documented. | ||
4142 | * | ||
4143 | * FIXME: To be fixed. | ||
4144 | */ | ||
4145 | EAPI void | ||
4146 | ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) | ||
4147 | { | ||
4148 | #if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) | ||
4149 | Ecore_X_Window *winp; | ||
4150 | |||
4151 | winp = malloc(sizeof(Ecore_X_Window)); | ||
4152 | if (winp) | ||
4153 | { | ||
4154 | *winp = win; | ||
4155 | ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); | ||
4156 | ecore_x_input_multi_select(win); | ||
4157 | ecore_event_window_register(win, ee, ee->evas, | ||
4158 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
4159 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
4160 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
4161 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
4162 | } | ||
4163 | #else | ||
4164 | return; | ||
4165 | (void)(ee); | ||
4166 | (void)(win); | ||
4167 | #endif | ||
4168 | } | ||
4169 | |||
4170 | EAPI void | ||
4171 | ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win) | ||
4172 | { | ||
4173 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4174 | _ecore_evas_x_group_leader_unset(ee); | ||
4175 | ee->engine.x.leader = win; | ||
4176 | _ecore_evas_x_group_leader_update(ee); | ||
4177 | #else | ||
4178 | return; | ||
4179 | ee = NULL; | ||
4180 | win = 0; | ||
4181 | #endif | ||
4182 | } | ||
4183 | |||
4184 | EAPI Ecore_X_Window | ||
4185 | ecore_evas_x11_leader_get(Ecore_Evas *ee) | ||
4186 | { | ||
4187 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4188 | return ee->engine.x.leader; | ||
4189 | #else | ||
4190 | return 0; | ||
4191 | ee = NULL; | ||
4192 | #endif | ||
4193 | } | ||
4194 | |||
4195 | EAPI void | ||
4196 | ecore_evas_x11_leader_default_set(Ecore_Evas *ee) | ||
4197 | { | ||
4198 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4199 | _ecore_evas_x_group_leader_unset(ee); | ||
4200 | _ecore_evas_x_group_leader_set(ee); | ||
4201 | #else | ||
4202 | return; | ||
4203 | ee = NULL; | ||
4204 | #endif | ||
4205 | } | ||
4206 | |||
4207 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4208 | static Eina_Bool | ||
4209 | _ecore_evas_x11_convert_rectangle_with_angle(Ecore_Evas *ee, Ecore_X_Rectangle *dst_rect, Ecore_X_Rectangle *src_rect) | ||
4210 | { | ||
4211 | if ((!src_rect) || (!dst_rect)) return 0; | ||
4212 | |||
4213 | if (ee->rotation == 0) | ||
4214 | { | ||
4215 | dst_rect->x = src_rect->x; | ||
4216 | dst_rect->y = src_rect->y; | ||
4217 | dst_rect->width = src_rect->width; | ||
4218 | dst_rect->height = src_rect->height; | ||
4219 | } | ||
4220 | else if (ee->rotation == 90) | ||
4221 | { | ||
4222 | dst_rect->x = src_rect->y; | ||
4223 | dst_rect->y = ee->req.h - src_rect->x - src_rect->width; | ||
4224 | dst_rect->width = src_rect->height; | ||
4225 | dst_rect->height = src_rect->width; | ||
4226 | } | ||
4227 | else if (ee->rotation == 180) | ||
4228 | { | ||
4229 | dst_rect->x = ee->req.w - src_rect->x - src_rect->width; | ||
4230 | dst_rect->y = ee->req.h - src_rect->y - src_rect->height; | ||
4231 | dst_rect->width = src_rect->width; | ||
4232 | dst_rect->height = src_rect->height; | ||
4233 | } | ||
4234 | else if (ee->rotation == 270) | ||
4235 | { | ||
4236 | dst_rect->x = ee->req.w - src_rect->y - src_rect->height; | ||
4237 | dst_rect->y = src_rect->x; | ||
4238 | dst_rect->width = src_rect->height; | ||
4239 | dst_rect->height = src_rect->width; | ||
4240 | } | ||
4241 | else | ||
4242 | { | ||
4243 | return 0; | ||
4244 | } | ||
4245 | |||
4246 | return 1; | ||
4247 | } | ||
4248 | #endif | ||
4249 | |||
4250 | EAPI void | ||
4251 | ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h) | ||
4252 | { | ||
4253 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4254 | Eina_Bool ret; | ||
4255 | Ecore_X_Rectangle src_rect; | ||
4256 | Ecore_X_Rectangle dst_rect; | ||
4257 | |||
4258 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4259 | { | ||
4260 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4261 | "ecore_evas_x11_shape_input_rectangle_set"); | ||
4262 | return; | ||
4263 | } | ||
4264 | |||
4265 | src_rect.x = x; | ||
4266 | src_rect.y = y; | ||
4267 | src_rect.width = w; | ||
4268 | src_rect.height = h; | ||
4269 | |||
4270 | dst_rect.x = 0; | ||
4271 | dst_rect.y = 0; | ||
4272 | dst_rect.width = 0; | ||
4273 | dst_rect.height = 0; | ||
4274 | |||
4275 | ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); | ||
4276 | |||
4277 | if (!ee->engine.x.win_shaped_input) | ||
4278 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, | ||
4279 | 0, 0, 1, 1); | ||
4280 | |||
4281 | if (ret) | ||
4282 | ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, | ||
4283 | dst_rect.x, dst_rect.y, | ||
4284 | dst_rect.width, dst_rect.height); | ||
4285 | #else | ||
4286 | return; | ||
4287 | ee = NULL; | ||
4288 | x = 0; | ||
4289 | y = 0; | ||
4290 | w = 0; | ||
4291 | h = 0; | ||
4292 | #endif | ||
4293 | } | ||
4294 | |||
4295 | EAPI void | ||
4296 | ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h) | ||
4297 | { | ||
4298 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4299 | Eina_Bool ret; | ||
4300 | Ecore_X_Rectangle src_rect; | ||
4301 | Ecore_X_Rectangle dst_rect; | ||
4302 | |||
4303 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4304 | { | ||
4305 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4306 | "ecore_evas_x11_shape_input_rectangle_add"); | ||
4307 | return; | ||
4308 | } | ||
4309 | |||
4310 | src_rect.x = x; | ||
4311 | src_rect.y = y; | ||
4312 | src_rect.width = w; | ||
4313 | src_rect.height = h; | ||
4314 | |||
4315 | dst_rect.x = 0; | ||
4316 | dst_rect.y = 0; | ||
4317 | dst_rect.width = 0; | ||
4318 | dst_rect.height = 0; | ||
4319 | |||
4320 | ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); | ||
4321 | |||
4322 | if (!ee->engine.x.win_shaped_input) | ||
4323 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, | ||
4324 | 0, 0, 1, 1); | ||
4325 | |||
4326 | if (ret) | ||
4327 | ecore_x_window_shape_input_rectangle_add(ee->engine.x.win_shaped_input, | ||
4328 | dst_rect.x, dst_rect.y, | ||
4329 | dst_rect.width, dst_rect.height); | ||
4330 | #else | ||
4331 | return; | ||
4332 | ee = NULL; | ||
4333 | x = 0; | ||
4334 | y = 0; | ||
4335 | w = 0; | ||
4336 | h = 0; | ||
4337 | #endif | ||
4338 | } | ||
4339 | |||
4340 | EAPI void | ||
4341 | ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h) | ||
4342 | { | ||
4343 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4344 | Eina_Bool ret; | ||
4345 | Ecore_X_Rectangle src_rect; | ||
4346 | Ecore_X_Rectangle dst_rect; | ||
4347 | |||
4348 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4349 | { | ||
4350 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4351 | "ecore_evas_x11_shape_input_rectangle_subtract"); | ||
4352 | return; | ||
4353 | } | ||
4354 | |||
4355 | src_rect.x = x; | ||
4356 | src_rect.y = y; | ||
4357 | src_rect.width = w; | ||
4358 | src_rect.height = h; | ||
4359 | |||
4360 | dst_rect.x = 0; | ||
4361 | dst_rect.y = 0; | ||
4362 | dst_rect.width = 0; | ||
4363 | dst_rect.height = 0; | ||
4364 | |||
4365 | ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); | ||
4366 | |||
4367 | if (!ee->engine.x.win_shaped_input) | ||
4368 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, | ||
4369 | 0, 0, 1, 1); | ||
4370 | |||
4371 | if (ret) | ||
4372 | ecore_x_window_shape_input_rectangle_subtract(ee->engine.x.win_shaped_input, | ||
4373 | dst_rect.x, dst_rect.y, | ||
4374 | dst_rect.width, dst_rect.height); | ||
4375 | #else | ||
4376 | return; | ||
4377 | ee = NULL; | ||
4378 | x = 0; | ||
4379 | y = 0; | ||
4380 | w = 0; | ||
4381 | h = 0; | ||
4382 | #endif | ||
4383 | } | ||
4384 | |||
4385 | EAPI void | ||
4386 | ecore_evas_x11_shape_input_empty(Ecore_Evas *ee) | ||
4387 | { | ||
4388 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4389 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4390 | { | ||
4391 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4392 | "ecore_evas_x11_shape_input_empty"); | ||
4393 | return; | ||
4394 | } | ||
4395 | |||
4396 | if (!ee->engine.x.win_shaped_input) | ||
4397 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1); | ||
4398 | |||
4399 | ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 0, 0); | ||
4400 | #else | ||
4401 | return; | ||
4402 | ee = NULL; | ||
4403 | #endif | ||
4404 | } | ||
4405 | |||
4406 | EAPI void | ||
4407 | ecore_evas_x11_shape_input_reset(Ecore_Evas *ee) | ||
4408 | { | ||
4409 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4410 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4411 | { | ||
4412 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4413 | "ecore_evas_x11_shape_input_reset"); | ||
4414 | return; | ||
4415 | } | ||
4416 | |||
4417 | if (!ee->engine.x.win_shaped_input) | ||
4418 | ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1); | ||
4419 | |||
4420 | ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 65535, 65535); | ||
4421 | #else | ||
4422 | return; | ||
4423 | ee = NULL; | ||
4424 | #endif | ||
4425 | } | ||
4426 | |||
4427 | EAPI void | ||
4428 | ecore_evas_x11_shape_input_apply(Ecore_Evas *ee) | ||
4429 | { | ||
4430 | #ifdef BUILD_ECORE_EVAS_X11 | ||
4431 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
4432 | { | ||
4433 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | ||
4434 | "ecore_evas_x11_shape_input_apply"); | ||
4435 | return; | ||
4436 | } | ||
4437 | |||
4438 | if (!ee->engine.x.win_shaped_input) return; | ||
4439 | |||
4440 | ecore_x_window_shape_input_window_set(ee->prop.window, ee->engine.x.win_shaped_input); | ||
4441 | #else | ||
4442 | return; | ||
4443 | ee = NULL; | ||
4444 | #endif | ||
4445 | } | ||