[Ttssh2-commit] [4828] Extended Mouse Tracking (SGR) に対応。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2012年 2月 6日 (月) 12:02:08 JST


Revision: 4828
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4828
Author:   doda
Date:     2012-02-06 12:02:07 +0900 (Mon, 06 Feb 2012)
Log Message:
-----------
Extended Mouse Tracking (SGR) に対応。

Modified Paths:
--------------
    trunk/teraterm/teraterm/vtterm.c

-------------- next part --------------
Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2012-02-06 01:34:34 UTC (rev 4827)
+++ trunk/teraterm/teraterm/vtterm.c	2012-02-06 03:02:07 UTC (rev 4828)
@@ -2373,10 +2373,14 @@
 	    if (ts.MouseEventTracking)
 	      FocusReportMode = TRUE;
 	    break;
-	  case 1005: // Extended Mouse Tracking
+	  case 1005: // Extended Mouse Tracking (UTF-8)
 	    if (ts.MouseEventTracking)
 	      MouseReportExtMode = IdMouseTrackExtUTF8;
 	    break;
+	  case 1006: // Extended Mouse Tracking (SGR)
+	    if (ts.MouseEventTracking)
+	      MouseReportExtMode = IdMouseTrackExtSGR;
+	    break;
 	  case 1047: // Alternate Screen Buffer
 	    if ((ts.TermFlag & TF_ALTSCR) && !AltScr) {
 	      BuffSaveScreen();
@@ -2509,8 +2513,9 @@
 	  case 1004: // Focus Report
 	    FocusReportMode = FALSE;
 	    break;
-	  case 1005: // Extended Mouse Tracking
-	    MouseReportExtMode = IdMouseTrackExtNone;
+	  case 1005: // Extended Mouse Tracking (UTF-8)
+	  case 1006: // Extended Mouse Tracking (SGR)
+	      MouseReportExtMode = IdMouseTrackExtNone;
 	    break;
 	  case 1047: // Alternate Screen Buffer
 	    if ((ts.TermFlag & TF_ALTSCR) && AltScr) {
@@ -4605,13 +4610,16 @@
     }
     return _snprintf_s_l(buff, buffsize, _TRUNCATE, "M%c%s%s", CLocale, mb+32, tmpx, tmpy);
     break;
+  case IdMouseTrackExtSGR:
+    return _snprintf_s_l(buff, buffsize, _TRUNCATE, "<%d;%d;%d%c", CLocale, mb&0x7f, x, y, (mb&0x80)?'m':'M');
+    break;
   }
   buff[0] = 0;
   return 0;
 }
 
 BOOL MouseReport(int Event, int Button, int Xpos, int Ypos) {
-  char Report[10];
+  char Report[32];
   int x, y, len, modifier;
   static int LastSendX = -1, LastSendY = -1, LastButton = IdButtonRelease;
 
@@ -4688,7 +4696,13 @@
 	case IdMouseTrackVT200:
 	case IdMouseTrackBtnEvent:
 	case IdMouseTrackAllEvent:
-	  len = MakeMouseReportStr(Report, sizeof Report, IdButtonRelease | modifier, x, y);
+	  if (MouseReportExtMode == IdMouseTrackExtSGR) {
+	    modifier |= 128;
+	  }
+	  else {
+	    Button = IdButtonRelease;
+	  }
+	  len = MakeMouseReportStr(Report, sizeof Report, Button | modifier, x, y);
 	  LastSendX = x;
 	  LastSendY = y;
 	  LastButton = IdButtonRelease;



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