Backport pointer_tap changes
This commit is contained in:
parent
9acc7e09dc
commit
1e53e3e19a
|
@ -1426,13 +1426,13 @@ static size_t glui_list_get_selection(void *data)
|
||||||
return glui->categories.selection_ptr;
|
return glui->categories.selection_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int glui_pointer_tap(menu_file_list_cbs_t *cbs,
|
static int glui_pointer_tap(unsigned x, unsigned y,
|
||||||
|
unsigned ptr, menu_file_list_cbs_t *cbs,
|
||||||
menu_entry_t *entry, unsigned action)
|
menu_entry_t *entry, unsigned action)
|
||||||
{
|
{
|
||||||
size_t selection, idx;
|
size_t selection, idx;
|
||||||
unsigned header_height, width, height, i;
|
unsigned header_height, width, height, i;
|
||||||
bool scroll = false;
|
bool scroll = false;
|
||||||
menu_input_t *menu_input = menu_input_get_ptr();
|
|
||||||
menu_handle_t *menu = menu_driver_get_ptr();
|
menu_handle_t *menu = menu_driver_get_ptr();
|
||||||
glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL;
|
glui_handle_t *glui = menu ? (glui_handle_t*)menu->userdata : NULL;
|
||||||
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
||||||
|
@ -1446,20 +1446,19 @@ static int glui_pointer_tap(menu_file_list_cbs_t *cbs,
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
|
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
|
||||||
|
|
||||||
if ((unsigned)menu_input->pointer.start_y < header_height)
|
if (y < header_height)
|
||||||
{
|
{
|
||||||
menu_entries_pop_stack(&selection, 0);
|
menu_entries_pop_stack(&selection, 0);
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
||||||
}
|
}
|
||||||
else if ((unsigned)menu_input->pointer.start_y > height - glui->tabs_height)
|
else if (y > height - glui->tabs_height)
|
||||||
{
|
{
|
||||||
for (i = 0; i <= GLUI_SYSTEM_TAB_END; i++)
|
for (i = 0; i <= GLUI_SYSTEM_TAB_END; i++)
|
||||||
{
|
{
|
||||||
unsigned tab_width = width / (GLUI_SYSTEM_TAB_END + 1);
|
unsigned tab_width = width / (GLUI_SYSTEM_TAB_END + 1);
|
||||||
unsigned start = tab_width * i;
|
unsigned start = tab_width * i;
|
||||||
|
|
||||||
if ((unsigned)menu_input->pointer.start_x >= start &&
|
if ((x >= start) && (x < (start + tab_width)))
|
||||||
(unsigned)menu_input->pointer.start_x < start + tab_width)
|
|
||||||
{
|
{
|
||||||
glui->categories.selection_ptr = i;
|
glui->categories.selection_ptr = i;
|
||||||
|
|
||||||
|
@ -1471,12 +1470,12 @@ static int glui_pointer_tap(menu_file_list_cbs_t *cbs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1))
|
else if (ptr <= (menu_entries_get_size() - 1))
|
||||||
{
|
{
|
||||||
if (menu_input->pointer.ptr == selection && cbs && cbs->action_select)
|
if (ptr == selection && cbs && cbs->action_select)
|
||||||
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
||||||
|
|
||||||
idx = menu_input->pointer.ptr;
|
idx = ptr;
|
||||||
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
||||||
|
|
|
@ -2723,28 +2723,28 @@ static bool xmb_menu_init_list(void *data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xmb_pointer_tap(menu_file_list_cbs_t *cbs,
|
static int xmb_pointer_tap(unsigned x, unsigned y, unsigned ptr,
|
||||||
|
menu_file_list_cbs_t *cbs,
|
||||||
menu_entry_t *entry, unsigned action)
|
menu_entry_t *entry, unsigned action)
|
||||||
{
|
{
|
||||||
size_t selection, idx;
|
size_t selection, idx;
|
||||||
unsigned header_height;
|
unsigned header_height;
|
||||||
bool scroll = false;
|
bool scroll = false;
|
||||||
menu_input_t *menu_input = menu_input_get_ptr();
|
|
||||||
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
||||||
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
|
menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);
|
||||||
|
|
||||||
if ((unsigned)menu_input->pointer.start_y < header_height)
|
if (y < header_height)
|
||||||
{
|
{
|
||||||
menu_entries_pop_stack(&selection, 0);
|
menu_entries_pop_stack(&selection, 0);
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
||||||
}
|
}
|
||||||
else if (menu_input->pointer.ptr <= (menu_entries_get_size() - 1))
|
else if (ptr <= (menu_entries_get_size() - 1))
|
||||||
{
|
{
|
||||||
if (menu_input->pointer.ptr == selection && cbs && cbs->action_select)
|
if (ptr == selection && cbs && cbs->action_select)
|
||||||
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
||||||
|
|
||||||
idx = menu_input->pointer.ptr;
|
idx = ptr;
|
||||||
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
||||||
|
|
|
@ -393,14 +393,15 @@ bool menu_environment_cb(menu_environ_cb_t type, void *data)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int menu_driver_pointer_tap(menu_file_list_cbs_t *cbs,
|
int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr,
|
||||||
|
menu_file_list_cbs_t *cbs,
|
||||||
menu_entry_t *entry, unsigned action)
|
menu_entry_t *entry, unsigned action)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||||
|
|
||||||
if (driver->pointer_tap)
|
if (driver->pointer_tap)
|
||||||
ret = driver->pointer_tap(cbs, entry, action);
|
ret = driver->pointer_tap(x, y, ptr, cbs, entry, action);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,8 @@ typedef struct menu_ctx_driver
|
||||||
const char *ident;
|
const char *ident;
|
||||||
menu_video_driver_type_t type;
|
menu_video_driver_type_t type;
|
||||||
int (*environ_cb)(menu_environ_cb_t type, void *data);
|
int (*environ_cb)(menu_environ_cb_t type, void *data);
|
||||||
int (*pointer_tap)(menu_file_list_cbs_t *cbs,
|
int (*pointer_tap)(unsigned x, unsigned y, unsigned ptr,
|
||||||
|
menu_file_list_cbs_t *cbs,
|
||||||
menu_entry_t *entry, unsigned action);
|
menu_entry_t *entry, unsigned action);
|
||||||
} menu_ctx_driver_t;
|
} menu_ctx_driver_t;
|
||||||
|
|
||||||
|
@ -230,7 +231,8 @@ int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
|
||||||
const char *elem0, const char *elem1,
|
const char *elem0, const char *elem1,
|
||||||
uint32_t label_hash, uint32_t menu_label_hash);
|
uint32_t label_hash, uint32_t menu_label_hash);
|
||||||
|
|
||||||
int menu_driver_pointer_tap(menu_file_list_cbs_t *cbs,
|
int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr,
|
||||||
|
menu_file_list_cbs_t *cbs,
|
||||||
menu_entry_t *entry, unsigned action);
|
menu_entry_t *entry, unsigned action);
|
||||||
|
|
||||||
/* HACK */
|
/* HACK */
|
||||||
|
|
|
@ -1029,7 +1029,8 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
|
||||||
if (menu_input->pointer.oldpressed[0])
|
if (menu_input->pointer.oldpressed[0])
|
||||||
{
|
{
|
||||||
if (!menu_input->pointer.dragging)
|
if (!menu_input->pointer.dragging)
|
||||||
ret = menu_driver_pointer_tap(cbs, entry, action);
|
ret = menu_driver_pointer_tap(menu_input->pointer.start_x,
|
||||||
|
menu_input->pointer.start_y, menu_input->pointer.ptr, cbs, entry, action);
|
||||||
|
|
||||||
menu_input->pointer.oldpressed[0] = false;
|
menu_input->pointer.oldpressed[0] = false;
|
||||||
menu_input->pointer.start_x = 0;
|
menu_input->pointer.start_x = 0;
|
||||||
|
|
Loading…
Reference in New Issue