summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/canvas/evas_main.c')
-rw-r--r--src/lib/evas/canvas/evas_main.c89
1 files changed, 37 insertions, 52 deletions
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 1323a89..6af60da 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -350,13 +350,6 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
350 350
351 EINA_LIST_FREE(e->outputs, evo) efl_canvas_output_del(evo); 351 EINA_LIST_FREE(e->outputs, evo) efl_canvas_output_del(evo);
352 352
353 if (e->engine.func)
354 {
355 e->engine.func->ector_destroy(e->engine.data.output,
356 e->engine.ector);
357 e->engine.func->output_free(e->engine.data.output);
358 e->engine.func->info_free(eo_e, e->engine.info);
359 }
360 if (e->common_init) 353 if (e->common_init)
361 { 354 {
362 e->common_init = 0; 355 e->common_init = 0;
@@ -419,58 +412,35 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
419 efl_destructor(efl_super(eo_e, MY_CLASS)); 412 efl_destructor(efl_super(eo_e, MY_CLASS));
420} 413}
421 414
415// It is now expected that the first output in the list is the default one
416// manipulated by this set of legacy API
417
422EAPI Evas_Engine_Info * 418EAPI Evas_Engine_Info *
423evas_engine_info_get(const Evas *obj) 419evas_engine_info_get(const Evas *obj)
424{ 420{
425 const Evas_Public_Data *e = efl_data_scope_get(obj, EVAS_CANVAS_CLASS); 421 const Evas_Public_Data *e = efl_data_scope_get(obj, EVAS_CANVAS_CLASS);
426 Evas_Engine_Info *info; 422 Efl_Canvas_Output *output;
427
428 if (!e->engine.info) return NULL;
429 423
430 info = e->engine.info; 424 output = eina_list_data_get(e->outputs);
431 ((Evas_Public_Data *)e)->engine.info_magic = info->magic; 425 if (!output)
426 {
427 output = efl_canvas_output_add((Evas*) obj);
428 }
429 if (!output) return NULL;
432 430
433 return info; 431 return efl_canvas_output_engine_info_get(output);
434} 432}
435 433
436EAPI Eina_Bool 434EAPI Eina_Bool
437evas_engine_info_set(Evas *obj, Evas_Engine_Info *info) 435evas_engine_info_set(Evas *obj, Evas_Engine_Info *info)
438{ 436{
439 Evas_Public_Data *e = efl_data_scope_get(obj, EVAS_CANVAS_CLASS); 437 Evas_Public_Data *e = efl_data_scope_get(obj, EVAS_CANVAS_CLASS);
438 Efl_Canvas_Output *output;
440 439
440 output = eina_list_data_get(e->outputs);
441 if (!output) return EINA_FALSE;
441 if (!info) return EINA_FALSE; 442 if (!info) return EINA_FALSE;
442 if (info != e->engine.info) return EINA_FALSE; 443 return efl_canvas_output_engine_info_set(output, info);
443 if (info->magic != e->engine.info_magic) return EINA_FALSE;
444
445 evas_canvas_async_block(e);
446
447 if (e->engine.data.output)
448 {
449 if (e->engine.func->update)
450 {
451 e->engine.func->update(e->engine.data.output, info, e->output.w, e->output.h);
452 }
453 else
454 {
455 // For engine who do not provide an update function
456 e->engine.func->output_free(e->engine.data.output);
457
458 goto setup;
459 }
460 }
461 else
462 {
463 if (!e->common_init)
464 {
465 e->common_init = 1;
466 evas_common_init();
467 }
468
469 setup:
470 e->engine.data.output = e->engine.func->setup(info, e->output.w, e->output.h);
471 }
472
473 return !!e->engine.data.output;
474} 444}
475 445
476EOLIAN static Evas_Coord 446EOLIAN static Evas_Coord
@@ -831,11 +801,19 @@ _evas_canvas_efl_loop_user_loop_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e EI
831} 801}
832 802
833Ector_Surface * 803Ector_Surface *
834evas_ector_get(Evas_Public_Data *e) 804evas_ector_get(Evas_Public_Data *e, void *output)
835{ 805{
836 if (!e->engine.ector) 806 Efl_Canvas_Output *r;
837 e->engine.ector = e->engine.func->ector_create(e->engine.data.output); 807 Eina_List *l;
838 return e->engine.ector; 808
809 EINA_LIST_FOREACH(e->outputs, l, r)
810 if (r->output == output)
811 {
812 if (!r->ector)
813 r->ector = e->engine.func->ector_create(_evas_engine_context(e), output);
814 return r->ector;
815 }
816 return NULL;
839} 817}
840 818
841EAPI void 819EAPI void
@@ -868,11 +846,11 @@ _image_data_unset(Evas_Object_Protected_Data *obj, Eina_List **list)
868 obj->layer->evas->engine.func->ector_free(data->engine_data)) 846 obj->layer->evas->engine.func->ector_free(data->engine_data))
869 else CHECK(EFL_CANVAS_POLYGON_CLASS, Efl_Canvas_Polygon_Data, 847 else CHECK(EFL_CANVAS_POLYGON_CLASS, Efl_Canvas_Polygon_Data,
870 data->engine_data = 848 data->engine_data =
871 obj->layer->evas->engine.func->polygon_points_clear(obj->layer->evas->engine.data.output, 849 obj->layer->evas->engine.func->polygon_points_clear(ENC,
872 data->engine_data)) 850 data->engine_data))
873 else CHECK(EVAS_CANVAS3D_TEXTURE_CLASS, Evas_Canvas3D_Texture_Data, 851 else CHECK(EVAS_CANVAS3D_TEXTURE_CLASS, Evas_Canvas3D_Texture_Data,
874 if (obj->layer->evas->engine.func->texture_free) 852 if (obj->layer->evas->engine.func->texture_free)
875 obj->layer->evas->engine.func->texture_free(obj->layer->evas->engine.data.output, data->engine_data)) 853 obj->layer->evas->engine.func->texture_free(ENC, data->engine_data))
876 else return; 854 else return;
877#undef CHECK 855#undef CHECK
878 evas_object_ref(obj->object); 856 evas_object_ref(obj->object);
@@ -1015,7 +993,14 @@ evas_output_method_set(Evas *eo_e, int render_method)
1015 e->engine.module = em; 993 e->engine.module = em;
1016 evas_module_ref(em); 994 evas_module_ref(em);
1017 /* get the engine info struct */ 995 /* get the engine info struct */
1018 if (e->engine.func->info) e->engine.info = e->engine.func->info(eo_e); 996 if (e->engine.func->info)
997 {
998 Efl_Canvas_Output *output;
999 Eina_List *l;
1000
1001 EINA_LIST_FOREACH(e->outputs, l, output)
1002 output->info = e->engine.func->info(eo_e);
1003 }
1019 1004
1020 // Wayland already handles seats. 1005 // Wayland already handles seats.
1021 if (em->definition && (eina_streq(em->definition->name, "wayland_shm") || 1006 if (em->definition && (eina_streq(em->definition->name, "wayland_shm") ||