src/events/SDL_windowevents.c
changeset 5042 8c39b82dc7b0
parent 4429 faa9fc8e7f67
child 5113 686d795b1b29
equal deleted inserted replaced
5041:3ce345cc46f8 5042:8c39b82dc7b0
    36 
    36 
    37     if (event->type == SDL_WINDOWEVENT &&
    37     if (event->type == SDL_WINDOWEVENT &&
    38         event->window.event == SDL_WINDOWEVENT_RESIZED &&
    38         event->window.event == SDL_WINDOWEVENT_RESIZED &&
    39         event->window.windowID == new_event->window.windowID) {
    39         event->window.windowID == new_event->window.windowID) {
    40         /* We're about to post a new size event, drop the old one */
    40         /* We're about to post a new size event, drop the old one */
       
    41         return 0;
       
    42     }
       
    43     return 1;
       
    44 }
       
    45 
       
    46 static int
       
    47 RemovePendingMoveEvents(void * userdata, SDL_Event *event)
       
    48 {
       
    49     SDL_Event *new_event = (SDL_Event *)userdata;
       
    50 
       
    51     if (event->type == SDL_WINDOWEVENT &&
       
    52         event->window.event == SDL_WINDOWEVENT_MOVED &&
       
    53         event->window.windowID == new_event->window.windowID) {
       
    54         /* We're about to post a new move event, drop the old one */
    41         return 0;
    55         return 0;
    42     }
    56     }
    43     return 1;
    57     return 1;
    44 }
    58 }
    45 
    59 
   154 
   168 
   155         /* Fixes queue overflow with resize events that aren't processed */
   169         /* Fixes queue overflow with resize events that aren't processed */
   156         if (windowevent == SDL_WINDOWEVENT_RESIZED) {
   170         if (windowevent == SDL_WINDOWEVENT_RESIZED) {
   157             SDL_FilterEvents(RemovePendingSizeEvents, &event);
   171             SDL_FilterEvents(RemovePendingSizeEvents, &event);
   158         }
   172         }
       
   173         if (windowevent == SDL_WINDOWEVENT_MOVED) {
       
   174             SDL_FilterEvents(RemovePendingMoveEvents, &event);
       
   175         }
   159 
   176 
   160         posted = (SDL_PushEvent(&event) > 0);
   177         posted = (SDL_PushEvent(&event) > 0);
   161     }
   178     }
   162     return (posted);
   179     return (posted);
   163 }
   180 }