[ttssh2-commit] [9380] クリップボードペースト確認ダイアログが画面からはみ出さないようにした

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2021年 8月 21日 (土) 01:31:56 JST


Revision: 9380
          https://osdn.net/projects/ttssh2/scm/svn/commits/9380
Author:   zmatsuo
Date:     2021-08-21 01:31:56 +0900 (Sat, 21 Aug 2021)
Log Message:
-----------
クリップボードペースト確認ダイアログが画面からはみ出さないようにした

- 本来はみ出さないようになっていた
- しかしダイアログサイズが変更されたときはみ出しがおこっていた
- 静的変数をなくした
- ts構造体の直接参照をなくした
- clipboarddlgdata の未使用メンバを削除した
- MoveWindowToDisplayPoint() を ttlib_static.c に追加
  - 指定座標が属するデスクトップから
  - ウィンドウをはみださないよう移動する

Modified Paths:
--------------
    trunk/teraterm/common/ttlib.h
    trunk/teraterm/common/ttlib_static.c
    trunk/teraterm/teraterm/clipboar.c
    trunk/teraterm/teraterm/clipboarddlg.cpp
    trunk/teraterm/teraterm/clipboarddlg.h

-------------- next part --------------
Modified: trunk/teraterm/common/ttlib.h
===================================================================
--- trunk/teraterm/common/ttlib.h	2021-08-20 16:31:43 UTC (rev 9379)
+++ trunk/teraterm/common/ttlib.h	2021-08-20 16:31:56 UTC (rev 9380)
@@ -129,6 +129,7 @@
 void GetDesktopRect(HWND hWnd, RECT *rect);
 void CenterWindow(HWND hWnd, HWND hWndParent);
 void MoveWindowToDisplay(HWND hWnd);
+void MoveWindowToDisplayPoint(HWND hWnd, const POINT *p);
 
 #define CheckFlag(var, flag)	(((var) & (flag)) != 0)
 

Modified: trunk/teraterm/common/ttlib_static.c
===================================================================
--- trunk/teraterm/common/ttlib_static.c	2021-08-20 16:31:43 UTC (rev 9379)
+++ trunk/teraterm/common/ttlib_static.c	2021-08-20 16:31:56 UTC (rev 9380)
@@ -151,14 +151,39 @@
 }
 
 /**
- *	\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x83f\x83B\x83X\x83v\x83\x8C\x83C\x82\xA9\x82\xE7\x82͂ݏo\x82\xB3\x82Ȃ\xA2\x82悤\x82Ɉړ\xAE\x82\xB7\x82\xE9
+ *	point\x82\xAA\x91\xB6\x8D݂\xB7\x82\xE9\x83f\x83B\x83X\x83v\x83\x8C\x83C\x82̃f\x83X\x83N\x83g\x83b\x83v\x82͈̔͂\xF0\x8E擾\x82\xB7\x82\xE9
+ */
+static void GetDesktopRectFromPoint(const POINT *p, RECT *rect)
+{
+	if (pMonitorFromPoint == NULL) {
+		// NT4.0, 95 \x82̓}\x83\x8B\x83`\x83\x82\x83j\x83^API\x82ɔ\xF1\x91Ή\x9E
+		SystemParametersInfo(SPI_GETWORKAREA, 0, rect, 0);
+	}
+	else {
+		// \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;
+		POINT pt;
+		MONITORINFO mi;
+
+		pt.x = p->x;
+		pt.y = p->y;
+		hm = pMonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
+
+		mi.cbSize = sizeof(MONITORINFO);
+		pGetMonitorInfoA(hm, &mi);
+		*rect = mi.rcWork;
+	}
+}
+
+/**
+ *	\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x97̈悩\x82\xE7\x82͂ݏo\x82\xB3\x82Ȃ\xA2\x82悤\x82Ɉړ\xAE\x82\xB7\x82\xE9
  *	\x82͂ݏo\x82Ă\xA2\x82Ȃ\xA2\x8Fꍇ\x82͈ړ\xAE\x82\xB5\x82Ȃ\xA2
  *
  *	@param[in]	hWnd		\x88ʒu\x82𒲐\xAE\x82\xB7\x82\xE9\x83E\x83B\x83\x93\x83h\x83E
  */
