lottie/example: updated evasapp to handle keyevent propagation.

Change-Id: Iecc3479ef011e64e113a50f3914676e0a6341f49
This commit is contained in:
subhransu mohanty
2018-07-17 13:58:17 +09:00
parent 8966564ec8
commit 0347a9677f
4 changed files with 22 additions and 5 deletions

View File

@@ -8,7 +8,7 @@ _on_resize(Ecore_Evas *ee)
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
app->resize(w, h);
if (app->mResizeCb)
app->mResizeCb(app->mResizeData);
app->mResizeCb(app->mResizeData, nullptr);
}
static void
@@ -16,12 +16,24 @@ _on_delete(Ecore_Evas *ee)
{
EvasApp *app = (EvasApp *)ecore_evas_data_get(ee, "app");
if (app->mExitCb)
app->mExitCb(app->mExitData);
app->mExitCb(app->mExitData, nullptr);
ecore_main_loop_quit();
ecore_evas_free(ee);
}
static Eina_Bool
on_key_down(void *data, int type, void *event)
{
Ecore_Event_Key *keyData = (Ecore_Event_Key *)event;
EvasApp *app = (EvasApp *) data;
if (app && app->mKeyCb)
app->mKeyCb(app->mKeyData, (void *)keyData->key);
return false;
}
EvasApp::EvasApp(int w, int h)
{
if (!ecore_evas_init())
@@ -39,6 +51,7 @@ EvasApp::setup()
ecore_evas_data_set(mEcoreEvas, "app", this);
ecore_evas_callback_resize_set(mEcoreEvas, _on_resize);
ecore_evas_callback_delete_request_set(mEcoreEvas, _on_delete);
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, on_key_down, this);
ecore_evas_show(mEcoreEvas);
mEvas = ecore_evas_get(mEcoreEvas);