Tizen 2.1 base
[framework/uifw/ecore.git] / src / lib / ecore_evas / ecore_evas_sdl.c
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 #if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL)
30
31 /* static char *ecore_evas_default_display = "0"; */
32 /* static Ecore_List *ecore_evas_input_devices = NULL; */
33
34 static int                      _ecore_evas_init_count = 0;
35
36 static Ecore_Evas               *sdl_ee = NULL;
37 static Ecore_Event_Handler      *ecore_evas_event_handlers[4] = {
38    NULL, NULL, NULL, NULL
39 };
40
41 static const char               *ecore_evas_sdl_default = "EFL SDL";
42 static int                      _ecore_evas_fps_debug = 0;
43 static Ecore_Poller             *ecore_evas_event;
44
45 static Ecore_Evas *
46 _ecore_evas_sdl_match(void)
47 {
48    return sdl_ee;
49 }
50
51 static void *
52 _ecore_evas_sdl_switch_buffer(void *data, void *dest __UNUSED__)
53 {
54    SDL_Flip(data);
55    return ((SDL_Surface*)data)->pixels;
56 }
57
58 static Eina_Bool
59 _ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
60 {
61    Ecore_Evas                   *ee;
62
63    ee = _ecore_evas_sdl_match();
64
65    if (!ee) return ECORE_CALLBACK_PASS_ON;
66    /* pass on event */
67    ee->prop.focused = 1;
68    evas_focus_in(ee->evas);
69    if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
70    return ECORE_CALLBACK_PASS_ON;
71 }
72
73 static Eina_Bool
74 _ecore_evas_sdl_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
75 {
76    Ecore_Evas                   *ee;
77
78    ee = _ecore_evas_sdl_match();
79
80    if (!ee) return ECORE_CALLBACK_PASS_ON;
81    /* pass on event */
82    ee->prop.focused = 0;
83    evas_focus_out(ee->evas);
84    if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
85    return ECORE_CALLBACK_PASS_ON;
86 }
87
88 static Eina_Bool
89 _ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event)
90 {
91    Ecore_Sdl_Event_Video_Resize *e;
92    Ecore_Evas                   *ee;
93    int                           rmethod;
94
95    e = event;
96    ee = _ecore_evas_sdl_match();
97
98    if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
99
100    rmethod = evas_output_method_get(ee->evas);
101    if (rmethod == evas_render_method_lookup("buffer"))
102      {
103         Evas_Engine_Info_Buffer *einfo;
104
105         einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
106         if (einfo)
107           {
108              einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
109              einfo->info.switch_data = SDL_SetVideoMode(e->w, e->h, 32,
110                                                         (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE)
111                                                         | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0)
112                                                         | (ee->alpha ? SDL_SRCALPHA : 0)
113                                                         | SDL_DOUBLEBUF);
114              if (!einfo->info.switch_data)
115                {
116                   return EINA_FALSE;
117                }
118
119              SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0);
120              SDL_FillRect(einfo->info.switch_data, NULL, 0);
121
122              einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels;
123              einfo->info.dest_buffer_row_bytes = e->w * sizeof (int);
124              einfo->info.use_color_key = 0;
125              einfo->info.alpha_threshold = 0;
126              einfo->info.func.new_update_region = NULL;
127              einfo->info.func.free_update_region = NULL;
128              einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
129              if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
130                {
131                   return EINA_FALSE;
132                }
133           }
134      }
135
136    ee->w = e->w;
137    ee->h = e->h;
138
139    evas_output_size_set(ee->evas, e->w, e->h);
140    evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h);
141
142    return ECORE_CALLBACK_PASS_ON;
143 }
144
145 static Eina_Bool
146 _ecore_evas_sdl_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
147 {
148    Ecore_Evas                   *ee;
149    int                          w;
150    int                          h;
151
152    ee = _ecore_evas_sdl_match();
153
154    if (!ee) return ECORE_CALLBACK_PASS_ON;
155    evas_output_size_get(ee->evas, &w, &h);
156    evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
157
158    return ECORE_CALLBACK_PASS_ON;
159 }
160
161 static int
162 _ecore_evas_render(Ecore_Evas *ee)
163 {
164    Eina_List *updates;
165
166    updates = evas_render_updates(ee->evas);
167    if (updates)
168      {
169         evas_render_updates_free(updates);
170         _ecore_evas_idle_timeout_update(ee);
171      }
172    return updates ? 1 : 0;
173 }
174
175 static int
176 _ecore_evas_sdl_render(Ecore_Evas *ee)
177 {
178    int rend = 0;
179    Eina_List *ll;
180    Ecore_Evas *ee2;
181
182    EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
183      {
184         if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
185         if (ee2->engine.func->fn_render)
186           rend |= ee2->engine.func->fn_render(ee2);
187         if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
188      }
189
190    if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
191
192    if (ee->prop.avoid_damage) rend = _ecore_evas_render(ee);
193    else if ((ee->visible) ||
194             ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
195             ((ee->should_be_visible) && (ee->prop.override)))
196      rend |= _ecore_evas_render(ee);
197    else
198      evas_norender(ee->evas);
199
200    if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
201    return rend;
202 }
203
204 static Eina_Bool
205 _ecore_evas_sdl_event(void *data __UNUSED__)
206 {
207    ecore_sdl_feed_events();
208    return ECORE_CALLBACK_RENEW;
209 }
210
211 static int
212 _ecore_evas_sdl_init(int w __UNUSED__, int h __UNUSED__)
213 {
214    _ecore_evas_init_count++;
215    if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
216
217 #ifndef _WIN32
218    if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1;
219 #endif /* _WIN32 */
220    // this is pretty bad: poller? and set poll time? pol time is meant to be
221    // adjustable for things like polling battery state, or amoutn of spare
222    // memory etc.
223    //
224    ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_sdl_event, NULL);
225    ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006);
226 #ifndef _WIN32
227    if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
228 #endif /* _WIN32 */
229
230    ecore_event_evas_init();
231
232    ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_SDL_EVENT_GOT_FOCUS, _ecore_evas_sdl_event_got_focus, NULL);
233    ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_SDL_EVENT_LOST_FOCUS, _ecore_evas_sdl_event_lost_focus, NULL);
234    ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_SDL_EVENT_RESIZE, _ecore_evas_sdl_event_video_resize, NULL);
235    ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_SDL_EVENT_EXPOSE, _ecore_evas_sdl_event_video_expose, NULL);
236
237    return _ecore_evas_init_count;
238 }
239
240 static int
241 _ecore_evas_sdl_shutdown(void)
242 {
243    _ecore_evas_init_count--;
244    if (_ecore_evas_init_count == 0)
245      {
246         unsigned int i;
247
248         for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++)
249           ecore_event_handler_del(ecore_evas_event_handlers[i]);
250         ecore_event_evas_shutdown();
251         ecore_poller_del(ecore_evas_event);
252         ecore_evas_event = NULL;
253 #ifndef _WIN32
254         if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
255 #endif /* _WIN32 */
256      }
257    if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
258    return _ecore_evas_init_count;
259 }
260
261 static void
262 _ecore_evas_sdl_free(Ecore_Evas *ee)
263 {
264    if (sdl_ee == ee) sdl_ee = NULL;
265
266    ecore_event_window_unregister(0);
267    _ecore_evas_sdl_shutdown();
268    ecore_sdl_shutdown();
269 }
270
271 static void
272 _ecore_evas_resize(Ecore_Evas *ee, int w, int h)
273 {
274    int rmethod;
275
276    if ((w == ee->w) && (h == ee->h)) return;
277    ee->w = w;
278    ee->h = h;
279
280    rmethod = evas_output_method_get(ee->evas);
281    if (rmethod == evas_render_method_lookup("buffer"))
282      {
283         Evas_Engine_Info_Buffer *einfo;
284
285         einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
286         if (einfo)
287           {
288              einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
289              einfo->info.switch_data = SDL_SetVideoMode(w, h, 32,
290                                                         (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE)
291                                                         | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0)
292                                                         | (ee->alpha ? SDL_SRCALPHA : 0)
293                                                         | SDL_DOUBLEBUF);
294              if (!einfo->info.switch_data)
295                {
296                   return ;
297                }
298
299              SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0);
300              SDL_FillRect(einfo->info.switch_data, NULL, 0);
301
302              einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels;
303              einfo->info.dest_buffer_row_bytes = w * sizeof (int);
304              einfo->info.use_color_key = 0;
305              einfo->info.alpha_threshold = 0;
306              einfo->info.func.new_update_region = NULL;
307              einfo->info.func.free_update_region = NULL;
308              einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
309              if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
310                {
311                   return ;
312                }
313           }
314      }
315
316    evas_output_size_set(ee->evas, ee->w, ee->h);
317    evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
318    evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
319
320    if (ee->func.fn_resize) ee->func.fn_resize(ee);
321 }
322
323 static void
324 _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h)
325 {
326    if ((w == ee->w) && (h == ee->h)) return;
327    ee->w = w;
328    ee->h = h;
329
330    evas_output_size_set(ee->evas, ee->w, ee->h);
331    evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
332    evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
333
334    if (ee->func.fn_resize) ee->func.fn_resize(ee);
335 }
336
337 static void
338 _ecore_evas_show(Ecore_Evas *ee)
339 {
340    if (ee->prop.focused) return;
341    ee->prop.focused = 1;
342    evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
343 }
344
345 static void
346 _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
347 {
348    Ecore_Evas *ee;
349
350    ee = data;
351    if (ee) ee->prop.cursor.object = NULL;
352 }
353
354 static void
355 _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
356 {
357    int x, y;
358
359    if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
360
361    if (!obj)
362      {
363         ee->prop.cursor.object = NULL;
364         ee->prop.cursor.layer = 0;
365         ee->prop.cursor.hot.x = 0;
366         ee->prop.cursor.hot.y = 0;
367         return;
368      }
369
370    ee->prop.cursor.object = obj;
371    ee->prop.cursor.layer = layer;
372    ee->prop.cursor.hot.x = hot_x;
373    ee->prop.cursor.hot.y = hot_y;
374    evas_pointer_output_xy_get(ee->evas, &x, &y);
375    evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
376    evas_object_move(ee->prop.cursor.object,
377                     x - ee->prop.cursor.hot.x,
378                     y - ee->prop.cursor.hot.y);
379    evas_object_pass_events_set(ee->prop.cursor.object, 1);
380    if (evas_pointer_inside_get(ee->evas))
381      evas_object_show(ee->prop.cursor.object);
382
383    evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
384 }
385
386 static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
387 {
388    _ecore_evas_sdl_free,
389    NULL,
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    _ecore_evas_resize,
406    _ecore_evas_move_resize,
407    NULL,
408    NULL,
409    _ecore_evas_show,
410    NULL,
411    NULL,
412    NULL,
413    NULL,
414    NULL,
415    NULL,
416    NULL,
417    NULL,
418    NULL,
419    NULL,
420    _ecore_evas_object_cursor_set,
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, //transparent
434    NULL, // profiles_set
435
436    NULL,
437    NULL,
438    NULL,
439    NULL,
440    NULL,
441    NULL,
442
443    NULL, // render
444    NULL, // screen_geometry_get
445    NULL  // screen_dpi_get
446 };
447
448 static Ecore_Evas*
449 _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha)
450 {
451    Ecore_Evas           *ee;
452
453    if (!name)
454      name = ecore_evas_sdl_default;
455
456    ee = calloc(1, sizeof(Ecore_Evas));
457    if (!ee) return NULL;
458
459    ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
460
461    ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_sdl_engine_func;
462
463    ee->driver = "sdl";
464    if (name) ee->name = strdup(name);
465
466    if (w < 1) w = 1;
467    if (h < 1) h = 1;
468    ee->visible = 1;
469    ee->w = w;
470    ee->h = h;
471
472    ee->prop.max.w = 0;
473    ee->prop.max.h = 0;
474    ee->prop.layer = 0;
475    ee->prop.focused = 1;
476    ee->prop.borderless = 1;
477    ee->prop.override = 1;
478    ee->prop.maximized = 1;
479    ee->prop.fullscreen = fullscreen;
480    ee->prop.withdrawn = 0;
481    ee->prop.sticky = 0;
482    ee->prop.window = 0;
483    ee->alpha = alpha;
484    ee->prop.hwsurface = hwsurface;
485
486    /* init evas here */
487    ee->evas = evas_new();
488    evas_data_attach_set(ee->evas, ee);
489    evas_output_method_set(ee->evas, rmethod);
490
491    evas_output_size_set(ee->evas, w, h);
492    evas_output_viewport_set(ee->evas, 0, 0, w, h);
493
494    if (rmethod == evas_render_method_lookup("buffer"))
495      {
496         Evas_Engine_Info_Buffer *einfo;
497
498         einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
499         if (einfo)
500           {
501              SDL_Init(SDL_INIT_NOPARACHUTE);
502
503              if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
504                {
505                   ERR("SDL_Init failed with %s", SDL_GetError());
506                   SDL_Quit();
507                   return NULL;
508                }
509
510              einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
511              einfo->info.switch_data = SDL_SetVideoMode(w, h, 32,
512                                                         (hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE)
513                                                         | (fullscreen ? SDL_FULLSCREEN : 0)
514                                                         | (noframe ? SDL_NOFRAME : 0)
515                                                         | (alpha ? SDL_SRCALPHA : 0)
516                                                         | SDL_DOUBLEBUF);
517              if (!einfo->info.switch_data)
518                {
519                   ERR("SDL_SetVideoMode failed !");
520                   ecore_evas_free(ee);
521                   return NULL;
522                }
523
524              SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0);
525              SDL_FillRect(einfo->info.switch_data, NULL, 0);
526
527              einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels;
528              einfo->info.dest_buffer_row_bytes = w * sizeof (int);
529              einfo->info.use_color_key = 0;
530              einfo->info.alpha_threshold = 0;
531              einfo->info.func.new_update_region = NULL;
532              einfo->info.func.free_update_region = NULL;
533              einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
534              if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
535                {
536                   ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
537                   ecore_evas_free(ee);
538                   return NULL;
539                }
540           }
541         else
542           {
543              ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
544              ecore_evas_free(ee);
545              return NULL;
546           }
547      }
548    else if (rmethod == evas_render_method_lookup("gl_sdl"))
549      {
550 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
551         Evas_Engine_Info_GL_SDL *einfo;
552
553         einfo = (Evas_Engine_Info_GL_SDL *) evas_engine_info_get(ee->evas);
554         if (einfo)
555           {
556              einfo->flags.fullscreen = fullscreen;
557              einfo->flags.noframe = noframe;
558              if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
559                {
560                   ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
561                   ecore_evas_free(ee);
562                   return NULL;
563                }
564           }
565         else
566           {
567              ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
568              ecore_evas_free(ee);
569              return NULL;
570           }
571 #endif
572      }
573    else
574      {
575         ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
576         ecore_evas_free(ee);
577         return NULL;
578      }
579
580    if (!ecore_sdl_init(name))
581      {
582         evas_free(ee->evas);
583         if (ee->name) free(ee->name);
584         free(ee);
585         return NULL;
586      }
587
588    _ecore_evas_sdl_init(w, h);
589
590    ecore_event_window_register(0, ee, ee->evas,
591                                (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
592                                (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
593                                (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
594                                (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
595
596    SDL_ShowCursor(SDL_ENABLE);
597
598    ee->engine.func->fn_render = _ecore_evas_sdl_render;
599    _ecore_evas_register(ee);
600
601    sdl_ee = ee;
602    return ee;
603 }
604 #endif
605
606 #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
607 EAPI Ecore_Evas*
608 ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha)
609 {
610    Ecore_Evas          *ee;
611    int                  rmethod;
612
613    rmethod = evas_render_method_lookup("buffer");
614    if (!rmethod) return NULL;
615
616    ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha);
617    return ee;
618 }
619 #else
620 EAPI Ecore_Evas*
621 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__)
622 {
623    ERR("OUTCH !");
624    return NULL;
625 }
626 #endif
627
628 EAPI Ecore_Evas*
629 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__)
630 {
631    ERR("OUTCH !");
632    return NULL;
633 }
634
635 #ifdef BUILD_ECORE_EVAS_OPENGL_SDL
636 EAPI Ecore_Evas*
637 ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe)
638 {
639    Ecore_Evas          *ee;
640    int                  rmethod;
641
642    rmethod = evas_render_method_lookup("gl_sdl");
643    if (!rmethod) return NULL;
644
645    ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, 0, noframe, 0);
646    if (ee) ee->driver = "gl_sdl";
647    return ee;
648 }
649 #else
650 EAPI Ecore_Evas*
651 ecore_evas_gl_sdl_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int noframe __UNUSED__)
652 {
653    ERR("OUTCH !");
654    return NULL;
655 }
656 #endif
657