-void MoveWindowToDisplay(HWND hWnd)
+void MoveWindowToDisplayRect(HWND hWnd, const RECT *rect)
 {
-	RECT desktop;
+	RECT desktop = *rect;
 	RECT win_rect;
 	int win_width;
 	int win_height;
@@ -196,6 +221,36 @@
 }
 
 /**
+ *	\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x83f\x83B\x83X\x83v\x83\x8C\x83C\x82\xA9\x82\xE7\x82͂ݏo\x82\xB3\x82Ȃ\xA2\x82悤\x82Ɉړ\xAE\x82\xB7\x82\xE9
+ *	\x83f\x83B\x83X\x83v\x83\x8C\x83C\x82̓E\x83B\x83\x93\x83h\x83E\x82\xAA\x91\xAE\x82\xB5\x82Ă\xA2\x82\xE9\x83f\x83B\x83X\x83v\x83\x8C\x83C
+ *	\x82܂\xBD\x82\xA2\x82ł\xA2\x82\xE9\x82Ƃ\xAB\x82͖ʐς̍L\x82\xA2\x95\xFB
+ *	\x82͂ݏo\x82Ă\xA2\x82Ȃ\xA2\x8Fꍇ\x82͈ړ\xAE\x82\xB5\x82Ȃ\xA2
+ *
+ *	@param[in]	hWnd		\x88ʒu\x82𒲐\xAE\x82\xB7\x82\xE9\x83E\x83B\x83\x93\x83h\x83E
+ */
+void MoveWindowToDisplay(HWND hWnd)
+{
+	RECT desktop;
+	GetDesktopRect(hWnd, &desktop);
+	MoveWindowToDisplayRect(hWnd, &desktop);
+}
+
+/**
+ *	\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x83f\x83B\x83X\x83v\x83\x8C\x83C\x82\xA9\x82\xE7\x82͂ݏo\x82\xB3\x82Ȃ\xA2\x82悤\x82Ɉړ\xAE\x82\xB7\x82\xE9
+ *	\x83f\x83B\x83X\x83v\x83\x8C\x83C\x82\xCDpoint\x82\xAA\x91\xAE\x82\xB5\x82Ă\xA2\x82\xE9\x83f\x83B\x83X\x83v\x83\x8C\x83C
+ *	\x82͂ݏo\x82Ă\xA2\x82Ȃ\xA2\x8Fꍇ\x82͈ړ\xAE\x82\xB5\x82Ȃ\xA2
+ *
+ *	@param[in]	hWnd		\x88ʒu\x82𒲐\xAE\x82\xB7\x82\xE9\x83E\x83B\x83\x93\x83h\x83E
+ *	@param[in]	point		\x88ʒu
+ */
+void MoveWindowToDisplayPoint(HWND hWnd, const POINT *point)
+{
+	RECT desktop;
+	GetDesktopRectFromPoint(point, &desktop);
+	MoveWindowToDisplayRect(hWnd, &desktop);
+}
+
+/**
  *	\x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x83f\x83B\x83X\x83v\x83\x8C\x83C\x82̒\x86\x89\x9B\x82ɔz\x92u\x82\xB7\x82\xE9
  *
  *	@param[in]	hWnd		\x88ʒu\x82𒲐\xAE\x82\xB7\x82\xE9\x83E\x83B\x83\x93\x83h\x83E

Modified: trunk/teraterm/teraterm/clipboar.c
===================================================================
--- trunk/teraterm/teraterm/clipboar.c	2021-08-20 16:31:43 UTC (rev 9379)
+++ trunk/teraterm/teraterm/clipboar.c	2021-08-20 16:31:56 UTC (rev 9380)
@@ -166,7 +166,9 @@
 		clipboarddlgdata dlg_data;
 		dlg_data.strW_ptr = str_w;
 		dlg_data.UILanguageFileW = ts.UILanguageFileW;
+		dlg_data.PasteDialogSize = ts.PasteDialogSize;
 		ret = clipboarddlg(hInst, HWin, &dlg_data);
+		ts.PasteDialogSize = dlg_data.PasteDialogSize;
 		*out_str_w = dlg_data.strW_edited_ptr;
 	}
 

Modified: trunk/teraterm/teraterm/clipboarddlg.cpp
===================================================================
--- trunk/teraterm/teraterm/clipboarddlg.cpp	2021-08-20 16:31:43 UTC (rev 9379)
+++ trunk/teraterm/teraterm/clipboarddlg.cpp	2021-08-20 16:31:56 UTC (rev 9380)
@@ -47,26 +47,44 @@
 
 #include "clipboarddlg.h"
 
-static void GetDesktopRectFromPoint(POINT p, RECT *rect)
+typedef struct {
+	clipboarddlgdata *data;
+	int init_width;
+	int init_height;
+	HWND hStatus;
+	int ok2right;
+	int edit2ok;
+	int edit2bottom;
+} DlgPrivateData;
+
+static void TTGetCaretPos(HWND hDlgWnd, POINT *p)
 {
-	if (pMonitorFromPoint == NULL) {
-		// NT4.0, 95 \x82̓}\x83\x8B\x83`\x83\x82\x83j\x83^API\x82ɔ\xF1\x91Ή\x9E
-		SystemParametersInfo(SPI_GETWORKAREA, 0, rect, 0);
+	if (ActiveWin == IdVT) { // VT Window
+		/*
+		 * Caret off \x8E\x9E\x82\xC9 GetCaretPos() \x82Ő\xB3\x8Am\x82ȏꏊ\x82\xAA\x8E\xE6\x82\xEA\x82Ȃ\xA2\x82̂ŁA
+		 * vtdisp.c \x93\xE0\x95\x94\x82ŊǗ\x9D\x82\xB5\x82Ă\xA2\x82\xE9\x92l\x82\xA9\x82\xE7\x8Cv\x8EZ\x82\xB7\x82\xE9
+		 */
+		int x, y;
+		DispConvScreenToWin(CursorX, CursorY, &x, &y);
+		p->x = x;
+		p->y = y;
 	}
