diff --git a/src/video/toaru/SDL_toaruevents.c b/src/video/toaru/SDL_toaruevents.c index 4ed408f..2a76285 100644 --- a/src/video/toaru/SDL_toaruevents.c +++ b/src/video/toaru/SDL_toaruevents.c @@ -57,6 +57,7 @@ void TOARU_PumpEvents(_THIS) { if (window) { window->focused = evt->left; } + this->hidden->redraw_borders = 1; SDL_PrivateAppActive(0, evt->left); break; } diff --git a/src/video/toaru/SDL_toaruvideo.c b/src/video/toaru/SDL_toaruvideo.c index 3905b18..883f952 100644 --- a/src/video/toaru/SDL_toaruvideo.c +++ b/src/video/toaru/SDL_toaruvideo.c @@ -170,6 +170,7 @@ SDL_Surface *TOARU_SetVideoMode(_THIS, SDL_Surface *current, if (this->hidden->bordered) { this->hidden->buffer = realloc(this->hidden->buffer, sizeof(uint32_t) * width * height); + this->hidden->redraw_borders = 1; } } else { @@ -188,6 +189,7 @@ SDL_Surface *TOARU_SetVideoMode(_THIS, SDL_Surface *current, this->hidden->x_w = decor_width(); this->hidden->o_h = decor_top_height; this->hidden->o_w = decor_left_width; + this->hidden->redraw_borders = 1; } fprintf(stderr, "Initializing window %dx%d (%d bpp)\n", width, height, bpp); @@ -249,10 +251,13 @@ static void TOARU_UpdateRects(_THIS, int numrects, SDL_Rect *rects) int x = 0; if (this->hidden->bordered) { gfx_context_t * ctx = (gfx_context_t *)this->hidden->ctx; - if (this->hidden->title) { - render_decorations(this->hidden->window, this->hidden->ctx, this->hidden->title); - } else { - render_decorations(this->hidden->window, this->hidden->ctx, "[SDL App]"); + if (this->hidden->redraw_borders) { + if (this->hidden->title) { + render_decorations(this->hidden->window, this->hidden->ctx, this->hidden->title); + } else { + render_decorations(this->hidden->window, this->hidden->ctx, "[SDL App]"); + } + this->hidden->redraw_borders = 0; } flip(this->hidden->ctx); for (y = 0; y < this->hidden->h; ++y) { @@ -291,5 +296,6 @@ static void TOARU_SetCaption(_THIS, const char *title, const char *icon) { free(this->hidden->title); } this->hidden->title = strdup(title); + this->hidden->redraw_borders = 1; } diff --git a/src/video/toaru/SDL_toaruvideo.h b/src/video/toaru/SDL_toaruvideo.h index 976b17b..d383e54 100644 --- a/src/video/toaru/SDL_toaruvideo.h +++ b/src/video/toaru/SDL_toaruvideo.h @@ -41,6 +41,7 @@ struct SDL_PrivateVideoData { char * title; int x_w, x_h; int o_w, o_h; + int redraw_borders; }; #endif /* _SDL_nullvideo_h */