mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 02:30:35 +00:00
(GLUI) Fix the menu entry being selected while we try to scroll
This commit is contained in:
parent
199d7b63a1
commit
130e3a77d8
@ -1898,48 +1898,6 @@ static size_t mui_list_get_selection(void *data)
|
||||
return mui->categories.selection_ptr;
|
||||
}
|
||||
|
||||
static int mui_pointer_down(void *userdata,
|
||||
unsigned x, unsigned y,
|
||||
unsigned ptr, menu_file_list_cbs_t *cbs,
|
||||
menu_entry_t *entry, unsigned action)
|
||||
{
|
||||
unsigned width, height;
|
||||
unsigned header_height, i;
|
||||
mui_handle_t *mui = (mui_handle_t*)userdata;
|
||||
|
||||
if (!mui)
|
||||
return 0;
|
||||
|
||||
header_height = menu_display_get_header_height();
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
if (y < header_height)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else if (y > height - mui->tabs_height)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else if (ptr <= (menu_entries_get_size() - 1))
|
||||
{
|
||||
size_t ii = 0;
|
||||
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
|
||||
for (ii = 0; ii < menu_entries_get_size(); ii++)
|
||||
{
|
||||
mui_node_t *node = (mui_node_t*)
|
||||
menu_entries_get_userdata_at_offset(list, ii);
|
||||
|
||||
if (y > (-mui->scroll_y + header_height + node->y)
|
||||
&& y < (-mui->scroll_y + header_height + node->y + node->line_height)
|
||||
)
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &ii);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mui_pointer_up(void *userdata,
|
||||
unsigned x, unsigned y,
|
||||
unsigned ptr, menu_file_list_cbs_t *cbs,
|
||||
@ -1985,11 +1943,24 @@ static int mui_pointer_up(void *userdata,
|
||||
}
|
||||
else if (ptr <= (menu_entries_get_size() - 1))
|
||||
{
|
||||
size_t idx;
|
||||
bool scroll = false;
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
||||
if (ptr == selection && cbs && cbs->action_select)
|
||||
return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_SELECT);
|
||||
size_t ii = 0;
|
||||
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
|
||||
for (ii = 0; ii < menu_entries_get_size(); ii++)
|
||||
{
|
||||
mui_node_t *node = (mui_node_t*)
|
||||
menu_entries_get_userdata_at_offset(list, ii);
|
||||
|
||||
if (y > (-mui->scroll_y + header_height + node->y)
|
||||
&& y < (-mui->scroll_y + header_height + node->y + node->line_height)
|
||||
)
|
||||
{
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &ii);
|
||||
if (ptr == ii && cbs && cbs->action_select)
|
||||
return menu_entry_action(entry, (unsigned)ii, MENU_ACTION_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -2099,6 +2070,6 @@ menu_ctx_driver_t menu_ctx_mui = {
|
||||
mui_osk_ptr_at_pos,
|
||||
NULL,
|
||||
NULL,
|
||||
mui_pointer_down,
|
||||
NULL,
|
||||
mui_pointer_up,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user