diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c | 596 |
1 files changed, 596 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c new file mode 100644 index 0000000..457f9e9 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c | |||
@@ -0,0 +1,596 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <string.h> | ||
6 | |||
7 | #include <Ecore.h> | ||
8 | #include "ecore_private.h" | ||
9 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
10 | #include <Ecore_DirectFB.h> | ||
11 | #endif | ||
12 | |||
13 | #include "ecore_evas_private.h" | ||
14 | #include "Ecore_Evas.h" | ||
15 | |||
16 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
17 | static int _ecore_evas_init_count = 0; | ||
18 | static Ecore_Event_Handler *ecore_evas_event_handlers[13]; | ||
19 | |||
20 | static Eina_Hash *ecore_evases_hash = NULL; | ||
21 | |||
22 | static int | ||
23 | _ecore_evas_directfb_render(Ecore_Evas *ee) | ||
24 | { | ||
25 | Eina_List *updates, *ll; | ||
26 | Ecore_Evas *ee2; | ||
27 | int rend = 0; | ||
28 | |||
29 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
30 | { | ||
31 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
32 | if (ee2->engine.func->fn_render) | ||
33 | rend |= ee2->engine.func->fn_render(ee2); | ||
34 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
35 | } | ||
36 | |||
37 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
38 | updates = evas_render_updates(ee->evas); | ||
39 | if (updates) | ||
40 | { | ||
41 | evas_render_updates_free(updates); | ||
42 | _ecore_evas_idle_timeout_update(ee); | ||
43 | } | ||
44 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
45 | |||
46 | return updates ? 1 : rend; | ||
47 | } | ||
48 | |||
49 | static char * | ||
50 | _ecore_evas_directfb_winid_str_get(Ecore_X_Window win) | ||
51 | { | ||
52 | const char *vals = "qWeRtYuIoP5$&<~"; | ||
53 | static char id[9]; | ||
54 | unsigned int val; | ||
55 | val = (unsigned int)win; | ||
56 | id[0] = vals[(val >> 28) & 0xf]; | ||
57 | id[1] = vals[(val >> 24) & 0xf]; | ||
58 | id[2] = vals[(val >> 20) & 0xf]; | ||
59 | id[3] = vals[(val >> 16) & 0xf]; | ||
60 | id[4] = vals[(val >> 12) & 0xf]; | ||
61 | id[5] = vals[(val >> 8) & 0xf]; | ||
62 | id[6] = vals[(val >> 4) & 0xf]; | ||
63 | id[7] = vals[(val ) & 0xf]; | ||
64 | id[8] = 0; | ||
65 | return id; | ||
66 | } | ||
67 | |||
68 | static Ecore_Evas * | ||
69 | _ecore_evas_directfb_match(DFBWindowID win) | ||
70 | { | ||
71 | Ecore_Evas *ee; | ||
72 | |||
73 | ee = eina_hash_find(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(win)); | ||
74 | return ee; | ||
75 | } | ||
76 | |||
77 | static Eina_Bool | ||
78 | _ecore_evas_directfb_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
79 | { | ||
80 | Ecore_Evas *ee; | ||
81 | Ecore_DirectFB_Event_Key_Down *e; | ||
82 | |||
83 | e = event; | ||
84 | ee = _ecore_evas_directfb_match(e->win); | ||
85 | |||
86 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
87 | evas_event_feed_key_down(ee->evas, e->name, e->name, e->string, | ||
88 | e->key_compose, e->time, NULL); | ||
89 | return EINA_TRUE; | ||
90 | } | ||
91 | |||
92 | static Eina_Bool | ||
93 | _ecore_evas_directfb_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
94 | { | ||
95 | Ecore_Evas *ee; | ||
96 | Ecore_DirectFB_Event_Key_Up *e; | ||
97 | |||
98 | e = event; | ||
99 | ee = _ecore_evas_directfb_match(e->win); | ||
100 | |||
101 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
102 | evas_event_feed_key_up(ee->evas, e->name, e->name, e->string, | ||
103 | e->key_compose, e->time, NULL); | ||
104 | return EINA_TRUE; | ||
105 | } | ||
106 | |||
107 | static Eina_Bool | ||
108 | _ecore_evas_directfb_event_motion(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
109 | { | ||
110 | Ecore_Evas *ee; | ||
111 | Ecore_DirectFB_Event_Motion *e; | ||
112 | |||
113 | e = event; | ||
114 | ee = _ecore_evas_directfb_match(e->win); | ||
115 | |||
116 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
117 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
118 | return EINA_TRUE; | ||
119 | } | ||
120 | |||
121 | static Eina_Bool | ||
122 | _ecore_evas_directfb_event_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
123 | { | ||
124 | Ecore_Evas *ee; | ||
125 | Ecore_DirectFB_Event_Button_Down *e; | ||
126 | |||
127 | e = event; | ||
128 | ee = _ecore_evas_directfb_match(e->win); | ||
129 | |||
130 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
131 | // _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
132 | evas_event_feed_mouse_down(ee->evas, e->button, EVAS_BUTTON_NONE, e->time, NULL); | ||
133 | return EINA_TRUE; | ||
134 | } | ||
135 | |||
136 | static Eina_Bool | ||
137 | _ecore_evas_directfb_event_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
138 | { | ||
139 | Ecore_Evas *ee; | ||
140 | Ecore_DirectFB_Event_Button_Up *e; | ||
141 | Evas_Button_Flags flags = EVAS_BUTTON_NONE; | ||
142 | |||
143 | e = event; | ||
144 | ee = _ecore_evas_directfb_match(e->win); | ||
145 | |||
146 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
147 | //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
148 | evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL); | ||
149 | return EINA_TRUE; | ||
150 | } | ||
151 | |||
152 | static Eina_Bool | ||
153 | _ecore_evas_directfb_event_enter(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
154 | { | ||
155 | Ecore_Evas *ee; | ||
156 | Ecore_DirectFB_Event_Enter *e; | ||
157 | |||
158 | e = event; | ||
159 | ee = _ecore_evas_directfb_match(e->win); | ||
160 | |||
161 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
162 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | ||
163 | //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
164 | return EINA_TRUE; | ||
165 | } | ||
166 | |||
167 | static Eina_Bool | ||
168 | _ecore_evas_directfb_event_leave(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
169 | { | ||
170 | Ecore_Evas *ee; | ||
171 | Ecore_DirectFB_Event_Leave *e; | ||
172 | |||
173 | e = event; | ||
174 | ee = _ecore_evas_directfb_match(e->win); | ||
175 | |||
176 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
177 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
178 | //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
179 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
180 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
181 | return EINA_TRUE; | ||
182 | } | ||
183 | |||
184 | static Eina_Bool | ||
185 | _ecore_evas_directfb_event_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
186 | { | ||
187 | Ecore_Evas *ee; | ||
188 | Ecore_DirectFB_Event_Wheel *e; | ||
189 | |||
190 | e = event; | ||
191 | ee = _ecore_evas_directfb_match(e->win); | ||
192 | |||
193 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
194 | evas_event_feed_mouse_wheel(ee->evas, e->direction, e->z, e->time, NULL); | ||
195 | return EINA_TRUE; | ||
196 | } | ||
197 | |||
198 | static Eina_Bool | ||
199 | _ecore_evas_directfb_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
200 | { | ||
201 | Ecore_Evas *ee; | ||
202 | Ecore_DirectFB_Event_Got_Focus *e; | ||
203 | |||
204 | e = event; | ||
205 | ee = _ecore_evas_directfb_match(e->win); | ||
206 | |||
207 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
208 | ee->prop.focused = 1; | ||
209 | return EINA_TRUE; | ||
210 | } | ||
211 | |||
212 | static Eina_Bool | ||
213 | _ecore_evas_directfb_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
214 | { | ||
215 | Ecore_Evas *ee; | ||
216 | Ecore_DirectFB_Event_Lost_Focus *e; | ||
217 | |||
218 | e = event; | ||
219 | ee = _ecore_evas_directfb_match(e->win); | ||
220 | |||
221 | if (!ee) return EINA_TRUE; /* pass on event */ | ||
222 | ee->prop.focused = 0; | ||
223 | return EINA_TRUE; | ||
224 | } | ||
225 | |||
226 | int | ||
227 | _ecore_evas_directfb_shutdown(void) | ||
228 | { | ||
229 | _ecore_evas_init_count--; | ||
230 | if (_ecore_evas_init_count == 0) | ||
231 | { | ||
232 | int i; | ||
233 | |||
234 | for (i = 0; i < 8; i++) | ||
235 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
236 | } | ||
237 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
238 | return _ecore_evas_init_count; | ||
239 | } | ||
240 | |||
241 | |||
242 | |||
243 | |||
244 | |||
245 | int | ||
246 | _ecore_evas_directfb_init(void) | ||
247 | { | ||
248 | _ecore_evas_init_count++; | ||
249 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | ||
250 | |||
251 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, _ecore_evas_directfb_event_key_down, NULL); | ||
252 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_UP, _ecore_evas_directfb_event_key_up, NULL); | ||
253 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, _ecore_evas_directfb_event_button_down, NULL); | ||
254 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, _ecore_evas_directfb_event_button_up, NULL); | ||
255 | ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_MOTION, _ecore_evas_directfb_event_motion, NULL); | ||
256 | ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_ENTER, _ecore_evas_directfb_event_enter, NULL); | ||
257 | ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LEAVE, _ecore_evas_directfb_event_leave, NULL); | ||
258 | ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_WHEEL, _ecore_evas_directfb_event_wheel, NULL); | ||
259 | ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, _ecore_evas_directfb_event_got_focus, NULL); | ||
260 | ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, _ecore_evas_directfb_event_lost_focus, NULL); | ||
261 | ecore_evas_event_handlers[10] = NULL; | ||
262 | ecore_evas_event_handlers[11] = NULL; | ||
263 | ecore_evas_event_handlers[12] = NULL; | ||
264 | |||
265 | return _ecore_evas_init_count; | ||
266 | } | ||
267 | |||
268 | /* engine functions */ | ||
269 | /********************/ | ||
270 | |||
271 | static void | ||
272 | _ecore_evas_directfb_free(Ecore_Evas *ee) | ||
273 | { | ||
274 | eina_hash_del(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); | ||
275 | ecore_directfb_window_free(ee->engine.directfb.window); | ||
276 | _ecore_evas_directfb_shutdown(); | ||
277 | ecore_directfb_shutdown(); | ||
278 | } | ||
279 | |||
280 | static void | ||
281 | _ecore_evas_directfb_move(Ecore_Evas *ee, int x, int y) | ||
282 | { | ||
283 | ecore_directfb_window_move(ee->engine.directfb.window, x, y); | ||
284 | } | ||
285 | |||
286 | static void | ||
287 | _ecore_evas_directfb_resize(Ecore_Evas *ee, int w, int h) | ||
288 | { | ||
289 | ee->req.w = w; | ||
290 | ee->req.h = h; | ||
291 | if ((w == ee->w) && (h == ee->h)) return; | ||
292 | ecore_directfb_window_resize(ee->engine.directfb.window, w, h); | ||
293 | ee->w = w; | ||
294 | ee->h = h; | ||
295 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
296 | { | ||
297 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
298 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
303 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | static void | ||
308 | _ecore_evas_directfb_focus_set(Ecore_Evas *ee, int on __UNUSED__) | ||
309 | { | ||
310 | ecore_directfb_window_focus(ee->engine.directfb.window); | ||
311 | } | ||
312 | |||
313 | static void | ||
314 | _ecore_evas_directfb_hide(Ecore_Evas *ee) | ||
315 | { | ||
316 | ecore_directfb_window_hide(ee->engine.directfb.window); | ||
317 | ee->should_be_visible = 0; | ||
318 | } | ||
319 | |||
320 | static void | ||
321 | _ecore_evas_directfb_show(Ecore_Evas *ee) | ||
322 | { | ||
323 | ecore_directfb_window_show(ee->engine.directfb.window); | ||
324 | ee->should_be_visible = 1; | ||
325 | } | ||
326 | |||
327 | static void | ||
328 | _ecore_evas_directfb_shaped_set(Ecore_Evas *ee, int shaped) | ||
329 | { | ||
330 | if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped))) | ||
331 | return; | ||
332 | ee->shaped = shaped; | ||
333 | if(ee->shaped) | ||
334 | ecore_directfb_window_shaped_set(ee->engine.directfb.window, 1); | ||
335 | else | ||
336 | ecore_directfb_window_shaped_set(ee->engine.directfb.window, 0); | ||
337 | |||
338 | } | ||
339 | |||
340 | static void | ||
341 | _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
342 | { | ||
343 | Ecore_Evas *ee; | ||
344 | |||
345 | ee = data; | ||
346 | if (ee) | ||
347 | ee->prop.cursor.object = NULL; | ||
348 | } | ||
349 | |||
350 | static void | ||
351 | _ecore_evas_directfb_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
352 | { | ||
353 | int x, y; | ||
354 | |||
355 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
356 | |||
357 | if (!obj) | ||
358 | { | ||
359 | ee->prop.cursor.object = NULL; | ||
360 | ee->prop.cursor.layer = 0; | ||
361 | ee->prop.cursor.hot.x = 0; | ||
362 | ee->prop.cursor.hot.y = 0; | ||
363 | ecore_directfb_window_cursor_show(ee->engine.directfb.window, 1); | ||
364 | return; | ||
365 | |||
366 | } | ||
367 | |||
368 | ee->prop.cursor.object = obj; | ||
369 | ee->prop.cursor.layer = layer; | ||
370 | ee->prop.cursor.hot.x = hot_x; | ||
371 | ee->prop.cursor.hot.y = hot_y; | ||
372 | |||
373 | ecore_directfb_window_cursor_show(ee->engine.directfb.window, 0); | ||
374 | |||
375 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
376 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
377 | evas_object_move(ee->prop.cursor.object,x - ee->prop.cursor.hot.x,y - ee->prop.cursor.hot.y); | ||
378 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
379 | if (evas_pointer_inside_get(ee->evas)) | ||
380 | evas_object_show(ee->prop.cursor.object); | ||
381 | |||
382 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | ||
383 | } | ||
384 | |||
385 | static void | ||
386 | _ecore_evas_directfb_fullscreen_set(Ecore_Evas *ee, int on) | ||
387 | { | ||
388 | Evas_Engine_Info_DirectFB *einfo; | ||
389 | int w; | ||
390 | int h; | ||
391 | int resized = 0; | ||
392 | |||
393 | if (((ee->prop.fullscreen) && (on)) || ((!ee->prop.fullscreen) && (!on))) | ||
394 | return; | ||
395 | |||
396 | if (on) | ||
397 | ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 1); | ||
398 | else | ||
399 | ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 0); | ||
400 | /* set the new size of the evas */ | ||
401 | ecore_directfb_window_size_get(ee->engine.directfb.window, &w, &h); | ||
402 | if( (ee->w != w) || (ee->h != h)) | ||
403 | { | ||
404 | resized = 1; | ||
405 | ee->w = w; | ||
406 | ee->h = h; | ||
407 | ee->req.w = ee->w; | ||
408 | ee->req.h = ee->h; | ||
409 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
410 | { | ||
411 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
412 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
413 | } | ||
414 | else | ||
415 | { | ||
416 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
417 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
418 | } | ||
419 | } | ||
420 | einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas); | ||
421 | if (einfo) | ||
422 | { | ||
423 | einfo->info.surface = ee->engine.directfb.window->surface; | ||
424 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
425 | { | ||
426 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
427 | } | ||
428 | } | ||
429 | ee->prop.fullscreen = on; | ||
430 | if (resized) | ||
431 | { | ||
432 | if(ee->func.fn_resize) ee->func.fn_resize(ee); | ||
433 | } | ||
434 | } | ||
435 | |||
436 | static void * | ||
437 | _ecore_evas_directfb_window_get(const Ecore_Evas *ee) | ||
438 | { | ||
439 | return ee->engine.directfb.window; | ||
440 | } | ||
441 | #endif | ||
442 | |||
443 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
444 | static Ecore_Evas_Engine_Func _ecore_directfb_engine_func = | ||
445 | { | ||
446 | _ecore_evas_directfb_free, /* free an ecore_evas */ | ||
447 | NULL, /* cb resize */ | ||
448 | NULL, /* cb move */ | ||
449 | NULL, /* cb show */ | ||
450 | NULL, /* cb hide */ | ||
451 | NULL, /* cb delete request */ | ||
452 | NULL, /* cb destroy */ | ||
453 | NULL, /* cb focus in */ | ||
454 | NULL, /* cb focus out */ | ||
455 | NULL, /* cb sticky */ | ||
456 | NULL, /* cb unsticky */ | ||
457 | NULL, /* cb mouse in */ | ||
458 | NULL, /* cb mouse out */ | ||
459 | NULL, /* cb pre render */ | ||
460 | NULL, /* cb post render */ | ||
461 | _ecore_evas_directfb_move, /* move */ | ||
462 | NULL, /* managed move */ | ||
463 | _ecore_evas_directfb_resize, /* resize */ | ||
464 | NULL, /* move resize */ | ||
465 | NULL,//_ecore_evas_directfb_rotation_set,/* rotation */ | ||
466 | _ecore_evas_directfb_shaped_set, /* shaped */ | ||
467 | _ecore_evas_directfb_show, /* show */ | ||
468 | _ecore_evas_directfb_hide, /* hide */ | ||
469 | NULL, /* raise */ | ||
470 | NULL, /* lower */ | ||
471 | NULL, /* activate */ | ||
472 | NULL, /* title set */ | ||
473 | NULL, /* name class set */ | ||
474 | NULL, /* size min */ | ||
475 | NULL, /* size max */ | ||
476 | NULL, /* size base */ | ||
477 | NULL, /* size step */ | ||
478 | _ecore_evas_directfb_object_cursor_set, /* set cursor to an evas object */ | ||
479 | NULL, /* layer set */ | ||
480 | _ecore_evas_directfb_focus_set, /* focus */ | ||
481 | NULL, /* iconified */ | ||
482 | NULL, /* borderless */ | ||
483 | NULL, /* override */ | ||
484 | NULL, /* maximized */ | ||
485 | _ecore_evas_directfb_fullscreen_set,/* fullscreen */ | ||
486 | NULL, /* avoid damage */ | ||
487 | NULL, /* withdrawn */ | ||
488 | NULL, /* sticky */ | ||
489 | NULL, /* ignore events */ | ||
490 | NULL, /* alpha */ | ||
491 | NULL, //transparent | ||
492 | |||
493 | NULL, // render | ||
494 | NULL // screen_geometry_get | ||
495 | }; | ||
496 | #endif | ||
497 | |||
498 | /* api */ | ||
499 | /*******/ | ||
500 | |||
501 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
502 | EAPI Ecore_Evas * | ||
503 | ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) | ||
504 | { | ||
505 | Evas_Engine_Info_DirectFB *einfo; | ||
506 | Ecore_Evas *ee; | ||
507 | Ecore_DirectFB_Window *window; | ||
508 | int rmethod; | ||
509 | |||
510 | rmethod = evas_render_method_lookup("directfb"); | ||
511 | if (!rmethod) return NULL; | ||
512 | if (!ecore_directfb_init(disp_name)) return NULL; | ||
513 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
514 | if (!ee) return NULL; | ||
515 | |||
516 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
517 | _ecore_evas_directfb_init(); | ||
518 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_directfb_engine_func; | ||
519 | |||
520 | ee->driver = "directfb"; | ||
521 | if (disp_name) ee->name = strdup(disp_name); | ||
522 | |||
523 | if (w < 1) w = 1; | ||
524 | if (h < 1) h = 1; | ||
525 | |||
526 | ee->rotation = 0; | ||
527 | ee->visible = 1; | ||
528 | ee->x = x; | ||
529 | ee->y = y; | ||
530 | ee->w = w; | ||
531 | ee->h = h; | ||
532 | ee->req.x = ee->x; | ||
533 | ee->req.y = ee->y; | ||
534 | ee->req.w = ee->w; | ||
535 | ee->req.h = ee->h; | ||
536 | ee->prop.layer = 1; | ||
537 | ee->prop.fullscreen = 0; | ||
538 | |||
539 | /* init evas here */ | ||
540 | ee->evas = evas_new(); | ||
541 | evas_data_attach_set(ee->evas, ee); | ||
542 | evas_output_method_set(ee->evas, rmethod); | ||
543 | evas_output_size_set(ee->evas, w, h); | ||
544 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
545 | einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas); | ||
546 | |||
547 | window = ecore_directfb_window_new(x,y,w,h); | ||
548 | ee->engine.directfb.window = window; | ||
549 | if (einfo) | ||
550 | { | ||
551 | einfo->info.dfb = ecore_directfb_interface_get(); | ||
552 | einfo->info.surface = window->surface; | ||
553 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
554 | { | ||
555 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
556 | ecore_evas_free(ee); | ||
557 | return NULL; | ||
558 | } | ||
559 | } | ||
560 | else | ||
561 | { | ||
562 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
563 | ecore_evas_free(ee); | ||
564 | return NULL; | ||
565 | } | ||
566 | |||
567 | ee->engine.func->fn_render = _ecore_evas_directfb_render; | ||
568 | _ecore_evas_register(ee); | ||
569 | |||
570 | if (!ecore_evases_hash) | ||
571 | ecore_evases_hash = eina_hash_string_superfast_new(NULL); | ||
572 | eina_hash_add(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); | ||
573 | |||
574 | return ee; | ||
575 | } | ||
576 | #else | ||
577 | EAPI Ecore_Evas * | ||
578 | ecore_evas_directfb_new(const char *disp_name __UNUSED__, int windowed __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
579 | { | ||
580 | return NULL; | ||
581 | } | ||
582 | #endif | ||
583 | |||
584 | #ifdef BUILD_ECORE_EVAS_DIRECTFB | ||
585 | EAPI Ecore_DirectFB_Window * | ||
586 | ecore_evas_directfb_window_get(const Ecore_Evas *ee) | ||
587 | { | ||
588 | return (Ecore_DirectFB_Window *) _ecore_evas_directfb_window_get(ee); | ||
589 | } | ||
590 | #else | ||
591 | EAPI Ecore_DirectFB_Window * | ||
592 | ecore_evas_directfb_window_get(const Ecore_Evas *ee __UNUSED__) | ||
593 | { | ||
594 | return NULL; | ||
595 | } | ||
596 | #endif | ||