• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Tera Termの個人的な作業用リポジトリ


Commit MetaInfo

修訂bce40a24fca0ccc793d1eb8bc3e435788997102b (tree)
時間2022-06-25 09:42:15
作者nmaya <nmaya@user...>
Commiternmaya

Log Message

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

ticket #44861

git-svn-id: svn+ssh://svn.osdn.net/svnroot/ttssh2/branches/4-stable@10018 f5f01b69-1e22-0410-acbf-894ab4bd6246

Change Summary

差異

--- a/doc/en/html/about/history.html
+++ b/doc/en/html/about/history.html
@@ -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>ファイルドロップダイアログの Send file の Binary のチェックボックス
--- a/doc/ja/html/about/history.html
+++ b/doc/ja/html/about/history.html
@@ -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>ファイルドロップダイアログの Send file の Binary のチェックボックス
--- a/teraterm/common/compat_win.cpp
+++ b/teraterm/common/compat_win.cpp
@@ -49,6 +49,9 @@ HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT lprc, DWORD dwFlags);
4949 BOOL (WINAPI *pAdjustWindowRectEx)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle);
5050 BOOL (WINAPI *pAdjustWindowRectExForDpi)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi);
5151
52+// dwmapi.dll
53+HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
54+
5255 static const APIInfo Lists_user32[] = {
5356 { "SetLayeredWindowAttributes", (void **)&pSetLayeredWindowAttributes },
5457 { "SetThreadDpiAwarenessContext", (void **)&pSetThreadDpiAwarenessContext },
@@ -79,11 +82,17 @@ static const APIInfo Lists_Shcore[] = {
7982 {},
8083 };
8184
85+static const APIInfo Lists_dwmapi[] = { // Windows Vista or later
86+ { "DwmSetWindowAttribute", (void **)&pDwmSetWindowAttribute },
87+ {},
88+};
89+
8290 static const DllInfo DllInfos[] = {
8391 { _T("user32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_user32 },
8492 { _T("msimg32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_msimg32 },
8593 { _T("gdi32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_gdi32 },
8694 { _T("Shcore.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_Shcore },
95+ { _T("dwmapi.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_dwmapi },
8796 {},
8897 };
8998
--- a/teraterm/common/compat_win.h
+++ b/teraterm/common/compat_win.h
@@ -67,6 +67,17 @@ typedef enum MONITOR_DPI_TYPE {
6767 #define OPENFILENAME_SIZE_VERSION_400A 76
6868 #endif
6969
70+// 10.0.22000 or later
71+#define DWMWA_WINDOW_CORNER_PREFERENCE 33
72+#if !defined(DWM_WINDOW_CORNER_PREFERENCE)
73+typedef enum {
74+ DWMWCP_DEFAULT = 0,
75+ DWMWCP_DONOTROUND = 1,
76+ DWMWCP_ROUND = 2,
77+ DWMWCP_ROUNDSMALL = 3
78+} DWM_WINDOW_CORNER_PREFERENCE;
79+#endif
80+
7081 extern BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
7182 extern BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
7283 extern HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT lprc, DWORD dwFlags);
@@ -90,6 +101,9 @@ extern BOOL (WINAPI *pRemoveFontResourceExW)(LPCWSTR name, DWORD fl, PVOID pdv);
90101 #define pRemoveFontResourceEx pRemoveFontResourceExA
91102 #endif // !UNICODE
92103
104+// dwmapi.dll
105+extern HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
106+
93107 void WinCompatInit();
94108
95109 #ifdef __cplusplus
--- a/teraterm/teraterm/tekwin.cpp
+++ b/teraterm/teraterm/tekwin.cpp
@@ -46,6 +46,7 @@
4646 #include <htmlhelp.h>
4747 #include "dlglib.h"
4848 #include <tchar.h>
49+#include "compat_win.h"
4950
5051 #define TEKClassName _T("TEKWin32")
5152
@@ -96,11 +97,19 @@ CTEKWindow::CTEKWindow(HINSTANCE hInstance)
9697 rect.bottom = rect.top + 400; //temporary height
9798 }
9899 Create(hInstance, TEKClassName, _T("Tera Term"), Style, rect, ::GetDesktopWindow(), NULL);
100+
99101 //--------------------------------------------------------
100102 HTEKWin = GetSafeHwnd();
101103 if (HTEKWin == NULL) {
102104 return;
103105 }
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+
104113 tk.HWin = HTEKWin;
105114 // register this window to the window list
106115 RegWin(HVTWin,HTEKWin);
--- a/teraterm/teraterm/vtwin.cpp
+++ b/teraterm/teraterm/vtwin.cpp
@@ -718,6 +718,13 @@ CVTWindow::CVTWindow(HINSTANCE hInstance)
718718 /*--------- Init2 -----------------*/
719719 HVTWin = GetSafeHwnd();
720720 if (HVTWin == NULL) return;
721+
722+ // Windows 11 でウィンドウの角が丸くならないようにする
723+ if (pDwmSetWindowAttribute != NULL) {
724+ DWM_WINDOW_CORNER_PREFERENCE preference = DWMWCP_DONOTROUND;
725+ pDwmSetWindowAttribute(HVTWin, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));
726+ }
727+
721728 // register this window to the window list
722729 SerialNo = RegWin(HVTWin,NULL);
723730