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.
This commit is contained in:
Philosoph228 2025-04-02 11:37:55 +05:00
parent b1910a45be
commit 607af63b08
No known key found for this signature in database
GPG Key ID: 02FA07138D16BF76

View File

@ -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);