elementary/elm_widget : Focus should be moved by "clicked" not by
authorwoohyun <woohyun@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 31 Oct 2011 08:26:12 +0000 (08:26 +0000)
committerwoohyun <woohyun@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 31 Oct 2011 08:26:12 +0000 (08:26 +0000)
"mouse_up". So modified about this.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@64548 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/elm_widget.c

index 92dbc78..c3fe93b 100644 (file)
@@ -114,6 +114,7 @@ struct _Smart_Data
    Eina_Bool    disabled : 1;
    Eina_Bool    is_mirrored : 1;
    Eina_Bool    mirrored_auto_mode : 1;   /* This is TRUE by default */
+   Eina_Bool    still_in : 1;
 
    Eina_List   *focus_chain;
    Eina_List   *event_cb;
@@ -244,14 +245,50 @@ _sub_obj_hide(void        *data __UNUSED__,
 }
 
 static void
-_sub_obj_mouse_up(void        *data __UNUSED__,
+_sub_obj_mouse_down(void        *data,
+                    Evas        *e __UNUSED__,
+                    Evas_Object *obj __UNUSED__,
+                    void        *event_info)
+{
+   Smart_Data *sd = data;
+   Evas_Event_Mouse_Down *ev = event_info;
+   if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
+          sd->still_in = 1;
+}
+
+static void
+_sub_obj_mouse_move(void        *data,
+                    Evas        *e __UNUSED__,
+                    Evas_Object *obj,
+                    void        *event_info)
+{
+   Smart_Data *sd = data;
+   Evas_Event_Mouse_Move *ev = event_info;
+   if (sd->still_in)
+     {
+        if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+          sd->still_in = 0;
+        else
+          {
+             Evas_Coord x, y, w, h;
+             evas_object_geometry_get(obj, &x, &y, &w, &h);
+             if ((ev->cur.canvas.x < x) || (ev->cur.canvas.y < y) ||
+                 (ev->cur.canvas.x >= (x + w)) || (ev->cur.canvas.y >= (y + h)))
+               sd->still_in = 0;
+          }
+     }
+}
+
+static void
+_sub_obj_mouse_up(void        *data,
                   Evas        *e __UNUSED__,
                   Evas_Object *obj,
-                  void        *event_info)
+                  void        *event_info __UNUSED__)
 {
-   Evas_Event_Mouse_Up *ev = event_info;
-   if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
-      elm_widget_focus_mouse_up_handle(obj);
+   Smart_Data *sd = data;
+   if (sd->still_in)
+     elm_widget_focus_mouse_up_handle(obj);
+   sd->still_in = 0;
 }
 
 static void
@@ -1002,6 +1039,10 @@ elm_widget_resize_object_set(Evas_Object *obj,
           }
         evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_DEL,
                                             _sub_obj_del, sd);
+        evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_DOWN,
+                                            _sub_obj_mouse_down, sd);
+        evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_MOVE,
+                                            _sub_obj_mouse_move, sd);
         evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_UP,
                                             _sub_obj_mouse_up, sd);
         evas_object_smart_member_del(sd->resize_obj);
@@ -1025,6 +1066,10 @@ elm_widget_resize_object_set(Evas_Object *obj,
      }
    evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_DEL,
                                        _sub_obj_del, sd);
+   evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_DOWN,
+                                       _sub_obj_mouse_down, sd);
+   evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_MOVE,
+                                       _sub_obj_mouse_move, sd);
    evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_UP,
                                        _sub_obj_mouse_up, sd);
    evas_object_smart_member_del(sobj);
@@ -1049,6 +1094,10 @@ elm_widget_resize_object_set(Evas_Object *obj,
    evas_object_smart_member_add(sobj, obj);
    evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL,
                                   _sub_obj_del, sd);
+   evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_DOWN,
+                                  _sub_obj_mouse_down, sd);
+   evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_MOVE,
+                                  _sub_obj_mouse_move, sd);
    evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_UP,
                                   _sub_obj_mouse_up, sd);
    _smart_reconfigure(sd);