aboutsummaryrefslogtreecommitdiff
path: root/c/main.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-22 23:52:22 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-22 23:52:22 +0200
commit21e96c692595f204b91431a90123419e4a1780c4 (patch)
treefbd273dc24fa590626283dac09bc7671f0562d59 /c/main.cpp
parentc1bbba366067f27881195f74cee5d063d1b270b0 (diff)
downloadEpisodeBrowser-21e96c692595f204b91431a90123419e4a1780c4.tar.gz
Cache GetSystemMetrics values with variable template.
The variable template could be generalized like this: template <auto F, auto... A> const auto cache = F(A...); and instantiated like: cache<GetSystemMetrics, SM_CXVSCROLL> It would still be limited to constant function arguments, which usually isn't a problem for GetSystemMetrics, but might be for other functions.
Diffstat (limited to 'c/main.cpp')
-rw-r--r--c/main.cpp3
1 files changed, 0 insertions, 3 deletions
diff --git a/c/main.cpp b/c/main.cpp
index 5a33405..c04890d 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -18,7 +18,6 @@ int g_bThread;
/* Looked-up constants. */
int g_bThemes;
-int g_cxVScroll;
int g_iDPI = 96;
/* Fonts. */
@@ -166,8 +165,6 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR
g_hWnd = (HWND)wParam;
/* Look up constants. */
- g_cxVScroll = GetSystemMetrics(SM_CXVSCROLL);
-
if (auto opLib = maybe_make<Library>(TEXT("User32.dll")))
if (auto GetDpiForWindow = opLib->GetProcAddress<UINT(HWND)>("GetDpiForWindow"))
g_iDPI = GetDpiForWindow(g_hWnd);