Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/teraterm/vtterm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4770 by doda, Tue Dec 6 10:20:48 2011 UTC revision 4813 by doda, Thu Feb 2 13:11:32 2012 UTC
# Line 138  static int NewKeyId, NewKeyLen; Line 138  static int NewKeyId, NewKeyLen;
138    
139  /* Mouse Report */  /* Mouse Report */
140  int MouseReportMode;  int MouseReportMode;
141    int MouseReportExtMode;
142  unsigned int DecLocatorFlag;  unsigned int DecLocatorFlag;
143  int LastX, LastY;  int LastX, LastY;
144  int ButtonStat;  int ButtonStat;
# Line 228  void ResetTerminal() /*reset variables b Line 229  void ResetTerminal() /*reset variables b
229    AutoRepeatMode = TRUE;    AutoRepeatMode = TRUE;
230    FocusReportMode = FALSE;    FocusReportMode = FALSE;
231    MouseReportMode = IdMouseTrackNone;    MouseReportMode = IdMouseTrackNone;
232      MouseReportExtMode = IdMouseTrackExtNone;
233    DecLocatorFlag = 0;    DecLocatorFlag = 0;
234    
235    ChangeTerminalID();    ChangeTerminalID();
# Line 2371  void CSSetAttr()               // SGR Line 2373  void CSSetAttr()               // SGR
2373              if (ts.MouseEventTracking)              if (ts.MouseEventTracking)
2374                FocusReportMode = TRUE;                FocusReportMode = TRUE;
2375              break;              break;
2376              case 1005: // Extended Mouse Tracking
2377                if (ts.MouseEventTracking)
2378                  MouseReportExtMode = IdMouseTrackExtUTF8;
2379            case 1047: // Alternate Screen Buffer            case 1047: // Alternate Screen Buffer
2380              if ((ts.TermFlag & TF_ALTSCR) && !AltScr) {              if ((ts.TermFlag & TF_ALTSCR) && !AltScr) {
2381                BuffSaveScreen();                BuffSaveScreen();
# Line 2501  void CSSetAttr()               // SGR Line 2506  void CSSetAttr()               // SGR
2506              MouseReportMode = IdMouseTrackNone;              MouseReportMode = IdMouseTrackNone;
2507              break;              break;
2508            case 1004: FocusReportMode = FALSE; break; // Focus Report            case 1004: FocusReportMode = FALSE; break; // Focus Report
2509              case 1005: // Extended Mouse Tracking
2510                  MouseReportExtMode = IdMouseTrackExtNone;
2511            case 1047: // Alternate Screen Buffer            case 1047: // Alternate Screen Buffer
2512              if ((ts.TermFlag & TF_ALTSCR) && AltScr) {              if ((ts.TermFlag & TF_ALTSCR) && AltScr) {
2513                BuffClearScreen();                BuffClearScreen();
# Line 4557  BOOL DecLocatorReport(int Event, int But Line 4564  BOOL DecLocatorReport(int Event, int But
4564    return TRUE;    return TRUE;
4565  }  }
4566    
4567    #define MOUSE_POS_LIMIT (255 - 32)
4568    #define MOUSE_POS_EXT_LIMIT (2047 - 32)
4569    
4570  int MakeMouseReportStr(char *buff, size_t buffsize, int mb, int x, int y) {  int MakeMouseReportStr(char *buff, size_t buffsize, int mb, int x, int y) {
4571    return _snprintf_s_l(buff, buffsize, _TRUNCATE, "M%c%c%c", CLocale, mb+32, x+32, y+32);    char tmpx[3], tmpy[4];
4572    
4573      switch (MouseReportExtMode) {
4574      case IdMouseTrackExtNone:
4575        if (x >= MOUSE_POS_LIMIT) x = MOUSE_POS_LIMIT;
4576        if (y >= MOUSE_POS_LIMIT) y = MOUSE_POS_LIMIT;
4577        return _snprintf_s_l(buff, buffsize, _TRUNCATE, "M%c%c%c", CLocale, mb+32, x+32, y+32);
4578        break;
4579      case IdMouseTrackExtUTF8:
4580        if (x >= MOUSE_POS_EXT_LIMIT) x = MOUSE_POS_EXT_LIMIT;
4581        if (y >= MOUSE_POS_EXT_LIMIT) y = MOUSE_POS_EXT_LIMIT;
4582        x += 32;
4583        y += 32;
4584        if (x < 128) {
4585          tmpx[0] = x;
4586          tmpx[1] = 0;
4587        }
4588        else {
4589          tmpx[0] = (x >> 6) & 0x1f | 0xc0;
4590          tmpx[1] = x & 0x3f | 0x80;
4591          tmpx[2] = 0;
4592        }
4593        if (y < 128) {
4594          tmpy[0] = y;
4595          tmpy[1] = 0;
4596        }
4597        else {
4598          tmpy[0] = (x >> 6) & 0x1f | 0xc0;
4599          tmpy[1] = y & 0x3f | 0x80;
4600          tmpy[2] = 0;
4601        }
4602        return _snprintf_s_l(buff, buffsize, _TRUNCATE, "M%c%s%s", CLocale, mb+32, tmpx, tmpy);
4603        break;
4604      }
4605      buff[0] = 0;
4606      return 0;
4607  }  }
4608    
4609  BOOL MouseReport(int Event, int Button, int Xpos, int Ypos) {  BOOL MouseReport(int Event, int Button, int Xpos, int Ypos) {
# Line 4594  BOOL MouseReport(int Event, int Button, Line 4639  BOOL MouseReport(int Event, int Button,
4639    if (x < 1) x = 1;    if (x < 1) x = 1;
4640    if (y < 1) y = 1;    if (y < 1) y = 1;
4641    
   if (MouseReportMode != IdMouseTrackDECELR && MouseReportMode != IdMouseTrackNetTerm) {  
     if (x > 0xff - 32) x = 0xff - 32;  
     if (y > 0xff - 32) y = 0xff - 32;  
   }  
   
4642    if (ShiftKey())    if (ShiftKey())
4643      modifier = 4;      modifier = 4;
4644    else    else

Legend:
Removed from v.4770  
changed lines
  Added in v.4813

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26