diff options
Diffstat (limited to '')
-rw-r--r-- | src/extantz/extantz.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index 28df70f..6ef2b75 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -34,7 +34,8 @@ static void _resize(GLData *gld) | |||
34 | { | 34 | { |
35 | Evas_GL_API *gl = gld->glApi; | 35 | Evas_GL_API *gl = gld->glApi; |
36 | 36 | ||
37 | _resize_winwin(gld); | 37 | if (gld->elmGl) |
38 | _resize_winwin(gld); | ||
38 | 39 | ||
39 | #if DO_GEARS | 40 | #if DO_GEARS |
40 | GLfloat ar, m[16] = { | 41 | GLfloat ar, m[16] = { |
@@ -56,7 +57,8 @@ static void _resize(GLData *gld) | |||
56 | memcpy(gld->proj, m, sizeof gld->proj); | 57 | memcpy(gld->proj, m, sizeof gld->proj); |
57 | #endif | 58 | #endif |
58 | 59 | ||
59 | gl->glViewport(0, 0, (GLint) gld->img_w, (GLint) gld->img_h); | 60 | if (gl) |
61 | gl->glViewport(0, 0, (GLint) gld->img_w, (GLint) gld->img_h); | ||
60 | } | 62 | } |
61 | 63 | ||
62 | static void _resize_gl(Evas_Object *obj) | 64 | static void _resize_gl(Evas_Object *obj) |
@@ -71,6 +73,16 @@ static void _resize_gl(Evas_Object *obj) | |||
71 | _resize(gld); | 73 | _resize(gld); |
72 | } | 74 | } |
73 | 75 | ||
76 | static void _on_resize(void *data, Evas *evas, Evas_Object *obj, void *event_info) | ||
77 | { | ||
78 | globals *ourGlobals = data; | ||
79 | GLData *gld = &ourGlobals->gld; | ||
80 | |||
81 | eo_do(gld->win, evas_obj_size_get(&gld->win_w, &gld->win_h)); | ||
82 | eo_do(ourGlobals->tb, evas_obj_size_set(gld->win_w, 25)); | ||
83 | _resize(gld); | ||
84 | } | ||
85 | |||
74 | // Callback from Evas, also used as the general callback for deleting the GL stuff. | 86 | // Callback from Evas, also used as the general callback for deleting the GL stuff. |
75 | static void _clean_gl(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | 87 | static void _clean_gl(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
76 | { | 88 | { |
@@ -128,6 +140,7 @@ static void _draw_gl(Evas_Object *obj) | |||
128 | { | 140 | { |
129 | globals *ourGlobals = evas_object_data_get(obj, "glob"); | 141 | globals *ourGlobals = evas_object_data_get(obj, "glob"); |
130 | GLData *gld = &ourGlobals->gld; | 142 | GLData *gld = &ourGlobals->gld; |
143 | if (!ourGlobals) return; | ||
131 | 144 | ||
132 | if (!gld->doneIrr) gld->doneIrr = startIrr(gld); // Needs to be after gld->win is shown, and needs to be done in the render thread. | 145 | if (!gld->doneIrr) gld->doneIrr = startIrr(gld); // Needs to be after gld->win is shown, and needs to be done in the render thread. |
133 | #if DO_GEARS | 146 | #if DO_GEARS |
@@ -142,7 +155,7 @@ static void _draw_gl(Evas_Object *obj) | |||
142 | drawGears(gld); | 155 | drawGears(gld); |
143 | #endif | 156 | #endif |
144 | 157 | ||
145 | _animate_scene(ourGlobals->scene); | 158 | _animate_scene(ourGlobals); |
146 | 159 | ||
147 | drawIrr_end(gld); | 160 | drawIrr_end(gld); |
148 | 161 | ||
@@ -254,17 +267,19 @@ static Evas_Object *_toolbar_menu_add(Evas_Object *win, Evas_Object *tb, char *l | |||
254 | return menu; | 267 | return menu; |
255 | } | 268 | } |
256 | 269 | ||
257 | static void makeMainMenu(GLData *gld) | 270 | static void makeMainMenu(globals *ourGlobals) |
258 | { | 271 | { |
272 | GLData *gld = &ourGlobals->gld; | ||
259 | Evas_Object *menu, *tb; | 273 | Evas_Object *menu, *tb; |
260 | Elm_Object_Item *tb_it; | 274 | Elm_Object_Item *tb_it; |
261 | 275 | ||
262 | // A toolbar thingy. | 276 | // A toolbar thingy. |
263 | tb = eo_add(ELM_OBJ_TOOLBAR_CLASS, gld->win); | 277 | tb = eo_add(ELM_OBJ_TOOLBAR_CLASS, gld->win); |
278 | ourGlobals->tb = tb; | ||
264 | eo_do(tb, | 279 | eo_do(tb, |
265 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), | 280 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0), |
266 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | 281 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), |
267 | elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_SCROLL), | 282 | elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU), |
268 | evas_obj_size_set(gld->win_w, 25), | 283 | evas_obj_size_set(gld->win_w, 25), |
269 | evas_obj_position_set(0, 0), | 284 | evas_obj_position_set(0, 0), |
270 | elm_obj_toolbar_align_set(0.0) | 285 | elm_obj_toolbar_align_set(0.0) |
@@ -306,7 +321,6 @@ static void makeMainMenu(GLData *gld) | |||
306 | tb_it = elm_toolbar_item_append(tb, NULL, "date time:o'clock", NULL, NULL); | 321 | tb_it = elm_toolbar_item_append(tb, NULL, "date time:o'clock", NULL, NULL); |
307 | 322 | ||
308 | evas_object_show(tb); | 323 | evas_object_show(tb); |
309 | eo_unref(tb); | ||
310 | } | 324 | } |
311 | 325 | ||
312 | EAPI_MAIN int elm_main(int argc, char **argv) | 326 | EAPI_MAIN int elm_main(int argc, char **argv) |
@@ -354,6 +368,7 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
354 | #endif | 368 | #endif |
355 | 369 | ||
356 | evas_object_smart_callback_add(gld->win, "delete,request", _on_done, gld); | 370 | evas_object_smart_callback_add(gld->win, "delete,request", _on_done, gld); |
371 | evas_object_event_callback_add(gld->win, EVAS_CALLBACK_RESIZE, _on_resize, &ourGlobals); | ||
357 | 372 | ||
358 | // Get the screen size. | 373 | // Get the screen size. |
359 | elm_win_screen_size_get(gld->win, &gld->win_x, &gld->win_y, &gld->scr_w, &gld->scr_h); | 374 | elm_win_screen_size_get(gld->win, &gld->win_x, &gld->win_y, &gld->scr_w, &gld->scr_h); |
@@ -373,7 +388,6 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
373 | elm_win_resize_object_add(gld->win, obj); | 388 | elm_win_resize_object_add(gld->win, obj); |
374 | eo_unref(obj); | 389 | eo_unref(obj); |
375 | 390 | ||
376 | |||
377 | gld->bx = eo_add(ELM_OBJ_BOX_CLASS, gld->win); | 391 | gld->bx = eo_add(ELM_OBJ_BOX_CLASS, gld->win); |
378 | eo_do(gld->bx, | 392 | eo_do(gld->bx, |
379 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | 393 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), |
@@ -384,13 +398,12 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
384 | 398 | ||
385 | // overlay_add(gld); | 399 | // overlay_add(gld); |
386 | woMan_add(gld); | 400 | woMan_add(gld); |
387 | // TODO - This is what causes it to hang after quitting. Fix it. | 401 | chat_add(gld); |
388 | // chat_add(gld); | ||
389 | 402 | ||
390 | // Gotta do this after adding the windows, otherwise the menu renders under the window. | 403 | // Gotta do this after adding the windows, otherwise the menu renders under the window. |
391 | // This sucks, gotta redefine this menu each time we create a new window? | 404 | // This sucks, gotta redefine this menu each time we create a new window? |
392 | // Also, GL focus gets lost when any menu is used. sigh | 405 | // Also, GL focus gets lost when any menu is used. sigh |
393 | makeMainMenu(gld); | 406 | makeMainMenu(&ourGlobals); |
394 | 407 | ||
395 | // This does elm_box_pack_end(), so needs to be after the others. | 408 | // This does elm_box_pack_end(), so needs to be after the others. |
396 | init_evas_gl(&ourGlobals); | 409 | init_evas_gl(&ourGlobals); |
@@ -418,8 +431,9 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
418 | 431 | ||
419 | if (gld->win) | 432 | if (gld->win) |
420 | { | 433 | { |
434 | Evas_3D_Demo_fini(&ourGlobals); | ||
435 | eo_unref(ourGlobals.tb); | ||
421 | eo_unref(gld->bx); | 436 | eo_unref(gld->bx); |
422 | Evas_3D_Demo_fini(); | ||
423 | evas_object_del(gld->win); | 437 | evas_object_del(gld->win); |
424 | } | 438 | } |
425 | 439 | ||