Turn returntype of set_resize into bool

This commit is contained in:
twinaphex 2016-01-07 00:58:33 +01:00
parent 28b615e62c
commit 3b8932b302
20 changed files with 58 additions and 39 deletions

View File

@ -217,6 +217,8 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message,
return 0;
}
extern bool d3d_restore(d3d_video_t *data);
LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam)
{
@ -232,7 +234,8 @@ LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message,
g_resized = true;
if (g_resize_width && g_resize_height)
gfx_ctx_set_resize(g_resize_width, g_resize_height);
if (gfx_ctx_set_resize(g_resize_width, g_resize_height))
d3d_restore(curD3D);
return 0;
case WM_SYSCOMMAND:
case WM_CHAR:

View File

@ -132,12 +132,14 @@ static void android_gfx_ctx_check_window(void *data, bool *quit,
*quit = true;
}
static void android_gfx_ctx_set_resize(void *data,
static bool android_gfx_ctx_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void android_gfx_ctx_update_window_title(void *data)

View File

@ -256,11 +256,12 @@ static void gfx_ctx_qnx_check_window(void *data, bool *quit,
*quit = true;
}
static void gfx_ctx_qnx_set_resize(void *data, unsigned width, unsigned height)
static bool gfx_ctx_qnx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_qnx_update_window_title(void *data)

View File

@ -104,11 +104,12 @@ static void gfx_ctx_cgl_swap_buffers(void *data)
CGLFlushDrawable(cgl->glCtx);
}
static void gfx_ctx_cgl_set_resize(void *data, unsigned width, unsigned height)
static bool gfx_ctx_cgl_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_cgl_update_window_title(void *data)

View File

@ -513,11 +513,12 @@ static void cocoagl_gfx_ctx_check_window(void *data, bool *quit,
}
}
static void cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
static bool cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void cocoagl_gfx_ctx_input_driver(void *data, const input_driver_t **input, void **input_data)

View File

@ -48,26 +48,20 @@ static bool widescreen_mode = false;
void *curD3D = NULL;
void *dinput;
extern bool d3d_restore(d3d_video_t *data);
static void d3d_resize(void *data, unsigned new_width, unsigned new_height)
static bool gfx_ctx_d3d_set_resize(void *data, unsigned new_width, unsigned new_height)
{
d3d_video_t *d3d = (d3d_video_t*)curD3D;
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;
if (!d3dr)
return;
/* No changes? */
if (new_width == d3d->video_info.width && new_height == d3d->video_info.height)
return false;
(void)data;
RARCH_LOG("[D3D]: Resize %ux%u.\n", new_width, new_height);
d3d->video_info.width = new_width;
d3d->video_info.height = new_height;
video_driver_set_size(&new_width, &new_height);
if (new_width != d3d->video_info.width || new_height != d3d->video_info.height)
{
RARCH_LOG("[D3D]: Resize %ux%u.\n", new_width, new_height);
d3d->video_info.width = new_width;
d3d->video_info.height = new_height;
video_driver_set_size(&new_width, &new_height);
d3d_restore(d3d);
}
return true;
}
static void gfx_ctx_d3d_swap_buffers(void *data)
@ -320,7 +314,7 @@ const gfx_ctx_driver_t gfx_ctx_d3d = {
NULL,
gfx_ctx_d3d_update_title,
gfx_ctx_d3d_check_window,
d3d_resize,
gfx_ctx_d3d_set_resize,
gfx_ctx_d3d_has_focus,
gfx_ctx_d3d_suppress_screensaver,
gfx_ctx_d3d_has_windowed,

View File

@ -226,12 +226,14 @@ static void gfx_ctx_drm_egl_swap_buffers(void *data)
wait_flip(true);
}
static void gfx_ctx_drm_egl_set_resize(void *data,
static bool gfx_ctx_drm_egl_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_drm_egl_update_window_title(void *data)

View File

@ -69,12 +69,13 @@ static void gfx_ctx_emscripten_swap_buffers(void *data)
#endif
}
static void gfx_ctx_emscripten_set_resize(void *data,
static bool gfx_ctx_emscripten_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_emscripten_update_window_title(void *data)

View File

@ -41,11 +41,12 @@ static void gfx_ctx_null_swap_buffers(void *data)
(void)data;
}
static void gfx_ctx_null_set_resize(void *data, unsigned width, unsigned height)
static bool gfx_ctx_null_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_null_update_window_title(void *data)

