Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Window move events have the same problem as size events on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 20, 2011
1 parent d9508b1 commit 5704341
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/events/SDL_windowevents.c
Expand Up @@ -43,6 +43,20 @@ RemovePendingSizeEvents(void * userdata, SDL_Event *event)
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)
Expand Down Expand Up @@ -156,6 +170,9 @@ SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
if (windowevent == SDL_WINDOWEVENT_RESIZED) {
SDL_FilterEvents(RemovePendingSizeEvents, &event);
}
if (windowevent == SDL_WINDOWEVENT_MOVED) {
SDL_FilterEvents(RemovePendingMoveEvents, &event);
}

posted = (SDL_PushEvent(&event) > 0);
}
Expand Down

0 comments on commit 5704341

Please sign in to comment.