Add RARCH_DISPLAY_CTL_SET_NONBLOCK_STATE

This commit is contained in:
twinaphex 2015-11-20 17:22:19 +01:00
parent dbf8d25e3e
commit 3e986f9562
5 changed files with 18 additions and 13 deletions

View File

@ -1420,7 +1420,7 @@ bool event_command(enum event_command cmd)
case EVENT_CMD_VIDEO_SET_NONBLOCKING_STATE:
boolean = true; /* fall-through */
case EVENT_CMD_VIDEO_SET_BLOCKING_STATE:
video_driver_set_nonblock_state(boolean);
video_driver_ctl(RARCH_DISPLAY_CTL_SET_NONBLOCK_STATE, &boolean);
break;
case EVENT_CMD_VIDEO_SET_ASPECT_RATIO:
video_driver_set_aspect_ratio(settings->video.aspect_ratio_idx);

View File

@ -283,7 +283,7 @@ void driver_set_nonblock_state(bool enable)
if (!settings->video.vsync || system->force_nonblock)
video_nonblock = true;
video_driver_set_nonblock_state(video_nonblock);
video_driver_ctl(RARCH_DISPLAY_CTL_SET_NONBLOCK_STATE, &video_nonblock);
}
audio_driver_set_nonblocking_state(enable);

View File

@ -125,7 +125,8 @@ const struct retro_controller_description *
**/
bool rarch_environment_cb(unsigned cmd, void *data);
struct retro_core_t {
struct retro_core_t
{
void (*retro_init)(void);
void (*retro_deinit)(void);
unsigned (*retro_api_version)(void);

View File

@ -590,14 +590,6 @@ bool video_driver_suppress_screensaver(bool enable)
return video->suppress_screensaver(driver->video_data, enable);
}
void video_driver_set_nonblock_state(bool toggle)
{
driver_t *driver = driver_get_ptr();
const video_driver_t *video = video_driver_ctx_get_ptr(driver);
if (video && video->set_nonblock_state)
video->set_nonblock_state(driver->video_data, toggle);
}
bool video_driver_set_viewport(unsigned width, unsigned height,
bool force_fullscreen, bool allow_rotate)
@ -1165,6 +1157,19 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
switch (state)
{
case RARCH_DISPLAY_CTL_SET_NONBLOCK_STATE:
{
driver_t *driver = driver_get_ptr();
const video_driver_t *video = video_driver_ctx_get_ptr(driver);
bool *toggle = (bool*)data;
if (!toggle || !video || !driver)
return false;
if (video && video->set_nonblock_state)
video->set_nonblock_state(driver->video_data, *toggle);
}
return true;
case RARCH_DISPLAY_CTL_FIND_DRIVER:
return find_video_driver();
case RARCH_DISPLAY_CTL_APPLY_STATE_CHANGES:

View File

@ -228,6 +228,7 @@ enum rarch_display_ctl_state
RARCH_DISPLAY_CTL_HAS_WINDOWED,
RARCH_DISPLAY_CTL_IS_FOCUSED,
RARCH_DISPLAY_CTL_READ_VIEWPORT,
RARCH_DISPLAY_CTL_SET_NONBLOCK_STATE,
/* Renders the current video frame. */
RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER,
RARCH_DISPLAY_CTL_CACHED_FRAME_HAS_VALID_FB,
@ -293,8 +294,6 @@ void uninit_video_input(void);
void init_video(void);
void video_driver_set_nonblock_state(bool toggle);
bool video_driver_set_rotation(unsigned rotation);
void video_driver_set_video_mode(unsigned width,