[Ttssh2-commit] [8022] CTRLを素早く2回押下で文字情報ポップアップが出るようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 8月 27日 (火) 23:39:12 JST


Revision: 8022
          https://osdn.net/projects/ttssh2/scm/svn/commits/8022
Author:   zmatsuo
Date:     2019-08-27 23:39:11 +0900 (Tue, 27 Aug 2019)
Log Message:
-----------
CTRLを素早く2回押下で文字情報ポップアップが出るようにした

Modified Paths:
--------------
    branches/unicode_buf/teraterm/teraterm/vtwin.cpp
    branches/unicode_buf/teraterm/teraterm/vtwin.h

-------------- next part --------------
Modified: branches/unicode_buf/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/unicode_buf/teraterm/teraterm/vtwin.cpp	2019-08-27 14:38:57 UTC (rev 8021)
+++ branches/unicode_buf/teraterm/teraterm/vtwin.cpp	2019-08-27 14:39:11 UTC (rev 8022)
@@ -809,6 +809,10 @@
 
 	DropLists = NULL;
 	DropListCount = 0;
+
+#if UNICODE_DEBUG
+	CtrlKeyState = 0;
+#endif
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -2257,11 +2261,33 @@
 	MSG M;
 
 #if UNICODE_DEBUG
-	if (nChar == VK_CONTROL && GetAsyncKeyState(VK_RCONTROL) != 0 && (nFlags & 0x4000) == 0){
-		POINT pos;
-		GetCursorPos(&pos);
-		ScreenToClient(m_hWnd, &pos);
-		CodePopup(pos.x, pos.y);
+	if (nChar == VK_CONTROL) {
+		const DWORD now = GetTickCount();
+		switch(CtrlKeyState) {
+		case 0:
+			CtrlKeyDownTick = now;
+			CtrlKeyState = 1;
+			break;
+		case 2:
+			if (now - CtrlKeyDownTick < 500 && TipWinCodeDebug == NULL) {
+				POINT pos;
+				GetCursorPos(&pos);
+				ScreenToClient(m_hWnd, &pos);
+				CodePopup(pos.x, pos.y);
+				CtrlKeyState++;
+			} else {
+				CtrlKeyDownTick = now;
+				CtrlKeyState = 1;
+			}
+			break;
+		case 3:
+			break;
+		default:
+			CtrlKeyState = 0;
+			break;
+		}
+	} else {
+		CtrlKeyState = 0;
 	}
 	if (TipWinCodeDebug != NULL && nChar == VK_SHIFT) {
 		POINT pos;
@@ -2305,10 +2331,16 @@
 {
 	KeyUp(nChar);
 #if UNICODE_DEBUG
+	if (CtrlKeyState == 1 && nChar == VK_CONTROL) {
+		CtrlKeyState++;
+	} else {
+		CtrlKeyState = 0;
+	}
 	if (nChar == VK_CONTROL) {
 		if (TipWinCodeDebug != NULL) {
 			TipWinDestroy(TipWinCodeDebug);
 			TipWinCodeDebug = NULL;
+			CtrlKeyState = 0;
 		}
 	}
 #endif

Modified: branches/unicode_buf/teraterm/teraterm/vtwin.h
===================================================================
--- branches/unicode_buf/teraterm/teraterm/vtwin.h	2019-08-27 14:38:57 UTC (rev 8021)
+++ branches/unicode_buf/teraterm/teraterm/vtwin.h	2019-08-27 14:39:11 UTC (rev 8022)
@@ -69,7 +69,8 @@
   // for debug
 #if UNICODE_DEBUG
   TipWin *TipWinCodeDebug;
-  
+  int CtrlKeyState;			// 0:\x8AJ\x8En/1:\x89\x9F\x82\xB7/2:\x97\xA3\x82\xB7/3:\x89\x9F\x82\xB7(\x95\\x8E\xA6\x8F\xF3\x91\xD4)
+  DWORD CtrlKeyDownTick;	// \x8Dŏ\x89\x82ɉ\x9F\x82\xB5\x82\xBDtick
 #endif
 
 public:


Ttssh2-commit メーリングリストの案内
Back to archive index