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

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


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

ticket #44861

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

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

-------------- next part --------------
Modified: branches/4-stable/doc/en/html/about/history.html
===================================================================
--- branches/4-stable/doc/en/html/about/history.html	2022-06-24 14:04:34 UTC (rev 10017)
+++ branches/4-stable/doc/en/html/about/history.html	2022-06-25 00:42:15 UTC (rev 10018)
@@ -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>\x83t\x83@\x83C\x83\x8B\x83h\x83\x8D\x83b\x83v\x83_\x83C\x83A\x83\x8D\x83O\x82\xCC Send file \x82\xCC Binary \x82̃`\x83F\x83b\x83N\x83{\x83b\x83N\x83X

Modified: branches/4-stable/doc/ja/html/about/history.html
===================================================================
--- branches/4-stable/doc/ja/html/about/history.html	2022-06-24 14:04:34 UTC (rev 10017)
+++ branches/4-stable/doc/ja/html/about/history.html	2022-06-25 00:42:15 UTC (rev 10018)
@@ -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>\x83t\x83@\x83C\x83\x8B\x83h\x83\x8D\x83b\x83v\x83_\x83C\x83A\x83\x8D\x83O\x82\xCC Send file \x82\xCC Binary \x82̃`\x83F\x83b\x83N\x83{\x83b\x83N\x83X

Modified: branches/4-stable/teraterm/common/compat_win.cpp
===================================================================
--- branches/4-stable/teraterm/common/compat_win.cpp	2022-06-24 14:04:34 UTC (rev 10017)
+++ branches/4-stable/teraterm/common/compat_win.cpp	2022-06-25 00:42:15 UTC (rev 10018)
@@ -49,6 +49,9 @@
 BOOL (WINAPI *pAdjustWindowRectEx)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle);
 BOOL (WINAPI *pAdjustWindowRectExForDpi)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi);
 
+// dwmapi.dll
+HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
+
 static const APIInfo Lists_user32[] = {
 	{ "SetLayeredWindowAttributes", (void **)&pSetLayeredWindowAttributes },
 	{ "SetThreadDpiAwarenessContext", (void **)&pSetThreadDpiAwarenessContext },
@@ -79,11 +82,17 @@
 	{},
 };
 
+static const APIInfo Lists_dwmapi[] = { // Windows Vista or later
+	{ "DwmSetWindowAttribute", (void **)&pDwmSetWindowAttribute },
+	{},
+};
+
 static const DllInfo DllInfos[] = {
 	{ _T("user32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_user32 },
 	{ _T("msimg32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_msimg32 },
 	{ _T("gdi32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_gdi32 },
 	{ _T("Shcore.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_Shcore },
+	{ _T("dwmapi.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_dwmapi },
 	{},
 };
 

Modified: branches/4-stable/teraterm/common/compat_win.h
===================================================================
--- branches/4-stable/teraterm/common/compat_win.h	2022-06-24 14:04:34 UTC (rev 10017)
+++ branches/4-stable/teraterm/common/compat_win.h	2022-06-25 00:42:15 UTC (rev 10018)
@@ -67,6 +67,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
+
 extern BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
 extern BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
 extern HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT lprc, DWORD dwFlags);
@@ -90,6 +101,9 @@
 #define pRemoveFontResourceEx	pRemoveFontResourceExA
 #endif // !UNICODE
 
+// dwmapi.dll
+extern HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
+
 void WinCompatInit();
 
 #ifdef __cplusplus

Modified: branches/4-stable/teraterm/teraterm/tekwin.cpp
===================================================================
--- branches/4-stable/teraterm/teraterm/tekwin.cpp	2022-06-24 14:04:34 UTC (rev 10017)
+++ branches/4-stable/teraterm/teraterm/tekwin.cpp	2022-06-25 00:42:15 UTC (rev 10018)
@@ -46,6 +46,7 @@
 #include <htmlhelp.h>
 #include "dlglib.h"
 #include <tchar.h>
+#include "compat_win.h"
 
 #define TEKClassName _T("TEKWin32")
 
@@ -96,11 +97,19 @@
 		rect.bottom = rect.top + 400; //temporary height
 	}
 	Create(hInstance, TEKClassName, _T("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: branches/4-stable/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/4-stable/teraterm/teraterm/vtwin.cpp	2022-06-24 14:04:34 UTC (rev 10017)
+++ branches/4-stable/teraterm/teraterm/vtwin.cpp	2022-06-25 00:42:15 UTC (rev 10018)
@@ -718,6 +718,13 @@
 	/*--------- Init2 -----------------*/
 	HVTWin = GetSafeHwnd();
 	if (HVTWin == 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(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