Tera Termの個人的な作業用リポジトリ
修訂 | bce40a24fca0ccc793d1eb8bc3e435788997102b (tree) |
---|---|
時間 | 2022-06-25 09:42:15 |
作者 | nmaya <nmaya@user...> |
Commiter | nmaya |
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
@@ -35,6 +35,7 @@ | ||
35 | 35 | <ul class="history"> |
36 | 36 | <li>Changes |
37 | 37 | <ul> |
38 | + <!--li>文字の一部が見えなくなるので、Windows 11 でウィンドウの角が丸くならないようにした。</li--> | |
38 | 39 | <li>XMODEM: Fix to check all received datas and process correctly, even if received datas are accumulated.</li> |
39 | 40 | <li>YMODEM: ignore continuous 'C' when waiting for sending.</li> |
40 | 41 | <!--li>ファイルドロップダイアログの Send file の Binary のチェックボックス |
@@ -35,6 +35,7 @@ | ||
35 | 35 | <ul class="history"> |
36 | 36 | <li>変更 |
37 | 37 | <ul> |
38 | + <li>文字の一部が見えなくなるので、Windows 11 でウィンドウの角が丸くならないようにした。</li> | |
38 | 39 | <li>XMODEM 受信データが蓄積しても全体を調べて正しく処理するように修正した。</li> |
39 | 40 | <li>YMODEM 送信待ちの時、連続した 'C' を無視するようにした。</li> |
40 | 41 | <li>ファイルドロップダイアログの Send file の Binary のチェックボックス |
@@ -49,6 +49,9 @@ HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT lprc, DWORD dwFlags); | ||
49 | 49 | BOOL (WINAPI *pAdjustWindowRectEx)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle); |
50 | 50 | BOOL (WINAPI *pAdjustWindowRectExForDpi)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi); |
51 | 51 | |
52 | +// dwmapi.dll | |
53 | +HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute); | |
54 | + | |
52 | 55 | static const APIInfo Lists_user32[] = { |
53 | 56 | { "SetLayeredWindowAttributes", (void **)&pSetLayeredWindowAttributes }, |
54 | 57 | { "SetThreadDpiAwarenessContext", (void **)&pSetThreadDpiAwarenessContext }, |
@@ -79,11 +82,17 @@ static const APIInfo Lists_Shcore[] = { | ||
79 | 82 | {}, |
80 | 83 | }; |
81 | 84 | |
85 | +static const APIInfo Lists_dwmapi[] = { // Windows Vista or later | |
86 | + { "DwmSetWindowAttribute", (void **)&pDwmSetWindowAttribute }, | |
87 | + {}, | |
88 | +}; | |
89 | + | |
82 | 90 | static const DllInfo DllInfos[] = { |
83 | 91 | { _T("user32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_user32 }, |
84 | 92 | { _T("msimg32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_msimg32 }, |
85 | 93 | { _T("gdi32.dll"), DLL_LOAD_LIBRARY_SYSTEM, DLL_ACCEPT_NOT_EXIST, Lists_gdi32 }, |
86 | 94 | { _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 }, | |
87 | 96 | {}, |
88 | 97 | }; |
89 | 98 |
@@ -67,6 +67,17 @@ typedef enum MONITOR_DPI_TYPE { | ||
67 | 67 | #define OPENFILENAME_SIZE_VERSION_400A 76 |
68 | 68 | #endif |
69 | 69 | |
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 | + | |
70 | 81 | extern BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION); |
71 | 82 | extern BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); |
72 | 83 | extern HMONITOR (WINAPI *pMonitorFromRect)(LPCRECT lprc, DWORD dwFlags); |
@@ -90,6 +101,9 @@ extern BOOL (WINAPI *pRemoveFontResourceExW)(LPCWSTR name, DWORD fl, PVOID pdv); | ||
90 | 101 | #define pRemoveFontResourceEx pRemoveFontResourceExA |
91 | 102 | #endif // !UNICODE |
92 | 103 | |
104 | +// dwmapi.dll | |
105 | +extern HRESULT (WINAPI *pDwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute); | |
106 | + | |
93 | 107 | void WinCompatInit(); |
94 | 108 | |
95 | 109 | #ifdef __cplusplus |
@@ -46,6 +46,7 @@ | ||
46 | 46 | #include <htmlhelp.h> |
47 | 47 | #include "dlglib.h" |
48 | 48 | #include <tchar.h> |
49 | +#include "compat_win.h" | |
49 | 50 | |
50 | 51 | #define TEKClassName _T("TEKWin32") |
51 | 52 |
@@ -96,11 +97,19 @@ CTEKWindow::CTEKWindow(HINSTANCE hInstance) | ||
96 | 97 | rect.bottom = rect.top + 400; //temporary height |
97 | 98 | } |
98 | 99 | Create(hInstance, TEKClassName, _T("Tera Term"), Style, rect, ::GetDesktopWindow(), NULL); |
100 | + | |
99 | 101 | //-------------------------------------------------------- |
100 | 102 | HTEKWin = GetSafeHwnd(); |
101 | 103 | if (HTEKWin == NULL) { |
102 | 104 | return; |
103 | 105 | } |
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 | + | |
104 | 113 | tk.HWin = HTEKWin; |
105 | 114 | // register this window to the window list |
106 | 115 | RegWin(HVTWin,HTEKWin); |
@@ -718,6 +718,13 @@ CVTWindow::CVTWindow(HINSTANCE hInstance) | ||
718 | 718 | /*--------- Init2 -----------------*/ |
719 | 719 | HVTWin = GetSafeHwnd(); |
720 | 720 | 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 | + | |
721 | 728 | // register this window to the window list |
722 | 729 | SerialNo = RegWin(HVTWin,NULL); |
723 | 730 |