From: hermet Date: Fri, 24 Feb 2012 12:21:22 +0000 (+0000) Subject: elementary/gesture_layer - reviewed done. X-Git-Tag: REL_F_I9500_20120323_1~17^2~536 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a08497035b6f6268ff6e62fe7119e6369ebbbb37;p=framework%2Fuifw%2Felementary.git elementary/gesture_layer - reviewed done. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68408 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index c244680..ccf54b1 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -203,7 +203,7 @@ EAPI extern Elm_Version *elm_version; #include //Done + XXX in header #include #include -#include +#include //Done #include #include //Done diff --git a/src/lib/elm_gesture_layer.c b/src/lib/elm_gesture_layer.c index f4fd0f1..61eb2e2 100644 --- a/src/lib/elm_gesture_layer.c +++ b/src/lib/elm_gesture_layer.c @@ -646,10 +646,14 @@ _n_long_tap_test_reset(Gesture_Info *gesture) Eina_List *l; Pointer_Event *p; EINA_LIST_FOREACH(st->touched, l, p) - free(p); + free(p); eina_list_free(st->touched); - if (st->timeout) ecore_timer_del(st->timeout); + if (st->timeout) + { + ecore_timer_del(st->timeout); + st->timeout = NULL; + } memset(gesture->data, 0, sizeof(Long_Tap_Type)); } @@ -913,7 +917,7 @@ _event_history_clear(Evas_Object *obj) Gesture_Info *p; Evas *e = evas_object_evas_get(obj); Eina_Bool gesture_found = EINA_FALSE; - for (i = ELM_GESTURE_FIRST ; i < ELM_GESTURE_LAST; i++) + for (i = ELM_GESTURE_FIRST; i < ELM_GESTURE_LAST; i++) { p = wd->gesture[i]; if (p) @@ -1119,7 +1123,6 @@ compare_pe_device(const void *data1, const void *data2) (pe1->event_type != EVAS_CALLBACK_MOUSE_DOWN)) return 1; - if (pe1->device == pe2->device) return 0; else if (pe1->device < pe2->device) @@ -2973,7 +2976,7 @@ _rotate_test(Evas_Object *obj, Pointer_Event *pe, void *event_info, if (rotation_broke_tolerance(st)) { /* Rotation broke tolerance, report move */ double d = st->info.angle - st->next_step; - if (d < 0.0) + if (d < 0) d = (-d); if (d >= wd->rotate_step) @@ -3200,7 +3203,6 @@ _event_process(void *data, Evas_Object *obj __UNUSED__, Pointer_Event _pe; Pointer_Event *pe = NULL; Widget_Data *wd = elm_widget_data_get(data); - if (!wd) return; #if defined(DEBUG_GESTURE_LAYER) int i; @@ -3384,7 +3386,7 @@ _multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, } EAPI Eina_Bool -elm_gesture_layer_hold_events_get(Evas_Object *obj) +elm_gesture_layer_hold_events_get(const Evas_Object *obj) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; @@ -3395,60 +3397,79 @@ elm_gesture_layer_hold_events_get(Evas_Object *obj) } EAPI void -elm_gesture_layer_hold_events_set(Evas_Object *obj, Eina_Bool r) +elm_gesture_layer_hold_events_set(Evas_Object *obj, Eina_Bool hold_events) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - wd->repeat_events = !r; + wd->repeat_events = !(!!hold_events); +} + +EAPI double +elm_gesture_layer_zoom_step_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; + + return wd->zoom_step; } EAPI void -elm_gesture_layer_zoom_step_set(Evas_Object *obj, double s) +elm_gesture_layer_zoom_step_set(Evas_Object *obj, double step) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - if (s < 0.0) - return; + if (step < 0) return; + + wd->zoom_step = step; +} + +EAPI double +elm_gesture_layer_rotate_step_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) 0; + + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return 0; - wd->zoom_step = s; + return wd->rotate_step; } EAPI void -elm_gesture_layer_rotate_step_set(Evas_Object *obj, double s) +elm_gesture_layer_rotate_step_set(Evas_Object *obj, double step) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return; - if (s < 0.0) - return; + if (step < 0) return; - wd->rotate_step = s; + wd->rotate_step = step; } EAPI Eina_Bool -elm_gesture_layer_attach(Evas_Object *obj, Evas_Object *t) +elm_gesture_layer_attach(Evas_Object *obj, Evas_Object *target) { ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); if (!wd) return EINA_FALSE; - if (!t) - return EINA_FALSE; + if (!target) return EINA_FALSE; /* if was attached before, unregister callbacks first */ if (wd->target) _unregister_callbacks(obj); - wd->target = t; + wd->target = target; _register_callbacks(obj); return EINA_TRUE; diff --git a/src/lib/elm_gesture_layer.h b/src/lib/elm_gesture_layer.h index 52ea7f1..eb14897 100644 --- a/src/lib/elm_gesture_layer.h +++ b/src/lib/elm_gesture_layer.h @@ -229,7 +229,7 @@ typedef Evas_Event_Flags (*Elm_Gesture_Event_Cb)(void *data, void *event_info); * it means user isn't interested in gesture-state * and it will not be tested. * - * @param obj Pointer to gesture-layer. + * @param obj gesture-layer. * @param idx The gesture you would like to track its state. * @param cb callback function pointer. * @param cb_type what event this callback tracks: START, MOVE, END, ABORT. @@ -242,60 +242,83 @@ EAPI void elm_gesture_layer_cb_set(Evas_Object *obj, Elm_Gesture_Type id /** * Call this function to get repeat-events settings. * - * @param obj Pointer to gesture-layer. + * @param obj gesture-layer. * * @return repeat events settings. * @see elm_gesture_layer_hold_events_set() * @ingroup Elm_Gesture_Layer */ -EAPI Eina_Bool elm_gesture_layer_hold_events_get(Evas_Object *obj); +EAPI Eina_Bool elm_gesture_layer_hold_events_get(const Evas_Object *obj); /** - * This function called in order to make gesture-layer repeat events. - * Set this of you like to get the raw events only if gestures were not detected. - * Clear this if you like gesture layer to fwd events as testing gestures. + * This function is to make gesture-layer repeat events. + * Set this if you like to get the raw events only if gestures were not + * detected. + * Clear this if you like gesture layer to forward events as testing gestures. * - * @param obj Pointer to gesture-layer. - * @param r Repeat: TRUE/FALSE + * @param obj gesture layer. + * @param hold_events hold events or not. * * @ingroup Elm_Gesture_Layer */ -EAPI void elm_gesture_layer_hold_events_set(Evas_Object *obj, Eina_Bool r); +EAPI void elm_gesture_layer_hold_events_set(Evas_Object *obj, Eina_Bool hold_events); /** * This function sets step-value for zoom action. * Set step to any positive value. - * Cancel step setting by setting to 0.0 + * Cancel step setting by setting to 0 * - * @param obj Pointer to gesture-layer. - * @param s new zoom step value. + * @param obj gesture-layer. + * @param step new zoom step value. * + * @see elm_gesture_layer_zoom_step_get() * @ingroup Elm_Gesture_Layer */ -EAPI void elm_gesture_layer_zoom_step_set(Evas_Object *obj, double s); +EAPI void elm_gesture_layer_zoom_step_set(Evas_Object *obj, double step); + +/** + * This function returns step-value for zoom action. + * + * @param obj gesture-layer. + * @return zoom step value. + * + * @see elm_gesture_layer_zoom_step_set() + * @ingroup Elm_Gesture_Layer + */ +EAPI double elm_gesture_layer_zoom_step_get(const Evas_Object *obj); /** * This function sets step-value for rotate action. * Set step to any positive value. - * Cancel step setting by setting to 0.0 + * Cancel step setting by setting to 0 + * + * @param obj gesture-layer. + * @param step new rotate step value. + * + * @ingroup Elm_Gesture_Layer + */ +EAPI void elm_gesture_layer_rotate_step_set(Evas_Object *obj, double step); + +/** + * This function returns step-value for rotate action. * - * @param obj Pointer to gesture-layer. - * @param s new rotate step value. + * @param obj gesture-layer. + * @return rotate step value. * * @ingroup Elm_Gesture_Layer */ -EAPI void elm_gesture_layer_rotate_step_set(Evas_Object *obj, double s); +EAPI double elm_gesture_layer_rotate_step_get(const Evas_Object *obj); /** * This function called to attach gesture-layer to an Evas_Object. - * @param obj Pointer to gesture-layer. - * @param t Pointer to underlying object (AKA Target) + * @param obj gesture-layer. + * @param target Pointer to underlying object (AKA Target) * * @return TRUE, FALSE on success, failure. * * @ingroup Elm_Gesture_Layer */ -EAPI Eina_Bool elm_gesture_layer_attach(Evas_Object *obj, Evas_Object *t); +EAPI Eina_Bool elm_gesture_layer_attach(Evas_Object *obj, Evas_Object *target); /** * Call this function to construct a new gesture-layer object. @@ -304,7 +327,7 @@ EAPI Eina_Bool elm_gesture_layer_attach(Evas_Object *obj, Evas_Object *t); * * @param parent the parent object. * - * @return Pointer to new gesture-layer object. + * @return new gesture-layer object. * * @ingroup Elm_Gesture_Layer */