-	else {
-		// \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;
-		POINT pt;
-		MONITORINFO mi;
+	else if (!GetCaretPos(p)) { // Tek Window
+		/*
+		 * Tek Window \x82͓\xE0\x95\x94\x8AǗ\x9D\x82̒l\x82\xF0\x8E\xE6\x82\xE9\x82̂\xAA\x96ʓ|\x82Ȃ̂\xC5 GetCaretPos() \x82\xF0\x8Eg\x82\xA4
+		 * GetCaretPos() \x82\xAA\x83G\x83\x89\x81[\x82ɂȂ\xC1\x82\xBD\x8Fꍇ\x82͔O\x82̂\xBD\x82\xDF 0, 0 \x82\xF0\x93\xFC\x82\xEA\x82Ă\xA8\x82\xAD
+		 */
+		p->x = 0;
+		p->y = 0;
+	}
 
-		pt.x = p.x;
-		pt.y = p.y;
-		hm = pMonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
+	// x, y \x82̗\xBC\x95\xFB\x82\xAA 0 \x82̎\x9E\x82͐e\x83E\x83B\x83\x93\x83h\x83E\x82̒\x86\x89\x9B\x82Ɉړ\xAE\x82\xB3\x82\xB9\x82\xE7\x82\xEA\x82\xE9\x82̂ŁA
+	// \x82\xBB\x82\xEA\x82\xF0\x96h\x82\xAE\x88ׂ\xC9 x \x82\xF0 1 \x82ɂ\xB7\x82\xE9
+	if (p->x == 0 && p->y == 0) {
+		p->x = 1;
+	}
 
-		mi.cbSize = sizeof(MONITORINFO);
-		pGetMonitorInfoA(hm, &mi);
-		*rect = mi.rcWork;
-	}
+	ClientToScreen(GetParent(hDlgWnd), p);
 }
 
 static INT_PTR CALLBACK OnClipboardDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
@@ -76,107 +94,57 @@
 		{ IDCANCEL, "BTN_CANCEL" },
 		{ IDOK, "BTN_OK" },
 	};
-	POINT p;
-	RECT rc_dsk, rc_dlg;
-	int dlg_height, dlg_width;
-	static int ok2right, edit2ok, edit2bottom;
+	RECT rc_dlg;
 	RECT rc_edit, rc_ok, rc_cancel;
-	// for status bar
-	static HWND hStatus = NULL;
-	static int init_width, init_height;
-	clipboarddlgdata *data = (clipboarddlgdata *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
+	DlgPrivateData *pdata = (DlgPrivateData *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
 
 	switch (msg) {
 		case WM_INITDIALOG:
-			data = (clipboarddlgdata *)lp;
-			SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)data);
-			SetDlgTextsW(hDlgWnd, TextInfos, _countof(TextInfos), data->UILanguageFileW);
+			pdata = (DlgPrivateData *)lp;
+			SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)pdata);
+			SetDlgTextsW(hDlgWnd, TextInfos, _countof(TextInfos), pdata->data->UILanguageFileW);
 
