(XMB/GLUI) Cleanups

This commit is contained in:
twinaphex 2015-02-11 06:34:30 +01:00
parent a687907bde
commit 37d9661846
2 changed files with 27 additions and 39 deletions

View File

@ -498,7 +498,8 @@ static void glui_context_reset(void *data)
static void glui_navigation_clear(void *data, bool pending_push)
{
driver.menu->begin = 0;
if (driver.menu)
driver.menu->begin = 0;
}
static void glui_navigation_set(void *data, bool scroll)
@ -518,15 +519,15 @@ static void glui_navigation_set(void *data, bool scroll)
if (!scroll)
return;
if (driver.menu->selection_ptr < glui->term_height/2)
driver.menu->begin = 0;
else if (driver.menu->selection_ptr >= glui->term_height/2
&& driver.menu->selection_ptr <
menu_list_get_size(driver.menu->menu_list) - glui->term_height/2)
driver.menu->begin = driver.menu->selection_ptr - glui->term_height/2;
else if (driver.menu->selection_ptr >=
menu_list_get_size(driver.menu->menu_list) - glui->term_height/2)
driver.menu->begin = menu_list_get_size(driver.menu->menu_list)
if (menu->selection_ptr < glui->term_height/2)
menu->begin = 0;
else if (menu->selection_ptr >= glui->term_height/2
&& menu->selection_ptr <
menu_list_get_size(menu->menu_list) - glui->term_height/2)
menu->begin = menu->selection_ptr - glui->term_height/2;
else if (menu->selection_ptr >=
menu_list_get_size(menu->menu_list) - glui->term_height/2)
menu->begin = menu_list_get_size(menu->menu_list)
- glui->term_height;
}

View File

@ -421,17 +421,17 @@ end:
string_list_free(list);
}
static void xmb_selection_pointer_changed(void)
static void xmb_selection_pointer_changed(menu_handle_t *menu)
{
int i;
unsigned current, end;
xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;
xmb_handle_t *xmb = (xmb_handle_t*)menu->userdata;
if (!xmb)
return;
current = driver.menu->selection_ptr;
end = menu_list_get_size(driver.menu->menu_list);
current = menu->selection_ptr;
end = menu_list_get_size(menu->menu_list);
for (i = 0; i < end; i++)
{
@ -439,7 +439,7 @@ static void xmb_selection_pointer_changed(void)
float ia = xmb->i_passive_alpha;
float iz = xmb->i_passive_zoom;
xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(
driver.menu->menu_list->selection_buf, i);
menu->menu_list->selection_buf, i);
if (!node)
continue;
@ -452,10 +452,10 @@ static void xmb_selection_pointer_changed(void)
iz = xmb->i_active_zoom;
}
menu_animation_push(driver.menu->animation, XMB_DELAY, ia, &node->alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(driver.menu->animation, XMB_DELAY, ia, &node->label_alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(driver.menu->animation, XMB_DELAY, iz, &node->zoom, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(driver.menu->animation, XMB_DELAY, iy, &node->y, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation, XMB_DELAY, ia, &node->alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation, XMB_DELAY, ia, &node->label_alpha, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation, XMB_DELAY, iz, &node->zoom, EASING_IN_OUT_QUAD, NULL);
menu_animation_push(menu->animation, XMB_DELAY, iy, &node->y, EASING_IN_OUT_QUAD, NULL);
}
}
@ -1335,55 +1335,42 @@ static void xmb_context_reset(void *data)
static void xmb_navigation_clear(void *data, bool pending_push)
{
(void)data;
if (!pending_push)
xmb_selection_pointer_changed();
xmb_selection_pointer_changed(data);
}
static void xmb_navigation_decrement(void *data)
{
(void)data;
xmb_selection_pointer_changed();
xmb_selection_pointer_changed(data);
}
static void xmb_navigation_increment(void *data)
{
(void)data;
xmb_selection_pointer_changed();
xmb_selection_pointer_changed(data);
}
static void xmb_navigation_set(void *data, bool scroll)
{
(void)data;
(void)scroll;
xmb_selection_pointer_changed();
xmb_selection_pointer_changed(data);
}
static void xmb_navigation_set_last(void *data)
{
(void)data;
xmb_selection_pointer_changed();
xmb_selection_pointer_changed(data);
}
static void xmb_navigation_descend_alphabet(void *data, size_t *unused)
{
(void)data;
(void)unused;
xmb_selection_pointer_changed();
xmb_selection_pointer_changed(data);
}
static void xmb_navigation_ascend_alphabet(void *data, size_t *unused)
{
(void)data;
(void)unused;
xmb_selection_pointer_changed();
xmb_selection_pointer_changed(data);
}
static void xmb_list_insert(void *data,