From c38f86e14addf4f69e2db7b1dc23c91d48657c75 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 23 Apr 2017 21:17:01 +0200 Subject: [PATCH] Create menu_driver_{decrement|increment}_navigation --- menu/menu_driver.c | 20 ++++++++++++-------- menu/menu_driver.h | 6 ++++-- menu/menu_navigation.c | 5 +++-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 03c7ce9021..50d1b0aa00 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -446,6 +446,18 @@ bool menu_driver_list_clear(void *data) return true; } +void menu_driver_increment_navigation(void) +{ + if (menu_driver_ctx->navigation_increment) + menu_driver_ctx->navigation_increment(menu_userdata); +} + +void menu_driver_decrement_navigation(void) +{ + if (menu_driver_ctx->navigation_decrement) + menu_driver_ctx->navigation_decrement(menu_userdata); +} + bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) { switch (state) @@ -655,14 +667,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) case RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT: menu_driver_load_no_content = false; break; - case RARCH_MENU_CTL_NAVIGATION_INCREMENT: - if (menu_driver_ctx->navigation_increment) - menu_driver_ctx->navigation_increment(menu_userdata); - break; - case RARCH_MENU_CTL_NAVIGATION_DECREMENT: - if (menu_driver_ctx->navigation_decrement) - menu_driver_ctx->navigation_decrement(menu_userdata); - break; case RARCH_MENU_CTL_NAVIGATION_SET: { bool *scroll = (bool*)data; diff --git a/menu/menu_driver.h b/menu/menu_driver.h index bda200a8e8..2147c744e8 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -82,8 +82,6 @@ enum rarch_menu_ctl_state { RARCH_MENU_CTL_NONE = 0, RARCH_MENU_CTL_REFRESH, - RARCH_MENU_CTL_NAVIGATION_INCREMENT, - RARCH_MENU_CTL_NAVIGATION_DECREMENT, RARCH_MENU_CTL_NAVIGATION_SET, RARCH_MENU_CTL_NAVIGATION_CLEAR, RARCH_MENU_CTL_NAVIGATION_SET_LAST, @@ -401,6 +399,10 @@ bool menu_driver_iterate(menu_ctx_iterate_t *iterate); bool menu_driver_list_clear(void *data); +void menu_driver_increment_navigation(void); + +void menu_driver_decrement_navigation(void); + extern menu_ctx_driver_t menu_ctx_xui; extern menu_ctx_driver_t menu_ctx_rgui; extern menu_ctx_driver_t menu_ctx_mui; diff --git a/menu/menu_navigation.c b/menu/menu_navigation.c index 527e0bc750..5849d66013 100644 --- a/menu/menu_navigation.c +++ b/menu/menu_navigation.c @@ -104,7 +104,7 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data) } } - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_INCREMENT, NULL); + menu_driver_increment_navigation(); } break; case MENU_NAVIGATION_CTL_DECREMENT: @@ -134,7 +134,8 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data) menu_navigation_set_selection(idx); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll); menu_navigation_ctl(MENU_NAVIGATION_CTL_DECREMENT, NULL); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_DECREMENT, NULL); + + menu_driver_decrement_navigation(); } break;