mirror of https://github.com/encounter/SDL.git
Filter both SIZE_CHANGED and RESIZED on any SIZE_CHANGED
This commit is contained in:
parent
95579f5f19
commit
de9f5415b3
|
@ -28,26 +28,13 @@
|
|||
|
||||
|
||||
static int SDLCALL
|
||||
RemovePendingResizedEvents(void * userdata, SDL_Event *event)
|
||||
RemovePendingSizeChangedAndResizedEvents(void * userdata, SDL_Event *event)
|
||||
{
|
||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||
|
||||
if (event->type == SDL_WINDOWEVENT &&
|
||||
event->window.event == SDL_WINDOWEVENT_RESIZED &&
|
||||
event->window.windowID == new_event->window.windowID) {
|
||||
/* We're about to post a new size event, drop the old one */
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int SDLCALL
|
||||
RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event)
|
||||
{
|
||||
SDL_Event *new_event = (SDL_Event *)userdata;
|
||||
|
||||
if (event->type == SDL_WINDOWEVENT &&
|
||||
event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED &&
|
||||
(event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED ||
|
||||
event->window.event == SDL_WINDOWEVENT_RESIZED) &&
|
||||
event->window.windowID == new_event->window.windowID) {
|
||||
/* We're about to post a new size event, drop the old one */
|
||||
return 0;
|
||||
|
@ -199,11 +186,8 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
|
|||
event.window.windowID = window->id;
|
||||
|
||||
/* Fixes queue overflow with resize events that aren't processed */
|
||||
if (windowevent == SDL_WINDOWEVENT_RESIZED) {
|
||||
SDL_FilterEvents(RemovePendingResizedEvents, &event);
|
||||
}
|
||||
if (windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) {
|
||||
SDL_FilterEvents(RemovePendingSizeChangedEvents, &event);
|
||||
SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &event);
|
||||
}
|
||||
if (windowevent == SDL_WINDOWEVENT_MOVED) {
|
||||
SDL_FilterEvents(RemovePendingMoveEvents, &event);
|
||||
|
|
Loading…
Reference in New Issue