mirror of https://github.com/encounter/SDL.git
Make sure we don't stay in the windows event loop forever if there are lots of events coming in quickly.
This commit is contained in:
parent
441f7d8d63
commit
5c5770ad44
|
@ -25,6 +25,7 @@
|
|||
#include "SDL_windowsvideo.h"
|
||||
#include "SDL_windowsshape.h"
|
||||
#include "SDL_syswm.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_vkeys.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#include "../../events/SDL_touch_c.h"
|
||||
|
@ -860,10 +861,17 @@ WIN_PumpEvents(_THIS)
|
|||
{
|
||||
const Uint8 *keystate;
|
||||
MSG msg;
|
||||
DWORD start_ticks = GetTickCount();
|
||||
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
/* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage( &msg );
|
||||
|
||||
/* Make sure we don't busy loop here forever if there are lots of events coming in */
|
||||
if (SDL_TICKS_PASSED(msg.time, start_ticks)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Windows loses a shift KEYUP event when you have both pressed at once and let go of one.
|
||||
|
|
Loading…
Reference in New Issue