Instead of querying the registry, just calls `GetDpiForWindow`.
Winecfg's DPI slider sets `Control Panel\Desktop\LogPixels`. See `programs/winecfg/x11drvdlg.c` Notepad queries `Software\Fonts\LogPixels`, and so doesn't pick up on the change.
I don't believe this changes how Notepad looks to the user, but it is necessary for a further MR I'm working on that adds more information to the status bar.
From: "petrak@" petrathekat@gmail.com
Instead of querying the registry, just calls `GetDpiForWindow`.
Winecfg's DPI slider sets `Control Panel\Desktop\LogPixels`. See `programs/winecfg/x11drvdlg.c` Notepad queries `Software\Fonts\LogPixels`, and so doesn't pick up on the change.
I don't believe this changes how Notepad looks to the user, but it is necessary for a further MR I'm working on that adds more information to the status bar. --- programs/notepad/main.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/programs/notepad/main.c b/programs/notepad/main.c index 829cd7af33b..f281f41be32 100644 --- a/programs/notepad/main.c +++ b/programs/notepad/main.c @@ -83,29 +83,10 @@ VOID SetFileNameAndEncoding(LPCWSTR szFileName, ENCODING enc)
/****************************************************************************** * get_dpi - * - * Get the dpi from registry HKCC\Software\Fonts\LogPixels. */ DWORD get_dpi(void) { - static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\','F','o','n','t','s','\0'}; - static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'}; - DWORD dpi = 96; - HKEY hkey; - - if (RegOpenKeyW(HKEY_CURRENT_CONFIG, dpi_key_name, &hkey) == ERROR_SUCCESS) - { - DWORD type, size, new_dpi; - - size = sizeof(new_dpi); - if(RegQueryValueExW(hkey, dpi_value_name, NULL, &type, (LPBYTE)&new_dpi, &size) == ERROR_SUCCESS) - { - if(type == REG_DWORD && new_dpi != 0) - dpi = new_dpi; - } - RegCloseKey(hkey); - } - return dpi; + return GetDpiForWindow(Globals.hMainWnd); }
void UpdateStatusBar(void)
/add_reviewer @madewokherd
This merge request was approved by Esme Povirk.
@petrathekat Could you also use your real name for your commit itself? `From: "petrak@" petrathekat@gmail.com`