mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 06:34:35 +00:00
Early out if setting a duplicate window title
Setting the window title is an expensive windowing operation, so short circuit it if possible.
This commit is contained in:
parent
56e2955b6a
commit
1ea99bc904
1 changed files with 8 additions and 1 deletions
|
|
@ -2767,9 +2767,16 @@ bool SDL_SetWindowTitle(SDL_Window *window, const char *title)
|
|||
if (title == window->title) {
|
||||
return true;
|
||||
}
|
||||
if (!title) {
|
||||
title = "";
|
||||
}
|
||||
if (window->title && SDL_strcmp(title, window->title) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
SDL_free(window->title);
|
||||
|
||||
window->title = SDL_strdup(title ? title : "");
|
||||
window->title = SDL_strdup(title);
|
||||
|
||||
if (_this->SetWindowTitle) {
|
||||
_this->SetWindowTitle(_this, window);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue