elementary: make sure that our index for the maximum number of object is actually unsigned int bound.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D10927
This commit is contained in:
parent
6756485476
commit
4624b56bed
|
@ -1208,8 +1208,9 @@ _efl_ui_collection_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, Efl_
|
||||||
|
|
||||||
if (ITEM_IS_OUTSIDE_VISIBLE(item_id))
|
if (ITEM_IS_OUTSIDE_VISIBLE(item_id))
|
||||||
{
|
{
|
||||||
int new_id = efl_ui_position_manager_entity_relative_item(collection_pd->pos_man, efl_ui_item_index_get(item), direction);
|
unsigned int new_id;
|
||||||
if (new_id == -1)
|
|
||||||
|
if (!efl_ui_position_manager_entity_relative_item(collection_pd->pos_man, efl_ui_item_index_get(item), direction, &new_id))
|
||||||
{
|
{
|
||||||
new_item = NULL;
|
new_item = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2430,12 +2430,12 @@ _efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj,
|
||||||
|
|
||||||
if (ITEM_IS_OUTSIDE_VISIBLE(item_id))
|
if (ITEM_IS_OUTSIDE_VISIBLE(item_id))
|
||||||
{
|
{
|
||||||
int new_id;
|
unsigned int new_id;
|
||||||
|
|
||||||
new_id = efl_ui_position_manager_entity_relative_item(cpd->manager,
|
if (!efl_ui_position_manager_entity_relative_item(cpd->manager,
|
||||||
item_id,
|
item_id,
|
||||||
direction);
|
direction,
|
||||||
if (new_id < 0)
|
&new_id))
|
||||||
{
|
{
|
||||||
new_item = NULL;
|
new_item = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,8 +107,9 @@ interface @beta Efl.Ui.Position_Manager.Entity extends Efl.Ui.Layout_Orientable
|
||||||
params {
|
params {
|
||||||
current_id : uint; [[The id where the direction is oriented at]]
|
current_id : uint; [[The id where the direction is oriented at]]
|
||||||
direction : Efl.Ui.Focus.Direction; [[The direction where the new id is]]
|
direction : Efl.Ui.Focus.Direction; [[The direction where the new id is]]
|
||||||
|
@out index: uint; [[The relative item index after the translation has been applied.]]
|
||||||
}
|
}
|
||||||
return : int; [[The id of the item in that direction, or -1 if there is no item in that direction]]
|
return : bool; [[$true if there is a next item, $false otherwise.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
events {
|
events {
|
||||||
|
|
|
@ -738,19 +738,20 @@ _efl_ui_position_manager_grid_efl_ui_position_manager_entity_position_single_ite
|
||||||
return geom;
|
return geom;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static int
|
EOLIAN static Eina_Bool
|
||||||
_efl_ui_position_manager_grid_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction)
|
_efl_ui_position_manager_grid_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction, unsigned int *index)
|
||||||
{
|
{
|
||||||
int new_id = current_id;
|
|
||||||
switch(direction)
|
switch(direction)
|
||||||
{
|
{
|
||||||
case EFL_UI_FOCUS_DIRECTION_RIGHT:
|
case EFL_UI_FOCUS_DIRECTION_RIGHT:
|
||||||
case EFL_UI_FOCUS_DIRECTION_NEXT:
|
case EFL_UI_FOCUS_DIRECTION_NEXT:
|
||||||
new_id += 1;
|
if (current_id + 1 >= pd->size) return EINA_FALSE;
|
||||||
|
current_id += 1;
|
||||||
break;
|
break;
|
||||||
case EFL_UI_FOCUS_DIRECTION_LEFT:
|
case EFL_UI_FOCUS_DIRECTION_LEFT:
|
||||||
case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
|
case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
|
||||||
new_id -= 1;
|
if (current_id == 0) return EINA_FALSE;
|
||||||
|
current_id -= 1;
|
||||||
break;
|
break;
|
||||||
case EFL_UI_FOCUS_DIRECTION_UP:
|
case EFL_UI_FOCUS_DIRECTION_UP:
|
||||||
//FIXME
|
//FIXME
|
||||||
|
@ -759,14 +760,12 @@ _efl_ui_position_manager_grid_efl_ui_position_manager_entity_relative_item(Eo *o
|
||||||
//FIXME
|
//FIXME
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
new_id = -1;
|
|
||||||
ERR("Uncaught case!");
|
ERR("Uncaught case!");
|
||||||
break;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
if (new_id < 0 || new_id > (int)pd->size)
|
|
||||||
return -1;
|
if (index) *index = current_id;
|
||||||
else
|
return EINA_TRUE;
|
||||||
return new_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static int
|
EOLIAN static int
|
||||||
|
|
|
@ -520,31 +520,30 @@ _efl_ui_position_manager_list_efl_object_invalidate(Eo *obj, Efl_Ui_Position_Man
|
||||||
efl_invalidate(efl_super(obj, MY_CLASS));
|
efl_invalidate(efl_super(obj, MY_CLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static int
|
EOLIAN static Eina_Bool
|
||||||
_efl_ui_position_manager_list_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction)
|
_efl_ui_position_manager_list_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction, unsigned int *index)
|
||||||
{
|
{
|
||||||
int new_id = current_id;
|
|
||||||
switch(direction)
|
switch(direction)
|
||||||
{
|
{
|
||||||
case EFL_UI_FOCUS_DIRECTION_RIGHT:
|
case EFL_UI_FOCUS_DIRECTION_RIGHT:
|
||||||
case EFL_UI_FOCUS_DIRECTION_NEXT:
|
case EFL_UI_FOCUS_DIRECTION_NEXT:
|
||||||
case EFL_UI_FOCUS_DIRECTION_DOWN:
|
case EFL_UI_FOCUS_DIRECTION_DOWN:
|
||||||
new_id += 1;
|
if (current_id + 1 >= pd->size) return EINA_FALSE;
|
||||||
|
current_id += 1;
|
||||||
break;
|
break;
|
||||||
case EFL_UI_FOCUS_DIRECTION_LEFT:
|
case EFL_UI_FOCUS_DIRECTION_LEFT:
|
||||||
case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
|
case EFL_UI_FOCUS_DIRECTION_PREVIOUS:
|
||||||
case EFL_UI_FOCUS_DIRECTION_UP:
|
case EFL_UI_FOCUS_DIRECTION_UP:
|
||||||
new_id -= 1;
|
if (current_id == 0) return EINA_FALSE;
|
||||||
|
current_id -= 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERR("Uncaught case!");
|
ERR("Uncaught case!");
|
||||||
new_id = -1;
|
return EINA_FALSE;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (new_id < 0 || new_id > (int)pd->size)
|
|
||||||
return -1;
|
if (index) *index = current_id;
|
||||||
else
|
return EINA_TRUE;
|
||||||
return new_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static int
|
EOLIAN static int
|
||||||
|
|
Loading…
Reference in New Issue