[Ttssh2-commit] [8066] リサイズ中の縦横サイズツールチップが、デスクトップの左端と上端で表示されなくなっていた。

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 9月 6日 (金) 20:06:41 JST


Revision: 8066
          https://osdn.net/projects/ttssh2/scm/svn/commits/8066
Author:   yutakapon
Date:     2019-09-06 20:06:40 +0900 (Fri, 06 Sep 2019)
Log Message:
-----------
リサイズ中の縦横サイズツールチップが、デスクトップの左端と上端で表示されなくなっていた。
ツールチップの表示位置がTera Termウィンドウの左上隅と重なっていたため、位置を調整した。

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/ja/html/about/history.html
    trunk/teraterm/common/tipwin.cpp
    trunk/teraterm/teraterm/sizetip.c

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2019-09-05 17:21:02 UTC (rev 8065)
+++ trunk/doc/en/html/about/history.html	2019-09-06 11:06:40 UTC (rev 8066)
@@ -47,7 +47,7 @@
   </li>
   <li>Bug fixes
     <ul>
-      <li></li>
+      <li>The toolchip during resizing can not be displayed on the left and top edge of the desktop.</li>
     </ul>
   </li>
 

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2019-09-05 17:21:02 UTC (rev 8065)
+++ trunk/doc/ja/html/about/history.html	2019-09-06 11:06:40 UTC (rev 8066)
@@ -47,7 +47,7 @@
   </li>
   <li>\x83o\x83O\x8FC\x90\xB3
     <ul>
