From 1e73ba466141265a55a9c7e46b05c78e65e468ce Mon Sep 17 00:00:00 2001 From: Themaister Date: Fri, 25 May 2012 22:11:44 +0200 Subject: [PATCH] Move SDL input driver init to sdlwrap. --- gfx/gl.c | 10 +--------- gfx/sdlwrap.c | 12 ++++++++++++ gfx/sdlwrap.h | 3 +++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gfx/gl.c b/gfx/gl.c index effc59bc74..f78c50d633 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1381,15 +1381,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo memcpy(gl->prev_info[i].coord, tex_coords, sizeof(tex_coords)); } - // Hook up SDL input driver to get SDL_QUIT events and RESIZE. - sdl_input_t *sdl_input = (sdl_input_t*)input_sdl.init(); - if (sdl_input) - { - *input = &input_sdl; - *input_data = sdl_input; - } - else - *input = NULL; + sdlwrap_input_driver(input, input_data); gl_init_font(gl, g_settings.video.font_path, g_settings.video.font_size); diff --git a/gfx/sdlwrap.c b/gfx/sdlwrap.c index 7c62c10416..81aed5afe3 100644 --- a/gfx/sdlwrap.c +++ b/gfx/sdlwrap.c @@ -359,3 +359,15 @@ bool sdlwrap_window_has_focus(void) #endif } +void sdlwrap_input_driver(const input_driver_t **input, void **input_data) +{ + void *sdl_input = input_sdl.init(); + if (sdl_input) + { + *input = &input_sdl; + *input_data = sdl_input; + } + else + *input = NULL; +} + diff --git a/gfx/sdlwrap.h b/gfx/sdlwrap.h index f1c3c915e5..a0c9fec116 100644 --- a/gfx/sdlwrap.h +++ b/gfx/sdlwrap.h @@ -23,6 +23,7 @@ #include "../boolean.h" +#include "../driver.h" #include "SDL.h" #include "SDL_version.h" #include "SDL_syswm.h" @@ -64,5 +65,7 @@ bool sdlwrap_get_wm_info(SDL_SysWMinfo *info); bool sdlwrap_window_has_focus(void); +void sdlwrap_input_driver(const input_driver_t **input, void **input_data); + #endif