-			if (data->strW_ptr != NULL) {
-				SetDlgItemTextW(hDlgWnd, IDC_EDIT, data->strW_ptr);
-			} else {
-				SetDlgItemTextA(hDlgWnd, IDC_EDIT, data->strA_ptr);
-			}
+			SetDlgItemTextW(hDlgWnd, IDC_EDIT, pdata->data->strW_ptr);
 
 			// \x83\x8A\x83T\x83C\x83Y\x83A\x83C\x83R\x83\x93\x82\xF0\x89E\x89\xBA\x82ɕ\\x8E\xA6\x82\xB3\x82\xB9\x82\xBD\x82\xA2\x82̂ŁA\x83X\x83e\x81[\x83^\x83X\x83o\x81[\x82\xF0\x95t\x82\xAF\x82\xE9\x81B
 			InitCommonControls();
-			hStatus = CreateStatusWindow(
+			pdata->hStatus = CreateStatusWindow(
 				WS_CHILD | WS_VISIBLE |
 				CCS_BOTTOM | SBARS_SIZEGRIP, NULL, hDlgWnd, 1);
 
-			if (ActiveWin == IdVT) { // VT Window
-				/*
-				 * Caret off \x8E\x9E\x82\xC9 GetCaretPos() \x82Ő\xB3\x8Am\x82ȏꏊ\x82\xAA\x8E\xE6\x82\xEA\x82Ȃ\xA2\x82̂ŁA
-				 * vtdisp.c \x93\xE0\x95\x94\x82ŊǗ\x9D\x82\xB5\x82Ă\xA2\x82\xE9\x92l\x82\xA9\x82\xE7\x8Cv\x8EZ\x82\xB7\x82\xE9
-				 */
-				int x, y;
-				DispConvScreenToWin(CursorX, CursorY, &x, &y);
-				p.x = x;
-				p.y = y;
-			}
-			else if (!GetCaretPos(&p)) { // Tek Window
-				/*
-				 * Tek Window \x82͓\xE0\x95\x94\x8AǗ\x9D\x82̒l\x82\xF0\x8E\xE6\x82\xE9\x82̂\xAA\x96ʓ|\x82Ȃ̂\xC5 GetCaretPos() \x82\xF0\x8Eg\x82\xA4
-				 * GetCaretPos() \x82\xAA\x83G\x83\x89\x81[\x82ɂȂ\xC1\x82\xBD\x8Fꍇ\x82͔O\x82̂\xBD\x82\xDF 0, 0 \x82\xF0\x93\xFC\x82\xEA\x82Ă\xA8\x82\xAD
-				 */
-				p.x = 0;
-				p.y = 0;
-			}
-
-			// x, y \x82̗\xBC\x95\xFB\x82\xAA 0 \x82̎\x9E\x82͐e\x83E\x83B\x83\x93\x83h\x83E\x82̒\x86\x89\x9B\x82Ɉړ\xAE\x82\xB3\x82\xB9\x82\xE7\x82\xEA\x82\xE9\x82̂ŁA
-			// \x82\xBB\x82\xEA\x82\xF0\x96h\x82\xAE\x88ׂ\xC9 x \x82\xF0 1 \x82ɂ\xB7\x82\xE9
-			if (p.x == 0 && p.y == 0) {
-				p.x = 1;
-			}
-
-			ClientToScreen(GetParent(hDlgWnd), &p);
-
-			// \x83L\x83\x83\x83\x8C\x83b\x83g\x82\xAA\x89\xE6\x96ʂ\xA9\x82\xE7\x82͂ݏo\x82\xB5\x82Ă\xA2\x82\xE9\x82Ƃ\xAB\x82ɓ\\x82\xE8\x95t\x82\xAF\x82\xF0\x82\xB7\x82\xE9\x82\xC6
-			// \x8Am\x94F\x83E\x83C\x83\x93\x83h\x83E\x82\xAA\x8C\xA9\x82\xA6\x82\xE9\x82Ƃ\xB1\x82\xEB\x82ɕ\\x8E\xA6\x82\xB3\x82\xEA\x82Ȃ\xA2\x82\xB1\x82Ƃ\xAA\x82\xA0\x82\xE9\x81B
-			// \x83E\x83C\x83\x93\x83h\x83E\x82\xA9\x82\xE7\x82͂ݏo\x82\xB5\x82\xBD\x8Fꍇ\x82ɒ\xB2\x90߂\xB7\x82\xE9 (2008.4.24 maya)
-			GetDesktopRectFromPoint(p, &rc_dsk);
-
+			// \x83_\x83C\x83A\x83\x8D\x83O\x82̃T\x83C\x83Y(\x8F\x89\x8A\xFA\x92l)
 			GetWindowRect(hDlgWnd, &rc_dlg);
-			dlg_height = rc_dlg.bottom-rc_dlg.top;
-			dlg_width  = rc_dlg.right-rc_dlg.left;
-			if (p.y < rc_dsk.top) {
-				p.y = rc_dsk.top;
-			}
-			else if (p.y + dlg_height > rc_dsk.bottom) {
-				p.y = rc_dsk.bottom - dlg_height;
-			}
-			if (p.x < rc_dsk.left) {
-				p.x = rc_dsk.left;
-			}
-			else if (p.x + dlg_width > rc_dsk.right) {
-				p.x = rc_dsk.right - dlg_width;
-			}
+			pdata->init_width = rc_dlg.right-rc_dlg.left;
+			pdata->init_height = rc_dlg.bottom-rc_dlg.top;
 
-			SetWindowPos(hDlgWnd, NULL, p.x, p.y,
-			             0, 0, SWP_NOSIZE | SWP_NOZORDER);
-
-			// \x83_\x83C\x83A\x83\x8D\x83O\x82̏\x89\x8A\xFA\x83T\x83C\x83Y\x82\xF0\x95ۑ\xB6
-			GetWindowRect(hDlgWnd, &rc_dlg);
-			init_width = rc_dlg.right - rc_dlg.left;
-			init_height = rc_dlg.bottom - rc_dlg.top;
-
 			// \x8C\xBB\x8D݃T\x83C\x83Y\x82\xA9\x82\xE7\x95K\x97v\x82Ȓl\x82\xF0\x8Cv\x8EZ
 			GetClientRect(hDlgWnd,                                 &rc_dlg);
 			GetWindowRect(GetDlgItem(hDlgWnd, IDC_EDIT),           &rc_edit);
 			GetWindowRect(GetDlgItem(hDlgWnd, IDOK),               &rc_ok);
 
+			POINT p;
 			p.x = rc_dlg.right;
 			p.y = rc_dlg.bottom;
 			ClientToScreen(hDlgWnd, &p);
-			ok2right = p.x - rc_ok.left;
-			edit2bottom = p.y - rc_edit.bottom;
-			edit2ok = rc_ok.left - rc_edit.right;
+			pdata->ok2right = p.x - rc_ok.left;
+			pdata->edit2bottom = p.y - rc_edit.bottom;
+			pdata->edit2ok = rc_ok.left - rc_edit.right;
 
 			// \x83T\x83C\x83Y\x82𕜌\xB3
 			SetWindowPos(hDlgWnd, NULL, 0, 0,
-			             ts.PasteDialogSize.cx, ts.PasteDialogSize.cy,
+			             pdata->data->PasteDialogSize.cx, pdata->data->PasteDialogSize.cy,
 			             SWP_NOZORDER | SWP_NOMOVE);
 
+			// \x88ʒu\x88ړ\xAE
+			POINT CaretPos;
+			TTGetCaretPos(hDlgWnd, &CaretPos);
+			SetWindowPos(hDlgWnd, NULL, CaretPos.x, CaretPos.y,
+			             0, 0, SWP_NOSIZE | SWP_NOZORDER);
+
+			// \x89\xE6\x96ʂ\xA9\x82\xE7\x82͂ݏo\x82\xB3\x82Ȃ\xA2\x82悤\x88ړ\xAE
+			MoveWindowToDisplayPoint(hDlgWnd, &CaretPos);
+			//MoveWindowToDisplay(hDlgWnd);
+
 			return TRUE;
 
 		case WM_COMMAND:
@@ -188,17 +156,15 @@
 					wchar_t *strW;
 					DWORD error = hGetDlgItemTextW(hDlgWnd, IDC_EDIT, &strW);
 					if (error == NO_ERROR) {
-						data->strW_edited_ptr = strW;
+						pdata->data->strW_edited_ptr = strW;
 						result = IDOK;
 					}
 
-					DestroyWindow(hStatus);
 					TTEndDialog(hDlgWnd, result);
 				}
 					break;
 
 				case IDCANCEL:
