From 607af63b0808cb033ed0d45f68e0cbebaf5e9440 Mon Sep 17 00:00:00 2001 From: Philosoph228 Date: Wed, 2 Apr 2025 11:37:55 +0500 Subject: [PATCH] Change HWND_DESKTOP to NULL in GetDC() calls At first I liked the idea to use something more semantic to pass as `HWND` to get the screen device context. And there is a HWND_DESKTOP macro which just a simple alias to NULL, but it is actually designed for CreateWindow and naming isn't clear enough. It may confuse someone who reading code that we're trying to get not the screen dc, but that desktop window dc itself. So I won't stand out let it be NULL as that commonly used. --- renderers/win32_gdi/clay_renderer_gdi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/renderers/win32_gdi/clay_renderer_gdi.c b/renderers/win32_gdi/clay_renderer_gdi.c index cc77c11..e235d91 100644 --- a/renderers/win32_gdi/clay_renderer_gdi.c +++ b/renderers/win32_gdi/clay_renderer_gdi.c @@ -499,7 +499,7 @@ static inline Clay_Dimensions Clay_Win32_MeasureText(Clay_StringSlice text, Clay if (hFont != NULL) { - HDC hScreenDC = GetDC(HWND_DESKTOP); + HDC hScreenDC = GetDC(NULL); HDC hTempDC = CreateCompatibleDC(hScreenDC); if (hTempDC != NULL) @@ -560,7 +560,7 @@ HFONT Clay_Win32_SimpleCreateFont(const char* filePath, const char* family, int // If negative, treat height as Pt rather than pixels if (height < 0) { // Get the screen DPI - HDC hScreenDC = GetDC(HWND_DESKTOP); + HDC hScreenDC = GetDC(NULL); int iScreenDPI = GetDeviceCaps(hScreenDC, LOGPIXELSY); ReleaseDC(HWND_DESKTOP, hScreenDC);