[Ttssh2-commit] [3475] ルートウィンドウサイズ報告シーケンスに対応。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 6月 13日 (土) 02:12:00 JST


Revision: 3475
          http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3475
Author:   doda
Date:     2009-06-13 02:12:00 +0900 (Sat, 13 Jun 2009)

Log Message:
-----------
ルートウィンドウサイズ報告シーケンスに対応。
  <CSI> 19 t
    応答: <CSI> 9 ; H ; W t
           H,W: ルートウィンドウの高さ/幅

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


-------------- next part --------------
Modified: trunk/teraterm/teraterm/vtdisp.c
===================================================================
--- trunk/teraterm/teraterm/vtdisp.c	2009-06-12 15:37:04 UTC (rev 3474)
+++ trunk/teraterm/teraterm/vtdisp.c	2009-06-12 17:12:00 UTC (rev 3475)
@@ -3424,3 +3424,32 @@
 
 	return;
 }
+
+void DispGetRootWinSize(int *x, int *y)
+{
+	HMODULE mod;
+	HMONITOR monitor;
+	MONITORINFO monitorInfo;
+	RECT desktop, win, client;
+
+	GetWindowRect(HVTWin, &win);
+	GetClientRect(HVTWin, &client);
+
+	if (((mod = GetModuleHandle("user32.dll")) != NULL) &&
+	    (GetProcAddress(mod,"MonitorFromWindow") != NULL)) {
+		// ƒ}ƒ‹ƒ`ƒ‚ƒjƒ^‚ªƒTƒ|[ƒg‚³‚ê‚Ä‚¢‚éê‡
+		monitor = MonitorFromWindow(HVTWin, MONITOR_DEFAULTTONEAREST);
+		monitorInfo.cbSize = sizeof(MONITORINFO);
+		GetMonitorInfo(monitor, &monitorInfo);
+		desktop = monitorInfo.rcWork;
+	}
+	else {
+		// ƒ}ƒ‹ƒ`ƒ‚ƒjƒ^‚ªƒTƒ|[ƒg‚³‚ê‚Ä‚¢‚È‚¢ê‡
+		SystemParametersInfo(SPI_GETWORKAREA, 0, &desktop, 0);
+	}
+
+	*x = (desktop.right - desktop.left - (win.right - win.left - client.right)) / FontWidth;
+	*y = (desktop.bottom - desktop.top - (win.bottom - win.top - client.bottom)) / FontHeight;
+
+	return;
+}

Modified: trunk/teraterm/teraterm/vtdisp.h
===================================================================
--- trunk/teraterm/teraterm/vtdisp.h	2009-06-12 15:37:04 UTC (rev 3474)
+++ trunk/teraterm/teraterm/vtdisp.h	2009-06-12 17:12:00 UTC (rev 3475)
@@ -84,6 +84,7 @@
 void DispResizeWin(int w, int h);
 BOOL DispWindowIconified();
 void DispGetWindowPos(int *x, int *y);
+void DispGetRootWinSize(int *x, int *y);
 
 extern int WinWidth, WinHeight;
 extern HFONT VTFont[AttrFontMask+1];

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2009-06-12 15:37:04 UTC (rev 3474)
+++ trunk/teraterm/teraterm/vtterm.c	2009-06-12 17:12:00 UTC (rev 3475)
@@ -1837,6 +1837,11 @@
 	len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "8;%u;%u;t", CLocale, NumOfLines-StatusLine, NumOfColumns);
 	SendCSIstr(Report, len);
 	break;
+      case 19: // Report display size (character)
+	DispGetRootWinSize(&x, &y);
+	len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "9;%d;%dt", CLocale, x, y);
+	SendCSIstr(Report, len);
+	break;
     }
   }
 



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