From e02ff9c40ceb683d60ff22d45006a0e32f9a7e03 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 11 Jul 2019 03:49:33 +0200 Subject: [PATCH] (Win32) Reimplement PeekMessage implementation - this should be at the start of the while loop --- frontend/frontend.c | 9 ++++++++- gfx/common/win32_common.c | 9 +-------- ui/drivers/win32/ui_win32_application.c | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/frontend/frontend.c b/frontend/frontend.c index 38682650c3..05e7b5c58e 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -146,8 +146,12 @@ int rarch_main(int argc, char *argv[], void *data) #if !defined(HAVE_MAIN) do { + int ret; unsigned sleep_ms = 0; - int ret = runloop_iterate(&sleep_ms); +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) + ui_companion_win32.application->process_events(); +#endif + ret = runloop_iterate(&sleep_ms); if (ret == 1 && sleep_ms > 0) retro_sleep(sleep_ms); @@ -170,6 +174,9 @@ int rarch_main(int argc, char *argv[], void *data) int ret; unsigned sleep_ms = 0; +#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__) + ui_companion_win32.application->process_events(); +#endif if (ui_application->process_events) ui_application->process_events(); diff --git a/gfx/common/win32_common.c b/gfx/common/win32_common.c index 19bff841f8..b6cf8a148b 100644 --- a/gfx/common/win32_common.c +++ b/gfx/common/win32_common.c @@ -1132,14 +1132,7 @@ void win32_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height) { #if !defined(_XBOX) - if (video_driver_is_threaded()) - { - const ui_application_t *application = - ui_companion_driver_get_application_ptr(); - if (application) - application->process_events(); - } - *quit = g_win32_quit; + *quit = g_win32_quit; if (g_win32_resized) { diff --git a/ui/drivers/win32/ui_win32_application.c b/ui/drivers/win32/ui_win32_application.c index 525814d73c..1dc19502eb 100644 --- a/ui/drivers/win32/ui_win32_application.c +++ b/ui/drivers/win32/ui_win32_application.c @@ -36,7 +36,8 @@ static bool ui_application_win32_pending_events(void) static void ui_application_win32_process_events(void) { - while (ui_application_win32_pending_events()) + MSG msg; + while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { MSG msg;