hermet pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=a30fcf41ee3ec74efdc13621bb13937c060b86a6

commit a30fcf41ee3ec74efdc13621bb13937c060b86a6
Author: ChunEon Park <[email protected]>
Date:   Thu Feb 20 20:44:19 2014 +0900

    tooltip - renamed the new tooltip apis until 1.9 release.
    
    Before
    elm_tooltip_move_lock_set()
    elm_tooltip_move_lock_get()
    
    After
    elm_tooltip_move_freeze_push()
    elm_tooltip_move_freeze_pop()
    elm_tooltip_move_freeze_get()
    
    we're likely to use the freeze rather than lock among the entire apis.
    it's already discussed in the mailing list.
---
 src/bin/test_tooltip.c | 14 +++++++-------
 src/lib/elm_tooltip.h  | 40 +++++++++++++++++++++++-----------------
 src/lib/els_tooltip.c  | 27 +++++++++++++++++++--------
 3 files changed, 49 insertions(+), 32 deletions(-)

diff --git a/src/bin/test_tooltip.c b/src/bin/test_tooltip.c
index d5ac0af..82c0465 100644
--- a/src/bin/test_tooltip.c
+++ b/src/bin/test_tooltip.c
@@ -200,18 +200,18 @@ _tt_text_replace(void *data       EINA_UNUSED,
 }
 
 static void
