Window move events have the same problem as size events on Windows
This commit is contained in:
parent
f69bce6999
commit
1e7f74dc1b
1 changed files with 17 additions and 0 deletions
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue