• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision9919 (tree)
Time2022-05-13 00:27:14
Authornmaya

Log Message

SSH 接続が切れたときに VT アイコンに戻らない問題を修正

ticket #43907

Change Summary

Incremental Difference

--- branches/adjust_icon/teraterm/common/tttypes.h (revision 9918)
+++ branches/adjust_icon/teraterm/common/tttypes.h (revision 9919)
@@ -348,8 +348,6 @@
348348 } cygterm_t;
349349
350350 /* TTTSet */
351-typedef struct tttset TTTSet, *PTTSet;
352-
353351 struct tttset {
354352 /*------ VTSet --------*/
355353 /* Tera Term home directory */
@@ -551,7 +549,6 @@
551549 WORD CRSend_ini;
552550 WORD LocalEcho_ini;
553551 WORD UnicodeDecSpMapping;
554- HINSTANCE Instance;
555552 WORD VTIcon;
556553 WORD TEKIcon;
557554 WORD ScrollWindowClearScreen;
@@ -648,11 +645,14 @@
648645 wchar_t *ExeDirW; // ttermpro.exe のあるフォルダ
649646 wchar_t *LogDirW; // logやダンプを置くフォルダ
650647 wchar_t *FileDirW; // ダウンロードパス("%APPDATA%" 等が含まれる,使用前に環境変数を展開すること)
648+ HINSTANCE PluginVTIocnInstance;
649+ WORD PluginVTIocnID;
651650
652-
653- void (*SetVTIcon)(TTTSet *ts, HINSTANCE Inst, WORD icon_id);
651+ void (*SetVTIcon)(HINSTANCE hInstance, WORD IconID);
654652 };
655653
654+typedef struct tttset TTTSet, *PTTSet;
655+
656656 /* New Line modes */
657657 #define IdCR 1
658658 #define IdCRLF 2
--- branches/adjust_icon/teraterm/teraterm/vtwin.cpp (revision 9918)
+++ branches/adjust_icon/teraterm/teraterm/vtwin.cpp (revision 9919)
@@ -243,7 +243,7 @@
243243
244244 static void SetIcon(HINSTANCE hInst_, HWND hWnd, const wchar_t *icon_name, int dpi)
245245 {
246- // 大きいアイコン(32x32,ディスプレイの拡大率が100%(dpi=76)のとき)
246+ // 大きいアイコン(32x32,ディスプレイの拡大率が100%(dpi=96)のとき)
247247 HICON icon = TTLoadIcon(hInst_, icon_name, 0, 0, dpi);
248248 icon = (HICON)::SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)icon);
249249 if (icon != NULL) {
@@ -250,7 +250,7 @@
250250 DestroyIcon(icon);
251251 }
252252
253- // 大きいアイコン(16x16,ディスプレイの拡大率が100%(dpi=76)のとき)
253+ // 大きいアイコン(16x16,ディスプレイの拡大率が100%(dpi=96)のとき)
254254 icon = TTLoadIcon(hInst_, icon_name, 16, 16, dpi);
255255 icon = (HICON)::SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)icon);
256256 if (icon != NULL) {
@@ -269,12 +269,19 @@
269269 }
270270 }
271271
272-static void SetVTIcon(TTTSet *ts, HINSTANCE inst, WORD icon_id)
272+static void SetVTIcon(HINSTANCE hInstance, WORD IconID)
273273 {
274- ts->Instance = inst;
275- ts->VTIcon = icon_id;
274+ HINSTANCE inst;
275+ WORD icon_id;
276+ const int dpi = GetMonitorDpiFromWindow(HVTWin);
276277
277- const int dpi = GetMonitorDpiFromWindow(HVTWin);
278+ ts.PluginVTIocnInstance = hInstance;
279+ ts.PluginVTIocnID = IconID;
280+
281+ inst = (ts.PluginVTIocnInstance == NULL) ? hInst : hInstance;
282+ icon_id = (ts.PluginVTIocnID != 0) ? IconID :
283+ (ts.VTIcon != IdIconDefault) ? ts.VTIcon
284+ : IDI_VT;
278285 SetIcon(inst, HVTWin, MAKEINTRESOURCEW(icon_id), dpi);
279286 }
280287
@@ -289,7 +296,6 @@
289296 int CmdShow;
290297 BOOL isFirstInstance;
291298 m_hInst = hInstance;
292- ts.Instance = hInstance;
293299
294300 CommInit(&cv);
295301 ts.SetVTIcon = SetVTIcon;
@@ -457,10 +463,14 @@
457463 RegDeviceNotify(HVTWin);
458464
459465 {
466+ HINSTANCE inst;
467+ WORD icon_id;
460468 const int dpi = GetMonitorDpiFromWindow(m_hWnd);
461- const int icon_id = (ts.VTIcon != IdIconDefault) ? ts.VTIcon : IDI_VT;
462- const wchar_t *icon_name = MAKEINTRESOURCEW(icon_id);
463- SetIcon(m_hInst, m_hWnd, icon_name, dpi);
469+ inst = (ts.PluginVTIocnInstance != NULL) ? ts.PluginVTIocnInstance : m_hInst;
470+ icon_id = (ts.PluginVTIocnID != 0) ? ts.PluginVTIocnID
471+ : (ts.VTIcon != IdIconDefault) ? ts.VTIcon
472+ : IDI_VT;
473+ SetIcon(inst, m_hWnd, MAKEINTRESOURCEW(icon_id), dpi);
464474 }
465475 SetCustomNotifyIcon(
466476 (HICON)LoadImage(
@@ -5071,10 +5081,13 @@
50715081 ChangeCaret();
50725082
50735083 {
5074- const int icon_id = (ts.VTIcon != IdIconDefault) ? ts.VTIcon : IDI_VT;
5075- const wchar_t *icon_name = MAKEINTRESOURCEW(icon_id);
5076- const HINSTANCE inst = ts.Instance;
5077- SetIcon(inst, m_hWnd, icon_name, NewDPI);
5084+ HINSTANCE inst;
5085+ WORD icon_id;
5086+ inst = (ts.PluginVTIocnInstance != NULL) ? ts.PluginVTIocnInstance : hInst;
5087+ icon_id = (ts.PluginVTIocnID != 0) ? ts.PluginVTIocnID
5088+ : (ts.VTIcon != IdIconDefault) ? ts.VTIcon
5089+ : IDI_VT;
5090+ SetIcon(inst, m_hWnd, MAKEINTRESOURCEW(icon_id), NewDPI);
50785091 }
50795092
50805093 return TRUE;
--- branches/adjust_icon/teraterm/ttpcmn/ttcmn.c (revision 9918)
+++ branches/adjust_icon/teraterm/ttpcmn/ttcmn.c (revision 9919)
@@ -272,6 +272,9 @@
272272 else {
273273 return FALSE;
274274 }
275+
276+ ts->PluginVTIocnInstance = NULL;
277+ ts->PluginVTIocnID = 0;
275278 }
276279
277280 // 設定ファイルをディスクに保存し、Tera Term本体を再起動する。
--- branches/adjust_icon/ttssh2/ttxssh/ttxssh.c (revision 9918)
+++ branches/adjust_icon/ttssh2/ttxssh/ttxssh.c (revision 9919)
@@ -115,11 +115,6 @@
115115
116116 HANDLE hInst; /* Instance handle of TTXSSH.DLL */
117117
118-static HICON SecureLargeIcon = NULL;
119-static HICON SecureSmallIcon = NULL;
120-static HICON SecureNotifyIcon = NULL;
121-static HICON OldNotifyIcon = NULL;
122-
123118 static TInstVar *pvar;
124119
125120 typedef struct {
@@ -187,19 +182,7 @@
187182 FWD_end(pvar);
188183 FWDUI_end(pvar);
189184
190- if (pvar->OldLargeIcon != NULL) {
191- PostMessage(pvar->NotificationWindow, WM_SETICON, ICON_BIG,
192- (LPARAM) pvar->OldLargeIcon);
193- pvar->OldLargeIcon = NULL;
194- }
195- if (pvar->OldSmallIcon != NULL) {
196- PostMessage(pvar->NotificationWindow, WM_SETICON, ICON_SMALL,
197- (LPARAM) pvar->OldSmallIcon);
198- pvar->OldSmallIcon = NULL;
199- }
200- if (OldNotifyIcon) {
201- SetCustomNotifyIcon(OldNotifyIcon);
202- }
185+ pvar->ts->SetVTIcon(NULL, 0);
203186
204187 ssh_heartbeat_lock_finalize();
205188
@@ -676,7 +659,7 @@
676659
677660 void notify_established_secure_connection(PTInstVar pvar)
678661 {
679- pvar->ts->SetVTIcon(pvar->ts, hInst, pvar->settings.IconID);
662+ pvar->ts->SetVTIcon(hInst, pvar->settings.IconID);
680663
681664 logputs(LOG_LEVEL_VERBOSE, "Entering secure mode");
682665 }
--- branches/adjust_icon/ttssh2/ttxssh/ttxssh.h (revision 9918)
+++ branches/adjust_icon/ttssh2/ttxssh/ttxssh.h (revision 9919)
@@ -238,8 +238,8 @@
238238 HWND NotificationWindow;
239239 unsigned int notification_msg;
240240 long notification_events;
241- HICON OldSmallIcon;
242- HICON OldLargeIcon;
241+ HICON OldSmallIcon; // 使用しない
242+ HICON OldLargeIcon; // 使用しない
243243
244244 BOOL hostdlg_activated;
245245 BOOL hostdlg_Enabled;
Show on old repository browser