[ttssh2-commit] [10019] VT ウィンドウと TEK ウィンドウで Windows 11 の角丸が無効になるようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 6月 25日 (土) 09:42:50 JST


Revision: 10019
          https://osdn.net/projects/ttssh2/scm/svn/commits/10019
Author:   nmaya
Date:     2022-06-25 09:42:49 +0900 (Sat, 25 Jun 2022)
Log Message:
-----------
VT ウィンドウと TEK ウィンドウで Windows 11 の角丸が無効になるようにした

ticket #44861

merge from 4-stable: r10018

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

Ticket Links:
------------
    https://osdn.net/projects/ttssh2/tracker/detail/44861

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/ja/html/about/history.html
    trunk/teraterm/common/compat_win.cpp
    trunk/teraterm/common/compat_win.h
    trunk/teraterm/teraterm/tekwin.cpp
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2022-06-25 00:42:15 UTC (rev 10018)
+++ trunk/doc/en/html/about/history.html	2022-06-25 00:42:49 UTC (rev 10019)
@@ -35,6 +35,7 @@
 <ul class="history">
   <li>Changes
     <ul>
+      <!--li>\x95\xB6\x8E\x9A\x82̈ꕔ\x82\xAA\x8C\xA9\x82\xA6\x82Ȃ\xAD\x82Ȃ\xE9\x82̂ŁAWindows 11 \x82ŃE\x83B\x83\x93\x83h\x83E\x82̊p\x82\xAA\x8Aۂ\xAD\x82Ȃ\xE7\x82Ȃ\xA2\x82悤\x82ɂ\xB5\x82\xBD\x81B</li-->
       <li>XMODEM: Fix to check all received datas and process correctly, even if received datas are accumulated.</li>
       <li>YMODEM: ignore continuous 'C' when waiting for sending.</li>
       <li>Changed default to on for High DPI support.</li>

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2022-06-25 00:42:15 UTC (rev 10018)
+++ trunk/doc/ja/html/about/history.html	2022-06-25 00:42:49 UTC (rev 10019)
@@ -35,6 +35,7 @@
 <ul class="history">
   <li>\x95ύX
     <ul>
