[Ttssh2-commit] [7639] ttsshのauth dialogで、ユーザー名が入力されていたときtabを使ったフォーカス移動を従来と同じ動作にした

scmno****@osdn***** scmno****@osdn*****
2019年 5月 1日 (水) 00:57:35 JST


Revision: 7639
          https://osdn.net/projects/ttssh2/scm/svn/commits/7639
Author:   zmatsuo
Date:     2019-05-01 00:57:34 +0900 (Wed, 01 May 2019)
Log Message:
-----------
ttsshのauth dialogで、ユーザー名が入力されていたときtabを使ったフォーカス移動を従来と同じ動作にした

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/auth.c

-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/auth.c
===================================================================
--- trunk/ttssh2/ttxssh/auth.c	2019-04-29 17:58:34 UTC (rev 7638)
+++ trunk/ttssh2/ttxssh/auth.c	2019-04-30 15:57:34 UTC (rev 7639)
@@ -246,6 +246,34 @@
 	}
 }
 
+static LRESULT CALLBACK username_proc(HWND hWnd, UINT msg,
+									  WPARAM wParam, LPARAM lParam)
+{
+	const WNDPROC ProcOrg = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+	const LRESULT result = CallWindowProc(ProcOrg, hWnd, msg, wParam, lParam);
+	switch (msg) {
+	case WM_CHAR:
+	case WM_SETTEXT: {
+		// \x83\x86\x81[\x83U\x81[\x96\xBC\x82\xAA\x93\xFC\x97͂\xB3\x82\xEA\x82Ă\xA2\x82\xBD\x8Fꍇ\x81A\x83I\x83v\x83V\x83\x87\x83\x93\x82\xF0\x8Eg\x82\xA4\x82\xB1\x82Ƃ͂Ȃ\xA2\x82̂ŁA
+		// tab\x82ł̃t\x83H\x81[\x83J\x83X\x88ړ\xAE\x8E\x9E\x81A\x83I\x83v\x83V\x83\x87\x83\x93\x83{\x83^\x83\x93\x82\xF0\x83p\x83X\x82\xB7\x82\xE9\x82悤\x82ɂ\xB7\x82\xE9
+		// \x8F]\x97\x88\x82Ɠ\xAF\x82\xB6\x83L\x81[\x91\x80\x8D\xEC\x82Ń\x86\x81[\x83U\x81[\x96\xBC\x82ƃp\x83X\x83t\x83\x8C\x81[\x83Y\x82\xF0\x93\xFC\x97͉”\\x82Ƃ\xB7\x82\xE9
+		const HWND dlg = GetParent(hWnd);
+		const HWND hWndOption = GetDlgItem(dlg, IDC_USERNAME_OPTION);
+		const int len = GetWindowTextLength(hWnd);
+		LONG_PTR style = GetWindowLongPtr(hWndOption, GWL_STYLE);
+		if (len > 0) {
+			// \x95s\x97vtabstop
+			style = style & (~(LONG_PTR)WS_TABSTOP);
+		} else {
+			// \x97vtabstop
+			style = style | WS_TABSTOP;
+		}
+		SetWindowLongPtr(hWndOption, GWL_STYLE, style);
+	}
+	}
+	return result;
+}
+
 static void init_auth_dlg(PTInstVar pvar, HWND dlg, BOOL *UseControlChar)
 {
 	const static DlgTextInfo text_info[] = {
@@ -304,6 +332,14 @@
 		SetDlgItemText(dlg, IDC_SSHUSETIS, pvar->ts->UIMsg);
 	}
 
+	// username\x82̃T\x83u\x83N\x83\x89\x83X\x89\xBB
+	{
+		HWND hWndUserName = GetDlgItem(dlg, IDC_SSHUSERNAME);
+		LONG_PTR ProcOrg =
+			SetWindowLongPtr(hWndUserName, GWLP_WNDPROC, (LONG_PTR)username_proc);
+		SetWindowLongPtr(hWndUserName, GWLP_USERDATA, ProcOrg);
+	}
+
 	if (pvar->auth_state.user != NULL) {
 		SetDlgItemText(dlg, IDC_SSHUSERNAME, pvar->auth_state.user);
 		EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE);
@@ -842,6 +878,7 @@
 			DlgAuthFont = NULL;
 		}
 #endif
+		// "\x81\xA5"\x89摜\x82\xF0\x83Z\x83b\x83g\x82\xB7\x82\xE9
 		hIconDropdown = LoadImage(hInst, MAKEINTRESOURCE(IDI_DROPDOWN),
 								  IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
 		SendMessage(GetDlgItem(dlg, IDC_USERNAME_OPTION), BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconDropdown);


Ttssh2-commit メーリングリストの案内