[Ttssh2-commit] [8760] GetSystemMetricsForDpi() を直接利用しないよう修正

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2020年 5月 2日 (土) 22:24:45 JST


Revision: 8760
          https://osdn.net/projects/ttssh2/scm/svn/commits/8760
Author:   zmatsuo
Date:     2020-05-02 22:24:44 +0900 (Sat, 02 May 2020)
Log Message:
-----------
GetSystemMetricsForDpi() を直接利用しないよう修正

- r8758

Revision Links:
--------------
    https://osdn.net/projects/ttssh2/scm/svn/commits/8758

Modified Paths:
--------------
    trunk/teraterm/common/compat_win.cpp
    trunk/teraterm/common/compat_win.h
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/compat_win.cpp
===================================================================
--- trunk/teraterm/common/compat_win.cpp	2020-05-02 13:24:34 UTC (rev 8759)
+++ trunk/teraterm/common/compat_win.cpp	2020-05-02 13:24:44 UTC (rev 8760)
@@ -70,6 +70,9 @@
 DWORD (WINAPI *pGetCurrentDirectoryW)(DWORD nBufferLength, LPWSTR lpBuffer);
 BOOL (WINAPI *pSetCurrentDirectoryW)(LPCWSTR lpPathName);
 
+// user32
+int (WINAPI *pGetSystemMetricsForDpi)(int nIndex, UINT dpi);
+
 // kernel32.dll
 DWORD (WINAPI *pGetFileAttributesW)(LPCWSTR lpFileName);
 void (WINAPI *pOutputDebugStringW)(LPCWSTR lpOutputString);
@@ -83,7 +86,7 @@
 							   DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory,
 							   LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
 
-// gdi32.lib
+// gdi32
 int (WINAPI *pAddFontResourceExW)(LPCWSTR name, DWORD fl, PVOID res);
 BOOL (WINAPI *pRemoveFontResourceExW)(LPCWSTR name, DWORD fl, PVOID pdv);
 
@@ -195,6 +198,7 @@
 	{ "MonitorFromPoint", (void **)&pMonitorFromPoint },
 	{ "MonitorFromRect", (void **)&pMonitorFromRect },
 	{ "GetMonitorInfoA", (void **)&pGetMonitorInfoA },
+	{ "GetSystemMetricsForDpi", (void **)&pGetSystemMetricsForDpi },
 	{},
 };
 

Modified: trunk/teraterm/common/compat_win.h
===================================================================
--- trunk/teraterm/common/compat_win.h	2020-05-02 13:24:34 UTC (rev 8759)
+++ trunk/teraterm/common/compat_win.h	2020-05-02 13:24:44 UTC (rev 8760)
@@ -134,6 +134,7 @@
 									  LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles,
 									  DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory,
 									  LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
+extern int (WINAPI *pGetSystemMetricsForDpi)(int  nIndex, UINT dpi);
 
 // shlobj_core.h
 extern LPITEMIDLIST (WINAPI *pSHBrowseForFolderW)(LPBROWSEINFOW lpbi);

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2020-05-02 13:24:34 UTC (rev 8759)
+++ trunk/teraterm/teraterm/vtwin.cpp	2020-05-02 13:24:44 UTC (rev 8760)
@@ -6268,17 +6268,18 @@
 		const DWORD Style = (DWORD)::GetWindowLongPtr(m_hWnd, GWL_STYLE);
 		const DWORD ExStyle = (DWORD)::GetWindowLongPtr(m_hWnd, GWL_EXSTYLE);
 		const BOOL bMenu = (ts.PopupMenu != 0) ? FALSE : TRUE;
-		{	// \x83X\x83N\x83\x8D\x81[\x83\x8B\x83o\x81[\x82\xAA\x95\\x8E\xA6\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x8Fꍇ\x82́A
+		if (pGetSystemMetricsForDpi != NULL) {
+			// \x83X\x83N\x83\x8D\x81[\x83\x8B\x83o\x81[\x82\xAA\x95\\x8E\xA6\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x8Fꍇ\x82́A
 			// \x83X\x83N\x83\x8A\x81[\x83\x93\x83T\x83C\x83Y(\x83N\x83\x89\x83C\x83A\x83\x93\x83g\x83G\x83\x8A\x83A\x82̃T\x83C\x83Y)\x82ɒlj\xC1\x82\xB7\x82\xE9
 			int min_pos;
 			int max_pos;
 			GetScrollRange(m_hWnd, SB_VERT, &min_pos, &max_pos);
 			if (min_pos != max_pos) {
-				ScreenWidth += GetSystemMetricsForDpi(SM_CXVSCROLL, NewDPI);
+				ScreenWidth += pGetSystemMetricsForDpi(SM_CXVSCROLL, NewDPI);
 			}
 			GetScrollRange(m_hWnd, SB_HORZ, &min_pos, &max_pos);
 			if (min_pos != max_pos) {
-				ScreenHeight += GetSystemMetricsForDpi(SM_CXHSCROLL, NewDPI);
+				ScreenHeight += pGetSystemMetricsForDpi(SM_CXHSCROLL, NewDPI);
 			}
 		}
 		RECT Rect = {0, 0, ScreenWidth, ScreenHeight};


Ttssh2-commit メーリングリストの案内
Back to archive index