diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index e64767d82d..90fa4e0214 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -4956,7 +4956,7 @@ static int action_ok_push_dropdown_item(const char *path, return 0; } -static int action_ok_push_dropdown_item_resolution(const char *path, +int action_cb_push_dropdown_item_resolution(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { char str[100]; @@ -4965,6 +4965,11 @@ static int action_ok_push_dropdown_item_resolution(const char *path, unsigned height = 0; unsigned refreshrate = 0; + (void)label; + (void)type; + (void)idx; + (void)entry_idx; + snprintf(str, sizeof(str), "%s", path); pch = strtok(str, "x"); @@ -4987,11 +4992,22 @@ static int action_ok_push_dropdown_item_resolution(const char *path, settings->uints.video_fullscreen_x = width; settings->uints.video_fullscreen_y = height; + return 1; + } + + return 0; +} + +static int action_ok_push_dropdown_item_resolution(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + if (action_cb_push_dropdown_item_resolution(path, + label, type, idx, entry_idx) == 1) + { /* TODO/FIXME - menu drivers like XMB don't rescale * automatically */ return menu_cbs_exit(); } - return 0; } diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index e1f61c5e2b..5845b8b157 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -149,6 +149,8 @@ enum }; /* Function callbacks */ +int action_cb_push_dropdown_item_resolution(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx); int action_cancel_pop_default(const char *path, const char *label, unsigned type, size_t idx); diff --git a/ui/drivers/qt/options/video.cpp b/ui/drivers/qt/options/video.cpp index 68f03ff702..77752d00cc 100644 --- a/ui/drivers/qt/options/video.cpp +++ b/ui/drivers/qt/options/video.cpp @@ -290,35 +290,9 @@ QWidget *CrtSwitchresPage::widget() void VideoPage::onResolutionComboIndexChanged(const QString &text) { - char str[100]; - char *pch = NULL; const char *path = text.toUtf8().constData(); - unsigned width = 0; - unsigned height = 0; - unsigned refreshrate = 0; - - snprintf(str, sizeof(str), "%s", path); - - pch = strtok(str, "x"); - if (pch) - width = strtoul(pch, NULL, 0); - pch = strtok(NULL, " "); - if (pch) - height = strtoul(pch, NULL, 0); - pch = strtok(NULL, "("); - if (pch) - refreshrate = strtoul(pch, NULL, 0); - - if (video_display_server_set_resolution(width, height, - refreshrate, (float)refreshrate, 0, 0, 0)) - { - settings_t *settings = config_get_ptr(); - - video_monitor_set_refresh_rate((float)refreshrate); - - settings->uints.video_fullscreen_x = width; - settings->uints.video_fullscreen_y = height; - } + action_cb_push_dropdown_item_resolution(path, + NULL, 0, 0, 0); } void CrtSwitchresPage::onCrtSuperResolutionComboIndexChanged(int index)