[Ttssh2-commit] [7715] terater.ini の DPIAware キーが "on" のとき高DPI有効とした

scmno****@osdn***** scmno****@osdn*****
2019年 5月 27日 (月) 23:59:59 JST


Revision: 7715
          https://osdn.net/projects/ttssh2/scm/svn/commits/7715
Author:   zmatsuo
Date:     2019-05-27 23:59:58 +0900 (Mon, 27 May 2019)
Log Message:
-----------
terater.ini の DPIAware キーが "on" のとき高DPI有効とした

- 変更前は DPIAware=1 のとき有効
- IsValidDpiAwarenessContext() APIを使ってDPI Aware設定できるかチェック

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/en/html/setup/teraterm-misc.html
    trunk/doc/ja/html/about/history.html
    trunk/doc/ja/html/setup/teraterm-misc.html
    trunk/teraterm/common/compat_win.cpp
    trunk/teraterm/common/compat_win.h
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/ttpmacro/ttmacro.cpp

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2019-05-27 13:23:19 UTC (rev 7714)
+++ trunk/doc/en/html/about/history.html	2019-05-27 14:59:58 UTC (rev 7715)
@@ -35,7 +35,7 @@
 <ul class="history">
   <li>Changes
     <ul>
-      <li>added support for <a href="../setup/teraterm-misc.html#HighDPI">High DPI</a> experimentally. The default setting is disabled. When DPIAware=1 is set in [Tera Term] of teraterm.ini file, this feature is enabled. However, this is only available for Windows 10 Version 1703 or later.</li>
+      <li>added support for <a href="../setup/teraterm-misc.html#HighDPI">High DPI</a> experimentally. The default setting is disabled. When DPIAware=on is set in [Tera Term] of teraterm.ini file, this feature is enabled. However, this is only available for Windows 10 Version 1703 or later.</li>
       <li>added support for configure the dialog font(<a href="../menu/setup-font.html">[Setup]/[Font])</a>. The font submenu is newly added. The default font is same as before.</li>
       <li>When the font file(TSPECIAL1.TTF) displaying ruled line is not installed, the file is loaded from same directory as ttermpro.exe.</li>
       <li>MACRO: Store <a href="../macro/command/exec.html">exec</a> command result to result variable.</li>

Modified: trunk/doc/en/html/setup/teraterm-misc.html
===================================================================
--- trunk/doc/en/html/setup/teraterm-misc.html	2019-05-27 13:23:19 UTC (rev 7714)
+++ trunk/doc/en/html/setup/teraterm-misc.html	2019-05-27 14:59:58 UTC (rev 7715)
@@ -413,13 +413,13 @@
 support for High DPI experimentally.
 <br>
 
-teraterm.ini\x82\xCC[Tera Term]\x83Z\x83N\x83V\x83\x87\x83\x93\x82\xC9DPIAware=1\x82Ƃ\xB7\x82\xE9\x82ƁA
+teraterm.ini\x82\xCC[Tera Term]\x83Z\x83N\x83V\x83\x87\x83\x93\x82\xC9DPIAware=on\x82Ƃ\xB7\x82\xE9\x82ƁA
 Per monitor DPI Aware \x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82Ƃ\xB5\x82ē\xAE\x8D삵\x82܂\xB7\x81B<br>
 \x82\xB1\x82̐ݒ\xE8\x82\xF0\x8Ds\x82\xED\x82Ȃ\xA2\x82ƁA\x8F]\x97\x88\x82Ɠ\xAF\x97l DPI Unaware \x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82Ƃ\xB5\x82ē\xAE\x8D삵\x82܂\xB7\x81B<br>
 \x8F\xAB\x97\x88\x93I\x82ɂ͂\xB1\x82̐ݒ\xE8\x82\xF0\x8EQ\x8FƂ\xB9\x82\xB8\x81A\x8E\xA9\x93\xAE\x82ō\x82DPI\x91Ή\x9E\x82ƂȂ\xE9\x97\\x92\xE8\x82ł\xB7\x81B<br>
 
 <pre>
-DPIAware=1
+DPIAware=on
 </pre>
 
 <p>

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2019-05-27 13:23:19 UTC (rev 7714)
+++ trunk/doc/ja/html/about/history.html	2019-05-27 14:59:58 UTC (rev 7715)
@@ -35,7 +35,7 @@
 <ul class="history">
   <li>\x95ύX
     <ul>
