changeset 5042:8c39b82dc7b0

Window move events have the same problem as size events on Windows
author Sam Lantinga <slouken@libsdl.org>
date Wed, 19 Jan 2011 16:02:15 -0800
parents 3ce345cc46f8
children da347bfed240
files src/events/SDL_windowevents.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/events/SDL_windowevents.c	Wed Jan 19 15:28:01 2011 -0800
+++ b/src/events/SDL_windowevents.c	Wed Jan 19 16:02:15 2011 -0800
@@ -43,6 +43,20 @@
     return 1;
 }
 
+static int
+RemovePendingMoveEvents(void * userdata, SDL_Event *event)
+{
+    SDL_Event *new_event = (SDL_Event *)userdata;
+
+    if (event->type == SDL_WINDOWEVENT &&
+        event->window.event == SDL_WINDOWEVENT_MOVED &&
+        event->window.windowID == new_event->window.windowID) {
+        /* We're about to post a new move event, drop the old one */
+        return 0;
+    }
+    return 1;
+}
+
 int
 SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
                     int data2)
@@ -156,6 +170,9 @@
         if (windowevent == SDL_WINDOWEVENT_RESIZED) {
             SDL_FilterEvents(RemovePendingSizeEvents, &event);
         }
+        if (windowevent == SDL_WINDOWEVENT_MOVED) {
+            SDL_FilterEvents(RemovePendingMoveEvents, &event);
+        }
 
         posted = (SDL_PushEvent(&event) > 0);
     }