From 331420a4c787f21864abb836fe2d6bcbc6bda816 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 06 Aug 2021 08:45:44 -0400 Subject: tk: Implement focus switching --- (limited to 'src/tk/text.c') diff --git a/src/tk/text.c b/src/tk/text.c index 6bac6e7..052beeb 100644 --- a/src/tk/text.c +++ b/src/tk/text.c @@ -139,8 +139,6 @@ _mftk_text_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y) t->color->r, t->color->g, t->color->b, t->color->a) < 0 || SDL_RenderDrawLine(renderer, - x + cur_x, y + t->y, x + cur_x, y + t->h) < 0 || - SDL_RenderDrawLine(renderer, x, y + w->h, x + w->w, y + w->h) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't render widget: %s", @@ -148,6 +146,14 @@ _mftk_text_render(struct mftk_widget *w, SDL_Renderer *renderer, int x, int y) free(val); return -1; } + if (w->focused == SDL_TRUE && SDL_RenderDrawLine(renderer, + x + cur_x, y + t->y, x + cur_x, y + t->h) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Couldn't render widget: %s", + SDL_GetError()); + free(val); + return -1; + } free(val); return 0; -- cgit v0.9.1