-_tt_move_lock(void *data       EINA_UNUSED,
+_tt_move_freeze(void *data       EINA_UNUSED,
               Evas_Object     *obj,
               void *event_info EINA_UNUSED)
 {
-   if (!elm_tooltip_move_lock_get(obj))
+   if (elm_tooltip_move_freeze_get(obj) == 0)
      {
-        elm_tooltip_move_lock_set(obj, EINA_TRUE);
-        elm_object_tooltip_text_set(obj, "Locked");
+        elm_tooltip_move_freeze_push(obj);
+        elm_object_tooltip_text_set(obj, "Fronzen");
      }
    else
      {
-        elm_tooltip_move_lock_set(obj, EINA_FALSE);
+        elm_tooltip_move_freeze_pop(obj);
         elm_object_tooltip_text_set(obj, "Free");
      }
 }
@@ -506,9 +506,9 @@ test_tooltip(void *data       EINA_UNUSED,
    evas_object_show(bt);
 
    bt = elm_button_add(win);
-   elm_object_text_set(bt, "Movement Lock Tooltip, click to change");
+   elm_object_text_set(bt, "Movement Freeze Tooltip, click to change");
    elm_object_tooltip_text_set(bt, "Free");
-   evas_object_smart_callback_add(bt, "clicked", _tt_move_lock, NULL);
+   evas_object_smart_callback_add(bt, "clicked", _tt_move_freeze, NULL);
    elm_box_pack_end(bx, bt);
    evas_object_show(bt);
 
diff --git a/src/lib/elm_tooltip.h b/src/lib/elm_tooltip.h
index 3b1c76a..f6ffb2d 100644
--- a/src/lib/elm_tooltip.h
+++ b/src/lib/elm_tooltip.h
@@ -33,36 +33,42 @@ typedef enum
  } Elm_Tooltip_Orient;
 
 /**
- * @def elm_tooltip_move_lock_set
- * @since 1.9
+ * This increments the tooltip movement freeze count by one. If the count
+ * is more than 0, the tooltip position will be fixed.
  *
- * @brief Enable/Disable tooltip movement with respect to mouse pointer
+ * @param obj The tooltip's anchor object
  *
- * @param[in] obj The tooltip's anchor object
- * @param[in] lock If EINA_TRUE, tooltip movement with respect to mouse 
pointer is disabled
+ * @ingroup Tooltips
+ * @see elm_tooltip_move_freeze_pop()
+ * @see elm_tooltio_move_freeze_get()
+ * @since 1.9
+ */
+EAPI void elm_tooltip_move_freeze_push(Evas_Object *obj);
+
+/**
+ * This decrements the tooltip freeze count by one.
  *
- * This function allows to enable/disable a tooltip to move with respect to 
mouse pointer
+ * @param obj The tooltip's anchor object
  *
  * @ingroup Tooltips
- * @see elm_tooltip_move_lock_get
+ * @see elm_tooltip_move_freeze_push()
+ * @since 1.9
  */
-EAPI void elm_tooltip_move_lock_set(Evas_Object *obj, Eina_Bool lock);
+EAPI void elm_tooltip_move_freeze_pop(Evas_Object *obj);
 
 /**
- * @def elm_tooltip_move_lock_get
- * @since 1.9
+ * Get the movement freeze by 1
  *
- * @brief Get the lock status of tooltip movement with respect to mouse pointer
+ * This gets the movement freeze count by one.
  *
- * @param[in] obj The tooltip's anchor object
- * @return The lock status of tooltip movement with respect to mouse pointer
- *
- * This function returns the status of tooltip movement with respect to mouse 
pointer
+ * @param obj The tooltip's anchor object
+ * @return The movement freeze count
  *
  * @ingroup Tooltips
- * @see elm_tooltip_move_lock_set
+ * @see elm_tooltip_move_freeze_push()
+ * @since 1.9
  */
-EAPI Eina_Bool elm_tooltip_move_lock_get(const Evas_Object *obj);
+EAPI int elm_tooltip_move_freeze_get(const Evas_Object *obj);
 
 /**
  * @def elm_object_tooltip_orient_set
diff --git a/src/lib/els_tooltip.c b/src/lib/els_tooltip.c
index dc899a5..cdc7c98 100644
--- a/src/lib/els_tooltip.c
+++ b/src/lib/els_tooltip.c
@@ -57,8 +57,9 @@ struct _Elm_Tooltip
         double                x, y;
      } rel_pos;
    Elm_Tooltip_Orient       orient; /** orientation for tooltip */
+   int                      move_freeze;
+
    double                   hide_timeout; /* from theme */
-   Eina_Bool                move_lock : 1; /* set/reset tooltip movement with 
respect to mouse pointer*/
    Eina_Bool                visible_lock:1;
    Eina_Bool                changed_style:1;
    Eina_Bool                free_size : 1;
@@ -157,7 +158,8 @@ _elm_tooltip_show(Elm_Tooltip *tt)
      (tt->eventarea, EVAS_CALLBACK_MOVE, _elm_tooltip_obj_move_cb, tt);
    evas_object_event_callback_add
      (tt->eventarea, EVAS_CALLBACK_RESIZE, _elm_tooltip_obj_resize_cb, tt);
-   if (!tt->move_lock)
+
+   if (tt->move_freeze == 0)
      {
       //No movement of tooltip upon mouse move if orientation set
       if ((tt->orient <= ELM_TOOLTIP_ORIENT_NONE) || (tt->orient >= 
ELM_TOOLTIP_ORIENT_LAST))
@@ -726,19 +728,28 @@ _elm_tooltip_data_clean(Elm_Tooltip *tt)
 }
 
 EAPI void
-elm_tooltip_move_lock_set(Evas_Object *obj, Eina_Bool lock)
+elm_tooltip_move_freeze_push(Evas_Object *obj)
 {
    ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
 
-   tt->move_lock = lock;
+   tt->move_freeze++;
 }
 
-EAPI Eina_Bool
-elm_tooltip_move_lock_get(const Evas_Object *obj)
+EAPI void
+elm_tooltip_move_freeze_pop(Evas_Object *obj)
 {
-   ELM_TOOLTIP_GET_OR_RETURN(tt, obj, EINA_FALSE);
+   ELM_TOOLTIP_GET_OR_RETURN(tt, obj);
+
+   tt->move_freeze--;
+   if (tt->move_freeze < 0) tt->move_freeze = 0;
+}
+
+EAPI int
+elm_tooltip_move_freeze_get(const Evas_Object *obj)
+{
+   ELM_TOOLTIP_GET_OR_RETURN(tt, obj, 0);
 
-   return tt->move_lock;
+   return tt->move_freeze;
 }
 
 EAPI void

-- 


Reply via email to