summaryrefslogtreecommitdiff
path: root/src/lib/ecore_evas
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-03-28 13:56:33 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-03-28 13:56:33 +0100
commitdb081f96486bde255716addaec67afc6dff9ba0f (patch)
tree9b62cce7e629ce02bc8dbdf7bee1fd074b937b0d /src/lib/ecore_evas
parent0e3a2e6ec7908c13336bd35ba4bdcde8638caa82 (diff)
ecore evas ews - deprecate/remove
it's broken. it doesnt render anything. input is broken. it isn't in use so it doesnt justify fixing. no one has complained it's brokne thus proof of it not in use, so proof that it's not needed, so do the right thing and nuke it to save work @feat
Diffstat (limited to 'src/lib/ecore_evas')
-rw-r--r--src/lib/ecore_evas/Ecore_Evas.h17
-rw-r--r--src/lib/ecore_evas/ecore_evas.c26
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.c1
-rw-r--r--src/lib/ecore_evas/ecore_evas_ews.c1400
-rw-r--r--src/lib/ecore_evas/ecore_evas_module.c3
5 files changed, 22 insertions, 1425 deletions
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 89a9ff843f..dfbd7a749f 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -97,7 +97,7 @@ extern "C" {
97#define HAVE_ECORE_EVAS_COCOA 1 97#define HAVE_ECORE_EVAS_COCOA 1
98#define HAVE_ECORE_EVAS_SDL 1 98#define HAVE_ECORE_EVAS_SDL 1
99//#define HAVE_ECORE_EVAS_WINCE 1 99//#define HAVE_ECORE_EVAS_WINCE 1
100#define HAVE_ECORE_EVAS_EWS 1 100//#define HAVE_ECORE_EVAS_EWS 1 /* @deprecated */
101#define HAVE_ECORE_EVAS_PSL1GHT 1 101#define HAVE_ECORE_EVAS_PSL1GHT 1
102#define HAVE_ECORE_EVAS_WAYLAND_SHM 1 102#define HAVE_ECORE_EVAS_WAYLAND_SHM 1
103#define HAVE_ECORE_EVAS_WAYLAND_EGL 1 103#define HAVE_ECORE_EVAS_WAYLAND_EGL 1
@@ -125,7 +125,7 @@ typedef enum _Ecore_Evas_Engine_Type
125 ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW, 125 ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW,
126 ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE, 126 ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE,
127 ECORE_EVAS_ENGINE_OPENGL_SDL, 127 ECORE_EVAS_ENGINE_OPENGL_SDL,
128 ECORE_EVAS_ENGINE_EWS, 128 ECORE_EVAS_ENGINE_EWS, /* @deprecated */
129 ECORE_EVAS_ENGINE_PSL1GHT, 129 ECORE_EVAS_ENGINE_PSL1GHT,
130 ECORE_EVAS_ENGINE_WAYLAND_SHM, 130 ECORE_EVAS_ENGINE_WAYLAND_SHM,
131 ECORE_EVAS_ENGINE_WAYLAND_EGL, 131 ECORE_EVAS_ENGINE_WAYLAND_EGL,
@@ -1788,6 +1788,7 @@ EAPI Ecore_Evas *ecore_evas_buffer_ecore_evas_parent_get(Ecore_Evas *ee);
1788 * @see ecore_evas_ews_ecore_evas_get() 1788 * @see ecore_evas_ews_ecore_evas_get()
1789 * 1789 *
1790 * @since 1.1 1790 * @since 1.1
1791 * @deprecated - @since 1.26
1791 */ 1792 */
1792EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h); 1793EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h);
1793 1794
@@ -1806,6 +1807,7 @@ EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h);
1806 * @see ecore_evas_ews_manager_set() 1807 * @see ecore_evas_ews_manager_set()
1807 * @see ecore_evas_ews_evas_get() 1808 * @see ecore_evas_ews_evas_get()
1808 * @since 1.1 1809 * @since 1.1
1810 * @deprecated - @since 1.26
1809 */ 1811 */
1810EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee); 1812EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee);
1811 1813
@@ -1816,6 +1818,7 @@ EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee);
1816 * @param ee The Ecore_Evas for which window will be deleted. 1818 * @param ee The Ecore_Evas for which window will be deleted.
1817 * 1819 *
1818 * @since 1.1 1820 * @since 1.1
1821 * @deprecated - @since 1.26
1819 */ 1822 */
1820EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee); 1823EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee);
1821 1824
@@ -3216,6 +3219,7 @@ EAPI void ecore_evas_callback_new_set(Evas *(*func)(int w, int h));
3216 * ecore_evas_ews_new(). 3219 * ecore_evas_ews_new().
3217 * 3220 *
3218 * @since 1.1 3221 * @since 1.1
3222 * @deprecated - @since 1.26
3219 * @{ 3223 * @{
3220 */ 3224 */
3221 3225
@@ -3227,6 +3231,7 @@ EAPI void ecore_evas_callback_new_set(Evas *(*func)(int w, int h));
3227 * @return @c EINA_TRUE on success, @c EINA_FALSE if ews is already in use. 3231 * @return @c EINA_TRUE on success, @c EINA_FALSE if ews is already in use.
3228 * 3232 *
3229 * @since 1.1 3233 * @since 1.1
3234 * @deprecated - @since 1.26
3230 */ 3235 */
3231EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options); 3236EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options);
3232 3237
@@ -3240,6 +3245,7 @@ EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options
3240 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. 3245 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
3241 * 3246 *
3242 * @since 1.1 3247 * @since 1.1
3248 * @deprecated - @since 1.26
3243 */ 3249 */
3244EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h); 3250EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h);
3245 3251
@@ -3253,6 +3259,7 @@ EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h);
3253 * 3259 *
3254 * @see ecore_evas_ews_evas_get() 3260 * @see ecore_evas_ews_evas_get()
3255 * @since 1.1 3261 * @since 1.1
3262 * @deprecated - @since 1.26
3256 */ 3263 */
3257EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void); 3264EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void);
3258 3265
@@ -3266,11 +3273,13 @@ EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void);
3266 * 3273 *
3267 * @see ecore_evas_ews_ecore_evas_get() 3274 * @see ecore_evas_ews_ecore_evas_get()
3268 * @since 1.1 3275 * @since 1.1
3276 * @deprecated - @since 1.26
3269 */ 3277 */
3270EAPI Evas *ecore_evas_ews_evas_get(void); 3278EAPI Evas *ecore_evas_ews_evas_get(void);
3271 3279
3272/** 3280/**
3273 * @brief Gets the current background. 3281 * @brief Gets the current background.
3282 * @deprecated - @since 1.26
3274 */ 3283 */
3275EAPI Evas_Object *ecore_evas_ews_background_get(void); 3284EAPI Evas_Object *ecore_evas_ews_background_get(void);
3276 3285
@@ -3284,6 +3293,7 @@ EAPI Evas_Object *ecore_evas_ews_background_get(void);
3284 * rectangle. 3293 * rectangle.
3285 * 3294 *
3286 * @note previous object will be deleted! 3295 * @note previous object will be deleted!
3296 * @deprecated - @since 1.26
3287 */ 3297 */
3288EAPI void ecore_evas_ews_background_set(Evas_Object *o); 3298EAPI void ecore_evas_ews_background_set(Evas_Object *o);
3289 3299
@@ -3295,6 +3305,7 @@ EAPI void ecore_evas_ews_background_set(Evas_Object *o);
3295 * @note Do not change the returned list or its contents. 3305 * @note Do not change the returned list or its contents.
3296 * 3306 *
3297 * @since 1.1 3307 * @since 1.1
3308 * @deprecated - @since 1.26
3298 */ 3309 */
3299EAPI const Eina_List *ecore_evas_ews_children_get(void); 3310EAPI const Eina_List *ecore_evas_ews_children_get(void);
3300 3311
@@ -3309,6 +3320,7 @@ EAPI const Eina_List *ecore_evas_ews_children_get(void);
3309 * 3320 *
3310 * @see ecore_evas_ews_manager_get() 3321 * @see ecore_evas_ews_manager_get()
3311 * @since 1.1 3322 * @since 1.1
3323 * @deprecated - @since 1.26
3312 */ 3324 */
3313EAPI void ecore_evas_ews_manager_set(const void *manager); 3325EAPI void ecore_evas_ews_manager_set(const void *manager);
3314 3326
@@ -3318,6 +3330,7 @@ EAPI void ecore_evas_ews_manager_set(const void *manager);
3318 * @return the value set by ecore_evas_ews_manager_set() 3330 * @return the value set by ecore_evas_ews_manager_set()
3319 * 3331 *
3320 * @since 1.1 3332 * @since 1.1
3333 * @deprecated - @since 1.26
3321 */ 3334 */
3322EAPI const void *ecore_evas_ews_manager_get(void); 3335EAPI const void *ecore_evas_ews_manager_get(void);
3323 3336
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index a579abff97..080a2f3894 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -565,11 +565,7 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
565 return EINA_FALSE; 565 return EINA_FALSE;
566#endif 566#endif
567 case ECORE_EVAS_ENGINE_EWS: 567 case ECORE_EVAS_ENGINE_EWS:
568#ifdef BUILD_ECORE_EVAS_EWS
569 return EINA_TRUE;
570#else
571 return EINA_FALSE; 568 return EINA_FALSE;
572#endif
573 case ECORE_EVAS_ENGINE_PSL1GHT: 569 case ECORE_EVAS_ENGINE_PSL1GHT:
574 return EINA_FALSE; 570 return EINA_FALSE;
575 case ECORE_EVAS_ENGINE_WAYLAND_SHM: 571 case ECORE_EVAS_ENGINE_WAYLAND_SHM:
@@ -632,10 +628,6 @@ ecore_evas_init(void)
632 if (getenv("ECORE_EVAS_RENDER_NOSYNC")) _ecore_evas_render_sync = 0; 628 if (getenv("ECORE_EVAS_RENDER_NOSYNC")) _ecore_evas_render_sync = 0;
633 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); 629 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
634 630
635#ifdef BUILD_ECORE_EVAS_EWS
636 _ecore_evas_ews_events_init();
637#endif
638
639 _ecore_evas_extn_init(); 631 _ecore_evas_extn_init();
640 632
641 _ecore_evas_engine_init(); 633 _ecore_evas_engine_init();
@@ -680,10 +672,6 @@ ecore_evas_shutdown(void)
680 EINA_LOG_STATE_START, 672 EINA_LOG_STATE_START,
681 EINA_LOG_STATE_SHUTDOWN); 673 EINA_LOG_STATE_SHUTDOWN);
682 674
683#ifdef BUILD_ECORE_EVAS_EWS
684 _ecore_evas_ews_events_flush();
685#endif
686
687 while (ecore_evases) _ecore_evas_free(ecore_evases); 675 while (ecore_evases) _ecore_evas_free(ecore_evases);
688 676
689 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); 677 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
@@ -694,9 +682,6 @@ ecore_evas_shutdown(void)
694 682
695 _ecore_evas_extn_shutdown(); 683 _ecore_evas_extn_shutdown();
696 684
697#ifdef BUILD_ECORE_EVAS_EWS
698 while (_ecore_evas_ews_shutdown());
699#endif
700 _ecore_evas_engine_shutdown(); 685 _ecore_evas_engine_shutdown();
701 686
702 eina_log_domain_unregister(_ecore_evas_log_dom); 687 eina_log_domain_unregister(_ecore_evas_log_dom);
@@ -995,14 +980,6 @@ _ecore_evas_constructor_buffer(int x EINA_UNUSED, int y EINA_UNUSED, int w, int
995 return ecore_evas_buffer_new(w, h); 980 return ecore_evas_buffer_new(w, h);
996} 981}
997 982
998#ifdef BUILD_ECORE_EVAS_EWS
999static Ecore_Evas *
1000_ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options EINA_UNUSED)
1001{
1002 return ecore_evas_ews_new(x, y, w, h);
1003}
1004#endif
1005
1006/* note: keep sorted by priority, highest first */ 983/* note: keep sorted by priority, highest first */
1007static const struct ecore_evas_engine _engines[] = { 984static const struct ecore_evas_engine _engines[] = {
1008 /* unix */ 985 /* unix */
@@ -1022,9 +999,6 @@ static const struct ecore_evas_engine _engines[] = {
1022 {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, 999 {"opengl_sdl", _ecore_evas_constructor_opengl_sdl},
1023 {"sdl", _ecore_evas_constructor_sdl}, 1000 {"sdl", _ecore_evas_constructor_sdl},
1024 {"buffer", _ecore_evas_constructor_buffer}, 1001 {"buffer", _ecore_evas_constructor_buffer},
1025#ifdef BUILD_ECORE_EVAS_EWS
1026 {"ews", _ecore_evas_constructor_ews},
1027#endif
1028 {NULL, NULL} 1002 {NULL, NULL}
1029}; 1003};
1030 1004
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c
index 2f3f2ff72b..569fe0a077 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -219,7 +219,6 @@ ecore_evas_buffer_render(Ecore_Evas *ee)
219 return r; 219 return r;
220} 220}
221 221
222// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
223static void 222static void
224_ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) 223_ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
225{ 224{
diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c
index 86e939f765..a30617f571 100644
--- a/src/lib/ecore_evas/ecore_evas_ews.c
+++ b/src/lib/ecore_evas/ecore_evas_ews.c
@@ -34,1459 +34,73 @@ EAPI int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = 0;
34EAPI int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = 0; 34EAPI int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = 0;
35EAPI int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = 0; 35EAPI int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = 0;
36 36
37#ifdef BUILD_ECORE_EVAS_EWS
38static int _ecore_evas_init_count = 0;
39
40static Ecore_Evas *_ews_ee = NULL;
41static Evas_Object *_ews_bg = NULL;
42static Eina_List *_ews_children = NULL;
43static const void *_ews_manager = NULL;
44static char *_ews_engine = NULL;
45static char *_ews_options = NULL;
46static int _ews_x = 0;
47static int _ews_y = 0;
48static int _ews_w = 1024;
49static int _ews_h = 768;
50static Eina_Bool _ews_defaults_engine = EINA_TRUE;
51static Eina_Bool _ews_defaults_geo = EINA_TRUE;
52
53static const char EWS_ENGINE_NAME[] = "ews";
54
55static void
56_ecore_evas_ews_pre_free(Ecore_Evas *ee EINA_UNUSED)
57{
58 DBG("EWS backing store free'd");
59 _ews_children = eina_list_free(_ews_children);
60 _ews_ee = NULL;
61 _ews_bg = NULL;
62}
63
64static void
65_ecore_evas_ews_del_request(Ecore_Evas *ee EINA_UNUSED)
66{
67 INF("EWS backing store deletion is forbidden!");
68}
69
70static Ecore_Evas *
71_ecore_evas_ews_ee_new(void)
72{
73 Ecore_Evas *ee = ecore_evas_new(_ews_engine, _ews_x, _ews_y, _ews_w, _ews_h,
74 _ews_options);
75 if (!ee)
76 ERR("Failed: ecore_evas_new(%s, %d, %d, %d, %d, %s)",
77 _ews_engine, _ews_x, _ews_y, _ews_w, _ews_h, _ews_options);
78 else
79 {
80 ecore_evas_size_min_set(ee, _ews_w, _ews_h);
81 ecore_evas_size_max_set(ee, _ews_w, _ews_h);
82 ecore_evas_callback_pre_free_set(ee, _ecore_evas_ews_pre_free);
83 ecore_evas_callback_delete_request_set(ee, _ecore_evas_ews_del_request);
84 ecore_evas_name_class_set(ee, "ecore_evas_ews", "ews");
85 ecore_evas_title_set
86 (ee, "EWS: Ecore + Evas Single Process Windowing System");
87 ecore_evas_show(ee);
88 }
89
90 return ee;
91}
92
93static void
94_ecore_evas_ews_env_setup(void)
95{
96 const char *env = getenv("ECORE_EVAS_EWS");
97 char *p, *n, *tmp;
98
99 if (_ews_defaults_engine)
100 {
101 free(_ews_engine);
102 _ews_engine = NULL;
103 free(_ews_options);
104 _ews_options = NULL;
105 }
106 if (_ews_defaults_geo)
107 {
108 _ews_x = 0;
109 _ews_y = 0;
110 _ews_w = 1024;
111 _ews_h = 768;
112 }
113
114 if ((!env) || (!*env)) return;
115
116 p = tmp = strdup(env);
117 if (!tmp) return;
118
119 n = strchr(p, ':');
120 if (n) *n = '\0';
121 if (_ews_defaults_engine) _ews_engine = strdup(p);
122 if (!n) goto end;
123
124 p = n + 1;
125 n = strchr(p, ':');
126 if (!n) goto end;
127 *n = '\0';
128 if (_ews_defaults_geo) _ews_x = atoi(p);
129
130 p = n + 1;
131 n = strchr(p, ':');
132 if (!n) goto end;
133 *n = '\0';
134 if (_ews_defaults_geo) _ews_y = atoi(p);
135
136 p = n + 1;
137 n = strchr(p, ':');
138 if (!n) goto end;
139 *n = '\0';
140 if (_ews_defaults_geo) _ews_w = atoi(p);
141
142 p = n + 1;
143 n = strchr(p, ':');
144 if (n) *n = '\0';
145 if (_ews_defaults_geo) _ews_h = atoi(p);
146 if (!n) goto end;
147
148 p = n + 1;
149 if (_ews_defaults_engine) _ews_options = strdup(p);
150
151 end:
152 free(tmp);
153}
154
155static void
156_ecore_evas_ews_event_free(void *data EINA_UNUSED, void *ev)
157{
158 Ecore_Evas *ee = ev;
159 _ecore_evas_unref(ee);
160}
161
162static void
163_ecore_evas_ews_event(Ecore_Evas *ee, int event)
164{
165 _ecore_evas_ref(ee);
166 ecore_event_add(event, ee, _ecore_evas_ews_event_free, NULL);
167}
168
169static void
170_ecore_evas_ews_event_free_del(void *data EINA_UNUSED, void *ev EINA_UNUSED)
171{
172 _ecore_evas_ews_shutdown();
173}
174
175static void
176_ecore_evas_ews_free(Ecore_Evas *ee)
177{
178 evas_object_del(ee->engine.ews.image);
179 _ews_ee->sub_ecore_evas = eina_list_remove(_ews_ee->sub_ecore_evas, ee);
180
181 ecore_event_add(ECORE_EVAS_EWS_EVENT_DEL, ee, _ecore_evas_ews_event_free_del, NULL);
182}
183
184static void
185_ecore_evas_ews_move(Ecore_Evas *ee, int x, int y)
186{
187 ee->req.x = x;
188 ee->req.y = y;
189
190 if ((x == ee->x) && (y == ee->y)) return;
191 ee->x = x;
192 ee->y = y;
193 evas_object_move(ee->engine.ews.image, x, y);
194 if (ee->func.fn_move) ee->func.fn_move(ee);
195
196 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE);
197}
198
199static void
200_ecore_evas_ews_managed_move(Ecore_Evas *ee, int x, int y)
201{
202 ee->req.x = x;
203 ee->req.y = y;
204
205 if ((x == ee->x) && (y == ee->y)) return;
206 ee->x = x;
207 ee->y = y;
208 if (ee->func.fn_move) ee->func.fn_move(ee);
209 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE);
210}
211
212static void
213_ecore_evas_ews_resize_internal(Ecore_Evas *ee, int w, int h)
214{
215 Evas_Engine_Info_Buffer *einfo;
216 void *pixels;
217 int stride;
218
219 evas_output_size_set(ee->evas, w, h);
220 evas_output_viewport_set(ee->evas, 0, 0, w, h);
221 evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
222
223 evas_object_image_size_set(ee->engine.ews.image, w, h);
224 evas_object_image_fill_set(ee->engine.ews.image, 0, 0, w, h);
225 evas_object_resize(ee->engine.ews.image, w, h);
226
227 pixels = evas_object_image_data_get(ee->engine.ews.image, 1);
228 evas_object_image_data_set(ee->engine.ews.image, pixels); // refcount
229 stride = evas_object_image_stride_get(ee->engine.ews.image);
230
231 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
232 EINA_SAFETY_ON_NULL_RETURN(einfo);
233
234 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
235 einfo->info.dest_buffer = pixels;
236 einfo->info.dest_buffer_row_bytes = stride;
237 einfo->info.use_color_key = 0;
238 einfo->info.alpha_threshold = 0;
239 einfo->info.func.new_update_region = NULL;
240 einfo->info.func.free_update_region = NULL;
241 evas_object_image_data_set(ee->engine.ews.image, pixels);
242 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
243 {
244 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
245 }
246}
247
248static void
249_ecore_evas_ews_resize(Ecore_Evas *ee, int w, int h)
250{
251 if (w < 1) w = 1;
252 if (h < 1) h = 1;
253
254 ee->req.w = w;
255 ee->req.h = h;
256
257 if ((w == ee->w) && (h == ee->h)) return;
258 ee->w = w;
259 ee->h = h;
260 _ecore_evas_ews_resize_internal(ee, w, h);
261 if (ee->func.fn_resize) ee->func.fn_resize(ee);
262 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RESIZE);
263}
264
265static void
266_ecore_evas_ews_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
267{
268 _ecore_evas_ews_move(ee, x, y);
269 _ecore_evas_ews_resize(ee, w, h);
270}
271
272static void
273_ecore_evas_ews_rotation_set(Ecore_Evas *ee, int rot, int resize EINA_UNUSED)
274{
275 if (ee->rotation == rot) return;
276 ee->rotation = rot;
277
278 ERR("TODO: rot=%d, resize=%d", rot, resize);
279
280 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
281}
282
283static void
284_ecore_evas_ews_shaped_set(Ecore_Evas *ee, int val)
285{
286 if (ee->shaped == val) return;
287 ee->shaped = val;
288 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
289}
290
291static void
292_ecore_evas_ews_show(Ecore_Evas *ee)
293{
294 ee->should_be_visible = EINA_TRUE;
295 evas_object_show(ee->engine.ews.image);
296 if (ee->prop.fullscreen)
297 evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
298
299 if (ee->func.fn_show) ee->func.fn_show(ee);
300 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_SHOW);
301}
302
303static void
304_ecore_evas_ews_hide(Ecore_Evas *ee)
305{
306 ee->should_be_visible = EINA_FALSE;
307 evas_object_hide(ee->engine.ews.image);
308
309 if (ee->func.fn_hide) ee->func.fn_hide(ee);
310 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_HIDE);
311}
312
313static void
314_ecore_evas_ews_raise(Ecore_Evas *ee)
315{
316 evas_object_raise(ee->engine.ews.image);
317 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RAISE);
318}
319
320static void
321_ecore_evas_ews_lower(Ecore_Evas *ee)
322{
323 evas_object_lower(ee->engine.ews.image);
324 evas_object_lower(_ews_bg);
325 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LOWER);
326}
327
328static void
329_ecore_evas_ews_activate(Ecore_Evas *ee)
330{
331 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ACTIVATE);
332}
333
334static void
335_ecore_evas_ews_title_set(Ecore_Evas *ee, const char *t)
336{
337 if (ee->prop.title) free(ee->prop.title);
338 ee->prop.title = NULL;
339 if (t) ee->prop.title = strdup(t);
340 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
341}
342
343static void
344_ecore_evas_ews_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
345{
346 if (ee->prop.name) free(ee->prop.name);
347 if (ee->prop.clas) free(ee->prop.clas);
348 ee->prop.name = NULL;
349 ee->prop.clas = NULL;
350 if (n) ee->prop.name = strdup(n);
351 if (c) ee->prop.clas = strdup(c);
352 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
353}
354
355static void
356_ecore_evas_ews_size_min_set(Ecore_Evas *ee, int w, int h)
357{
358 if (w < 0) w = 0;
359 if (h < 0) h = 0;
360 if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
361 ee->prop.min.w = w;
362 ee->prop.min.h = h;
363 evas_object_size_hint_min_set(ee->engine.ews.image, w, h);
364 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
365}
366
367static void
368_ecore_evas_ews_size_max_set(Ecore_Evas *ee, int w, int h)
369{
370 if (w < 0) w = 0;
371 if (h < 0) h = 0;
372 if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
373 ee->prop.max.w = w;
374 ee->prop.max.h = h;
375 evas_object_size_hint_max_set(ee->engine.ews.image, w, h);
376 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
377}
378
379static void
380_ecore_evas_ews_size_base_set(Ecore_Evas *ee, int w, int h)
381{
382 if (w < 0) w = 0;
383 if (h < 0) h = 0;
384 if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
385 ee->prop.base.w = w;
386 ee->prop.base.h = h;
387 evas_object_size_hint_request_set(ee->engine.ews.image, w, h);
388 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
389}
390
391static void
392_ecore_evas_ews_size_step_set(Ecore_Evas *ee, int w, int h)
393{
394 if (w < 1) w = 1;
395 if (h < 1) h = 1;
396 if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
397 ee->prop.step.w = w;
398 ee->prop.step.h = h;
399 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
400}
401
402static void
403_ecore_evas_ews_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj EINA_UNUSED,
404 int layer EINA_UNUSED, int hot_x EINA_UNUSED,
405 int hot_y EINA_UNUSED)
406{
407 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
408}
409
410static void
411_ecore_evas_ews_layer_set(Ecore_Evas *ee, int layer)
412{
413 if (layer < EVAS_LAYER_MIN + 2)
414 layer = EVAS_LAYER_MIN + 2;
415 else if (layer > EVAS_LAYER_MAX)
416 layer = EVAS_LAYER_MAX;
417
418 if (ee->prop.layer == layer) return;
419 ee->prop.layer = layer;
420 evas_object_layer_set(ee->engine.ews.image, layer);
421 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LAYER_CHANGE);
422}
423
424static void
425_ecore_evas_ews_focus_set(Ecore_Evas *ee, Eina_Bool on)
426{
427 evas_object_focus_set(ee->engine.ews.image, on);
428 _ecore_evas_focus_device_set(ee, NULL, on);
429 if (on)
430 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FOCUS);
431 else
432 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_UNFOCUS);
433}
434
435static void
436_ecore_evas_ews_iconified_set(Ecore_Evas *ee, Eina_Bool on)
437{
438 if (ee->prop.iconified == on) return;
439 ee->prop.iconified = on;
440 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE);
441}
442
443static void
444_ecore_evas_ews_borderless_set(Ecore_Evas *ee, Eina_Bool on)
445{
446 if (ee->prop.borderless == on) return;
447 ee->prop.borderless = on;
448 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
449}
450
451static void
452_ecore_evas_ews_override_set(Ecore_Evas *ee, Eina_Bool on)
453{
454 if (ee->prop.override == on) return;
455 if (ee->visible) evas_object_show(ee->engine.ews.image);
456 if (ecore_evas_focus_device_get(ee, NULL))
457 evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
458 ee->prop.override = on;
459 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
460}
461
462static void
463_ecore_evas_ews_maximized_set(Ecore_Evas *ee, Eina_Bool on)
464{
465 if (ee->prop.maximized == on) return;
466 ee->prop.maximized = on;
467 if (on) evas_object_show(ee->engine.ews.image);
468 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE);
469}
470
471static void
472_ecore_evas_ews_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
473{
474 if (ee->prop.fullscreen == on) return;
475 ee->prop.fullscreen = on;
476
477 if (!on)
478 {
479 evas_object_move(ee->engine.ews.image, ee->x, ee->y);
480 evas_object_resize(ee->engine.ews.image, ee->w, ee->h);
481 }
482 else
483 {
484 Evas_Coord w, h;
485 ecore_evas_geometry_get(_ews_ee, NULL, NULL, &w, &h);
486 evas_object_move(ee->engine.ews.image, 0, 0);
487 evas_object_resize(ee->engine.ews.image, w, h);
488 evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
489 }
490
491 if (ee->should_be_visible)
492 evas_object_show(ee->engine.ews.image);
493 else
494 evas_object_hide(ee->engine.ews.image);
495
496 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE);
497}
498
499static void
500_ecore_evas_ews_avoid_damage_set(Ecore_Evas *ee, int val)
501{
502 if (ee->prop.avoid_damage == val) return;
503 ee->prop.avoid_damage = val;
504 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
505}
506
507static void
508_ecore_evas_ews_withdrawn_set(Ecore_Evas *ee, Eina_Bool on)
509{
510 if (ee->prop.withdrawn == on) return;
511 ee->prop.withdrawn = on;
512 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
513}
514
515static void
516_ecore_evas_ews_sticky_set(Ecore_Evas *ee, Eina_Bool on)
517{
518 if (ee->prop.sticky == on) return;
519 ee->prop.sticky = on;
520 if ((on) && (ee->func.fn_sticky)) ee->func.fn_sticky(ee);
521 else if ((!on) && (ee->func.fn_unsticky)) ee->func.fn_unsticky(ee);
522 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
523}
524
525static void
526_ecore_evas_ews_ignore_events_set(Ecore_Evas *ee, int val)
527{
528 if (ee->ignore_events == val) return;
529 ee->ignore_events = val;
530 evas_object_pass_events_set(ee->engine.ews.image, val);
531 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
532}
533
534static void
535_ecore_evas_ews_alpha_set(Ecore_Evas *ee, int val)
536{
537 if (ee->alpha == val) return;
538 ee->alpha = val;
539 evas_object_image_alpha_set(ee->engine.ews.image, val);
540 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
541}
542
543static void
544_ecore_evas_ews_transparent_set(Ecore_Evas *ee, int val)
545{
546 if (ee->transparent == val) return;
547 ee->transparent = val;
548 evas_object_image_alpha_set(ee->engine.ews.image, val);
549 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
550}
551
552static Eina_Bool
553_ecore_evas_ews_prepare(Ecore_Evas *ee)
554{
555 Evas_Coord w, h;
556 void *pixels;
557
558 evas_object_image_size_get(ee->engine.ews.image, &w, &h);
559 if ((w != ee->w) || (h != ee->h))
560 ecore_evas_resize(ee, w, h);
561
562 pixels = evas_object_image_data_get(ee->engine.ews.image, 1);
563 if (!pixels) return EINA_FALSE;
564
565 evas_object_data_set(ee->engine.ews.image, "_ews.pixels", pixels);
566
567 return EINA_TRUE;
568}
569
570static void
571_ecore_evas_ews_update_image(void *data, Evas *e EINA_UNUSED, void *event_info)
572{
573 Evas_Event_Render_Post *post = event_info;
574 Ecore_Evas *ee = data;
575 Eina_Rectangle *r;
576 Eina_List *l;
577 void *pixels;
578
579 pixels = evas_object_data_get(ee->engine.ews.image, "_ews.pixels");
580 if (!pixels) return ;
581
582 evas_object_image_data_set(ee->engine.ews.image, pixels);
583 EINA_LIST_FOREACH(post->updated_area, l, r)
584 evas_object_image_data_update_add(ee->engine.ews.image,
585 r->x, r->y, r->w, r->h);
586
587 evas_object_data_set(ee->engine.ews.image, "_ews.pixels", NULL);
588}
589
590static void
591_ecore_evas_ews_screen_geometry_get(const Ecore_Evas *ee EINA_UNUSED, int *x, int *y, int *w, int *h)
592{
593 ecore_evas_geometry_get(_ews_ee, x, y, w, h);
594}
595
596static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
597{
598 _ecore_evas_ews_free,
599 NULL,
600 NULL,
601 NULL,
602 NULL,
603 NULL,
604 NULL,
605 NULL,
606 NULL,
607 NULL,
608 NULL,
609 NULL,
610 NULL,
611 NULL,
612 NULL,
613 _ecore_evas_ews_move,
614 _ecore_evas_ews_managed_move,
615 _ecore_evas_ews_resize,
616 _ecore_evas_ews_move_resize,
617 _ecore_evas_ews_rotation_set,
618 _ecore_evas_ews_shaped_set,
619 _ecore_evas_ews_show,
620 _ecore_evas_ews_hide,
621 _ecore_evas_ews_raise,
622 _ecore_evas_ews_lower,
623 _ecore_evas_ews_activate,
624 _ecore_evas_ews_title_set,
625 _ecore_evas_ews_name_class_set,
626 _ecore_evas_ews_size_min_set,
627 _ecore_evas_ews_size_max_set,
628 _ecore_evas_ews_size_base_set,
629 _ecore_evas_ews_size_step_set,
630 _ecore_evas_ews_object_cursor_set,
631 NULL,
632 _ecore_evas_ews_layer_set,
633 _ecore_evas_ews_focus_set,
634 _ecore_evas_ews_iconified_set,
635 _ecore_evas_ews_borderless_set,
636 _ecore_evas_ews_override_set,
637 _ecore_evas_ews_maximized_set,
638 _ecore_evas_ews_fullscreen_set,
639 _ecore_evas_ews_avoid_damage_set,
640 _ecore_evas_ews_withdrawn_set,
641 _ecore_evas_ews_sticky_set,
642 _ecore_evas_ews_ignore_events_set,
643 _ecore_evas_ews_alpha_set,
644 _ecore_evas_ews_transparent_set,
645 NULL, // profiles_set
646 NULL, // profile_set
647
648 NULL,
649 NULL,
650 NULL,
651 NULL,
652 NULL,
653 NULL,
654
655 NULL,
656 _ecore_evas_ews_screen_geometry_get,
657 NULL, // screen_dpi_get
658 NULL,
659 NULL, // msg_send
660
661 NULL, // pointer_xy_get
662 NULL, // pointer_warp
663
664 NULL, // wm_rot_preferred_rotation_set
665 NULL, // wm_rot_available_rotations_set
666 NULL, // wm_rot_manual_rotation_done_set
667 NULL, // wm_rot_manual_rotation_done
668
669 NULL, // aux_hints_set
670
671 NULL, // fn_animator_register
672 NULL, // fn_animator_unregister
673
674 NULL, // fn_evas_changed
675 NULL, //fn_focus_device_set
676 NULL, //fn_callback_focus_device_in_set
677 NULL, //fn_callback_focus_device_out_set
678 NULL, //fn_callback_device_mouse_in_set
679 NULL, //fn_callback_device_mouse_out_set
680 NULL, //fn_pointer_device_xy_get
681 _ecore_evas_ews_prepare,
682};
683
684void
685_ecore_evas_ews_events_init(void)
686{
687 ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = ecore_event_type_new();
688 ECORE_EVAS_EWS_EVENT_ADD = ecore_event_type_new();
689 ECORE_EVAS_EWS_EVENT_DEL = ecore_event_type_new();
690 ECORE_EVAS_EWS_EVENT_RESIZE = ecore_event_type_new();
691 ECORE_EVAS_EWS_EVENT_MOVE = ecore_event_type_new();
692 ECORE_EVAS_EWS_EVENT_SHOW = ecore_event_type_new();
693 ECORE_EVAS_EWS_EVENT_HIDE = ecore_event_type_new();
694 ECORE_EVAS_EWS_EVENT_FOCUS = ecore_event_type_new();
695 ECORE_EVAS_EWS_EVENT_UNFOCUS = ecore_event_type_new();
696 ECORE_EVAS_EWS_EVENT_RAISE = ecore_event_type_new();
697 ECORE_EVAS_EWS_EVENT_LOWER = ecore_event_type_new();
698 ECORE_EVAS_EWS_EVENT_ACTIVATE = ecore_event_type_new();
699 ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = ecore_event_type_new();
700 ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = ecore_event_type_new();
701 ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = ecore_event_type_new();
702 ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = ecore_event_type_new();
703 ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = ecore_event_type_new();
704}
705
706void
707_ecore_evas_ews_events_flush(void)
708{
709 ecore_event_type_flush(ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE,
710 ECORE_EVAS_EWS_EVENT_ADD,
711 ECORE_EVAS_EWS_EVENT_DEL,
712 ECORE_EVAS_EWS_EVENT_RESIZE,
713 ECORE_EVAS_EWS_EVENT_MOVE,
714 ECORE_EVAS_EWS_EVENT_SHOW,
715 ECORE_EVAS_EWS_EVENT_HIDE,
716 ECORE_EVAS_EWS_EVENT_FOCUS,
717 ECORE_EVAS_EWS_EVENT_UNFOCUS,
718 ECORE_EVAS_EWS_EVENT_RAISE,
719 ECORE_EVAS_EWS_EVENT_LOWER,
720 ECORE_EVAS_EWS_EVENT_ACTIVATE,
721 ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE,
722 ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE,
723 ECORE_EVAS_EWS_EVENT_LAYER_CHANGE,
724 ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE,
725 ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
726}
727
728static int
729_ecore_evas_ews_init(void)
730{
731 _ecore_evas_init_count++;
732 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
733
734 _ecore_evas_ews_env_setup();
735
736 return _ecore_evas_init_count;
737}
738
739int
740_ecore_evas_ews_shutdown(void)
741{
742 _ecore_evas_init_count--;
743 if (_ecore_evas_init_count == 0)
744 {
745 if (_ews_ee)
746 {
747 ecore_evas_free(_ews_ee);
748 _ews_ee = NULL;
749 }
750 if (_ews_children)
751 {
752 eina_list_free(_ews_children);
753 _ews_children = NULL;
754 }
755
756 free(_ews_engine);
757 _ews_engine = NULL;
758 free(_ews_options);
759 _ews_options = NULL;
760 _ews_defaults_engine = EINA_TRUE;
761 _ews_defaults_geo = EINA_TRUE;
762
763 }
764 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
765 return _ecore_evas_init_count;
766}
767
768static void
769_ecore_evas_ews_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
770{
771 Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh;
772
773 evas_object_geometry_get(ee->engine.ews.image, &xx, &yy, &ww, &hh);
774 evas_object_image_fill_get(ee->engine.ews.image, &fx, &fy, &fw, &fh);
775
776 if (fw < 1) fw = 1;
777 if (fh < 1) fh = 1;
778
779 if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh))
780 {
781 *x = (ee->w * (*x - xx)) / fw;
782 *y = (ee->h * (*y - yy)) / fh;
783 }
784 else
785 {
786 xx = (*x - xx) - fx;
787 while (xx < 0) xx += fw;
788 while (xx > fw) xx -= fw;
789 *x = (ee->w * xx) / fw;
790
791 yy = (*y - yy) - fy;
792 while (yy < 0) yy += fh;
793 while (yy > fh) yy -= fh;
794 *y = (ee->h * yy) / fh;
795 }
796}
797
798static void
799_ecore_evas_ews_modifiers_apply(Ecore_Evas *ee, const Evas_Modifier *modifier)
800{
801 Evas *e = ee->evas;
802
803 if (evas_key_modifier_is_set(modifier, "Shift"))
804 evas_key_modifier_on(e, "Shift");
805 else evas_key_modifier_off(e, "Shift");
806
807 if (evas_key_modifier_is_set(modifier, "Control"))
808 evas_key_modifier_on(e, "Control");
809 else evas_key_modifier_off(e, "Control");
810
811 if (evas_key_modifier_is_set(modifier, "Alt"))
812 evas_key_modifier_on(e, "Alt");
813 else evas_key_modifier_off(e, "Alt");
814
815 if (evas_key_modifier_is_set(modifier, "Super"))
816 evas_key_modifier_on(e, "Super");
817 else evas_key_modifier_off(e, "Super");
818
819 if (evas_key_modifier_is_set(modifier, "Hyper"))
820 evas_key_modifier_on(e, "Hyper");
821 else evas_key_modifier_off(e, "Hyper");
822
823 if (evas_key_modifier_is_set(modifier, "Scroll_Lock"))
824 evas_key_lock_on(e, "Scroll_Lock");
825 else evas_key_lock_off(e, "Scroll_Lock");
826
827 if (evas_key_modifier_is_set(modifier, "Num_Lock"))
828 evas_key_lock_on(e, "Num_Lock");
829 else evas_key_lock_off(e, "Num_Lock");
830
831 if (evas_key_modifier_is_set(modifier, "Caps_Lock"))
832 evas_key_lock_on(e, "Caps_Lock");
833 else evas_key_lock_off(e, "Caps_Lock");
834
835 if (evas_key_modifier_is_set(modifier, "Shift_Lock"))
836 evas_key_lock_on(e, "Shift_Lock");
837 else evas_key_lock_off(e, "Shift_Lock");
838}
839
840static void
841_ecore_evas_ews_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
842{
843 Ecore_Evas *ee = data;
844 Evas_Event_Mouse_In *ev = event_info;
845 Evas_Coord x = ev->canvas.x;
846 Evas_Coord y = ev->canvas.y;
847 _ecore_evas_ews_coord_translate(ee, &x, &y);
848 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
849 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
850 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
851 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
852}
853
854static void
855_ecore_evas_ews_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
856{
857 Ecore_Evas *ee = data;
858 Evas_Event_Mouse_Out *ev = event_info;
859 Evas_Coord x = ev->canvas.x;
860 Evas_Coord y = ev->canvas.y;
861 // TODO: consider grab mode in EWS
862 _ecore_evas_ews_coord_translate(ee, &x, &y);
863 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
864 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
865 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
866 _ecore_evas_default_cursor_hide(ee);
867 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
868}
869
870static void
871_ecore_evas_ews_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
872{
873 Ecore_Evas *ee = data;
874 Evas_Event_Mouse_Down *ev = event_info;
875 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
876 evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
877}
878
879static void
880_ecore_evas_ews_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
881{
882 Ecore_Evas *ee = data;
883 Evas_Event_Mouse_Up *ev = event_info;
884 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
885 evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
886}
887
888static void
889_ecore_evas_ews_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
890{
891 Ecore_Evas *ee = data;
892 Evas_Event_Mouse_Move *ev = event_info;
893 Evas_Coord x = ev->cur.canvas.x;
894 Evas_Coord y = ev->cur.canvas.y;
895 _ecore_evas_ews_coord_translate(ee, &x, &y);
896 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
897 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
898}
899
900static void
901_ecore_evas_ews_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
902{
903 Ecore_Evas *ee = data;
904 Evas_Event_Mouse_Wheel *ev = event_info;
905 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
906 evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL);
907}
908
909static void
910_ecore_evas_ews_cb_multi_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
911{
912 Ecore_Evas *ee = data;
913 Evas_Event_Multi_Down *ev = event_info;
914 Evas_Coord x, y, xx, yy;
915 double xf, yf;
916
917 x = ev->canvas.x;
918 y = ev->canvas.y;
919 xx = x;
920 yy = y;
921 _ecore_evas_ews_coord_translate(ee, &x, &y);
922 xf = (ev->canvas.xsub - (double)xx) + (double)x;
923 yf = (ev->canvas.ysub - (double)yy) + (double)y;
924 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
925 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);
926}
927
928static void
929_ecore_evas_ews_cb_multi_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
930{
931 Ecore_Evas *ee = data;
932 Evas_Event_Multi_Up *ev = event_info;
933 Evas_Coord x, y, xx, yy;
934 double xf, yf;
935
936 x = ev->canvas.x;
937 y = ev->canvas.y;
938 xx = x;
939 yy = y;
940 _ecore_evas_ews_coord_translate(ee, &x, &y);
941 xf = (ev->canvas.xsub - (double)xx) + (double)x;
942 yf = (ev->canvas.ysub - (double)yy) + (double)y;
943 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
944 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);
945}
946
947static void
948_ecore_evas_ews_cb_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
949{
950 Ecore_Evas *ee = data;
951 Evas_Event_Multi_Move *ev = event_info;
952 Evas_Coord x, y, xx, yy;
953 double xf, yf;
954
955 x = ev->cur.canvas.x;
956 y = ev->cur.canvas.y;
957 xx = x;
958 yy = y;
959 _ecore_evas_ews_coord_translate(ee, &x, &y);
960 xf = (ev->cur.canvas.xsub - (double)xx) + (double)x;
961 yf = (ev->cur.canvas.ysub - (double)yy) + (double)y;
962 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
963 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);
964}
965
966static void
967_ecore_evas_ews_cb_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
968{
969 Ecore_Evas *ee = data;
970 if (ee->driver) _ecore_evas_free(ee);
971}
972
973static void
974_ecore_evas_ews_cb_key_down(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
975{
976 Ecore_Evas *ee = data;
977 Evas_Event_Key_Down *ev = event_info;
978
979 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
980 evas_key_modifier_on(ee->evas, "Shift");
981 else
982 evas_key_modifier_off(ee->evas, "Shift");
983 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
984 evas_key_modifier_on(ee->evas, "Control");
985 else
986 evas_key_modifier_off(ee->evas, "Control");
987 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
988 evas_key_modifier_on(ee->evas, "Alt");
989 else
990 evas_key_modifier_off(ee->evas, "Alt");
991 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
992 evas_key_modifier_on(ee->evas, "Meta");
993 else
994 evas_key_modifier_off(ee->evas, "Meta");
995 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
996 evas_key_modifier_on(ee->evas, "Hyper");
997 else
998 evas_key_modifier_off(ee->evas, "Hyper");
999 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
1000 evas_key_modifier_on(ee->evas, "Super");
1001 else
1002 evas_key_modifier_off(ee->evas, "Super");
1003 if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
1004 evas_key_lock_on(ee->evas, "Scroll_Lock");
1005 else
1006 evas_key_lock_off(ee->evas, "Scroll_Lock");
1007 if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
1008 evas_key_lock_on(ee->evas, "Num_Lock");
1009 else
1010 evas_key_lock_off(ee->evas, "Num_Lock");
1011 if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
1012 evas_key_lock_on(ee->evas, "Caps_Lock");
1013 else
1014 evas_key_lock_off(ee->evas, "Caps_Lock");
1015 evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
1016}
1017
1018static void
1019_ecore_evas_ews_cb_key_up(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
1020{
1021 Ecore_Evas *ee = data;
1022 Evas_Event_Key_Up *ev = event_info;
1023
1024 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
1025 evas_key_modifier_on(ee->evas, "Shift");
1026 else
1027 evas_key_modifier_off(ee->evas, "Shift");
1028 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
1029 evas_key_modifier_on(ee->evas, "Control");
1030 else
1031 evas_key_modifier_off(ee->evas, "Control");
1032 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
1033 evas_key_modifier_on(ee->evas, "Alt");
1034 else
1035 evas_key_modifier_off(ee->evas, "Alt");
1036 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
1037 evas_key_modifier_on(ee->evas, "Meta");
1038 else
1039 evas_key_modifier_off(ee->evas, "Meta");
1040 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
1041 evas_key_modifier_on(ee->evas, "Hyper");
1042 else
1043 evas_key_modifier_off(ee->evas, "Hyper");
1044 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
1045 evas_key_modifier_on(ee->evas, "Super");
1046 else
1047 evas_key_modifier_off(ee->evas, "Super");
1048 if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
1049 evas_key_lock_on(ee->evas, "Scroll_Lock");
1050 else
1051 evas_key_lock_off(ee->evas, "Scroll_Lock");
1052 if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
1053 evas_key_lock_on(ee->evas, "Num_Lock");
1054 else
1055 evas_key_lock_off(ee->evas, "Num_Lock");
1056 if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
1057 evas_key_lock_on(ee->evas, "Caps_Lock");
1058 else
1059 evas_key_lock_off(ee->evas, "Caps_Lock");
1060 evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
1061}
1062
1063static void
1064_ecore_evas_ews_cb_focus_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1065{
1066 Ecore_Evas *ee = data;
1067 ecore_evas_focus_set(ee, EINA_TRUE);
1068}
1069
1070static void
1071_ecore_evas_ews_cb_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1072{
1073 Ecore_Evas *ee = data;
1074 if (ee->deleted) return;
1075 ecore_evas_focus_set(ee, EINA_FALSE);
1076}
1077
1078static void
1079_ecore_evas_ews_cb_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1080{
1081 Ecore_Evas *ee = data;
1082 ecore_evas_show(ee);
1083}
1084
1085static void
1086_ecore_evas_ews_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1087{
1088 Ecore_Evas *ee = data;
1089 if (ee->deleted) return;
1090 ecore_evas_hide(ee);
1091}
1092#endif
1093
1094EAPI Ecore_Evas * 37EAPI Ecore_Evas *
1095ecore_evas_ews_new(int x, int y, int w, int h) 38ecore_evas_ews_new(int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED)
1096{ 39{
1097// basically a copy of ecore_evas_buffer_new() keep in sync...
1098#ifdef BUILD_ECORE_EVAS_EWS
1099 Evas_Object *o;
1100 Evas_Engine_Info_Buffer *einfo;
1101 Ecore_Evas *ee;
1102 int rmethod;
1103 static Eina_Bool creating = EINA_FALSE;
1104
1105 if (_ecore_evas_ews_init() < 1) return NULL;
1106
1107 if (creating) return NULL; /* avoid recursive ecore_evas_new() with ews */
1108 creating = EINA_TRUE;
1109 if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new();
1110 creating = EINA_FALSE;
1111 if (!_ews_ee)
1112 {
1113 ERR("Could not create EWS backing store");
1114 _ecore_evas_ews_shutdown();
1115 return NULL;
1116 }
1117
1118 rmethod = evas_render_method_lookup("buffer");
1119 if (!rmethod) return NULL;
1120 ee = calloc(1, sizeof(Ecore_Evas));
1121 if (!ee) return NULL;
1122
1123 if (w < 1) w = 1;
1124 if (h < 1) h = 1;
1125
1126 o = evas_object_image_add(_ews_ee->evas);
1127 evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
1128 evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
1129 evas_object_image_size_set(o, w, h);
1130 evas_object_image_alpha_set(o, 1);
1131
1132 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
1133
1134 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_ews_engine_func;
1135
1136 ee->driver = EWS_ENGINE_NAME;
1137
1138 ee->x = 0;
1139 ee->y = 0;
1140 ee->w = w;
1141 ee->h = h;
1142 ee->req.x = ee->x;
1143 ee->req.y = ee->y;
1144 ee->req.w = ee->w;
1145 ee->req.h = ee->h;
1146
1147 /* init evas here */
1148 ee->evas = evas_new();
1149 evas_data_attach_set(ee->evas, ee);
1150 evas_output_method_set(ee->evas, rmethod);
1151 evas_output_size_set(ee->evas, w, h);
1152 evas_output_viewport_set(ee->evas, 0, 0, w, h);
1153
1154 evas_object_move(o, x, y);
1155 evas_object_resize(o, w, h);
1156 evas_object_image_fill_set(o, 0, 0, w, h);
1157
1158 ee->engine.ews.image = o;
1159 evas_object_data_set(ee->engine.ews.image, "Ecore_Evas", ee);
1160 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, _ecore_evas_ews_update_image, ee);
1161 evas_object_event_callback_add(ee->engine.ews.image,
1162 EVAS_CALLBACK_MOUSE_IN,
1163 _ecore_evas_ews_cb_mouse_in, ee);
1164 evas_object_event_callback_add(ee->engine.ews.image,
1165 EVAS_CALLBACK_MOUSE_OUT,
1166 _ecore_evas_ews_cb_mouse_out, ee);
1167 evas_object_event_callback_add(ee->engine.ews.image,
1168 EVAS_CALLBACK_MOUSE_DOWN,
1169 _ecore_evas_ews_cb_mouse_down, ee);
1170 evas_object_event_callback_add(ee->engine.ews.image,
1171 EVAS_CALLBACK_MOUSE_UP,
1172 _ecore_evas_ews_cb_mouse_up, ee);
1173 evas_object_event_callback_add(ee->engine.ews.image,
1174 EVAS_CALLBACK_MOUSE_MOVE,
1175 _ecore_evas_ews_cb_mouse_move, ee);
1176 evas_object_event_callback_add(ee->engine.ews.image,
1177 EVAS_CALLBACK_MOUSE_WHEEL,
1178 _ecore_evas_ews_cb_mouse_wheel, ee);
1179 evas_object_event_callback_add(ee->engine.ews.image,
1180 EVAS_CALLBACK_MULTI_DOWN,
1181 _ecore_evas_ews_cb_multi_down, ee);
1182 evas_object_event_callback_add(ee->engine.ews.image,
1183 EVAS_CALLBACK_MULTI_UP,
1184 _ecore_evas_ews_cb_multi_up, ee);
1185 evas_object_event_callback_add(ee->engine.ews.image,
1186 EVAS_CALLBACK_MULTI_MOVE,
1187 _ecore_evas_ews_cb_multi_move, ee);
1188 evas_object_event_callback_add(ee->engine.ews.image,
1189 EVAS_CALLBACK_FREE,
1190 _ecore_evas_ews_cb_free, ee);
1191 evas_object_event_callback_add(ee->engine.ews.image,
1192 EVAS_CALLBACK_KEY_DOWN,
1193 _ecore_evas_ews_cb_key_down, ee);
1194 evas_object_event_callback_add(ee->engine.ews.image,
1195 EVAS_CALLBACK_KEY_UP,
1196 _ecore_evas_ews_cb_key_up, ee);
1197 evas_object_event_callback_add(ee->engine.ews.image,
1198 EVAS_CALLBACK_FOCUS_IN,
1199 _ecore_evas_ews_cb_focus_in, ee);
1200 evas_object_event_callback_add(ee->engine.ews.image,
1201 EVAS_CALLBACK_FOCUS_OUT,
1202 _ecore_evas_ews_cb_focus_out, ee);
1203 evas_object_event_callback_add(ee->engine.ews.image,
1204 EVAS_CALLBACK_SHOW,
1205 _ecore_evas_ews_cb_show, ee);
1206 evas_object_event_callback_add(ee->engine.ews.image,
1207 EVAS_CALLBACK_HIDE,
1208 _ecore_evas_ews_cb_hide, ee);
1209 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
1210 if (einfo)
1211 {
1212 void *pixels = evas_object_image_data_get(o, 1);
1213 evas_object_image_data_set(o, pixels); // refcount
1214 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
1215 einfo->info.dest_buffer = pixels;
1216 einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o);
1217 einfo->info.use_color_key = 0;
1218 einfo->info.alpha_threshold = 0;
1219 einfo->info.func.new_update_region = NULL;
1220 einfo->info.func.free_update_region = NULL;
1221 evas_object_image_data_set(o, pixels);
1222 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1223 {
1224 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1225 ecore_evas_free(ee);
1226 return NULL;
1227 }
1228 }
1229 else
1230 {
1231 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1232 ecore_evas_free(ee);
1233 return NULL;
1234 }
1235 evas_key_modifier_add(ee->evas, "Shift");
1236 evas_key_modifier_add(ee->evas, "Control");
1237 evas_key_modifier_add(ee->evas, "Alt");
1238 evas_key_modifier_add(ee->evas, "Meta");
1239 evas_key_modifier_add(ee->evas, "Hyper");
1240 evas_key_modifier_add(ee->evas, "Super");
1241 evas_key_lock_add(ee->evas, "Caps_Lock");
1242 evas_key_lock_add(ee->evas, "Num_Lock");
1243 evas_key_lock_add(ee->evas, "Scroll_Lock");
1244
1245 if (!_ecore_evas_cursors_init(ee))
1246 {
1247 ERR("Could not init the Ecore Evas cursors");
1248 ecore_evas_free(ee);
1249 }
1250
1251 _ecore_evas_subregister(_ews_ee, ee);
1252 _ews_children = eina_list_append(_ews_children, ee);
1253
1254 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ADD);
1255
1256 return ee;
1257#else
1258 return NULL; 40 return NULL;
1259 (void)x;
1260 (void)y;
1261 (void)w;
1262 (void)h;
1263#endif
1264} 41}
1265 42
1266EAPI Evas_Object * 43EAPI Evas_Object *
1267ecore_evas_ews_backing_store_get(const Ecore_Evas *ee) 44ecore_evas_ews_backing_store_get(const Ecore_Evas *ee EINA_UNUSED)
1268{ 45{
1269#ifdef BUILD_ECORE_EVAS_EWS
1270 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1271 {
1272 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1273 "ecore_evas_ews_backing_store_get");
1274 return NULL;
1275 }
1276 return ee->engine.ews.image;
1277#else
1278 return NULL; 46 return NULL;
1279 (void)ee;
1280#endif
1281} 47}
1282 48
1283EAPI void 49EAPI void
1284ecore_evas_ews_delete_request(Ecore_Evas *ee) 50ecore_evas_ews_delete_request(Ecore_Evas *ee EINA_UNUSED)
1285{ 51{
1286#ifdef BUILD_ECORE_EVAS_EWS
1287 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1288 {
1289 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1290 "ecore_evas_ews_delete_request");
1291 return;
1292 }
1293 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
1294 else ecore_evas_free(ee);
1295#else
1296 (void)ee;
1297#endif
1298} 52}
1299 53
1300 54
1301EAPI Eina_Bool 55EAPI Eina_Bool
1302ecore_evas_ews_engine_set(const char *engine, const char *options) 56ecore_evas_ews_engine_set(const char *engine EINA_UNUSED, const char *options EINA_UNUSED)
1303{ 57{
1304#ifdef BUILD_ECORE_EVAS_EWS
1305 if (_ews_ee) return EINA_FALSE;
1306
1307 free(_ews_engine);
1308 free(_ews_options);
1309
1310 _ews_engine = engine ? strdup(engine) : NULL;
1311 _ews_options = options ? strdup(options) : NULL;
1312
1313 if ((engine) && (!_ews_engine)) return EINA_FALSE;
1314 if ((options) && (!_ews_options))
1315 {
1316 free(_ews_engine);
1317 _ews_engine = NULL;
1318 _ews_defaults_engine = EINA_TRUE;
1319 return EINA_FALSE;
1320 }
1321
1322 _ews_defaults_engine = EINA_FALSE;
1323 return EINA_TRUE;
1324#else
1325 return EINA_FALSE; 58 return EINA_FALSE;
1326 (void)engine;
1327 (void)options;
1328#endif
1329} 59}
1330 60
1331EAPI Eina_Bool 61EAPI Eina_Bool
1332ecore_evas_ews_setup(int x, int y, int w, int h) 62ecore_evas_ews_setup(int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED)
1333{ 63{
1334#ifdef BUILD_ECORE_EVAS_EWS
1335 Eina_Bool ret = EINA_TRUE;
1336
1337 _ews_defaults_geo = EINA_FALSE;
1338 _ews_x = x;
1339 _ews_y = y;
1340 _ews_w = w;
1341 _ews_h = h;
1342
1343 if (!_ews_ee) return EINA_TRUE;
1344
1345 /* move-resize is not as implemented as move + resize */
1346 ecore_evas_move(_ews_ee, x, y);
1347 ecore_evas_size_min_set(_ews_ee, w, h);
1348 ecore_evas_size_max_set(_ews_ee, w, h);
1349 ecore_evas_resize(_ews_ee, w, h);
1350
1351 ecore_evas_geometry_get(_ews_ee, &x, &y, &w, &h);
1352
1353#define TST(n) if ((n != _ews_##n)) \
1354 { \
1355 WRN("Asked %d, got %d for "#n, _ews_##n, n); \
1356 ret = EINA_FALSE; \
1357 }
1358 TST(x);
1359 TST(y);
1360 TST(w);
1361 TST(h);
1362#undef TST
1363 return ret;
1364#else
1365 return EINA_FALSE; 64 return EINA_FALSE;
1366 (void)x;
1367 (void)y;
1368 (void)w;
1369 (void)h;
1370#endif
1371} 65}
1372 66
1373EAPI Ecore_Evas * 67EAPI Ecore_Evas *
1374ecore_evas_ews_ecore_evas_get(void) 68ecore_evas_ews_ecore_evas_get(void)
1375{ 69{
1376#ifdef BUILD_ECORE_EVAS_EWS
1377 if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new();
1378 return _ews_ee;
1379#else
1380 return NULL; 70 return NULL;
1381#endif
1382} 71}
1383 72
1384EAPI Evas * 73EAPI Evas *
1385ecore_evas_ews_evas_get(void) 74ecore_evas_ews_evas_get(void)
1386{ 75{
1387#ifdef BUILD_ECORE_EVAS_EWS
1388 return ecore_evas_get(ecore_evas_ews_ecore_evas_get());
1389#else
1390 return NULL; 76 return NULL;
1391#endif
1392} 77}
1393 78
1394EAPI Evas_Object * 79EAPI Evas_Object *
1395ecore_evas_ews_background_get(void) 80ecore_evas_ews_background_get(void)
1396{ 81{
1397#ifdef BUILD_ECORE_EVAS_EWS
1398 return _ews_bg;
1399#else
1400 return NULL; 82 return NULL;
1401#endif
1402}
1403
1404#ifdef BUILD_ECORE_EVAS_EWS
1405static void
1406_ecore_evas_ews_background_free(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
1407{
1408 _ews_bg = NULL;
1409 ecore_evas_ews_background_set(NULL);
1410} 83}
1411#endif
1412 84
1413EAPI void 85EAPI void
1414ecore_evas_ews_background_set(Evas_Object *o) 86ecore_evas_ews_background_set(Evas_Object *o EINA_UNUSED)
1415{ 87{
1416#ifdef BUILD_ECORE_EVAS_EWS
1417 if ((o) && (o == _ews_bg)) return;
1418
1419 if (_ews_bg)
1420 {
1421 evas_object_del(_ews_bg);
1422 _ews_bg = NULL;
1423 }
1424
1425 if ((!o) && (_ews_ee))
1426 {
1427 o = evas_object_rectangle_add(ecore_evas_get(_ews_ee));
1428 evas_object_color_set(o, 0, 0, 0, 255);
1429 }
1430
1431 if (_ews_ee)
1432 {
1433 Evas_Coord w, h, fw, fh;
1434 Evas *e = ecore_evas_get(_ews_ee);
1435
1436 if (e != evas_object_evas_get(o))
1437 {
1438 ERR("background not in ecore_evas_ews_evas_get() canvas!");
1439 return;
1440 }
1441
1442 evas_output_viewport_get(e, NULL, NULL, &w, &h);
1443 evas_output_framespace_get(e, NULL, NULL, &fw, &fh);
1444 evas_object_move(o, 0, 0);
1445 evas_object_resize(o, w - fw, h - fh);
1446 evas_object_layer_set(o, EVAS_LAYER_MIN + 1);
1447 evas_object_lower(o);
1448 evas_object_show(o);
1449
1450 evas_object_event_callback_add
1451 (o, EVAS_CALLBACK_FREE, _ecore_evas_ews_background_free, NULL);
1452 }
1453
1454 _ews_bg = o;
1455#else
1456 return;
1457 (void)o;
1458#endif
1459} 88}
1460 89
1461 90
1462EAPI const Eina_List * 91EAPI const Eina_List *
1463ecore_evas_ews_children_get(void) 92ecore_evas_ews_children_get(void)
1464{ 93{
1465#ifdef BUILD_ECORE_EVAS_EWS
1466 return _ews_children;
1467#else
1468 return NULL; 94 return NULL;
1469#endif
1470} 95}
1471 96
1472EAPI void 97EAPI void
1473ecore_evas_ews_manager_set(const void *manager) 98ecore_evas_ews_manager_set(const void *manager EINA_UNUSED)
1474{ 99{
1475#ifdef BUILD_ECORE_EVAS_EWS
1476 if (_ews_manager == manager) return;
1477 _ews_manager = manager;
1478 ecore_event_add(ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE, NULL, NULL, NULL);
1479#else
1480 (void)manager;
1481#endif
1482} 100}
1483 101
1484EAPI const void * 102EAPI const void *
1485ecore_evas_ews_manager_get(void) 103ecore_evas_ews_manager_get(void)
1486{ 104{
1487#ifdef BUILD_ECORE_EVAS_EWS
1488 return _ews_manager;
1489#else
1490 return NULL; 105 return NULL;
1491#endif
1492} 106}
diff --git a/src/lib/ecore_evas/ecore_evas_module.c b/src/lib/ecore_evas/ecore_evas_module.c
index 2b5394b06f..4fdd8f70b0 100644
--- a/src/lib/ecore_evas/ecore_evas_module.c
+++ b/src/lib/ecore_evas/ecore_evas_module.c
@@ -251,9 +251,6 @@ _ecore_evas_available_engines_get(void)
251#ifdef BUILD_ECORE_EVAS_BUFFER 251#ifdef BUILD_ECORE_EVAS_BUFFER
252 ADDENG("buffer"); 252 ADDENG("buffer");
253#endif 253#endif
254#ifdef BUILD_ECORE_EVAS_EWS
255 ADDENG("ews");
256#endif
257 } 254 }
258 else if (!strcmp(name, "cocoa")) 255 else if (!strcmp(name, "cocoa"))
259 { 256 {