src/events/SDL_windowevents.c
changeset 3685 64ce267332c6
parent 3573 41cd18e05965
child 3697 f7b03b6838cb
equal deleted inserted replaced
3684:cc564f08884f 3685:64ce267332c6
    42     }
    42     }
    43     return 1;
    43     return 1;
    44 }
    44 }
    45 
    45 
    46 int
    46 int
    47 SDL_SendWindowEvent(SDL_WindowID windowID, Uint8 windowevent, int data1,
    47 SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1,
    48                     int data2)
    48                     int data2)
    49 {
    49 {
    50     int posted;
    50     int posted;
    51     SDL_Window *window;
       
    52 
    51 
    53     window = SDL_GetWindowFromID(windowID);
       
    54     if (!window) {
    52     if (!window) {
    55         return 0;
    53         return 0;
    56     }
    54     }
    57     switch (windowevent) {
    55     switch (windowevent) {
    58     case SDL_WINDOWEVENT_SHOWN:
    56     case SDL_WINDOWEVENT_SHOWN:
   150         SDL_Event event;
   148         SDL_Event event;
   151         event.type = SDL_WINDOWEVENT;
   149         event.type = SDL_WINDOWEVENT;
   152         event.window.event = windowevent;
   150         event.window.event = windowevent;
   153         event.window.data1 = data1;
   151         event.window.data1 = data1;
   154         event.window.data2 = data2;
   152         event.window.data2 = data2;
   155         event.window.windowID = windowID;
   153         event.window.windowID = window->id;
   156 
   154 
   157         /* Fixes queue overflow with resize events that aren't processed */
   155         /* Fixes queue overflow with resize events that aren't processed */
   158         if (windowevent == SDL_WINDOWEVENT_RESIZED) {
   156         if (windowevent == SDL_WINDOWEVENT_RESIZED) {
   159             SDL_FilterEvents(RemovePendingSizeEvents, &event);
   157             SDL_FilterEvents(RemovePendingSizeEvents, &event);
   160         }
   158         }