[Ttssh2-commit] [8537] 指定サイズ毎の遅延が動作しなかったので修正

scmno****@osdn***** scmno****@osdn*****
2020年 2月 12日 (水) 08:48:22 JST


Revision: 8537
          https://osdn.net/projects/ttssh2/scm/svn/commits/8537
Author:   zmatsuo
Date:     2020-02-12 08:48:22 +0900 (Wed, 12 Feb 2020)
Log Message:
-----------
指定サイズ毎の遅延が動作しなかったので修正

Modified Paths:
--------------
    branches/sendmem_sendsize/teraterm/teraterm/sendmem.cpp

-------------- next part --------------
Modified: branches/sendmem_sendsize/teraterm/teraterm/sendmem.cpp
===================================================================
--- branches/sendmem_sendsize/teraterm/teraterm/sendmem.cpp	2020-02-11 15:56:16 UTC (rev 8536)
+++ branches/sendmem_sendsize/teraterm/teraterm/sendmem.cpp	2020-02-11 23:48:22 UTC (rev 8537)
@@ -70,6 +70,7 @@
 	DWORD delay_per_line;  // (ms)
 	DWORD delay_per_char;
 	DWORD delay_per_sendsize;
+	DWORD delay_tick;
 	size_t send_size_max;
 	SendMemDelayType delay_type;
 	HWND hWnd;	 // \x83^\x83C\x83}\x81[\x82\xF0\x8E󂯂\xE9window
@@ -266,8 +267,7 @@
 	}
 
 	if (p->waited) {
-		const DWORD delay = p->delay_per_line > 0 ? p->delay_per_line : p->delay_per_char;
-		if (GetTickCount() - p->last_send_tick < delay) {
+		if (GetTickCount() - p->last_send_tick < p->delay_tick) {
 			// \x83E\x83G\x83C\x83g\x82\xB7\x82\xE9
 			return;
 		}
@@ -295,12 +295,10 @@
 
 	// \x91\x97\x90M\x92\xB7
 	BOOL need_delay = FALSE;
-	DWORD delay_tick = 0;
 	size_t send_len;
 	if (p->delay_per_char > 0) {
 		// 1\x83L\x83\x83\x83\x89\x83N\x83^\x91\x97\x90M
 		need_delay = TRUE;
-		delay_tick = p->delay_per_char;
 		if (p->type == SendMemTypeBinary) {
 			send_len = 1;
 		}
@@ -311,7 +309,6 @@
 	else if (p->delay_per_line > 0) {
 		// 1\x83\x89\x83C\x83\x93\x91\x97\x90M
 		need_delay = TRUE;
-		delay_tick = p->delay_per_line;
 
 		// 1\x8Ds\x8E\xE6\x82\xE8\x8Fo\x82\xB5(\x89\xFC\x8Ds\x83R\x81[\x83h\x82\xCD 0x0a \x82ɐ\xB3\x8BK\x89\xBB\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9)
 		const wchar_t *line_top = (wchar_t *)&p->send_ptr[p->send_index];
@@ -345,7 +342,6 @@
 			// \x91\x97\x90M\x83T\x83C\x83Y\x8F\xE3\x8C\xC0
 			if (send_len > p->send_size_max) {
 				need_delay = TRUE;
-				delay_tick = p->delay_per_sendsize;
 				send_len = p->send_size_max;
 			}
 		}
@@ -382,7 +378,7 @@
 		p->waited = TRUE;
 		p->last_send_tick = GetTickCount();
 		// \x83^\x83C\x83}\x81[\x82\xCDidle\x82𓮍삳\x82\xB9\x82邽\x82߂Ɏg\x97p\x82\xB5\x82Ă\xA2\x82\xE9
-		SetTimer(p->hWnd, p->timer_id, delay_tick, NULL);
+		SetTimer(p->hWnd, p->timer_id, p->delay_tick, NULL);
 	}
 }
 
@@ -545,6 +541,7 @@
 		sm->send_size_max = send_max;
 		break;
 	}
+	sm->delay_tick = delay_tick;
 }
 
 // \x83Z\x83b\x83g\x82\xB7\x82\xE9\x82ƃ_\x83C\x83A\x83\x8D\x83O\x82\xAA\x8Fo\x82\xE9


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