aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz/extantz.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-05 00:55:37 +1000
committerDavid Walter Seikel2014-05-05 00:55:37 +1000
commitd5d869e9ec2c54db9e3ff25c518d0b57ee362c1e (patch)
treec86a3c2b51216270a447652174b7c1b54a59d6b4 /src/extantz/extantz.c
parentMinor clean up. (diff)
downloadSledjHamr-d5d869e9ec2c54db9e3ff25c518d0b57ee362c1e.zip
SledjHamr-d5d869e9ec2c54db9e3ff25c518d0b57ee362c1e.tar.gz
SledjHamr-d5d869e9ec2c54db9e3ff25c518d0b57ee362c1e.tar.bz2
SledjHamr-d5d869e9ec2c54db9e3ff25c518d0b57ee362c1e.tar.xz
fangWin -> winFang and related changes.
Diffstat (limited to 'src/extantz/extantz.c')
-rw-r--r--src/extantz/extantz.c61
1 files changed, 57 insertions, 4 deletions
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c
index ef493b8..679a47e 100644
--- a/src/extantz/extantz.c
+++ b/src/extantz/extantz.c
@@ -328,12 +328,65 @@ static void makeMainMenu(globals *ourGlobals)
328 evas_object_show(tb); 328 evas_object_show(tb);
329} 329}
330 330
331// Elm inlined image windows needs this to change focus on mouse click.
332// Evas style event callback.
333static void _cb_mouse_down_elm(void *data, Evas *evas, Evas_Object *obj, void *event_info)
334{
335 Evas_Event_Mouse_Down *ev = event_info;
336
337 if (1 == ev->button)
338 elm_object_focus_set(obj, EINA_TRUE);
339}
340
341void overlay_add(globals *ourGlobals)
342{
343 GLData *gld = &ourGlobals->gld;
344 Evas_Object *bg;
345
346 // There are many reasons for this window.
347 // The first is to cover the GL and provide something to click on to change focus.
348 // The second is to provide something to click on for all the GL type clicking stuff that needs to be done. In other words, no click through, we catch the clicks here.
349 // So we can probably avoid the following issue -
350 // How to do click through? evas_object_pass_events_set(rectangle, EINA_TRUE), and maybe need to do that to the underlaying window to?
351 // Though if the rectangle is entirely transparent, or even hidden, events might pass through anyway.
352 // Gotta have click through on the parts where there's no other window.
353 // The third is to have the other windows live here.
354 // This idea doesn't work, as it breaks the damn focus again.
355 // Don't think it's needed anyway.
356 // While on the subject of layers, need a HUD layer of some sort, but Irrlicht might support that itself.
357
358 gld->winwin = elm_win_add(ourGlobals->win, "inlined", ELM_WIN_INLINED_IMAGE);
359 // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets.
360 // According to the Elm inlined image window example, this is what's needed to.
361 evas_object_event_callback_add(elm_win_inlined_image_object_get(gld->winwin), EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, NULL);
362 // In this code, we are making our own camera, so grab it's input when we are focused.
363 cameraAdd(ourGlobals, gld->winwin);
364
365 elm_win_alpha_set(gld->winwin, EINA_TRUE);
366 // Apparently transparent is not good enough for ELM backgrounds, so make it a rectangle.
367 // Apparently coz ELM prefers stuff to have edjes. A bit over the top if all I want is a transparent rectangle.
368 bg = evas_object_rectangle_add(evas_object_evas_get(gld->winwin));
369 evas_object_color_set(bg, 0, 0, 0, 0);
370 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
371 elm_win_resize_object_add(gld->winwin, bg);
372 evas_object_show(bg);
373
374 // image object for win is unlinked to its pos/size - so manual control
375 // this allows also for using map and other things with it.
376 evas_object_move(elm_win_inlined_image_object_get(gld->winwin), 0, 0);
377 // Odd, it needs to be resized twice. WTF?
378 evas_object_resize(gld->winwin, ourGlobals->win_w, ourGlobals->win_h);
379 evas_object_resize(elm_win_inlined_image_object_get(gld->winwin), ourGlobals->win_w, ourGlobals->win_h);
380 evas_object_show(gld->winwin);
381}
382
383
331EAPI_MAIN int elm_main(int argc, char **argv) 384EAPI_MAIN int elm_main(int argc, char **argv)
332{ 385{
333 Evas_Object *obj; 386 Evas_Object *obj;
334 EPhysics_World *world; 387 EPhysics_World *world;
335 GLData *gld = NULL; 388 GLData *gld = NULL;
336 fangWin *chat = NULL, *woMan = NULL; 389 winFang *chat = NULL, *woMan = NULL;
337 char buf[PATH_MAX]; 390 char buf[PATH_MAX];
338// Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't. 391// Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't.
339 392
@@ -452,9 +505,9 @@ EAPI_MAIN int elm_main(int argc, char **argv)
452 { 505 {
453 Evas_3D_Demo_fini(&ourGlobals); 506 Evas_3D_Demo_fini(&ourGlobals);
454 eo_unref(ourGlobals.tb); 507 eo_unref(ourGlobals.tb);
455 fang_win_del(&ourGlobals, ourGlobals.files); 508 winFangDel(&ourGlobals, ourGlobals.files);
456 fang_win_del(&ourGlobals, chat); 509 winFangDel(&ourGlobals, chat);
457 fang_win_del(&ourGlobals, woMan); 510 winFangDel(&ourGlobals, woMan);
458 eo_unref(ourGlobals.bx); 511 eo_unref(ourGlobals.bx);
459 evas_object_del(ourGlobals.win); 512 evas_object_del(ourGlobals.win);
460 } 513 }