+      <li>\x95\xB6\x8E\x9A\x82̈ꕔ\x82\xAA\x8C\xA9\x82\xA6\x82Ȃ\xAD\x82Ȃ\xE9\x82̂ŁAWindows 11 \x82ŃE\x83B\x83\x93\x83h\x83E\x82̊p\x82\xAA\x8Aۂ\xAD\x82Ȃ\xE7\x82Ȃ\xA2\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
       <li>XMODEM \x8E\xF3\x90M\x83f\x81[\x83^\x82\xAA\x92~\x90ς\xB5\x82Ă\xE0\x91S\x91̂𒲂ׂĐ\xB3\x82\xB5\x82\xAD\x8F\x88\x97\x9D\x82\xB7\x82\xE9\x82悤\x82ɏC\x90\xB3\x82\xB5\x82\xBD\x81B</li>
       <li>YMODEM \x91\x97\x90M\x91҂\xBF\x82̎\x9E\x81A\x98A\x91\xB1\x82\xB5\x82\xBD 'C' \x82𖳎\x8B\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
       <li>\x8D\x82DPI\x91Ή\x9E\x82̃f\x83t\x83H\x83\x8B\x83g\x82\xF0ON\x82ɕύX</li>

Modified: trunk/teraterm/common/compat_win.cpp
===================================================================
--- trunk/teraterm/common/compat_win.cpp	2022-06-25 00:42:15 UTC (rev 10018)
+++ trunk/teraterm/common/compat_win.cpp	2022-06-25 00:42:49 UTC (rev 10019)
@@ -100,6 +100,8 @@
 // comctl32.dll
 static HRESULT (WINAPI *pLoadIconWithScaleDown)(HINSTANCE hinst, PCWSTR pszName, int cx, int cy, HICON *phico);
 
+// dwmapi.dll
+HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
 
 class Initializer {
 public:
@@ -240,6 +242,11 @@
 	{},
 };
 
+static const APIInfo Lists_dwmapi[] = { // Windows Vista or later
+	{ "DwmSetWindowAttribute", (void **)&pDwmSetWindowAttribute },
+	{},
+};
+
 static const DllInfo DllInfos[] = {
 	{ L"user32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_user32 },
 	{ L"msimg32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_msimg32 },
@@ -252,6 +259,7 @@
 	{ L"dbghelp.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_dbghelp },
 	{ L"shell32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_shell32 },
 	{ L"comctl32.dll", DLL_LOAD_LIBRARY_SxS, DLL_ACCEPT_NOT_EXIST, Lists_comctl32 },
+	{ L"dwmapi.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_dwmapi },
 	{},
 };
 

Modified: trunk/teraterm/common/compat_win.h
===================================================================
--- trunk/teraterm/common/compat_win.h	2022-06-25 00:42:15 UTC (rev 10018)
+++ trunk/teraterm/common/compat_win.h	2022-06-25 00:42:49 UTC (rev 10019)
@@ -69,6 +69,17 @@
 #define OPENFILENAME_SIZE_VERSION_400A	76
 #endif
 
+// 10.0.22000 or later
+#define DWMWA_WINDOW_CORNER_PREFERENCE 33
+#if !defined(DWM_WINDOW_CORNER_PREFERENCE)
+typedef enum  {
+  DWMWCP_DEFAULT = 0,
+  DWMWCP_DONOTROUND = 1,
+  DWMWCP_ROUND = 2,
+  DWMWCP_ROUNDSMALL = 3
+} DWM_WINDOW_CORNER_PREFERENCE;
+#endif
+
 #if !defined(_WIN64)
 #include <pshpack1.h>
 #endif
@@ -197,6 +208,8 @@
 // comctl32.dll
 HRESULT _LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR pszName, int cx, int cy, HICON *phico);
 
+// dwmapi.dll
+extern HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
 
 void WinCompatInit();
 

Modified: trunk/teraterm/teraterm/tekwin.cpp
===================================================================
--- trunk/teraterm/teraterm/tekwin.cpp	2022-06-25 00:42:15 UTC (rev 10018)
+++ trunk/teraterm/teraterm/tekwin.cpp	2022-06-25 00:42:49 UTC (rev 10019)
@@ -97,11 +97,19 @@
 		rect.bottom = rect.top + 400; //temporary height
 	}
 	CreateW(hInstance, TEKClassName, L"Tera Term", Style, rect, ::GetDesktopWindow(), NULL);
+
 //--------------------------------------------------------
 	HTEKWin = GetSafeHwnd();
 	if (HTEKWin == NULL) {
 		return;
 	}
+
+	// Windows 11 \x82ŃE\x83B\x83\x93\x83h\x83E\x82̊p\x82\xAA\x8Aۂ\xAD\x82Ȃ\xE7\x82Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9
+	if (pDwmSetWindowAttribute != NULL) {
+		DWM_WINDOW_CORNER_PREFERENCE preference = DWMWCP_DONOTROUND;
+		pDwmSetWindowAttribute(HTEKWin, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));
+	}
+
 	tk.HWin = HTEKWin;
 	// register this window to the window list
 	RegWin(HVTWin,HTEKWin);

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2022-06-25 00:42:15 UTC (rev 10018)
+++ trunk/teraterm/teraterm/vtwin.cpp	2022-06-25 00:42:49 UTC (rev 10019)
@@ -401,6 +401,13 @@
 	HVTWin = GetSafeHwnd();
 	if (HVTWin == NULL) return;
 	cv.HWin = HVTWin;
+
+	// Windows 11 \x82ŃE\x83B\x83\x93\x83h\x83E\x82̊p\x82\xAA\x8Aۂ\xAD\x82Ȃ\xE7\x82Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9
+	if (pDwmSetWindowAttribute != NULL) {
+		DWM_WINDOW_CORNER_PREFERENCE preference = DWMWCP_DONOTROUND;
+		pDwmSetWindowAttribute(HVTWin, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));
+	}
+
 	// register this window to the window list
 	SerialNo = RegWin(HVTWin,NULL);
 


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