diff options
Diffstat (limited to '')
-rw-r--r-- | src/extantz/extantz.c | 53 | ||||
-rw-r--r-- | src/extantz/extantz.h | 15 |
2 files changed, 51 insertions, 17 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index ab09fd0..1176bb9 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -1,7 +1,7 @@ | |||
1 | #include "extantz.h" | 1 | #include "extantz.h" |
2 | 2 | ||
3 | 3 | ||
4 | int _log_domain = -1; | 4 | globals ourGlobals; |
5 | 5 | ||
6 | Eina_Hash *grids; | 6 | Eina_Hash *grids; |
7 | Eina_Hash *viewers; | 7 | Eina_Hash *viewers; |
@@ -786,10 +786,8 @@ static void _del_gl(Evas_Object *obj) | |||
786 | // Callback for when the app quits. | 786 | // Callback for when the app quits. |
787 | static void _on_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 787 | static void _on_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
788 | { | 788 | { |
789 | GLData *gld = data; | 789 | // GLData *gld = data; |
790 | 790 | ||
791 | evas_object_del(gld->win); | ||
792 | free(gld); | ||
793 | elm_exit(); | 791 | elm_exit(); |
794 | } | 792 | } |
795 | 793 | ||
@@ -1386,7 +1384,7 @@ static void woMan_add(GLData *gld) | |||
1386 | EAPI_MAIN int elm_main(int argc, char **argv) | 1384 | EAPI_MAIN int elm_main(int argc, char **argv) |
1387 | { | 1385 | { |
1388 | // Evas_Object *bg, *menu, *bt, *tb; | 1386 | // Evas_Object *bg, *menu, *bt, *tb; |
1389 | Evas_Object *menu, *tb; | 1387 | Evas_Object *obj, *menu, *tb; |
1390 | Elm_Object_Item *tb_it; | 1388 | Elm_Object_Item *tb_it; |
1391 | //, *menu_it; | 1389 | //, *menu_it; |
1392 | EPhysics_Body *boundary; | 1390 | EPhysics_Body *boundary; |
@@ -1398,16 +1396,20 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
1398 | // int i; | 1396 | // int i; |
1399 | // Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't. | 1397 | // Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't. |
1400 | 1398 | ||
1401 | _log_domain = eina_log_domain_register("extantz", NULL); | ||
1402 | // Don't do this, we need to clean up other stuff to, so set a clean up function below. | ||
1403 | //elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); | ||
1404 | |||
1405 | HamrTime(elm_main, "extantz"); | 1399 | HamrTime(elm_main, "extantz"); |
1406 | fprintf(stdout, "prefix was set to: %s\n", elm_app_prefix_dir_get()); | 1400 | fprintf(stdout, "prefix was set to: %s\n", elm_app_prefix_dir_get()); |
1407 | fprintf(stdout, "data directory is: %s\n", elm_app_data_dir_get()); | 1401 | fprintf(stdout, "data directory is: %s\n", elm_app_data_dir_get()); |
1408 | fprintf(stdout, "library directory is: %s\n", elm_app_lib_dir_get()); | 1402 | fprintf(stdout, "library directory is: %s\n", elm_app_lib_dir_get()); |
1409 | fprintf(stdout, "locale directory is: %s\n", elm_app_locale_dir_get()); | 1403 | fprintf(stdout, "locale directory is: %s\n", elm_app_locale_dir_get()); |
1410 | 1404 | ||
1405 | ourGlobals.logDom = loggingStartup("extantz", ourGlobals.logDom); | ||
1406 | |||
1407 | // Don't do this, we need to clean up other stuff to, so set a clean up function below. | ||
1408 | //elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); | ||
1409 | elm_policy_set(ELM_POLICY_EXIT, ELM_POLICY_EXIT_NONE); | ||
1410 | elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_NONE); | ||
1411 | elm_policy_set(ELM_POLICY_THROTTLE, ELM_POLICY_THROTTLE_HIDDEN_ALWAYS); | ||
1412 | |||
1411 | // These are set via the elementary_config tool, which is hard to find. | 1413 | // These are set via the elementary_config tool, which is hard to find. |
1412 | elm_config_finger_size_set(0); | 1414 | elm_config_finger_size_set(0); |
1413 | elm_config_scale_set(1.0); | 1415 | elm_config_scale_set(1.0); |
@@ -1420,6 +1422,8 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
1420 | if (gld->useEGL) | 1422 | if (gld->useEGL) |
1421 | elm_config_preferred_engine_set("opengl_x11"); | 1423 | elm_config_preferred_engine_set("opengl_x11"); |
1422 | gld->win = elm_win_add(NULL, "extantz", ELM_WIN_BASIC); | 1424 | gld->win = elm_win_add(NULL, "extantz", ELM_WIN_BASIC); |
1425 | gld->win = elm_win_util_standard_add("extantz", "extantz virtual world viewer"); | ||
1426 | |||
1423 | // Set preferred engine back to default from config | 1427 | // Set preferred engine back to default from config |
1424 | elm_config_preferred_engine_set(NULL); | 1428 | elm_config_preferred_engine_set(NULL); |
1425 | 1429 | ||
@@ -1428,7 +1432,7 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
1428 | return 1; | 1432 | return 1; |
1429 | #endif | 1433 | #endif |
1430 | 1434 | ||
1431 | elm_win_title_set(gld->win, "extantz virtual world manager"); | 1435 | // elm_win_title_set(gld->win, "extantz virtual world manager"); |
1432 | evas_object_smart_callback_add(gld->win, "delete,request", _on_done, gld); | 1436 | evas_object_smart_callback_add(gld->win, "delete,request", _on_done, gld); |
1433 | 1437 | ||
1434 | // Get the screen size. | 1438 | // Get the screen size. |
@@ -1437,12 +1441,27 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
1437 | gld->win_w = gld->scr_w / 2; | 1441 | gld->win_w = gld->scr_w / 2; |
1438 | gld->win_h = gld->scr_h - 30; | 1442 | gld->win_h = gld->scr_h - 30; |
1439 | 1443 | ||
1444 | // 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. | ||
1445 | ourGlobals.evas = evas_object_evas_get(gld->win); | ||
1446 | |||
1447 | // Add a background image object. | ||
1448 | obj = eo_add(ELM_OBJ_IMAGE_CLASS, gld->win); | ||
1449 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", elm_app_data_dir_get()); | ||
1450 | eo_do(obj, | ||
1451 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | ||
1452 | elm_obj_image_fill_outside_set(EINA_TRUE), | ||
1453 | elm_obj_image_file_set(buf, NULL), | ||
1454 | evas_obj_visibility_set(EINA_TRUE) | ||
1455 | ); | ||
1456 | elm_win_resize_object_add(gld->win, obj); | ||
1457 | eo_unref(obj); | ||
1458 | |||
1440 | // Note, we don't need an Elm_bg, the entire thing gets covered with the GL rendering surface anyway. | 1459 | // Note, we don't need an Elm_bg, the entire thing gets covered with the GL rendering surface anyway. |
1441 | #if 0 | 1460 | #if 0 |
1442 | bg = elm_bg_add(gld->win); | 1461 | bg = elm_bg_add(gld->win); |
1443 | elm_bg_load_size_set(bg, gld->win_w, gld->win_h); | 1462 | elm_bg_load_size_set(bg, gld->win_w, gld->win_h); |
1444 | elm_bg_option_set(bg, ELM_BG_OPTION_CENTER); | 1463 | elm_bg_option_set(bg, ELM_BG_OPTION_CENTER); |
1445 | snprintf(buf, sizeof(buf), "%s/media/sky_03.jpg", elm_app_data_dir_get()); | 1464 | snprintf(buf, sizeof(buf), "%s/sky_03.jpg", elm_app_data_dir_get()); |
1446 | elm_bg_file_set(bg, buf, NULL); | 1465 | elm_bg_file_set(bg, buf, NULL); |
1447 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | 1466 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); |
1448 | elm_win_resize_object_add(gld->win, bg); | 1467 | elm_win_resize_object_add(gld->win, bg); |
@@ -1580,6 +1599,18 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
1580 | ephysics_shutdown(); | 1599 | ephysics_shutdown(); |
1581 | #endif | 1600 | #endif |
1582 | 1601 | ||
1602 | if (gld->win) | ||
1603 | { | ||
1604 | evas_object_del(gld->win); | ||
1605 | } | ||
1606 | free(gld); | ||
1607 | |||
1608 | if (ourGlobals.logDom >= 0) | ||
1609 | { | ||
1610 | eina_log_domain_unregister(ourGlobals.logDom); | ||
1611 | ourGlobals.logDom = -1; | ||
1612 | } | ||
1613 | |||
1583 | elm_shutdown(); | 1614 | elm_shutdown(); |
1584 | 1615 | ||
1585 | return 0; | 1616 | return 0; |
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h index 25b78cf..9a27481 100644 --- a/src/extantz/extantz.h +++ b/src/extantz/extantz.h | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | 9 | ||
10 | #include "SledjHamr.h" | 10 | #include "SledjHamr.h" |
11 | #include "LumbrJack.h" | ||
11 | #include <elm_widget_glview.h> | 12 | #include <elm_widget_glview.h> |
12 | #include <Evas_GL.h> | 13 | #include <Evas_GL.h> |
13 | #include <EPhysics.h> | 14 | #include <EPhysics.h> |
@@ -59,13 +60,15 @@ typedef struct ICameraSceneNode ICameraSceneNode; | |||
59 | #endif | 60 | #endif |
60 | 61 | ||
61 | 62 | ||
62 | #define CRI(...) EINA_LOG_DOM_CRIT(_log_domain, _VA_ARGS__) | 63 | typedef struct _globals |
63 | #define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__) | 64 | { |
64 | #define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__) | 65 | Evas *evas; |
65 | #define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__) | 66 | Evas_Object *win; // Our Elm window. |
66 | #define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__) | 67 | Eina_Clist widgets; // Our windows widgets. |
68 | int logDom; // Our logging domain. | ||
69 | } globals; | ||
67 | 70 | ||
68 | extern int _log_domain; | 71 | extern globals ourGlobals; |
69 | 72 | ||
70 | 73 | ||
71 | typedef struct _Gear Gear; | 74 | typedef struct _Gear Gear; |