-      <li>\x8E\x8E\x8C\xB1\x93I\x82\xC9<a href="../setup/teraterm-misc.html#HighDPI">\x8D\x82DPI\x91Ή\x9E</a>\x81B\x83f\x83t\x83H\x83\x8B\x83g\x82\xCDdisable\x81Bteraterm.ini\x82\xCC[Tera Term]\x83Z\x83N\x83V\x83\x87\x83\x93\x82\xC9DPIAware=1\x82Ƃ\xB7\x82\xE9\x82ƗL\x8C\xF8\x82ƂȂ\xE9\x81BWindows 10 Version 1703\x88ȍ~\x82̂ݗL\x8C\xF8\x81B</li>
+      <li>\x8E\x8E\x8C\xB1\x93I\x82\xC9<a href="../setup/teraterm-misc.html#HighDPI">\x8D\x82DPI\x91Ή\x9E</a>\x81B\x83f\x83t\x83H\x83\x8B\x83g\x82\xCDdisable\x81Bteraterm.ini\x82\xCC[Tera Term]\x83Z\x83N\x83V\x83\x87\x83\x93\x82\xC9DPIAware=on\x82Ƃ\xB7\x82\xE9\x82ƗL\x8C\xF8\x82ƂȂ\xE9\x81BWindows 10 Version 1703\x88ȍ~\x82̂ݗL\x8C\xF8\x81B</li>
       <li>\x83_\x83C\x83A\x83\x8D\x83O\x82̃t\x83H\x83\x93\x83g\x82\xF0\x90ݒ\xE8\x82ł\xAB\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD(<a href="../menu/setup-font.html">[Setup]/[Font])</a>\x81B\x83t\x83H\x83\x93\x83g\x83T\x83u\x83\x81\x83j\x83\x85\x81[\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B\x83_\x83C\x83A\x83\x8D\x83O\x83t\x83H\x83\x93\x83g\x82̃f\x83t\x83H\x83\x8B\x83g\x82͏]\x97\x88\x82Ɠ\xAF\x82\xB6\x83t\x83H\x83\x93\x83g\x81B</li>
       <li>\x8Cr\x90\xFC\x82\xF0\x95\\x8E\xA6\x82\xB7\x82邽\x82߂̃t\x83H\x83\x93\x83g\x83t\x83@\x83C\x83\x8B(TSPECIAL1.TTF)\x82\xAA\x83C\x83\x93\x83X\x83g\x81[\x83\x8B\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xA2\x8Fꍇ\x81Attermpro.exe\x82Ɠ\xAF\x88\xEA\x83t\x83H\x83\x8B\x83_\x82\xA9\x82\xE7\x93ǂݍ\x9E\x82ނ悤\x82ɂ\xB5\x82\xBD\x81B</li>
       <li>MACRO: <a href="../macro/command/exec.html">exec</a> \x83}\x83N\x83\x8D\x83R\x83}\x83\x93\x83h\x82̎\xC0\x8Ds\x8C\x8B\x89ʂ\xF0 result \x83V\x83X\x83e\x83\x80\x95ϐ\x94\x82ɑ\xE3\x93\xFC\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>

Modified: trunk/doc/ja/html/setup/teraterm-misc.html
===================================================================
--- trunk/doc/ja/html/setup/teraterm-misc.html	2019-05-27 13:23:19 UTC (rev 7714)
+++ trunk/doc/ja/html/setup/teraterm-misc.html	2019-05-27 14:59:58 UTC (rev 7715)
@@ -431,13 +431,13 @@
 <p>
 \x8E\x8E\x8C\xB1\x93I\x82ɍ\x82DPI\x82ɑΉ\x9E\x82\xB5\x82܂\xB5\x82\xBD\x81B<br>
 
-teraterm.ini\x82\xCC[Tera Term]\x83Z\x83N\x83V\x83\x87\x83\x93\x82\xC9DPIAware=1\x82Ƃ\xB7\x82\xE9\x82ƁA
+teraterm.ini\x82\xCC[Tera Term]\x83Z\x83N\x83V\x83\x87\x83\x93\x82\xC9DPIAware=on\x82Ƃ\xB7\x82\xE9\x82ƁA
 Per monitor DPI Aware \x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82Ƃ\xB5\x82ē\xAE\x8D삵\x82܂\xB7\x81B<br>
 \x82\xB1\x82̐ݒ\xE8\x82\xF0\x8Ds\x82\xED\x82Ȃ\xA2\x82ƁA\x8F]\x97\x88\x82Ɠ\xAF\x97l DPI Unaware \x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82Ƃ\xB5\x82ē\xAE\x8D삵\x82܂\xB7\x81B<br>
 \x8F\xAB\x97\x88\x93I\x82ɂ͂\xB1\x82̐ݒ\xE8\x82\xF0\x8EQ\x8FƂ\xB9\x82\xB8\x81A\x8E\xA9\x93\xAE\x82ō\x82DPI\x91Ή\x9E\x82ƂȂ\xE9\x97\\x92\xE8\x82ł\xB7\x81B<br>
 
 <pre>
