Create GFX_CTL_INPUT_DRIVER

This commit is contained in:
twinaphex 2016-02-13 23:26:33 +01:00
parent 098fc0a860
commit 0a9787ec49
5 changed files with 26 additions and 16 deletions

View File

@ -956,6 +956,7 @@ static bool d3d_construct(d3d_video_t *d3d,
const video_info_t *info, const input_driver_t **input,
void **input_data)
{
gfx_ctx_input_t inp;
unsigned full_x, full_y;
settings_t *settings = config_get_ptr();
@ -1045,7 +1046,10 @@ static bool d3d_construct(d3d_video_t *d3d,
if (!d3d_initialize(d3d, &d3d->video_info))
return false;
gfx_ctx_input_driver(input, input_data);
inp.input = input;
inp.input_data = input_data;
gfx_ctx_ctl(GFX_CTL_INPUT_DRIVER, &inp);
RARCH_LOG("[D3D]: Init complete.\n");
return true;

View File

@ -2462,6 +2462,7 @@ static void gl_begin_debug(gl_t *gl)
static void *gl_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
gfx_ctx_input_t inp;
unsigned interval;
unsigned win_width, win_height, temp_width = 0, temp_height = 0;
bool force_smooth = false;
@ -2659,7 +2660,10 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
goto error;
#endif
gfx_ctx_input_driver(input, input_data);
inp.input = input;
inp.input_data = input_data;
gfx_ctx_ctl(GFX_CTL_INPUT_DRIVER, &inp);
if (settings->video.font_enable)
{

View File

@ -85,6 +85,7 @@ static INLINE bool vg_query_extension(const char *ext)
static void *vg_init(const video_info_t *video, const input_driver_t **input, void **input_data)
{
gfx_ctx_input_t inp;
gfx_ctx_aspect_t aspect_data;
unsigned interval;
unsigned temp_width = 0, temp_height = 0;
@ -156,7 +157,10 @@ static void *vg_init(const video_info_t *video, const input_driver_t **input, vo
video->smooth ? VG_IMAGE_QUALITY_BETTER : VG_IMAGE_QUALITY_NONANTIALIASED);
vg_set_nonblock_state(vg, !video->vsync);
gfx_ctx_input_driver(input, input_data);
inp.input = input;
inp.input_data = input_data;
gfx_ctx_ctl(GFX_CTL_INPUT_DRIVER, &inp);
if (settings->video.font_enable && font_renderer_create_default(&vg->font_driver, &vg->mFontRenderer,
*settings->video.font_path ? settings->video.font_path : NULL, settings->video.font_size))

View File

@ -136,15 +136,6 @@ bool gfx_ctx_set_resize(unsigned width, unsigned height)
video_context_data, width, height);
}
void gfx_ctx_input_driver(
const input_driver_t **input, void **input_data)
{
if (!current_video_context || !current_video_context->input_driver)
return;
current_video_context->input_driver(
video_context_data, input, input_data);
}
/**
* find_gfx_ctx_driver_index:
* @ident : Identifier of resampler driver to find.
@ -433,6 +424,15 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
metrics->type,
metrics->value);
}
case GFX_CTL_INPUT_DRIVER:
{
gfx_ctx_input_t *inp = (gfx_ctx_input_t*)data;
if (!current_video_context || !current_video_context->input_driver)
return false;
current_video_context->input_driver(
video_context_data, inp->input, inp->input_data);
}
break;
case GFX_CTL_NONE:
default:
break;

View File

@ -75,7 +75,8 @@ enum gfx_ctx_ctl_state
GFX_CTL_SWAP_INTERVAL,
GFX_CTL_PROC_ADDRESS_GET,
GFX_CTL_TRANSLATE_ASPECT,
GFX_CTL_GET_METRICS
GFX_CTL_GET_METRICS,
GFX_CTL_INPUT_DRIVER,
};
typedef void (*gfx_ctx_proc_t)(void);
@ -270,9 +271,6 @@ bool gfx_ctx_set_resize(unsigned width, unsigned height);
const char *gfx_ctx_get_ident(void);
void gfx_ctx_input_driver(
const input_driver_t **input, void **input_data);
bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data);
#ifdef __cplusplus