(Win32) Implement application process events

This commit is contained in:
twinaphex 2016-06-07 17:28:51 +02:00
parent ba962d5dda
commit f4c3a41f84
5 changed files with 27 additions and 10 deletions

View File

@ -537,13 +537,9 @@ void win32_show_cursor(bool state)
void win32_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height)
{
#ifndef _XBOX
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
const ui_application_t *application = ui_companion_driver_get_application_ptr();
if (application)
application->process_events();
#endif
*quit = g_quit;

View File

@ -63,9 +63,9 @@ static INLINE int compat_ctz(unsigned x)
#elif _MSC_VER >= 1400
static INLINE int compat_ctz(unsigned x)
{
int r = 0;
_BitScanReverse(&r, x);
return r;
unsigned long r = 0;
_BitScanReverse((unsigned long*)&r, x);
return (int)r;
}
#else
/* Only checks at nibble granularity,

View File

@ -18,7 +18,12 @@
#include <sys/types.h>
#include <string.h>
#include <time.h>
#ifdef _WIN32
#include <direct.h>
#else
#include <unistd.h>
#endif
#include <errno.h>
#include <lists/string_list.h>

View File

@ -19,10 +19,24 @@
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include "../../ui_companion_driver.h"
static void ui_application_win32_process_events(void)
{
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
MSG msg2;
if (PeekMessage(&msg2, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg2);
DispatchMessage (&msg2);
}
}
}
const ui_application_t ui_application_win32 = {

View File

@ -20,6 +20,8 @@
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#ifdef _MSC_VER
#pragma comment( lib, "comctl32" )
#endif