• R/O
  • SSH
  • HTTPS

ttssh2: コミット


コミットメタ情報

リビジョン10019 (tree)
日時2022-06-25 09:42:49
作者nmaya

ログメッセージ

VT ウィンドウと TEK ウィンドウで Windows 11 の角丸が無効になるようにした

ticket #44861

merge from 4-stable: r10018

変更サマリ

差分

--- trunk/doc/en/html/about/history.html (revision 10018)
+++ trunk/doc/en/html/about/history.html (revision 10019)
@@ -35,6 +35,7 @@
3535 <ul class="history">
3636 <li>Changes
3737 <ul>
38+ <!--li>文字の一部が見えなくなるので、Windows 11 でウィンドウの角が丸くならないようにした。</li-->
3839 <li>XMODEM: Fix to check all received datas and process correctly, even if received datas are accumulated.</li>
3940 <li>YMODEM: ignore continuous 'C' when waiting for sending.</li>
4041 <li>Changed default to on for High DPI support.</li>
--- trunk/doc/ja/html/about/history.html (revision 10018)
+++ trunk/doc/ja/html/about/history.html (revision 10019)
@@ -35,6 +35,7 @@
3535 <ul class="history">
3636 <li>変更
3737 <ul>
38+ <li>文字の一部が見えなくなるので、Windows 11 でウィンドウの角が丸くならないようにした。</li>
3839 <li>XMODEM 受信データが蓄積しても全体を調べて正しく処理するように修正した。</li>
3940 <li>YMODEM 送信待ちの時、連続した 'C' を無視するようにした。</li>
4041 <li>高DPI対応のデフォルトをONに変更</li>
--- trunk/teraterm/common/compat_win.cpp (revision 10018)
+++ trunk/teraterm/common/compat_win.cpp (revision 10019)
@@ -100,6 +100,8 @@
100100 // comctl32.dll
101101 static HRESULT (WINAPI *pLoadIconWithScaleDown)(HINSTANCE hinst, PCWSTR pszName, int cx, int cy, HICON *phico);
102102
103+// dwmapi.dll
104+HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
103105
104106 class Initializer {
105107 public:
@@ -240,6 +242,11 @@
240242 {},
241243 };
242244
245+static const APIInfo Lists_dwmapi[] = { // Windows Vista or later
246+ { "DwmSetWindowAttribute", (void **)&pDwmSetWindowAttribute },
247+ {},
248+};
249+
243250 static const DllInfo DllInfos[] = {
244251 { L"user32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_user32 },
245252 { L"msimg32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_msimg32 },
@@ -252,6 +259,7 @@
252259 { L"dbghelp.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_dbghelp },
253260 { L"shell32.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_shell32 },
254261 { L"comctl32.dll", DLL_LOAD_LIBRARY_SxS, DLL_ACCEPT_NOT_EXIST, Lists_comctl32 },
262+ { L"dwmapi.dll", DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_dwmapi },
255263 {},
256264 };
257265
--- trunk/teraterm/common/compat_win.h (revision 10018)
+++ trunk/teraterm/common/compat_win.h (revision 10019)
@@ -69,6 +69,17 @@
6969 #define OPENFILENAME_SIZE_VERSION_400A 76
7070 #endif
7171
72+// 10.0.22000 or later
73+#define DWMWA_WINDOW_CORNER_PREFERENCE 33
74+#if !defined(DWM_WINDOW_CORNER_PREFERENCE)
75+typedef enum {
76+ DWMWCP_DEFAULT = 0,
77+ DWMWCP_DONOTROUND = 1,
78+ DWMWCP_ROUND = 2,
79+ DWMWCP_ROUNDSMALL = 3
80+} DWM_WINDOW_CORNER_PREFERENCE;
81+#endif
82+
7283 #if !defined(_WIN64)
7384 #include <pshpack1.h>
7485 #endif
@@ -197,6 +208,8 @@
197208 // comctl32.dll
198209 HRESULT _LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR pszName, int cx, int cy, HICON *phico);
199210
211+// dwmapi.dll
212+extern HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
200213
201214 void WinCompatInit();
202215
--- trunk/teraterm/teraterm/tekwin.cpp (revision 10018)
+++ trunk/teraterm/teraterm/tekwin.cpp (revision 10019)
@@ -97,11 +97,19 @@
9797 rect.bottom = rect.top + 400; //temporary height
9898 }
9999 CreateW(hInstance, TEKClassName, L"Tera Term", Style, rect, ::GetDesktopWindow(), NULL);
100+
100101 //--------------------------------------------------------
101102 HTEKWin = GetSafeHwnd();
102103 if (HTEKWin == NULL) {
103104 return;
104105 }
106+
107+ // Windows 11 でウィンドウの角が丸くならないようにする
108+ if (pDwmSetWindowAttribute != NULL) {
109+ DWM_WINDOW_CORNER_PREFERENCE preference = DWMWCP_DONOTROUND;
110+ pDwmSetWindowAttribute(HTEKWin, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));
111+ }
112+
105113 tk.HWin = HTEKWin;
106114 // register this window to the window list
107115 RegWin(HVTWin,HTEKWin);
--- trunk/teraterm/teraterm/vtwin.cpp (revision 10018)
+++ trunk/teraterm/teraterm/vtwin.cpp (revision 10019)
@@ -401,6 +401,13 @@
401401 HVTWin = GetSafeHwnd();
402402 if (HVTWin == NULL) return;
403403 cv.HWin = HVTWin;
404+
405+ // Windows 11 でウィンドウの角が丸くならないようにする
406+ if (pDwmSetWindowAttribute != NULL) {
407+ DWM_WINDOW_CORNER_PREFERENCE preference = DWMWCP_DONOTROUND;
408+ pDwmSetWindowAttribute(HVTWin, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));
409+ }
410+
404411 // register this window to the window list
405412 SerialNo = RegWin(HVTWin,NULL);
406413
旧リポジトリブラウザで表示