Create RARCH_MAIN_CTL_SET_WINDOWED_SCALE

This commit is contained in:
twinaphex 2015-11-18 11:55:11 +01:00
parent 2468c23d4c
commit fecdc86475
5 changed files with 20 additions and 10 deletions

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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,

View File

@ -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;
}