I'm trying to capture getsture events on top of GLView, but it failed.
I tried capture gesture events on top of box as below codes, it works.
/* Box */ ad->box = elm_box_add(ad->conform); evas_object_size_hint_weight_set(ad->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_box_padding_set(ad->box, 0, 5 * elm_config_scale_get()); /* Event Rect */ ad->rect = evas_object_rectangle_add(evas_object_evas_get(ad->box)); evas_object_size_hint_weight_set(ad->rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(ad->rect, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_color_set(ad->rect, 0, 204, 0, 255); evas_object_repeat_events_set(ad->rect, EINA_TRUE); /* Create getsture layer*/ Evas_Object *ges = elm_gesture_layer_add(ad->box); elm_gesture_layer_attach(ges, ad->rect); elm_gesture_layer_cb_set(ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_START, zoom_start_cb, ad); elm_gesture_layer_cb_set(ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, zoom_move_cb, ad); elm_gesture_layer_cb_set(ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_END, zoom_end_cb, ad); elm_gesture_layer_cb_set(ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_ABORT, zoom_abort_cb, ad); elm_box_pack_end(ad->box, ad->rect); evas_object_show(ad->rect); elm_object_content_set(ad->conform, ad->box); evas_object_show(ad->box);
When I do zoom operation on screen, all zoom_**_cb been called.
but when I do almost samething on GLView, it failed. No zoom_**_cb is called when doing zoom operation.
/* Create and initialize GLView */ gl = elm_glview_add(ad->conform); ELEMENTARY_GLVIEW_GLOBAL_USE(gl); evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); /* Request a surface with alpha and a depth buffer */ elm_glview_mode_set(gl, ELM_GLVIEW_DEPTH); /* The resize policy tells GLView what to do with the surface when it * resizes. ELM_GLVIEW_RESIZE_POLICY_RECREATE will tell it to * destroy the current surface and recreate it to the new size. */ elm_glview_resize_policy_set(gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE); /* The render policy sets how GLView should render GL code. * ELM_GLVIEW_RENDER_POLICY_ON_DEMAND will have the GL callback * called only when the object is visible. * ELM_GLVIEW_RENDER_POLICY_ALWAYS would cause the callback to be * called even if the object were hidden. */ elm_glview_render_policy_set(gl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND); /* The initialize callback function gets registered here */ elm_glview_init_func_set(gl, init_gl); /* The delete callback function gets registered here */ elm_glview_del_func_set(gl, del_gl); /* The render callback function gets registered here */ elm_glview_render_func_set(gl, draw_gl); /* Event Rect */ ad->rect = evas_object_rectangle_add(evas_object_evas_get(gl)); evas_object_size_hint_weight_set(ad->rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(ad->rect, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_color_set(ad->rect, 0, 204, 0, 255); evas_object_repeat_events_set(ad->rect, EINA_TRUE); /* Create getsture layer*/ Evas_Object *ges = elm_gesture_layer_add(gl); elm_gesture_layer_attach(ges, ad->rect); elm_gesture_layer_cb_set(ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_START, zoom_start_cb, ad); elm_gesture_layer_cb_set(ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, zoom_move_cb, ad); elm_gesture_layer_cb_set(ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_END, zoom_end_cb, ad); elm_gesture_layer_cb_set(ges, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_ABORT, zoom_abort_cb, ad); elm_box_pack_end(gl, ad->rect); evas_object_show(ad->rect); /* Add the GLView to the conformant and show it */ elm_object_content_set(ad->conform, gl); evas_object_show(gl); elm_object_focus_set(gl, EINA_TRUE); /* This adds an animator so that the app will regularly * trigger updates of the GLView using elm_glview_changed_set(). * * NOTE: If you delete GL, this animator will keep running trying to access * GL so this animator needs to be deleted with ecore_animator_del(). */ ani = ecore_animator_add(anim, gl); evas_object_data_set(gl, "ani", ani); evas_object_data_set(gl, "ad", ad); evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, del_anim, gl); evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_DOWN, mouse_down_cb, ad); evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_UP, mouse_up_cb, ad); evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_MOVE, mouse_move_cb, ad); evas_object_show(ad->win);