From a3e14acaa37b97a6bfe533a3ee425eb9693a0af2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 10 Apr 2015 09:36:03 +0200 Subject: [PATCH] Create win32_check_window --- gfx/common/win32_common.c | 13 +++++++++++++ gfx/common/win32_common.h | 2 ++ gfx/drivers_context/d3d_ctx.cpp | 9 +-------- gfx/drivers_context/wgl_ctx.c | 8 +------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index b415a8a58d..81d603d5f0 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -226,3 +226,16 @@ void win32_show_cursor(bool state) while (ShowCursor(FALSE) >= 0); #endif } + +void win32_check_window(void) +{ +#ifndef _XBOX + MSG msg; + + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } +#endif +} diff --git a/gfx/common/win32_common.h b/gfx/common/win32_common.h index 4a78bda07e..fa7a978366 100644 --- a/gfx/common/win32_common.h +++ b/gfx/common/win32_common.h @@ -42,6 +42,8 @@ bool win32_get_metrics(void *data, void win32_show_cursor(bool state); +void win32_check_window(void); + #ifdef __cplusplus } #endif diff --git a/gfx/drivers_context/d3d_ctx.cpp b/gfx/drivers_context/d3d_ctx.cpp index 45eda6e3e9..b8a586cadb 100644 --- a/gfx/drivers_context/d3d_ctx.cpp +++ b/gfx/drivers_context/d3d_ctx.cpp @@ -286,15 +286,8 @@ static void gfx_ctx_d3d_check_window(void *data, bool *quit, *quit = true; if (d3d->should_resize) *resize = true; -#ifndef _XBOX - MSG msg; - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } -#endif + win32_check_window(); } #ifdef _XBOX diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c index 38933dceae..7cb9499ee3 100644 --- a/gfx/drivers_context/wgl_ctx.c +++ b/gfx/drivers_context/wgl_ctx.c @@ -313,17 +313,11 @@ static void gfx_ctx_wgl_swap_interval(void *data, unsigned interval) static void gfx_ctx_wgl_check_window(void *data, bool *quit, bool *resize, unsigned *width, unsigned *height, unsigned frame_count) { - MSG msg; + win32_check_window(); (void)data; (void)frame_count; - while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - *quit = g_quit; if (g_resized)