summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-07 22:10:34 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-07 22:10:34 +0300
commite02ffdc898096a9cfeba3bf56b1a1bf37aa5642e (patch)
tree1e612744f7863efa39061da912dfae01d93078ab /src/ui/window.c
parent291e0761ed230bca612fe5e6f66f1a0e86d8d437 (diff)
Window: Only draw widgets after window exposed
No point in wasting time drawing anything before the window is actually visible. Should test this is different platforms, though...
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 14eb6ac1..4607b44c 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1926,25 +1926,27 @@ void draw_Window(iWindow *d) {
1926 } 1926 }
1927 /* Draw widgets. */ 1927 /* Draw widgets. */
1928 d->frameTime = SDL_GetTicks(); 1928 d->frameTime = SDL_GetTicks();
1929 draw_Widget(d->root); 1929 if (isExposed_Window(d)) {
1930 draw_Widget(d->root);
1930#if defined (LAGRANGE_CUSTOM_FRAME) 1931#if defined (LAGRANGE_CUSTOM_FRAME)
1931 /* App icon. */ 1932 /* App icon. */
1932 const iWidget *appIcon = findChild_Widget(d->root, "winbar.icon"); 1933 const iWidget *appIcon = findChild_Widget(d->root, "winbar.icon");
1933 if (isVisible_Widget(appIcon)) { 1934 if (isVisible_Widget(appIcon)) {
1934 const int size = appIconSize_(); 1935 const int size = appIconSize_();
1935 const iRect rect = bounds_Widget(appIcon); 1936 const iRect rect = bounds_Widget(appIcon);
1936 const iInt2 mid = mid_Rect(rect); 1937 const iInt2 mid = mid_Rect(rect);
1937 const iBool isLight = isLight_ColorTheme(colorTheme_App()); 1938 const iBool isLight = isLight_ColorTheme(colorTheme_App());
1938 iColor iconColor = get_Color(gotFocus || isLight ? white_ColorId : uiAnnotation_ColorId); 1939 iColor iconColor = get_Color(gotFocus || isLight ? white_ColorId : uiAnnotation_ColorId);
1939 SDL_SetTextureColorMod(d->appIcon, iconColor.r, iconColor.g, iconColor.b); 1940 SDL_SetTextureColorMod(d->appIcon, iconColor.r, iconColor.g, iconColor.b);
1940 SDL_SetTextureAlphaMod(d->appIcon, gotFocus || !isLight ? 255 : 92); 1941 SDL_SetTextureAlphaMod(d->appIcon, gotFocus || !isLight ? 255 : 92);
1941 SDL_RenderCopy( 1942 SDL_RenderCopy(
1942 d->render, 1943 d->render,
1943 d->appIcon, 1944 d->appIcon,
1944 NULL, 1945 NULL,
1945 &(SDL_Rect){ left_Rect(rect) + gap_UI * 1.25f, mid.y - size / 2, size, size }); 1946 &(SDL_Rect){ left_Rect(rect) + gap_UI * 1.25f, mid.y - size / 2, size, size });
1946 } 1947 }
1947#endif 1948#endif
1949 }
1948#if 0 1950#if 0
1949 /* Text cache debugging. */ { 1951 /* Text cache debugging. */ {
1950 SDL_Texture *cache = glyphCache_Text(); 1952 SDL_Texture *cache = glyphCache_Text();