mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Fixed bug 3030 - SDL_RecreateWindow fails to restore title, icon, etc.
Adam M. It loses the title and icon when window recreation fails. For instance, this may happen when trying to create an OpenGL ES window on a system that doesn't support it. But at that point, the title and icon have already been lost.
This commit is contained in:
parent
ded3a16e72
commit
b7aa856c8f
@ -1388,8 +1388,6 @@ SDL_CreateWindowFrom(const void *data)
|
|||||||
int
|
int
|
||||||
SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
||||||
{
|
{
|
||||||
char *title = window->title;
|
|
||||||
SDL_Surface *icon = window->icon;
|
|
||||||
SDL_bool loaded_opengl = SDL_FALSE;
|
SDL_bool loaded_opengl = SDL_FALSE;
|
||||||
|
|
||||||
if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
|
if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
|
||||||
@ -1429,8 +1427,6 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window->title = NULL;
|
|
||||||
window->icon = NULL;
|
|
||||||
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
|
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
|
||||||
window->last_fullscreen_flags = window->flags;
|
window->last_fullscreen_flags = window->flags;
|
||||||
window->is_destroying = SDL_FALSE;
|
window->is_destroying = SDL_FALSE;
|
||||||
@ -1444,17 +1440,17 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & SDL_WINDOW_FOREIGN) {
|
if (flags & SDL_WINDOW_FOREIGN) {
|
||||||
window->flags |= SDL_WINDOW_FOREIGN;
|
window->flags |= SDL_WINDOW_FOREIGN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title) {
|
if (_this->SetWindowTitle && window->title) {
|
||||||
SDL_SetWindowTitle(window, title);
|
_this->SetWindowTitle(_this, window);
|
||||||
SDL_free(title);
|
|
||||||
}
|
}
|
||||||
if (icon) {
|
|
||||||
SDL_SetWindowIcon(window, icon);
|
if (_this->SetWindowIcon && window->icon) {
|
||||||
SDL_FreeSurface(icon);
|
_this->SetWindowIcon(_this, window, window->icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->hit_test) {
|
if (window->hit_test) {
|
||||||
|
Loading…
Reference in New Issue
Block a user