diff options
author | David Walter Seikel | 2014-04-28 00:31:20 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-04-28 00:31:20 +1000 |
commit | 7c90651a504b9dd3a1201a019d9c8ef6f99c75a8 (patch) | |
tree | ad6d7c941726f7021d07700a6bb22f658e0fccc6 /src | |
parent | Some code shuffling. (diff) | |
download | SledjHamr-7c90651a504b9dd3a1201a019d9c8ef6f99c75a8.zip SledjHamr-7c90651a504b9dd3a1201a019d9c8ef6f99c75a8.tar.gz SledjHamr-7c90651a504b9dd3a1201a019d9c8ef6f99c75a8.tar.bz2 SledjHamr-7c90651a504b9dd3a1201a019d9c8ef6f99c75a8.tar.xz |
Do the on resize thing, which didn't help, and TODO++ as a result.
Guess I have to wait for evas_3d to be fixed. B-(
Diffstat (limited to 'src')
-rw-r--r-- | src/GuiLua/GuiLua.c | 31 | ||||
-rw-r--r-- | src/GuiLua/GuiLua.h | 4 |
2 files changed, 27 insertions, 8 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index b34d8cc..eb185b8 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -465,6 +465,18 @@ struct _Widget | |||
465 | 465 | ||
466 | // TODO - These functions should be able to deal with multiple windows. | 466 | // TODO - These functions should be able to deal with multiple windows. |
467 | // TODO - Should be able to open external and internal windows, and even switch between them on the fly. | 467 | // TODO - Should be able to open external and internal windows, and even switch between them on the fly. |
468 | static void _on_canvas_resize(Ecore_Evas *ee) | ||
469 | { | ||
470 | int w, h; | ||
471 | |||
472 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
473 | |||
474 | printf("RESIZED!!!\n"); | ||
475 | evas_object_resize(ourGlobals.background, w, h); | ||
476 | evas_object_resize(ourGlobals.image, w, h); | ||
477 | evas_object_move(ourGlobals.image, 0, 0); | ||
478 | } | ||
479 | |||
468 | static void _on_click(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) | 480 | static void _on_click(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) |
469 | { | 481 | { |
470 | globals *ourGlobals; | 482 | globals *ourGlobals; |
@@ -571,7 +583,6 @@ static int window(lua_State *L) | |||
571 | globals *ourGlobals; | 583 | globals *ourGlobals; |
572 | char *name = "GuiLua"; | 584 | char *name = "GuiLua"; |
573 | char *title = "GuiLua test harness"; | 585 | char *title = "GuiLua test harness"; |
574 | Evas_Object *background; | ||
575 | struct _Widget *wid; | 586 | struct _Widget *wid; |
576 | int w = WIDTH, h = HEIGHT; | 587 | int w = WIDTH, h = HEIGHT; |
577 | 588 | ||
@@ -592,21 +603,29 @@ static int window(lua_State *L) | |||
592 | 603 | ||
593 | // Get the Evas / canvas from the elm window (that the Evas_Object "lives on"), which is itself an Evas_Object created by Elm, so not sure if it was created internally with Ecore_Evas. | 604 | // Get the Evas / canvas from the elm window (that the Evas_Object "lives on"), which is itself an Evas_Object created by Elm, so not sure if it was created internally with Ecore_Evas. |
594 | ourGlobals->evas = evas_object_evas_get(ourGlobals->win); | 605 | ourGlobals->evas = evas_object_evas_get(ourGlobals->win); |
606 | // An Ecore_Evas holds an Evas. | ||
607 | // Get the Ecore_Evas that wraps an Evas. | ||
608 | ourGlobals->ee = ecore_evas_ecore_evas_get(ourGlobals->evas); // Only use this on Evas that was created with Ecore_Evas. | ||
609 | ecore_evas_callback_resize_set(ourGlobals->ee, _on_canvas_resize); | ||
610 | |||
595 | _scene_setup(ourGlobals, &ourScene); | 611 | _scene_setup(ourGlobals, &ourScene); |
596 | 612 | ||
597 | /* Add a background rectangle objects. */ | 613 | /* Add a background rectangle objects. */ |
598 | background = evas_object_rectangle_add(ourGlobals->evas); | 614 | ourGlobals->background = evas_object_rectangle_add(ourGlobals->evas); |
599 | evas_object_color_set(background, 0, 0, 0, 255); | 615 | evas_object_color_set(ourGlobals->background, 255, 0, 255, 255); |
600 | evas_object_move(background, 0, 0); | 616 | evas_object_move(ourGlobals->background, 0, 0); |
601 | evas_object_resize(background, w, h); | 617 | evas_object_resize(ourGlobals->background, w, h); |
602 | evas_object_show(background); | 618 | evas_object_show(ourGlobals->background); |
603 | 619 | ||
604 | // Add an image object for 3D scene rendering. | 620 | // Add an image object for 3D scene rendering. |
605 | wid = calloc(1, sizeof(struct _Widget)); | 621 | wid = calloc(1, sizeof(struct _Widget)); |
606 | strcpy(wid->magic, "Widget"); | 622 | strcpy(wid->magic, "Widget"); |
607 | eina_clist_add_head(&ourGlobals->widgets, &wid->node); | 623 | eina_clist_add_head(&ourGlobals->widgets, &wid->node); |
608 | 624 | ||
625 | // TODO - Doesn't matter how you do it, calling evas_obj_image_scene_set() AND evas_obj_size_set() will segfault. | ||
626 | // Not calling them both means the image is not big enough to see. FUCK!! | ||
609 | wid->obj = eo_add(EVAS_OBJ_IMAGE_CLASS, ourGlobals->win); | 627 | wid->obj = eo_add(EVAS_OBJ_IMAGE_CLASS, ourGlobals->win); |
628 | ourGlobals->image = (wid->obj); | ||
610 | eo_do(wid->obj, | 629 | eo_do(wid->obj, |
611 | evas_obj_image_filled_set(EINA_TRUE), | 630 | evas_obj_image_filled_set(EINA_TRUE), |
612 | // evas_obj_image_size_set(w, h), | 631 | // evas_obj_image_size_set(w, h), |
diff --git a/src/GuiLua/GuiLua.h b/src/GuiLua/GuiLua.h index d94c2ce..388e343 100644 --- a/src/GuiLua/GuiLua.h +++ b/src/GuiLua/GuiLua.h | |||
@@ -21,9 +21,9 @@ struct _globals | |||
21 | Eina_Clist widgets; // Our windows widgets. | 21 | Eina_Clist widgets; // Our windows widgets. |
22 | int logDom; // Our logging domain. | 22 | int logDom; // Our logging domain. |
23 | 23 | ||
24 | //Ecore_Evas *ecore_evas; | 24 | Ecore_Evas *ee; |
25 | Evas *evas; | 25 | Evas *evas; |
26 | //Evas_Object *background; | 26 | Evas_Object *background; |
27 | Evas_Object *image; | 27 | Evas_Object *image; |
28 | }; | 28 | }; |
29 | 29 | ||