-					DestroyWindow(hStatus);
 					TTEndDialog(hDlgWnd, IDCANCEL);
 					break;
 
@@ -225,7 +191,7 @@
 				p.y = rc_ok.top;
 				ScreenToClient(hDlgWnd, &p);
 				SetWindowPos(GetDlgItem(hDlgWnd, IDOK), 0,
-				             dlg_w - ok2right, p.y, 0, 0,
+				             dlg_w - pdata->ok2right, p.y, 0, 0,
 				             SWP_NOSIZE | SWP_NOZORDER);
 
 				// CANCEL
@@ -233,7 +199,7 @@
 				p.y = rc_cancel.top;
 				ScreenToClient(hDlgWnd, &p);
 				SetWindowPos(GetDlgItem(hDlgWnd, IDCANCEL), 0,
-				             dlg_w - ok2right, p.y, 0, 0,
+				             dlg_w - pdata->ok2right, p.y, 0, 0,
 				             SWP_NOSIZE | SWP_NOZORDER);
 
 				// EDIT
@@ -241,16 +207,16 @@
 				p.y = rc_edit.top;
 				ScreenToClient(hDlgWnd, &p);
 				SetWindowPos(GetDlgItem(hDlgWnd, IDC_EDIT), 0,
-				             0, 0, dlg_w - p.x - edit2ok - ok2right, dlg_h - p.y - edit2bottom,
+				             0, 0, dlg_w - p.x - pdata->edit2ok - pdata->ok2right, dlg_h - p.y - pdata->edit2bottom,
 				             SWP_NOMOVE | SWP_NOZORDER);
 
 				// \x83T\x83C\x83Y\x82\xF0\x95ۑ\xB6
 				GetWindowRect(hDlgWnd, &rc_dlg);
