From b76a8a7e9e62e223378e7d4c7cf462851f8d80e4 Mon Sep 17 00:00:00 2001 From: xhell Date: Tue, 6 Mar 2012 23:56:02 +0000 Subject: [PATCH] elementary/elm_photocam: change api name and add 'do_gesture' variable git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68859 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/test_photocam.c | 2 +- src/lib/elm_photocam.c | 14 ++++++++------ src/lib/elm_photocam.h | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/bin/test_photocam.c b/src/bin/test_photocam.c index 626ed06..1b47915 100644 --- a/src/bin/test_photocam.c +++ b/src/bin/test_photocam.c @@ -176,7 +176,7 @@ my_bt_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUS static void my_bt_gesture(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { - elm_photocam_gesture_set(data, !elm_photocam_gesture_get(data)); + elm_photocam_gesture_enabled_set(data, !elm_photocam_gesture_enabled_get(data)); } static void diff --git a/src/lib/elm_photocam.c b/src/lib/elm_photocam.c index 4f8a65e..c077f04 100644 --- a/src/lib/elm_photocam.c +++ b/src/lib/elm_photocam.c @@ -98,6 +98,7 @@ struct _Widget_Data Eina_Bool on_hold : 1; Eina_Bool paused : 1; Eina_Bool do_region : 1; + Eina_Bool do_gesture : 1; Eina_Bool zoom_gest : 1; }; @@ -1925,12 +1926,12 @@ elm_photocam_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool * } EAPI void -elm_photocam_gesture_set(Evas_Object *obj, Eina_Bool gesture) +elm_photocam_gesture_enabled_set(Evas_Object *obj, Eina_Bool gesture) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - if ((wd->gest && !!gesture) || (!wd->gest && !gesture)) return; + if (wd->do_gesture == !!gesture) return; if (wd->gest) { @@ -1941,6 +1942,7 @@ elm_photocam_gesture_set(Evas_Object *obj, Eina_Bool gesture) if (gesture) { wd->gest = elm_gesture_layer_add(wd->obj); + if (!wd->gest) return; elm_gesture_layer_attach(wd->gest, wd->obj); elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_START, _gzoom_start, wd); @@ -1951,16 +1953,16 @@ elm_photocam_gesture_set(Evas_Object *obj, Eina_Bool gesture) elm_gesture_layer_cb_set(wd->gest, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_ABORT, _gzoom_end, wd); } + + wd->do_gesture = !!gesture; } EAPI Eina_Bool -elm_photocam_gesture_get(const Evas_Object *obj) +elm_photocam_gesture_enabled_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return EINA_FALSE; - if (wd->gest) - return EINA_TRUE; - return EINA_FALSE; + return wd->do_gesture; } diff --git a/src/lib/elm_photocam.h b/src/lib/elm_photocam.h index d7e0494..9043f7c 100644 --- a/src/lib/elm_photocam.h +++ b/src/lib/elm_photocam.h @@ -263,7 +263,7 @@ EAPI void elm_photocam_bounce_get(const Evas_Object *obj, Eina * This sets the gesture state to on(EINA_TRUE) or off (EINA_FALSE) for * photocam. The default is off. This will start multi touch zooming. */ -EAPI void elm_photocam_gesture_set(Evas_Object *obj, Eina_Bool gesture); +EAPI void elm_photocam_gesture_enabled_set(Evas_Object *obj, Eina_Bool gesture); /** * @brief Get the gesture state for photocam. @@ -273,9 +273,9 @@ EAPI void elm_photocam_gesture_set(Evas_Object *obj, Eina_Bool gesture); * * This gets the current gesture state for the photocam object. * - * @see elm_photocam_gesture_set() + * @see elm_photocam_gesture_enabled_set() */ -EAPI Eina_Bool elm_photocam_gesture_get(const Evas_Object *obj); +EAPI Eina_Bool elm_photocam_gesture_enabled_get(const Evas_Object *obj); /** * @} */ -- 2.7.4