Filter both SIZE_CHANGED and RESIZED on any SIZE_CHANGED
authorEthan Lee <flibitijibibo@flibitijibibo.com>
Mon, 13 Aug 2018 12:52:52 -0400
changeset 1227052dddda6fba7
parent 12269 754cd2042e21
child 12271 44a639b5f1af
Filter both SIZE_CHANGED and RESIZED on any SIZE_CHANGED
src/events/SDL_windowevents.c
     1.1 --- a/src/events/SDL_windowevents.c	Mon Oct 01 09:40:58 2018 -0700
     1.2 +++ b/src/events/SDL_windowevents.c	Mon Aug 13 12:52:52 2018 -0400
     1.3 @@ -28,26 +28,13 @@
     1.4  
     1.5  
     1.6  static int SDLCALL
     1.7 -RemovePendingResizedEvents(void * userdata, SDL_Event *event)
     1.8 +RemovePendingSizeChangedAndResizedEvents(void * userdata, SDL_Event *event)
     1.9  {
    1.10      SDL_Event *new_event = (SDL_Event *)userdata;
    1.11  
    1.12      if (event->type == SDL_WINDOWEVENT &&
    1.13 -        event->window.event == SDL_WINDOWEVENT_RESIZED &&
    1.14 -        event->window.windowID == new_event->window.windowID) {
    1.15 -        /* We're about to post a new size event, drop the old one */
    1.16 -        return 0;
    1.17 -    }
    1.18 -    return 1;
    1.19 -}
    1.20 -
    1.21 -static int SDLCALL
    1.22 -RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event)
    1.23 -{
    1.24 -    SDL_Event *new_event = (SDL_Event *)userdata;
    1.25 -
    1.26 -    if (event->type == SDL_WINDOWEVENT &&
    1.27 -        event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED &&
    1.28 +        (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED ||
    1.29 +         event->window.event == SDL_WINDOWEVENT_RESIZED) &&
    1.30          event->window.windowID == new_event->window.windowID) {
    1.31          /* We're about to post a new size event, drop the old one */
    1.32          return 0;
    1.33 @@ -199,11 +186,8 @@
    1.34          event.window.windowID = window->id;
    1.35  
    1.36          /* Fixes queue overflow with resize events that aren't processed */
    1.37 -        if (windowevent == SDL_WINDOWEVENT_RESIZED) {
    1.38 -            SDL_FilterEvents(RemovePendingResizedEvents, &event);
    1.39 -        }
    1.40          if (windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) {
    1.41 -            SDL_FilterEvents(RemovePendingSizeChangedEvents, &event);
    1.42 +            SDL_FilterEvents(RemovePendingSizeChangedAndResizedEvents, &event);
    1.43          }
    1.44          if (windowevent == SDL_WINDOWEVENT_MOVED) {
    1.45              SDL_FilterEvents(RemovePendingMoveEvents, &event);