src/video/SDL_video.c
changeset 9776 952ff8a5076f
parent 9745 885b6b5c8426
child 9813 0652406e46c6
equal deleted inserted replaced
9775:8bd9e4e20d99 9776:952ff8a5076f
  1386 }
  1386 }
  1387 
  1387 
  1388 int
  1388 int
  1389 SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
  1389 SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
  1390 {
  1390 {
  1391     char *title = window->title;
       
  1392     SDL_Surface *icon = window->icon;
       
  1393     SDL_bool loaded_opengl = SDL_FALSE;
  1391     SDL_bool loaded_opengl = SDL_FALSE;
  1394 
  1392 
  1395     if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
  1393     if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
  1396         return SDL_SetError("No OpenGL support in video driver");
  1394         return SDL_SetError("No OpenGL support in video driver");
  1397     }
  1395     }
  1427         } else {
  1425         } else {
  1428             SDL_GL_UnloadLibrary();
  1426             SDL_GL_UnloadLibrary();
  1429         }
  1427         }
  1430     }
  1428     }
  1431 
  1429 
  1432     window->title = NULL;
       
  1433     window->icon = NULL;
       
  1434     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
  1430     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
  1435     window->last_fullscreen_flags = window->flags;
  1431     window->last_fullscreen_flags = window->flags;
  1436     window->is_destroying = SDL_FALSE;
  1432     window->is_destroying = SDL_FALSE;
  1437 
  1433 
  1438     if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) {
  1434     if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) {
  1442                 window->flags &= ~SDL_WINDOW_OPENGL;
  1438                 window->flags &= ~SDL_WINDOW_OPENGL;
  1443             }
  1439             }
  1444             return -1;
  1440             return -1;
  1445         }
  1441         }
  1446     }
  1442     }
       
  1443 
  1447     if (flags & SDL_WINDOW_FOREIGN) {
  1444     if (flags & SDL_WINDOW_FOREIGN) {
  1448         window->flags |= SDL_WINDOW_FOREIGN;
  1445         window->flags |= SDL_WINDOW_FOREIGN;
  1449     }
  1446     }
  1450 
  1447 
  1451     if (title) {
  1448     if (_this->SetWindowTitle && window->title) {
  1452         SDL_SetWindowTitle(window, title);
  1449         _this->SetWindowTitle(_this, window);
  1453         SDL_free(title);
  1450     }
  1454     }
  1451 
  1455     if (icon) {
  1452     if (_this->SetWindowIcon && window->icon) {
  1456         SDL_SetWindowIcon(window, icon);
  1453         _this->SetWindowIcon(_this, window, window->icon);
  1457         SDL_FreeSurface(icon);
       
  1458     }
  1454     }
  1459 
  1455 
  1460     if (window->hit_test) {
  1456     if (window->hit_test) {
  1461         _this->SetWindowHitTest(window, SDL_TRUE);
  1457         _this->SetWindowHitTest(window, SDL_TRUE);
  1462     }
  1458     }