src/video/SDL_video.c
changeset 5373 02007fd16991
parent 5306 cf3cd833dcd3
child 5375 16877f74123c
equal deleted inserted replaced
5372:a244ea780baa 5373:02007fd16991
   886     display->current_mode = display_mode;
   886     display->current_mode = display_mode;
   887     return 0;
   887     return 0;
   888 }
   888 }
   889 
   889 
   890 int
   890 int
   891 SDLCALL SDL_GetWindowDisplay(SDL_Window * window)
   891 SDL_GetWindowDisplay(SDL_Window * window)
   892 {
   892 {
   893     int displayIndex;
   893     int displayIndex;
   894     int i, dist;
   894     int i, dist;
   895     int closest = -1;
   895     int closest = -1;
   896     int closest_dist = 0x7FFFFFFF;
   896     int closest_dist = 0x7FFFFFFF;
   943 }
   943 }
   944 
   944 
   945 SDL_VideoDisplay *
   945 SDL_VideoDisplay *
   946 SDL_GetDisplayForWindow(SDL_Window *window)
   946 SDL_GetDisplayForWindow(SDL_Window *window)
   947 {
   947 {
   948     return &_this->displays[SDL_GetWindowDisplay(window)];
   948     int displayIndex = SDL_GetWindowDisplay(window);
       
   949     if (displayIndex >= 0) {
       
   950         return &_this->displays[displayIndex];
       
   951     } else {
       
   952         return NULL;
       
   953     }
   949 }
   954 }
   950 
   955 
   951 int
   956 int
   952 SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode)
   957 SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode)
   953 {
   958 {