From de9f5415b368f03d2ce375a61fd41b3cb19dd5a6 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Mon, 13 Aug 2018 12:52:52 -0400 Subject: [PATCH] Filter both SIZE_CHANGED and RESIZED on any SIZE_CHANGED --- src/events/SDL_windowevents.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index a62a2ce61..167084109 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -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);