diff options
-rw-r--r-- | src/extantz/extantz.c | 199 | ||||
-rw-r--r-- | src/extantz/extantz.h | 13 | ||||
-rw-r--r-- | src/libraries/winFang.c | 26 |
3 files changed, 107 insertions, 131 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index f4f602e..bf721e2 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -17,6 +17,7 @@ globals ourGlobals; | |||
17 | 17 | ||
18 | 18 | ||
19 | 19 | ||
20 | #if USE_LOVE | ||
20 | static Eina_Bool _add(void *data, int type, Ecore_Con_Event_Server_Add *ev) | 21 | static Eina_Bool _add(void *data, int type, Ecore_Con_Event_Server_Add *ev) |
21 | { | 22 | { |
22 | globals *ourGlobals = data; | 23 | globals *ourGlobals = data; |
@@ -126,6 +127,7 @@ static Eina_Bool _del(void *data, int type, Ecore_Con_Event_Server_Del *ev) | |||
126 | 127 | ||
127 | return ECORE_CALLBACK_CANCEL; | 128 | return ECORE_CALLBACK_CANCEL; |
128 | } | 129 | } |
130 | #endif | ||
129 | 131 | ||
130 | #if USE_EVAS_3D | 132 | #if USE_EVAS_3D |
131 | static void _onWorldClick(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo) | 133 | static void _onWorldClick(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *einfo) |
@@ -234,8 +236,10 @@ static void _on_resize(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA | |||
234 | ); | 236 | ); |
235 | // Stop internal windows going under the toolbar. | 237 | // Stop internal windows going under the toolbar. |
236 | evas_object_resize(ourGlobals->mainWindow->layout, ourGlobals->win_w, h); | 238 | evas_object_resize(ourGlobals->mainWindow->layout, ourGlobals->win_w, h); |
239 | #if USE_EPHYSICS | ||
237 | if (ourGlobals->world) | 240 | if (ourGlobals->world) |
238 | ephysics_world_render_geometry_set(ourGlobals->world, 0, 0, -50, ourGlobals->win_w, ourGlobals->win_h, 100); | 241 | ephysics_world_render_geometry_set(ourGlobals->world, 0, 0, -50, ourGlobals->win_w, ourGlobals->win_h, 100); |
242 | #endif | ||
239 | _resize(gld); | 243 | _resize(gld); |
240 | } | 244 | } |
241 | 245 | ||
@@ -424,27 +428,24 @@ static winFang *_makeMainMenu(globals *ourGlobals) | |||
424 | 428 | ||
425 | // GL focus gets lost when any menu is used. sigh | 429 | // GL focus gets lost when any menu is used. sigh |
426 | 430 | ||
427 | // Try to work around the borkedness of EFL menus by creating our own window. | ||
428 | // I can't figure it out, but the main menu wont appear otherwise. It worked before. | ||
429 | // TODO - rip out ELMs menu and create my own. It sucks. | 431 | // TODO - rip out ELMs menu and create my own. It sucks. |
430 | me = winFangAdd(ourGlobals->mainWindow, 0, -4, ourGlobals->win_w, 0, "main menu hack", "mainMenu", ourGlobals->world); | 432 | me = ourGlobals->mainWindow; |
431 | |||
432 | tb = makeMainMenu(me); | 433 | tb = makeMainMenu(me); |
433 | ourGlobals->tb = tb; | 434 | ourGlobals->tb = tb; |
434 | 435 | ||
435 | menu = menuAdd(ourGlobals->mainWindow, tb, "file"); | 436 | menu = menuAdd(me, tb, "file"); |
436 | // Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data | 437 | // Evas_Object *obj, Elm_Object_Item *parent, const char *icon, const char *label, Evas_Smart_Cb func, const void *data |
437 | elm_menu_item_add(menu, NULL, NULL, "open", _on_open, ourGlobals); | 438 | elm_menu_item_add(menu, NULL, NULL, "open", _on_open, ourGlobals); |
438 | elm_menu_item_add(menu, NULL, NULL, "quit", _on_done, gld); | 439 | elm_menu_item_add(menu, NULL, NULL, "quit", _on_done, gld); |
439 | 440 | ||
440 | menu = menuAdd(ourGlobals->mainWindow, tb, "edit"); | 441 | menu = menuAdd(me, tb, "edit"); |
441 | elm_menu_item_add(menu, NULL, NULL, "preferences", NULL, NULL); | 442 | elm_menu_item_add(menu, NULL, NULL, "preferences", NULL, NULL); |
442 | 443 | ||
443 | menu = menuAdd(ourGlobals->mainWindow, tb, "view"); | 444 | menu = menuAdd(me, tb, "view"); |
444 | menu = menuAdd(ourGlobals->mainWindow, tb, "world"); | 445 | menu = menuAdd(me, tb, "world"); |
445 | menu = menuAdd(ourGlobals->mainWindow, tb, "tools"); | 446 | menu = menuAdd(me, tb, "tools"); |
446 | 447 | ||
447 | menu = menuAdd(ourGlobals->mainWindow, tb, "help"); | 448 | menu = menuAdd(me, tb, "help"); |
448 | elm_menu_item_add(menu, NULL, NULL, "grid help", NULL, NULL); | 449 | elm_menu_item_add(menu, NULL, NULL, "grid help", NULL, NULL); |
449 | elm_menu_item_separator_add(menu, NULL); | 450 | elm_menu_item_separator_add(menu, NULL); |
450 | elm_menu_item_add(menu, NULL, NULL, "extantz blogs", NULL, NULL); | 451 | elm_menu_item_add(menu, NULL, NULL, "extantz blogs", NULL, NULL); |
@@ -452,10 +453,10 @@ static winFang *_makeMainMenu(globals *ourGlobals) | |||
452 | elm_menu_item_separator_add(menu, NULL); | 453 | elm_menu_item_separator_add(menu, NULL); |
453 | elm_menu_item_add(menu, NULL, NULL, "about extantz", NULL, NULL); | 454 | elm_menu_item_add(menu, NULL, NULL, "about extantz", NULL, NULL); |
454 | 455 | ||
455 | menu = menuAdd(ourGlobals->mainWindow, tb, "advanced"); | 456 | menu = menuAdd(me, tb, "advanced"); |
456 | elm_menu_item_add(menu, NULL, NULL, "debug settings", NULL, NULL); | 457 | elm_menu_item_add(menu, NULL, NULL, "debug settings", NULL, NULL); |
457 | 458 | ||
458 | menu = menuAdd(ourGlobals->mainWindow, tb, "god"); | 459 | menu = menuAdd(me, tb, "god"); |
459 | 460 | ||
460 | makeMainMenuFinish(me, tb); | 461 | makeMainMenuFinish(me, tb); |
461 | 462 | ||
@@ -466,7 +467,7 @@ static winFang *_makeMainMenu(globals *ourGlobals) | |||
466 | it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); elm_toolbar_item_separator_set(it, EINA_TRUE); | 467 | it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); elm_toolbar_item_separator_set(it, EINA_TRUE); |
467 | it = elm_toolbar_item_append(tb, NULL, "date time:o'clock", NULL, NULL); | 468 | it = elm_toolbar_item_append(tb, NULL, "date time:o'clock", NULL, NULL); |
468 | 469 | ||
469 | winFangCalcMinSize(me); | 470 | elm_layout_box_prepend(me->layout, WF_BOX, tb); |
470 | 471 | ||
471 | return me; | 472 | return me; |
472 | } | 473 | } |
@@ -524,106 +525,62 @@ void overlay_add(globals *ourGlobals) | |||
524 | } | 525 | } |
525 | 526 | ||
526 | 527 | ||
527 | // Use jobs to split the init load. So that the window pops up quickly, with it's background clouds. | 528 | // Use jobs or timers to split the init load. So that the window pops up quickly, with it's background clouds. |
528 | // Then the rest appears a bit at a time. | 529 | // Then the rest appears a bit at a time. |
529 | static Eina_Bool _makePhysics(void *data) | 530 | int skangStep = 0; |
530 | { | 531 | static Eina_Bool _makeSkang(void *data) |
531 | globals *ourGlobals = data; | ||
532 | |||
533 | if (ephysics_init()) | ||
534 | ourGlobals->world = ephysicsAdd(ourGlobals); | ||
535 | |||
536 | return ECORE_CALLBACK_CANCEL; | ||
537 | } | ||
538 | |||
539 | static Eina_Bool _makeFiles(void *data) | ||
540 | { | ||
541 | globals *ourGlobals = data; | ||
542 | |||
543 | ecore_job_add((Ecore_Cb) _makePhysics, ourGlobals); | ||
544 | // ecore_timer_add(0.1, _makePhysics, ourGlobals); | ||
545 | |||
546 | ourGlobals->files = filesAdd(ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); | ||
547 | |||
548 | return ECORE_CALLBACK_CANCEL; | ||
549 | } | ||
550 | |||
551 | static Eina_Bool _makeLove(void *data) | ||
552 | { | ||
553 | globals *ourGlobals = data; | ||
554 | |||
555 | ecore_job_add((Ecore_Cb) _makeFiles, ourGlobals); | ||
556 | // ecore_timer_add(0.1, _makeFiles, ourGlobals); | ||
557 | |||
558 | // PD("About to try connecting to a love server."); | ||
559 | reachOut("love", "./love", "127.0.0.1", 8211 + 1, ourGlobals, (Ecore_Event_Handler_Cb) _add, /*(Ecore_Event_Handler_Cb) _data*/ NULL, (Ecore_Event_Handler_Cb) _del, clientParser); | ||
560 | |||
561 | return ECORE_CALLBACK_CANCEL; | ||
562 | } | ||
563 | |||
564 | static Eina_Bool _makeMess(void *data) | ||
565 | { | 532 | { |
566 | globals *ourGlobals = data; | 533 | globals *ourGlobals = data; |
567 | 534 | ||
568 | ecore_job_add((Ecore_Cb) _makeLove, ourGlobals); | 535 | switch (skangStep++) |
569 | // ecore_timer_add(0.1, _makeLove, ourGlobals); | 536 | { |
570 | 537 | #if USE_SKANG | |
571 | // ourGlobals->LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals->mainWindow, ourGlobals->world); | 538 | case 0 : ourGlobals->purkle = GuiLuaLoad("purkle", ourGlobals->mainWindow, ourGlobals->world); break; |
572 | 539 | case 1 : ourGlobals->LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals->mainWindow, ourGlobals->world); break; | |
573 | return ECORE_CALLBACK_CANCEL; | 540 | case 2 : ourGlobals->files = filesAdd(ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); break; |
574 | } | 541 | #endif |
575 | 542 | ||
576 | static Eina_Bool _makeScenery(void *data) | ||
577 | { | ||
578 | #if USE_EVAS_3D | 543 | #if USE_EVAS_3D |
579 | globals *ourGlobals = data; | 544 | case 3 : |
580 | 545 | // Setup our Evas_3D stuff. | |
581 | ecore_job_add((Ecore_Cb) _makeMess, ourGlobals); | 546 | ourGlobals->scene = scenriAdd(ourGlobals->win); |
582 | // ecore_timer_add(0.1, _makeMess, ourGlobals); | 547 | // TODO - Just a temporary hack so Irrlicht and Evas_3D can share the camera move. |
583 | 548 | // ourGlobals->gld->move = ourGlobals->scene->move; | |
584 | // Setup our Evas_3D stuff. | 549 | evas_object_data_set(elm_image_object_get(ourGlobals->scene->image), "glob", ourGlobals); |
585 | ourGlobals->scene = scenriAdd(ourGlobals->win); | 550 | evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals->scene->image), on_pixels, ourGlobals); |
586 | // TODO - Just a temporary hack so Irrlicht and Evas_3D can share the camera move. | 551 | ourGlobals->scene->clickCb = _onWorldClick; |
587 | // ourGlobals->gld->move = ourGlobals->scene->move; | 552 | break; |
588 | evas_object_data_set(elm_image_object_get(ourGlobals->scene->image), "glob", ourGlobals); | ||
589 | evas_object_image_pixels_get_callback_set(elm_image_object_get(ourGlobals->scene->image), on_pixels, ourGlobals); | ||
590 | ourGlobals->scene->clickCb = _onWorldClick; | ||
591 | #endif | 553 | #endif |
592 | 554 | ||
593 | return ECORE_CALLBACK_CANCEL; | 555 | // TODO - When the menus get fixed, we can bunch these all up with the rest of skang above. |
594 | } | 556 | #if USE_SKANG |
595 | 557 | case 4 : woMan_add(ourGlobals); break; | |
596 | static Eina_Bool _makeMenus(void *data) | 558 | #endif |
597 | { | ||
598 | globals *ourGlobals = data; | ||
599 | |||
600 | // ecore_job_add((Ecore_Cb) _makeScenery, ourGlobals); | ||
601 | ecore_timer_add(0.5, _makeScenery, ourGlobals); | ||
602 | |||
603 | // Gotta do this after adding the windows, otherwise the menu renders under the window. | ||
604 | // This sucks, gotta redefine this menu each time we create a new window? | ||
605 | _makeMainMenu(ourGlobals); | ||
606 | |||
607 | return ECORE_CALLBACK_CANCEL; | ||
608 | } | ||
609 | |||
610 | static Eina_Bool _makePurkle(void *data) | ||
611 | { | ||
612 | globals *ourGlobals = data; | ||
613 | |||
614 | // ecore_job_add((Ecore_Cb) _makeMenus, ourGlobals); | ||
615 | ecore_timer_add(1.0, _makeMenus, ourGlobals); | ||
616 | 559 | ||
617 | woMan_add(ourGlobals); | 560 | #if USE_LOVE |
618 | ourGlobals->purkle = GuiLuaLoad("purkle", ourGlobals->mainWindow, ourGlobals->world); | 561 | case 5 : |
619 | ourGlobals->LSLGuiMess = GuiLuaLoad("LSLGuiMess", ourGlobals->mainWindow, ourGlobals->world); | 562 | // PD("About to try connecting to a love server."); |
620 | // ourGlobals->files = filesAdd(ourGlobals, (char *) prefix_data_get(), EINA_TRUE, EINA_FALSE); | 563 | reachOut("love", "./love", "127.0.0.1", 8211 + 1, ourGlobals, (Ecore_Event_Handler_Cb) _add, /*(Ecore_Event_Handler_Cb) _data*/ NULL, (Ecore_Event_Handler_Cb) _del, clientParser); |
564 | break; | ||
565 | #endif | ||
621 | 566 | ||
622 | // Gotta do this after adding the windows, otherwise the menu renders under the window. | 567 | case 6 : |
623 | // This sucks, gotta redefine this menu each time we create a new window? | 568 | // Gotta do this after adding the windows, otherwise the menu renders under the window. |
624 | // _makeMainMenu(ourGlobals); | 569 | // This sucks, gotta redefine this menu each time we create a new window? |
570 | _makeMainMenu(ourGlobals); | ||
571 | break; | ||
572 | |||
573 | default : | ||
574 | // Menus and toolbars suck, so gotta kick it again here. Which is still not reliable. | ||
575 | elm_layout_sizing_eval(ourGlobals->mainWindow->layout); | ||
576 | _on_resize(ourGlobals, NULL, NULL, NULL); | ||
577 | // ecore_job_add((Ecore_Cb) _makeScenery, ourGlobals); | ||
578 | // ecore_timer_add(0.5, _makeScenery, ourGlobals); | ||
579 | return ECORE_CALLBACK_CANCEL; | ||
580 | break; | ||
581 | } | ||
625 | 582 | ||
626 | return ECORE_CALLBACK_CANCEL; | 583 | return ECORE_CALLBACK_RENEW; |
627 | } | 584 | } |
628 | 585 | ||
629 | EAPI_MAIN int elm_main(int argc, char **argv) | 586 | EAPI_MAIN int elm_main(int argc, char **argv) |
@@ -664,8 +621,19 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
664 | elm_config_preferred_engine_set("opengl_x11"); | 621 | elm_config_preferred_engine_set("opengl_x11"); |
665 | elm_config_accel_preference_set("3d"); | 622 | elm_config_accel_preference_set("3d"); |
666 | 623 | ||
667 | ourGlobals.mainWindow = winFangAdd(NULL, 0, 0, 50, 20, "extantz virtual world viewer", "extantz", NULL); | 624 | // Get the screen size. |
625 | // Found a use for a splash screen, though it's never visible, and even if it was, you would never see it. lol | ||
626 | ourGlobals.win = elm_win_add(NULL, "extantz", ELM_WIN_SPLASH); | ||
627 | elm_win_screen_size_get(ourGlobals.win, &ourGlobals.win_x, &ourGlobals.win_y, &ourGlobals.scr_w, &ourGlobals.scr_h); | ||
628 | ourGlobals.win_x = ourGlobals.win_x + (ourGlobals.scr_w / 3); | ||
629 | // TODO - Now we have to take the frame height into consideration, didn't have to do that before. Faked for now. | ||
630 | ourGlobals.win_y += 25; | ||
631 | ourGlobals.win_w = ourGlobals.scr_w / 2; | ||
632 | ourGlobals.win_h = ourGlobals.scr_h - 25; | ||
633 | evas_object_del(ourGlobals.win); | ||
668 | 634 | ||
635 | // Create the main window. | ||
636 | ourGlobals.mainWindow = winFangAdd(NULL, ourGlobals.win_x, ourGlobals.win_y, ourGlobals.win_w, ourGlobals.win_h, "extantz virtual world viewer", "extantz", NULL); | ||
669 | ourGlobals.win = ourGlobals.mainWindow->win; | 637 | ourGlobals.win = ourGlobals.mainWindow->win; |
670 | // TODO, or not TODO - I keep getting rid of these, but keep bringing them back. | 638 | // TODO, or not TODO - I keep getting rid of these, but keep bringing them back. |
671 | // 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. | 639 | // 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. |
@@ -676,16 +644,6 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
676 | ourGlobals.ee = ecore_evas_ecore_evas_get(ourGlobals.evas); // Only use this on Evas that was created with Ecore_Evas. | 644 | ourGlobals.ee = ecore_evas_ecore_evas_get(ourGlobals.evas); // Only use this on Evas that was created with Ecore_Evas. |
677 | #endif | 645 | #endif |
678 | 646 | ||
679 | // Get the screen size. | ||
680 | elm_win_screen_size_get(ourGlobals.win, &ourGlobals.win_x, &ourGlobals.win_y, &ourGlobals.scr_w, &ourGlobals.scr_h); | ||
681 | ourGlobals.win_x = ourGlobals.win_x + (ourGlobals.scr_w / 3); | ||
682 | // TODO - Now we have to take the frame height into consideration, didn't have to do that before. Faked for now. | ||
683 | ourGlobals.win_y += 28; | ||
684 | ourGlobals.win_w = ourGlobals.scr_w / 2; | ||
685 | ourGlobals.win_h = ourGlobals.scr_h - 30; | ||
686 | evas_object_move(ourGlobals.win, ourGlobals.win_x, ourGlobals.win_y); | ||
687 | evas_object_resize(ourGlobals.win, ourGlobals.win_w, ourGlobals.win_h); | ||
688 | |||
689 | evas_object_event_callback_add(ourGlobals.win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals); | 647 | evas_object_event_callback_add(ourGlobals.win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals); |
690 | 648 | ||
691 | 649 | ||
@@ -714,10 +672,10 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
714 | Ephysics objects | 672 | Ephysics objects |
715 | */ | 673 | */ |
716 | 674 | ||
717 | // Override the background image | 675 | // Create the background image |
718 | #if 1 | 676 | #if 1 |
719 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", prefix_data_get()); | 677 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", prefix_data_get()); |
720 | ourGlobals.mainWindow->bg = eo_add(ELM_IMAGE_CLASS, ourGlobals.mainWindow->win, | 678 | ourGlobals.mainWindow->bg = eo_add(ELM_BG_CLASS, ourGlobals.mainWindow->win, |
721 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 679 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
722 | elm_obj_image_fill_outside_set(EINA_TRUE), | 680 | elm_obj_image_fill_outside_set(EINA_TRUE), |
723 | efl_file_set(buf, NULL), | 681 | efl_file_set(buf, NULL), |
@@ -734,17 +692,24 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
734 | 692 | ||
735 | init_evas_gl(&ourGlobals); | 693 | init_evas_gl(&ourGlobals); |
736 | 694 | ||
695 | #if USE_EPHYSICS | ||
696 | if (ephysics_init()) | ||
697 | ourGlobals.world = ephysicsAdd(&ourGlobals); | ||
698 | #endif | ||
737 | 699 | ||
738 | _on_resize(&ourGlobals, NULL, NULL, NULL); | 700 | _on_resize(&ourGlobals, NULL, NULL, NULL); |
739 | 701 | ||
740 | // TODO - It's still very random if we got clouds straight away or not. B-( | 702 | // Leave the rest of the init for later. |
741 | ecore_timer_add(0.5, _makePurkle, &ourGlobals); | 703 | ecore_timer_add(0.1, _makeSkang, &ourGlobals); |
742 | 704 | ||
743 | elm_run(); | 705 | elm_run(); |
706 | |||
744 | ourGlobals.running = 0; | 707 | ourGlobals.running = 0; |
745 | 708 | ||
709 | #if USE_EPHYSICS | ||
746 | ephysics_world_del(ourGlobals.world); | 710 | ephysics_world_del(ourGlobals.world); |
747 | ephysics_shutdown(); | 711 | ephysics_shutdown(); |
712 | #endif | ||
748 | 713 | ||
749 | if (ourGlobals.win) | 714 | if (ourGlobals.win) |
750 | { | 715 | { |
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h index 2eddeb6..f441f54 100644 --- a/src/extantz/extantz.h +++ b/src/extantz/extantz.h | |||
@@ -1,11 +1,14 @@ | |||
1 | #ifndef _EXTANTZ_H_ | 1 | #ifndef _EXTANTZ_H_ |
2 | #define _EXTANTZ_H_ | 2 | #define _EXTANTZ_H_ |
3 | 3 | ||
4 | #define USE_EVAS_3D 1 | 4 | #define USE_EVAS_3D 1 |
5 | #define USE_IRR 0 | 5 | #define USE_IRR 0 |
6 | #define USE_DEMO 1 | 6 | #define USE_DEMO 0 |
7 | #define DO_GEARS 0 | 7 | #define DO_GEARS 0 |
8 | #define USE_ELM_IMG 1 | 8 | #define USE_ELM_IMG 1 |
9 | #define USE_EPHYSICS 1 | ||
10 | #define USE_LOVE 1 | ||
11 | #define USE_SKANG 1 | ||
9 | 12 | ||
10 | 13 | ||
11 | #include "LumbrJack.h" | 14 | #include "LumbrJack.h" |
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index b99cfdb..0f2c5a5 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c | |||
@@ -192,6 +192,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
192 | result->w = w; | 192 | result->w = w; |
193 | result->h = h; | 193 | result->h = h; |
194 | 194 | ||
195 | // NOTE: parent = NULL is a special case, it's our main window. Not sure yet what to do if there's more than one. | ||
195 | if (result->parent) | 196 | if (result->parent) |
196 | { | 197 | { |
197 | eina_clist_add_head(&parent->winFangs, &result->node); | 198 | eina_clist_add_head(&parent->winFangs, &result->node); |
@@ -202,9 +203,11 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
202 | else | 203 | else |
203 | { | 204 | { |
204 | result->win = elm_win_add(NULL, name, ELM_WIN_BASIC); | 205 | result->win = elm_win_add(NULL, name, ELM_WIN_BASIC); |
205 | evas_object_move(result->win, result->x, result->y); | ||
206 | evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL); | 206 | evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL); |
207 | evas_object_resize(result->win, result->w, result->h); | ||
208 | evas_object_move(result->win, result->x, result->y); | ||
207 | elm_win_title_set(result->win, title); | 209 | elm_win_title_set(result->win, title); |
210 | evas_object_show(result->win); | ||
208 | 211 | ||
209 | obj = result->win; | 212 | obj = result->win; |
210 | x = 0; y = 0; | 213 | x = 0; y = 0; |
@@ -302,8 +305,11 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch | |||
302 | 305 | ||
303 | } | 306 | } |
304 | 307 | ||
305 | evas_object_resize(result->win, result->w, result->h); | 308 | if (result->parent) |
306 | evas_object_show(result->win); | 309 | { |
310 | evas_object_resize(result->win, result->w, result->h); | ||
311 | evas_object_show(result->win); | ||
312 | } | ||
307 | winFangCalcMinSize(result); | 313 | winFangCalcMinSize(result); |
308 | 314 | ||
309 | return result; | 315 | return result; |
@@ -430,7 +436,7 @@ Widget *widgetAdd(winFang *win, char *type , char *title, int x, int y, int w, i | |||
430 | } | 436 | } |
431 | 437 | ||
432 | if (x < 0) | 438 | if (x < 0) |
433 | elm_layout_box_append(win->win, WF_BOX, result->obj); | 439 | elm_layout_box_append(win->layout, WF_BOX, result->obj); |
434 | else | 440 | else |
435 | elm_grid_pack(win->grid, result->obj, x, y, w, h); | 441 | elm_grid_pack(win->grid, result->obj, x, y, w, h); |
436 | 442 | ||
@@ -527,10 +533,10 @@ Evas_Object *makeMainMenu(winFang *win) | |||
527 | ); | 533 | ); |
528 | } | 534 | } |
529 | 535 | ||
530 | static void _on_menu_focus(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) | 536 | //static void _on_menu_focus(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) |
531 | { | 537 | //{ |
532 | evas_object_raise(obj); | 538 | // evas_object_raise(obj); |
533 | } | 539 | //} |
534 | 540 | ||
535 | Evas_Object *menuAdd(winFang *win, Evas_Object *tb, char *label) | 541 | Evas_Object *menuAdd(winFang *win, Evas_Object *tb, char *label) |
536 | { | 542 | { |
@@ -545,7 +551,7 @@ Evas_Object *menuAdd(winFang *win, Evas_Object *tb, char *label) | |||
545 | // This alledgedly marks it as a menu (not true), and gets an Evas_Object for us to play with. | 551 | // This alledgedly marks it as a menu (not true), and gets an Evas_Object for us to play with. |
546 | menu = elm_toolbar_item_menu_get(tb_it); | 552 | menu = elm_toolbar_item_menu_get(tb_it); |
547 | // Alas this does not work. B-( | 553 | // Alas this does not work. B-( |
548 | evas_object_smart_callback_add(menu, "focused", _on_menu_focus, NULL); | 554 | // evas_object_smart_callback_add(menu, "focused", _on_menu_focus, NULL); |
549 | 555 | ||
550 | // Priority is for when toolbar items are set to hide or menu when there are too many of them. They get hidden or put on the menu based on priority. | 556 | // Priority is for when toolbar items are set to hide or menu when there are too many of them. They get hidden or put on the menu based on priority. |
551 | elm_toolbar_item_priority_set(tb_it, 9999); | 557 | elm_toolbar_item_priority_set(tb_it, 9999); |
@@ -553,6 +559,8 @@ Evas_Object *menuAdd(winFang *win, Evas_Object *tb, char *label) | |||
553 | // The docs for this functien are meaningless, but it wont work right if you leave it out. | 559 | // The docs for this functien are meaningless, but it wont work right if you leave it out. |
554 | elm_toolbar_menu_parent_set(tb, win->win); | 560 | elm_toolbar_menu_parent_set(tb, win->win); |
555 | 561 | ||
562 | elm_toolbar_homogeneous_set(tb, EINA_FALSE); | ||
563 | |||
556 | // Add a seperator after, so that there's some visual distinction between menu items. | 564 | // Add a seperator after, so that there's some visual distinction between menu items. |
557 | // Coz using all lower case and with no underline on the first letter, it's hard to tell. | 565 | // Coz using all lower case and with no underline on the first letter, it's hard to tell. |
558 | tb_it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); | 566 | tb_it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL); |