-				ts.PasteDialogSize.cx = rc_dlg.right - rc_dlg.left;
-				ts.PasteDialogSize.cy = rc_dlg.bottom - rc_dlg.top;
+				pdata->data->PasteDialogSize.cx = rc_dlg.right - rc_dlg.left;
+				pdata->data->PasteDialogSize.cy = rc_dlg.bottom - rc_dlg.top;
 
 				// status bar
-				SendMessage(hStatus , msg , wp , lp);
+				SendMessage(pdata->hStatus , msg , wp , lp);
 			}
 			return TRUE;
 
@@ -257,13 +223,16 @@
 		case WM_GETMINMAXINFO:
 			{
 				// \x83_\x83C\x83A\x83\x8D\x83O\x82̏\x89\x8A\xFA\x83T\x83C\x83Y\x82\xE6\x82菬\x82\xB3\x82\xAD\x82ł\xAB\x82Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9
-				LPMINMAXINFO lpmmi;
-				lpmmi = (LPMINMAXINFO)lp;
-				lpmmi->ptMinTrackSize.x = init_width;
-				lpmmi->ptMinTrackSize.y = init_height;
+				LPMINMAXINFO lpmmi = (LPMINMAXINFO)lp;
+				lpmmi->ptMinTrackSize.x = pdata->init_width;
+				lpmmi->ptMinTrackSize.y = pdata->init_height;
 			}
 			return FALSE;
 
+		case WM_DESTROY:
+			DestroyWindow(pdata->hStatus);
+			return 0;
+
 		default:
 			return FALSE;
 	}
@@ -274,8 +243,11 @@
 	HWND hWndParent,
 	clipboarddlgdata *data)
 {
+	DlgPrivateData *pdata = (DlgPrivateData * )calloc(sizeof(DlgPrivateData), 1);
 	INT_PTR ret;
+	pdata->data = data;
 	ret = TTDialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CLIPBOARD_DIALOG),
-						   hWndParent, OnClipboardDlgProc, (LPARAM)data);
+						   hWndParent, OnClipboardDlgProc, (LPARAM)pdata);
+	free(pdata);
 	return ret;
 }

Modified: trunk/teraterm/teraterm/clipboarddlg.h
===================================================================
--- trunk/teraterm/teraterm/clipboarddlg.h	2021-08-20 16:31:43 UTC (rev 9379)
+++ trunk/teraterm/teraterm/clipboarddlg.h	2021-08-20 16:31:56 UTC (rev 9380)
@@ -36,11 +36,10 @@
 
 typedef struct {
 	const wchar_t *strW_ptr;
-	size_t strW_len;
-	wchar_t *strW_edited_ptr;
-	char *strA_ptr;
-	size_t strA_len;
+	wchar_t *strW_edited_ptr;		// ok\x82\xAA\x89\x9F\x82\xB3\x82ꂽ\x82Ƃ\xAB\x95Ԃ\xC1\x82Ă\xAD\x82\xE9
 	const wchar_t *UILanguageFileW;
+	TTTSet *pts;
+	SIZE PasteDialogSize;
 } clipboarddlgdata;
 
 INT_PTR clipboarddlg(


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