View File

@ -160,12 +160,13 @@ static void gfx_ctx_glx_swap_buffers(void *data)
glXSwapBuffers(g_x11_dpy, glx->g_glx_win);
}
static void gfx_ctx_glx_set_resize(void *data,
static bool gfx_ctx_glx_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void *gfx_ctx_glx_init(void *data)

View File

@ -129,12 +129,13 @@ static void gfx_ctx_mali_fbdev_check_window(void *data, bool *quit,
*quit = g_egl_quit;
}
static void gfx_ctx_mali_fbdev_set_resize(void *data,
static bool gfx_ctx_mali_fbdev_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_mali_fbdev_update_window_title(void *data)

View File

@ -187,8 +187,11 @@ static void gfx_ctx_ps3_swap_buffers(void *data)
#endif
}
static void gfx_ctx_ps3_set_resize(void *data,
unsigned width, unsigned height) { }
static bool gfx_ctx_ps3_set_resize(void *data,
unsigned width, unsigned height)
{
return false;
}
static void gfx_ctx_ps3_update_window_title(void *data)
{

View File

@ -334,11 +334,12 @@ static void sdl_ctx_check_window(void *data, bool *quit, bool *resize,unsigned *
sdl->g_frame_count = frame_count;
}
static void sdl_ctx_set_resize(void *data, unsigned width, unsigned height)
static bool sdl_ctx_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static bool sdl_ctx_has_focus(void *data)

View File

@ -76,11 +76,12 @@ static void gfx_ctx_vc_check_window(void *data, bool *quit,
*quit = g_egl_quit;
}
static void gfx_ctx_vc_set_resize(void *data, unsigned width, unsigned height)
static bool gfx_ctx_vc_set_resize(void *data, unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_vc_update_window_title(void *data)

View File

@ -95,12 +95,13 @@ static void gfx_ctx_vivante_check_window(void *data, bool *quit,
*quit = g_egl_quit;
}
static void gfx_ctx_vivante_set_resize(void *data,
static bool gfx_ctx_vivante_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_vivante_update_window_title(void *data)

View File

@ -206,11 +206,12 @@ static void gfx_ctx_wl_check_window(void *data, bool *quit,
*quit = g_egl_quit;
}
static void gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height)
static bool gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height)
{
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
wl_egl_window_resize(wl->win, width, height, 0, 0);
return true;
}
static void gfx_ctx_wl_update_window_title(void *data)

View File

@ -247,12 +247,13 @@ static void gfx_ctx_wgl_swap_buffers(void *data)
SwapBuffers(g_hdc);
}
static void gfx_ctx_wgl_set_resize(void *data,
static bool gfx_ctx_wgl_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
static void gfx_ctx_wgl_update_window_title(void *data)

View File

@ -69,12 +69,13 @@ static void gfx_ctx_xegl_destroy(void *data)
*/
}
static void gfx_ctx_xegl_set_resize(void *data,
static bool gfx_ctx_xegl_set_resize(void *data,
unsigned width, unsigned height)
{
(void)data;
(void)width;
(void)height;
return false;
}
#define XEGL_ATTRIBS_BASE \

View File

@ -263,10 +263,12 @@ void gfx_ctx_swap_interval(unsigned interval)
current_video_context->swap_interval(video_context_data, interval);
}
void gfx_ctx_set_resize(unsigned width, unsigned height)
bool gfx_ctx_set_resize(unsigned width, unsigned height)
{
if (current_video_context)
current_video_context->set_resize(video_context_data, width, height);
if (!current_video_context)
return false;
return current_video_context->set_resize(video_context_data, width, height);
}
void gfx_ctx_input_driver(

View File

@ -103,7 +103,7 @@ typedef struct gfx_ctx_driver
/* Acknowledge a resize event. This is needed for some APIs.
* Most backends will ignore this. */
void (*set_resize)(void*, unsigned, unsigned);
bool (*set_resize)(void*, unsigned, unsigned);
/* Checks if window has input focus. */
bool (*has_focus)(void*);
@ -229,7 +229,7 @@ void gfx_ctx_update_window_title(void);
void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
void gfx_ctx_set_resize(unsigned width, unsigned height);
bool gfx_ctx_set_resize(unsigned width, unsigned height);
void gfx_ctx_swap_interval(unsigned interval);