-DPIAware=1
+DPIAware=on
 </pre>
 
 <p>

Modified: trunk/teraterm/common/compat_win.cpp
===================================================================
--- trunk/teraterm/common/compat_win.cpp	2019-05-27 13:23:19 UTC (rev 7714)
+++ trunk/teraterm/common/compat_win.cpp	2019-05-27 14:59:58 UTC (rev 7715)
@@ -1,5 +1,5 @@
 /*
- * (C) 2019 TeraTerm Project
+ * (C) 20018-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@
 BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
 BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
 DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
+BOOL (WINAPI *pIsValidDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
 UINT (WINAPI *pGetDpiForWindow)(HWND hwnd);
 BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
 int (WINAPI *pAddFontResourceExA)(LPCSTR name, DWORD fl, PVOID res);
@@ -47,6 +48,7 @@
 static const APIInfo Lists_user32[] = {
 	{ "SetLayeredWindowAttributes", (void **)&pSetLayeredWindowAttributes },
 	{ "SetThreadDpiAwarenessContext", (void **)&pSetThreadDpiAwarenessContext },
+	{ "IsValidDpiAwarenessContext", (void **)&pIsValidDpiAwarenessContext },
 	{ "GetDpiForWindow", (void **)&pGetDpiForWindow },
 	{ NULL },
 };

Modified: trunk/teraterm/common/compat_win.h
===================================================================
--- trunk/teraterm/common/compat_win.h	2019-05-27 13:23:19 UTC (rev 7714)
+++ trunk/teraterm/common/compat_win.h	2019-05-27 14:59:58 UTC (rev 7715)
@@ -1,5 +1,5 @@
 /*
- * (C) 2018 TeraTerm Project
+ * (C) 2018-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -61,6 +61,7 @@
 extern BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
 extern BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
 extern DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
+extern BOOL (WINAPI *pIsValidDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
 extern UINT (WINAPI *pGetDpiForWindow)(HWND hwnd);
 extern BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
 extern int (WINAPI *pAddFontResourceExA)(LPCSTR name, DWORD fl, PVOID res);

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-05-27 13:23:19 UTC (rev 7714)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-05-27 14:59:58 UTC (rev 7715)
@@ -771,12 +771,11 @@
 	FreeTTSET();
 
 	// DPI Aware (\x8D\x82DPI\x91Ή\x9E)
-	{
-		int dip_aware = 0;
-		dip_aware = GetPrivateProfileInt("Tera Term", "DPIAware", dip_aware, ts.SetupFName);
-		if (dip_aware != 0) {
-			if (pSetThreadDpiAwarenessContext != NULL) {
-				// TODO Windows 10 Version 1703\x88ȍ~\x82̃`\x83F\x83b\x83N\x82\xF0\x93\xFC\x82\xEA\x82\xE9\x82ׂ\xAB\x82\xA9?
+	if (pIsValidDpiAwarenessContext != NULL && pSetThreadDpiAwarenessContext != NULL) {
+		char Temp[4];
+		GetPrivateProfileString("Tera Term", "DPIAware", NULL, Temp, sizeof(Temp), ts.SetupFName);
+		if (_stricmp(Temp, "on") == 0) {
+			if (pIsValidDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) == TRUE) {
 				pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
 			}
 		}

Modified: trunk/teraterm/ttpmacro/ttmacro.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmacro.cpp	2019-05-27 13:23:19 UTC (rev 7714)
+++ trunk/teraterm/ttpmacro/ttmacro.cpp	2019-05-27 14:59:58 UTC (rev 7715)
@@ -87,11 +87,11 @@
 	WinCompatInit();
 
 	// DPI Aware (\x8D\x82DPI\x91Ή\x9E)
-	{
-		int dip_aware = 0;
-		dip_aware = GetPrivateProfileInt("Tera Term", "DPIAware", dip_aware, SetupFName);
-		if (dip_aware != 0) {
-			if (pSetThreadDpiAwarenessContext != NULL) {
+	if (pIsValidDpiAwarenessContext != NULL && pSetThreadDpiAwarenessContext != NULL) {
+		char Temp[4];
+		GetPrivateProfileString("Tera Term", "DPIAware", NULL, Temp, sizeof(Temp), SetupFName);
+		if (_stricmp(Temp, "on") == 0) {
+			if (pIsValidDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) == TRUE) {
 				pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
 			}
 		}


Ttssh2-commit メーリングリストの案内