src/events/SDL_windowevents.c
changeset 6512 4beb596ccfae
parent 6138 4c64952a58fb
child 6885 700f1b25f77f
     1.1 --- a/src/events/SDL_windowevents.c	Sat Sep 29 00:17:34 2012 -0700
     1.2 +++ b/src/events/SDL_windowevents.c	Sat Sep 29 01:10:53 2012 -0700
     1.3 @@ -29,13 +29,26 @@
     1.4  
     1.5  
     1.6  static int
     1.7 -RemovePendingSizeEvents(void * userdata, SDL_Event *event)
     1.8 +RemovePendingResizedEvents(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.event == SDL_WINDOWEVENT_SIZE_CHANGED) &&
    1.15 +        event->window.event == SDL_WINDOWEVENT_RESIZED &&
    1.16 +        event->window.windowID == new_event->window.windowID) {
    1.17 +        /* We're about to post a new size event, drop the old one */
    1.18 +        return 0;
    1.19 +    }
    1.20 +    return 1;
    1.21 +}
    1.22 +
    1.23 +static int
    1.24 +RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event)
    1.25 +{
    1.26 +    SDL_Event *new_event = (SDL_Event *)userdata;
    1.27 +
    1.28 +    if (event->type == SDL_WINDOWEVENT &&
    1.29 +        event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED &&
    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 @@ -169,9 +182,11 @@
    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 -            windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) {
    1.39 -            SDL_FilterEvents(RemovePendingSizeEvents, &event);
    1.40 +        if (windowevent == SDL_WINDOWEVENT_RESIZED) {
    1.41 +            SDL_FilterEvents(RemovePendingResizedEvents, &event);
    1.42 +        }
    1.43 +        if (windowevent == SDL_WINDOWEVENT_SIZE_CHANGED) {
    1.44 +            SDL_FilterEvents(RemovePendingSizeChangedEvents, &event);
    1.45          }
    1.46          if (windowevent == SDL_WINDOWEVENT_MOVED) {
    1.47              SDL_FilterEvents(RemovePendingMoveEvents, &event);