This commit is contained in:
twinaphex 2015-09-05 18:49:48 +02:00
parent 92b918cb63
commit d4eefc020f
4 changed files with 17 additions and 15 deletions

View File

@ -682,6 +682,7 @@ static float glui_get_scroll(void)
glui_handle_t *glui = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
size_t selection = nav->selection_ptr;
if (!menu || !menu->userdata)
return 0;
@ -692,9 +693,9 @@ static float glui_get_scroll(void)
if (glui->line_height)
half = (height / glui->line_height) / 2;
if (nav->selection_ptr < (unsigned)half)
if (selection < (unsigned)half)
return 0;
return ((nav->selection_ptr + 2 - half) * glui->line_height);
return ((selection + 2 - half) * glui->line_height);
}
static void glui_navigation_set(bool scroll)

View File

@ -682,6 +682,7 @@ static void rgui_navigation_set(bool scroll)
menu_handle_t *menu = menu_driver_get_ptr();
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
size_t selection = nav->selection_ptr;
if (!menu)
return;
@ -690,12 +691,12 @@ static void rgui_navigation_set(bool scroll)
if (!scroll)
return;
if (nav->selection_ptr < RGUI_TERM_HEIGHT/2)
if (selection < RGUI_TERM_HEIGHT/2)
menu_entries_set_start(0);
else if (nav->selection_ptr >= RGUI_TERM_HEIGHT/2
&& nav->selection_ptr < (end - RGUI_TERM_HEIGHT/2))
menu_entries_set_start(nav->selection_ptr - RGUI_TERM_HEIGHT/2);
else if (nav->selection_ptr >= (end - RGUI_TERM_HEIGHT/2))
else if (selection >= (RGUI_TERM_HEIGHT/2)
&& selection < (end - RGUI_TERM_HEIGHT/2))
menu_entries_set_start(selection - RGUI_TERM_HEIGHT/2);
else if (selection >= (end - RGUI_TERM_HEIGHT/2))
menu_entries_set_start(end - RGUI_TERM_HEIGHT);
}

View File

@ -981,6 +981,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
settings_t *settings = config_get_ptr();
size_t selection = nav->selection_ptr;
if (!menu)
return;
@ -1002,8 +1003,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
xmb_list_switch_old(xmb, xmb->selection_buf_old,
dir, xmb->selection_ptr_old);
xmb_list_switch_new(xmb, menu_list->selection_buf,
dir, nav->selection_ptr);
xmb_list_switch_new(xmb, menu_list->selection_buf, dir, selection);
xmb->categories.active.idx_old = xmb->categories.selection_ptr;
if (settings->menu.boxart_enable)

View File

@ -105,13 +105,13 @@ void menu_navigation_decrement(menu_navigation_t *nav, unsigned scroll_speed)
{
menu_list_t *menu_list = menu_list_get_ptr();
settings_t *settings = config_get_ptr();
size_t selection = nav->selection_ptr;
if (!nav)
return;
if (nav->selection_ptr >= scroll_speed)
menu_navigation_set(nav,
nav->selection_ptr - scroll_speed, true);
if (selection >= scroll_speed)
menu_navigation_set(nav, selection - scroll_speed, true);
else
{
if (settings->menu.navigation.wraparound.vertical_enable)
@ -133,14 +133,14 @@ void menu_navigation_increment(menu_navigation_t *nav, unsigned scroll_speed)
{
settings_t *settings = config_get_ptr();
menu_list_t *menu_list = menu_list_get_ptr();
size_t selection = nav->selection_ptr;
if (!nav)
return;
if (nav->selection_ptr + scroll_speed < (menu_list_get_size(menu_list)))
if ((selection + scroll_speed) < (menu_list_get_size(menu_list)))
{
menu_navigation_set(nav,
nav->selection_ptr + scroll_speed, true);
menu_navigation_set(nav, selection + scroll_speed, true);
menu_driver_navigation_increment();
}
else