Window move events have the same problem as size events on Windows
authorSam Lantinga
Wed, 19 Jan 2011 16:02:15 -0800
changeset 50428c39b82dc7b0
parent 5041 3ce345cc46f8
child 5043 da347bfed240
Window move events have the same problem as size events on Windows
src/events/SDL_windowevents.c
     1.1 --- a/src/events/SDL_windowevents.c	Wed Jan 19 15:28:01 2011 -0800
     1.2 +++ b/src/events/SDL_windowevents.c	Wed Jan 19 16:02:15 2011 -0800
     1.3 @@ -43,6 +43,20 @@
     1.4      return 1;
     1.5  }
     1.6  
     1.7 +static int
     1.8 +RemovePendingMoveEvents(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_MOVED &&
    1.14 +        event->window.windowID == new_event->window.windowID) {
    1.15 +        /* We're about to post a new move event, drop the old one */
    1.16 +        return 0;
    1.17 +    }
    1.18 +    return 1;
    1.19 +}
    1.20 +
    1.21  int
    1.22  SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
    1.23                      int data2)
    1.24 @@ -156,6 +170,9 @@
    1.25          if (windowevent == SDL_WINDOWEVENT_RESIZED) {
    1.26              SDL_FilterEvents(RemovePendingSizeEvents, &event);
    1.27          }
    1.28 +        if (windowevent == SDL_WINDOWEVENT_MOVED) {
    1.29 +            SDL_FilterEvents(RemovePendingMoveEvents, &event);
    1.30 +        }
    1.31  
    1.32          posted = (SDL_PushEvent(&event) > 0);
    1.33      }