list: Fixed item focus logic correctly by checking mouse down instead
of highlighted_item. highlighted_item will be NULL after the first click and it is not useful. To avoid first item focus -> first item unfocus -> clicked item focus on the first focus to list widget, this patch is needed. Thanks for the report Ceolin.
This commit is contained in:
parent
b9a1047845
commit
bb4a6d181d
|
@ -1074,7 +1074,7 @@ _elm_list_smart_on_focus(Eo *obj, void *_pd, va_list *list)
|
|||
_elm_list_item_focused((Elm_List_Item *)sd->last_focused_item);
|
||||
else if (sd->last_selected_item)
|
||||
_elm_list_item_focused((Elm_List_Item *)sd->last_selected_item);
|
||||
else if (!sd->highlighted_item)
|
||||
else if (!sd->mouse_down)
|
||||
_elm_list_item_focused((Elm_List_Item *)eina_list_data_get(sd->items));
|
||||
_elm_widget_focus_highlight_start(obj);
|
||||
}
|
||||
|
@ -1152,7 +1152,6 @@ _item_highlight(Elm_List_Item *it)
|
|||
if ((select_raise) && (!strcmp(select_raise, "on")))
|
||||
evas_object_raise(VIEW(it));
|
||||
it->highlighted = EINA_TRUE;
|
||||
sd->highlighted_item = (Elm_Object_Item *)it;
|
||||
_elm_list_unwalk(obj, sd);
|
||||
evas_object_unref(obj);
|
||||
}
|
||||
|
@ -1219,7 +1218,6 @@ _item_unhighlight(Elm_List_Item *it)
|
|||
}
|
||||
it->highlighted = EINA_FALSE;
|
||||
|
||||
sd->highlighted_item = NULL;
|
||||
_elm_list_unwalk(obj, sd);
|
||||
evas_object_unref(obj);
|
||||
}
|
||||
|
@ -1405,6 +1403,7 @@ _mouse_down_cb(void *data,
|
|||
else sd->on_hold = EINA_FALSE;
|
||||
|
||||
if (sd->on_hold) return;
|
||||
sd->mouse_down = EINA_TRUE;
|
||||
sd->was_selected = it->selected;
|
||||
|
||||
evas_object_ref(obj);
|
||||
|
@ -1448,6 +1447,8 @@ _mouse_up_cb(void *data,
|
|||
if (ev->button != 1) return;
|
||||
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) sd->on_hold = EINA_TRUE;
|
||||
else sd->on_hold = EINA_FALSE;
|
||||
|
||||
sd->mouse_down = EINA_FALSE;
|
||||
sd->longpressed = EINA_FALSE;
|
||||
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
|
||||
ELM_SAFE_FREE(it->swipe_timer, ecore_timer_del);
|
||||
|
|
|
@ -43,8 +43,6 @@ struct _Elm_List_Smart_Data
|
|||
Evas_Coord x, y;
|
||||
} history[ELM_LIST_SWIPE_MOVES];
|
||||
|
||||
Elm_Object_Item *highlighted_item;
|
||||
|
||||
Eina_Bool focus_on_selection_enabled : 1;
|
||||
Eina_Bool was_selected : 1;
|
||||
Eina_Bool fix_pending : 1;
|
||||
|
@ -55,6 +53,7 @@ struct _Elm_List_Smart_Data
|
|||
Eina_Bool multi : 1;
|
||||
Eina_Bool swipe : 1;
|
||||
Eina_Bool delete_me : 1;
|
||||
Eina_Bool mouse_down : 1; /**< a flag that mouse is down on the list at the moment. this flag is set to true on mouse and reset to false on mouse up */
|
||||
};
|
||||
|
||||
typedef struct _Elm_List_Item Elm_List_Item;
|
||||
|
|
Loading…
Reference in New Issue