From 4f98051cbe62171775f6b319400b6dc6c2841e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 1 Apr 2022 02:36:26 +0200 Subject: Clarify control flow in UpdateTheme. --- c/main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'c') diff --git a/c/main.c b/c/main.c index 6f317eb..eac223a 100644 --- a/c/main.c +++ b/c/main.c @@ -302,15 +302,19 @@ UpdateTheme() { int bThemeActive; extern HWND HElv, HDlv; - static int bTheming = -1; + static int bThemes = -1; - if (bTheming == -1) { + switch (bThemes) { + case -1: + { HMODULE hModule; hModule = LoadLibrary(TEXT("uxtheme.dll")); - bTheming = hModule && GetProcAddress(hModule,"SetWindowTheme"); + bThemes = hModule && GetProcAddress(hModule,"SetWindowTheme"); + break; + } + case 1: + bThemeActive = IsThemeActive(); + LvSetTheme(HElv, bThemeActive); + LvSetTheme(HDlv, bThemeActive); } - if (!bTheming) return; - bThemeActive = IsThemeActive(); - LvSetTheme(HElv, bThemeActive); - LvSetTheme(HDlv, bThemeActive); } -- cgit v1.2.3