Fixed bug 3161 - SDL_WINDOWEVENT_EXPOSED event possible queue overflow
Marcel Bakker Observed when resizing or moving a window in Windows 7. Depending on how you resize/move your window , you may receive none or a lot of SDL_WINDOWEVENT_EXPOSED events , at the moment you release the mouse button. Maybe add this event to an already existing list of overflow candidates ?
parent
614cb35a4d
commit
13dd2ccda8
|
@ -70,6 +70,20 @@ RemovePendingMoveEvents(void * userdata, SDL_Event *event)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
RemovePendingExposedEvents(void * userdata, SDL_Event *event)
|
||||||
|
{
|
||||||
|
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||||
|
|
||||||
|
if (event->type == SDL_WINDOWEVENT &&
|
||||||
|
event->window.event == SDL_WINDOWEVENT_EXPOSED &&
|
||||||
|
event->window.windowID == new_event->window.windowID) {
|
||||||
|
/* We're about to post a new exposed event, drop the old one */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
|
SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
|
||||||
int data2)
|
int data2)
|
||||||
|
@ -195,7 +209,9 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
|
||||||
if (windowevent == SDL_WINDOWEVENT_MOVED) {
|
if (windowevent == SDL_WINDOWEVENT_MOVED) {
|
||||||
SDL_FilterEvents(RemovePendingMoveEvents, &event);
|
SDL_FilterEvents(RemovePendingMoveEvents, &event);
|
||||||
}
|
}
|
||||||
|
if (windowevent == SDL_WINDOWEVENT_EXPOSED) {
|
||||||
|
SDL_FilterEvents(RemovePendingExposedEvents, &event);
|
||||||
|
}
|
||||||
posted = (SDL_PushEvent(&event) > 0);
|
posted = (SDL_PushEvent(&event) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue