From fecdc86475c807830a8ec691f78ab8969de0c012 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 18 Nov 2015 11:55:11 +0100 Subject: [PATCH] Create RARCH_MAIN_CTL_SET_WINDOWED_SCALE --- command_event.c | 15 +++++++++------ gfx/common/win32_common.cpp | 3 +-- runloop.c | 8 ++++++++ runloop.h | 1 + ui/drivers/ui_cocoa.m | 3 +-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/command_event.c b/command_event.c index c71806c07c..eb397ee629 100644 --- a/command_event.c +++ b/command_event.c @@ -1124,15 +1124,18 @@ bool event_command(enum event_command cmd) event_main_state(cmd); break; case EVENT_CMD_RESIZE_WINDOWED_SCALE: - if (global->pending.windowed_scale == 0) - return false; + { + unsigned idx = 0; + if (global->pending.windowed_scale == 0) + return false; - settings->video.scale = global->pending.windowed_scale; + settings->video.scale = global->pending.windowed_scale; - if (!settings->video.fullscreen) - event_command(EVENT_CMD_REINIT); + if (!settings->video.fullscreen) + event_command(EVENT_CMD_REINIT); - global->pending.windowed_scale = 0; + rarch_main_ctl(RARCH_MAIN_CTL_SET_WINDOWED_SCALE, &idx); + } break; case EVENT_CMD_MENU_TOGGLE: #ifdef HAVE_MENU diff --git a/gfx/common/win32_common.cpp b/gfx/common/win32_common.cpp index 2903e087ad..b78da2052a 100644 --- a/gfx/common/win32_common.cpp +++ b/gfx/common/win32_common.cpp @@ -408,9 +408,8 @@ LRESULT win32_menu_loop(HWND owner, WPARAM wparam) default: if (mode >= ID_M_WINDOW_SCALE_1X && mode <= ID_M_WINDOW_SCALE_10X) { - global_t *global = global_get_ptr(); unsigned idx = (mode - (ID_M_WINDOW_SCALE_1X-1)); - global->pending.windowed_scale = idx; + rarch_main_ctl(RARCH_MAIN_CTL_SET_WINDOWED_SCALE, &idx); cmd = EVENT_CMD_RESIZE_WINDOWED_SCALE; } else if (mode == ID_M_STATE_INDEX_AUTO) diff --git a/runloop.c b/runloop.c index e5b999e4f3..4ff6271d23 100644 --- a/runloop.c +++ b/runloop.c @@ -317,6 +317,14 @@ bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data) switch (state) { + case RARCH_MAIN_CTL_SET_WINDOWED_SCALE: + { + unsigned *idx = (unsigned*)data; + if (!idx) + return false; + global->pending.windowed_scale = *idx; + } + break; case RARCH_MAIN_CTL_SET_LIBRETRO_PATH: { const char *fullpath = (const char*)data; diff --git a/runloop.h b/runloop.h index ebcf292dce..d0809fcde4 100644 --- a/runloop.h +++ b/runloop.h @@ -37,6 +37,7 @@ extern "C" { enum rarch_main_ctl_state { RARCH_MAIN_CTL_IS_IDLE = 0, + RARCH_MAIN_CTL_SET_WINDOWED_SCALE, RARCH_MAIN_CTL_SET_IDLE, RARCH_MAIN_CTL_GET_CONTENT_PATH, RARCH_MAIN_CTL_SET_CONTENT_PATH, diff --git a/ui/drivers/ui_cocoa.m b/ui/drivers/ui_cocoa.m index 9af3e3a23d..005ff432bf 100644 --- a/ui/drivers/ui_cocoa.m +++ b/ui/drivers/ui_cocoa.m @@ -371,7 +371,6 @@ extern void action_ok_push_quick_menu(void); { enum event_command cmd; unsigned sender_tag = (unsigned)[sender tag]; - global_t *global = global_get_ptr(); switch (sender_tag) { @@ -413,7 +412,7 @@ extern void action_ok_push_quick_menu(void); if (sender_tag >= 10 && sender_tag <= 19) { unsigned idx = (sender_tag - (10-1)); - global->pending.windowed_scale = idx; + rarch_main_ctl(RARCH_MAIN_CTL_SET_WINDOWED_SCALE, &idx); cmd = EVENT_CMD_RESIZE_WINDOWED_SCALE; }