-      <li></li>
+      <li>\x83\x8A\x83T\x83C\x83Y\x92\x86\x82̏c\x89\xA1\x83T\x83C\x83Y\x83c\x81[\x83\x8B\x83`\x83b\x83v\x82\xAA\x81A\x83f\x83X\x83N\x83g\x83b\x83v\x82̍\xB6\x92[\x82Ə\xE3\x92[\x82ŕ\\x8E\xA6\x82\xB3\x82\xEA\x82Ȃ\xAD\x82Ȃ\xC1\x82Ă\xA2\x82\xBD\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B</li>
     </ul>
   </li>
 

Modified: trunk/teraterm/common/tipwin.cpp
===================================================================
--- trunk/teraterm/common/tipwin.cpp	2019-09-05 17:21:02 UTC (rev 8065)
+++ trunk/teraterm/common/tipwin.cpp	2019-09-06 11:06:40 UTC (rev 8066)
@@ -84,6 +84,61 @@
 	BOOL auto_destroy;
 } TipWin;
 
+/**
+ *	point \x82\xF0
+ *	\x83X\x83N\x83\x8A\x81[\x83\x93\x82\xA9\x82\xE7\x82͂ݏo\x82\xB5\x82Ă\xA2\x82\xE9\x8Fꍇ\x81A\x93\xFC\x82\xE9\x82悤\x82ɕ␳\x82\xB7\x82\xE9
+ *	NearestMonitor \x82\xAA TRUE \x82̂Ƃ\xAB\x81A\x8Dł\xE0\x8B߂\xA2\x83\x82\x83j\x83^
+ *	FALSE\x82̂Ƃ\xAB\x81A\x83}\x83E\x83X\x82̂\xA0\x82郂\x83j\x83^\x82Ɉړ\xAE\x82\xB3\x82\xB9\x82\xE9
+ *	\x83f\x83B\x83X\x83v\x83\x8C\x83C\x82̒[\x82\xA9\x82\xE7 FrameWidth(pixel) \x82\xE6\x82藣\x82\xEA\x82\xE9\x82悤\x82ɂ\xB7\x82\xE9
+ */
+static void FixPosFromFrame(POINT *point, int FrameWidth, BOOL NearestMonitor)
+{
+	if (HasMultiMonitorSupport()) {
+		// \x83}\x83\x8B\x83`\x83\x82\x83j\x83^\x82\xAA\x83T\x83|\x81[\x83g\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9\x8Fꍇ
+		HMONITOR hm;
+		MONITORINFO mi;
+		int ix, iy;
+
+		// \x8C\xB3\x82̍\xC0\x95W\x82\xF0\x95ۑ\xB6\x82\xB5\x82Ă\xA8\x82\xAD
+		ix = point->x;
+		iy = point->y;
+
+		hm = MonitorFromPoint(*point, MONITOR_DEFAULTTONULL);
+		if (hm == NULL) {
+			if (NearestMonitor) {
+				// \x8Dł\xE0\x8B߂\xA2\x83\x82\x83j\x83^\x82ɕ\\x8E\xA6\x82\xB7\x82\xE9
+				hm = MonitorFromPoint(*point, MONITOR_DEFAULTTONEAREST);
+			} else {
+				// \x83X\x83N\x83\x8A\x81[\x83\x93\x82\xA9\x82\xE7\x82͂ݏo\x82\xB5\x82Ă\xA2\x82\xE9\x8Fꍇ\x82̓}\x83E\x83X\x82̂\xA0\x82郂\x83j\x83^\x82ɕ\\x8E\xA6\x82\xB7\x82\xE9
+				GetCursorPos(point);
+				hm = MonitorFromPoint(*point, MONITOR_DEFAULTTONEAREST);
+			}
+		}
+
+		mi.cbSize = sizeof(MONITORINFO);
+		GetMonitorInfo(hm, &mi);
+		if (ix < mi.rcMonitor.left + FrameWidth) {
+			ix = mi.rcMonitor.left + FrameWidth;
+		}
+		if (iy < mi.rcMonitor.top + FrameWidth) {
+			iy = mi.rcMonitor.top + FrameWidth;
+		}
+		
+		point->x = ix;
+		point->y = iy;
+	}
+	else
+	{
+		// \x83}\x83\x8B\x83`\x83\x82\x83j\x83^\x82\xAA\x83T\x83|\x81[\x83g\x82\xB3\x82\xEA\x82Ă\xA2\x82Ȃ\xA2\x8Fꍇ
+		if (point->x < FrameWidth) {
+			point->x = FrameWidth;
+		}
+		if (point->y < FrameWidth) {
+			point->y = FrameWidth;
+		}
+	}
+}
+
 static void CalcStrRect(TipWin *pTipWin)
 {
 	HDC hdc = CreateCompatibleDC(NULL);
@@ -233,6 +288,8 @@
 	const HINSTANCE hInst = (HINSTANCE)GetWindowLongPtr(src, GWLP_HINSTANCE);
 	LOGFONTA logfont;
 	const UINT uDpi = GetMonitorDpiFromWindow(src);
+	int height;
+	POINT point;
 
 	register_class(hInst);
 	pTipWin = (TipWin *)malloc(sizeof(TipWin));
@@ -249,6 +306,15 @@
 	pTipWin->tip_font = CreateFontIndirect(&logfont);
 	CalcStrRect(pTipWin);
 	pTipWin->hParentWnd = src;
+
+	// \x95\xB6\x8E\x9A\x97\xF1\x82̍\x82\x82\xB3\x82\xF0\x8E擾\x82\xB7\x82\xE9\x81B
+	height = pTipWin->str_rect.bottom - pTipWin->str_rect.top;
+	point.x = cx;
+	point.y = cy - (height + FRAME_WIDTH * 2);
+	FixPosFromFrame(&point, 16, FALSE);
+	cx = point.x;
+	cy = point.y;
+
 	create_tipwin(pTipWin, hInst, cx, cy);
 
 	pTipWin->hParentWnd = src;

Modified: trunk/teraterm/teraterm/sizetip.c
===================================================================
--- trunk/teraterm/teraterm/sizetip.c	2019-09-05 17:21:02 UTC (rev 8065)
+++ trunk/teraterm/teraterm/sizetip.c	2019-09-06 11:06:40 UTC (rev 8066)
@@ -41,53 +41,6 @@
 static TipWin *SizeTip;
 static int tip_enabled = 0;
 
-/**
- *	point を
- *	スクリーンからはみ出している場合、入るように補正する
- *	NearestMonitor が TRUE のとき、最も近いモニタ
- *	FALSEのとき、マウスのあるモニタに移動させる
- *	ディスプレイの端から FrameWidth(pixel) より離れるようにする
- */
-static void FixPosFromFrame(POINT *point, int FrameWidth, BOOL NearestMonitor)
-{
-	if (HasMultiMonitorSupport()) {
-		// マルチモニタがサポートされている場合
-		HMONITOR hm;
-		MONITORINFO mi;
-
-		hm = MonitorFromPoint(*point, MONITOR_DEFAULTTONULL);
-		if (hm == NULL) {
-			if (NearestMonitor) {
-				// 最も近いモニタに表示する
-				hm = MonitorFromPoint(*point, MONITOR_DEFAULTTONEAREST);
-			} else {
-				// スクリーンからはみ出している場合はマウスのあるモニタに表示する
-				GetCursorPos(point);
-				hm = MonitorFromPoint(*point, MONITOR_DEFAULTTONEAREST);
-			}
-		}
-
-		mi.cbSize = sizeof(MONITORINFO);
-		GetMonitorInfo(hm, &mi);
-		if (point->x < mi.rcMonitor.left + FrameWidth) {
-			point->x = mi.rcMonitor.left + FrameWidth;
-		}
-		if (point->y < mi.rcMonitor.top + FrameWidth) {
-			point->y = mi.rcMonitor.top + FrameWidth;
-		}
-	}
-	else
-	{
-		// マルチモニタがサポートされていない場合
-		if (point->x < FrameWidth) {
-			point->x = FrameWidth;
-		}
-		if (point->y < FrameWidth) {
-			point->y = FrameWidth;
-		}
-	}
-}
-
 void UpdateSizeTip(HWND src, int cx, int cy)
 {
 	TCHAR str[32];
@@ -101,15 +54,10 @@
 
 	if (SizeTip == NULL) {
 		RECT wr;
-		POINT point;
 		// ウィンドウの位置を取得
 		GetWindowRect(src, &wr);
-		// sizetipを出す位置は、ウィンドウ左上-(8,16)
-		point.x = wr.left - 16;
-		point.y = wr.top - 8;
-		FixPosFromFrame(&point, 16, FALSE);
-		cx = point.x;
-		cy = point.y;
+		cx = wr.left;
+		cy = wr.top;
 		SizeTip = TipWinCreate(src, cx, cy, str);
 	} else {
 		/* Tip already exists, just set the text */


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