aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJi-Youn Park <jy0703.park@samsung.com>2016-03-16 15:28:35 +0830
committerJi-Youn Park <jy0703.park@samsung.com>2016-03-16 15:28:39 +0830
commit8e0c8ec5902894c8e4b81fa1d429707719273d41 (patch)
tree4f842c55d1803575a3d7df3f6f05948c48282ee1
parentElm_glview: remove elm_glview_size_set. (diff)
downloadelementary-8e0c8ec5902894c8e4b81fa1d429707719273d41.tar.gz
elm_glview: eo-fication for set function
remove elm_glveiw_XXX_set function and create event render_set-render init_set->created resize_set-> resized del_set -> destroyed
-rw-r--r--src/lib/elm_glview.c95
-rw-r--r--src/lib/elm_glview.eo83
2 files changed, 95 insertions, 83 deletions
diff --git a/src/lib/elm_glview.c b/src/lib/elm_glview.c
index b8d7602dd..d20d67d38 100644
--- a/src/lib/elm_glview.c
+++ b/src/lib/elm_glview.c
@@ -128,12 +128,16 @@ _render_cb(void *obj)
// Call the init function if it hasn't been called already
if (!sd->initialized)
{
+ //TODO:will be optimized
+ eo_event_callback_call(obj, ELM_GLVIEW_EVENT_CREATED, NULL);
if (sd->init_func) sd->init_func(obj);
sd->initialized = EINA_TRUE;
}
if (sd->resized)
{
+ //TODO:will be optimized
+ eo_event_callback_call(obj, ELM_GLVIEW_EVENT_RESIZED, NULL);
if (sd->resize_func) sd->resize_func(obj);
sd->resized = EINA_FALSE;
}
@@ -142,6 +146,8 @@ _render_cb(void *obj)
evas_sync(evas_object_evas_get(obj));
// Call the render function
if (sd->render_func) sd->render_func(obj);
+ //TODO:will be optimized
+ eo_event_callback_call(obj, ELM_GLVIEW_EVENT_RENDER, NULL);
// Depending on the policy return true or false
if (sd->render_policy == ELM_GLVIEW_RENDER_POLICY_ON_DEMAND)
@@ -276,6 +282,8 @@ _elm_glview_evas_object_smart_del(Eo *obj, Elm_Glview_Data *sd)
evas_gl_make_current(sd->evasgl, sd->surface, sd->context);
sd->del_func(obj);
}
+ //TODO:will be optimised
+ eo_event_callback_call(obj, ELM_GLVIEW_EVENT_DESTROYED, NULL);
ecore_idle_enterer_del(sd->render_idle_enterer);
evas_gl_make_current(sd->evasgl, NULL, NULL);
@@ -292,6 +300,25 @@ _elm_glview_evas_object_smart_del(Eo *obj, Elm_Glview_Data *sd)
evas_obj_smart_del(eo_super(obj, MY_CLASS));
}
+static Eina_Bool
+_cb_added(void *data EINA_UNUSED, const Eo_Event *ev)
+{
+ const Eo_Callback_Array_Item *event = ev->event_info;
+
+ ELM_GLVIEW_DATA_GET(ev->obj, sd);
+
+ if (event->desc == ELM_GLVIEW_EVENT_CREATED)
+ {
+ sd->initialized = EINA_FALSE;
+ }
+ else if (event->desc == ELM_GLVIEW_EVENT_RENDER)
+ {
+ _set_render_policy_callback(ev->obj);
+ }
+
+ return EO_CALLBACK_CONTINUE;
+}
+
EAPI Evas_Object *
elm_glview_add(Evas_Object *parent)
{
@@ -321,6 +348,7 @@ _elm_glview_version_constructor(Eo *obj, Elm_Glview_Data *sd,
evas_obj_type_set(obj, MY_CLASS_NAME_LEGACY);
evas_obj_smart_callbacks_descriptions_set(obj, _smart_callbacks);
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_ANIMATION);
+ eo_event_callback_add(obj, EO_BASE_EVENT_CALLBACK_ADD, _cb_added, NULL);
}
EOLIAN static Eo *
@@ -483,32 +511,6 @@ _elm_glview_efl_gfx_view_view_size_get(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd,
}
EOLIAN static void
-_elm_glview_init_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
-{
- sd->initialized = EINA_FALSE;
- sd->init_func = func;
-}
-
-EOLIAN static void
-_elm_glview_del_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
-{
- sd->del_func = func;
-}
-
-EOLIAN static void
-_elm_glview_resize_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
-{
- sd->resize_func = func;
-}
-
-EOLIAN static void
-_elm_glview_render_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
-{
- sd->render_func = func;
- _set_render_policy_callback(obj);
-}
-
-EOLIAN static void
_elm_glview_draw_request(Eo *obj, Elm_Glview_Data *sd)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
@@ -539,8 +541,7 @@ _elm_glview_class_constructor(Eo_Class *klass)
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
}
-/* Legacy wrappers */
-
+/* Legacy deprecated functions */
EAPI void
elm_glview_changed_set(Evas_Object *obj)
{
@@ -560,4 +561,42 @@ elm_glview_size_set(Elm_Glview *obj, int w, int h)
{
efl_gfx_view_size_set(obj, w, h);
}
+
+EAPI void
+elm_glview_init_func_set(Elm_Glview *obj, Elm_GLView_Func_Cb func)
+{
+ ELM_GLVIEW_CHECK(obj);
+ ELM_GLVIEW_DATA_GET(obj, sd);
+
+ sd->initialized = EINA_FALSE;
+ sd->init_func = func;
+}
+
+EAPI void
+elm_glview_del_func_set(Elm_Glview *obj, Elm_GLView_Func_Cb func)
+{
+ ELM_GLVIEW_CHECK(obj);
+ ELM_GLVIEW_DATA_GET(obj, sd);
+
+ sd->del_func = func;
+}
+
+EAPI void
+elm_glview_resize_func_set(Elm_Glview *obj, Elm_GLView_Func_Cb func)
+{
+ ELM_GLVIEW_CHECK(obj);
+ ELM_GLVIEW_DATA_GET(obj, sd);
+
+ sd->resize_func = func;
+}
+
+EAPI void
+elm_glview_render_func_set(Elm_Glview *obj, Elm_GLView_Func_Cb func)
+{
+ ELM_GLVIEW_CHECK(obj);
+ ELM_GLVIEW_DATA_GET(obj, sd);
+
+ sd->render_func = func;
+ _set_render_policy_callback(obj);
+}
#include "elm_glview.eo.c"
diff --git a/src/lib/elm_glview.eo b/src/lib/elm_glview.eo
index 7548a824d..42c4c0164 100644
--- a/src/lib/elm_glview.eo
+++ b/src/lib/elm_glview.eo
@@ -104,48 +104,6 @@ class Elm.Glview (Elm.Widget, Efl.Gfx.View)
policy: Elm.GLView.Resize.Policy; [[The scaling policy.]]
}
}
- @property resize_func {
- set {
- [[Set the resize function that gets called when resize happens.
-
- The resize function gets called during the render loop.
- This function allows glview to hide all the rendering
- context/surface details and have the user just call GL
- alls that they desire when resize happens.
- ]]
- }
- values {
- func: Elm_GLView_Func_Cb; [[The resize function to be registered.]]
- }
- }
- @property del_func {
- set {
- [[Set the render function that runs in the main loop.
-
- The registered del function gets called when GLView object
- is deleted. This function allows glview to hide all the
- rendering context/surface details and have the user just
- call GL calls that they desire when delete happens.
- ]]
- }
- values {
- func: Elm_GLView_Func_Cb @nullable; [[The delete function to be registered.]]
- }
- }
- @property init_func {
- set {
- [[Set the init function that runs once in the main loop.
-
- The registered init function gets called once during the
- render loop. This function allows glview to hide all the
- rendering context/surface details and have the user just
- call GL calls that they desire for initialization GL calls.
- ]]
- }
- values {
- func: Elm_GLView_Func_Cb @nullable; [[The init function to be registered.]]
- }
- }
@property render_policy {
set {
[[Set the render policy for the glview object.
@@ -179,19 +137,6 @@ class Elm.Glview (Elm.Widget, Efl.Gfx.View)
mode: Elm.GLView.Mode; [[The mode Options OR'ed enabling Alpha, Depth, Stencil, Direct.]]
}
}
- @property render_func {
- set {
- [[Set the render function that runs in the main loop.
-
- The render function gets called in the main loop but whether
- it runs depends on the rendering policy and whether
- @.draw_request called.
- ]]
- }
- values {
- func: Elm_GLView_Func_Cb @nullable; [[The render function to be registered.]]
- }
- }
@property gl_api {
get {
[[Get the gl api struct for gl rendering.]]
@@ -241,6 +186,34 @@ class Elm.Glview (Elm.Widget, Efl.Gfx.View)
Efl.Gfx.View.view_size.set;
}
events {
+ created; [[Event dispatched when first render happens.
+
+ The callback function gets called once during the
+ render loop. Callback function allows glview to hide all the
+ rendering context/surface details and have the user just
+ call GL calls that they desire for initialization GL calls.
+ ]]
+ destroyed; [[Event dispatched when GLView object is deleted.
+
+ The registered destroyed function gets called when GLView object
+ is deleted. Callback function allows glview to hide all the
+ rendering context/surface details and have the user just
+ call GL calls that they desire when delete happens.
+ ]]
+ resized; [[Event dispatched when resize happens.
+
+ The resized event callback functions gets called
+ during the render loop. The callback function allows
+ glview to hide all the rendering context/surface
+ details and have the user just call GL alls that
+ they desire when resize happens.
+ ]]
+ render; [[Event dispatched when GLView is rendered.
+
+ The callback function gets called in the main loop but whether
+ it runs depends on the rendering policy and whether
+ @.draw_request gets called.
+ ]]
}
constructors {
.version_constructor;