[Ttssh2-commit] [7250] Merge remote-tracking branch 'remotes/box/transparent-window-svn' into cmake

アーカイブの一覧に戻る

scmno****@osdn***** scmno****@osdn*****
2018年 9月 22日 (土) 02:37:13 JST


Revision: 7250
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7250
Author:   zmatsuo
Date:     2018-09-22 02:37:13 +0900 (Sat, 22 Sep 2018)
Log Message:
-----------
Merge remote-tracking branch 'remotes/box/transparent-window-svn' into cmake

Modified Paths:
--------------
    branches/cmake/installer/release/lang/Japanese.lng
    branches/cmake/teraterm/common/compat_win.cpp
    branches/cmake/teraterm/common/compat_win.h
    branches/cmake/teraterm/common/tt_res.h
    branches/cmake/teraterm/common/ttlib.c
    branches/cmake/teraterm/common/ttlib.h
    branches/cmake/teraterm/common/tttypes.h
    branches/cmake/teraterm/teraterm/addsetting.cpp
    branches/cmake/teraterm/teraterm/teraterm.cpp
    branches/cmake/teraterm/teraterm/ttermpro.rc
    branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj
    branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj.filters
    branches/cmake/teraterm/teraterm/ttermpro.vcproj
    branches/cmake/teraterm/teraterm/vtdisp.c
    branches/cmake/teraterm/teraterm/vtwin.cpp
    branches/cmake/teraterm/teraterm/vtwin.h
    branches/cmake/teraterm/ttpdlg/ttpdlg.rc
    branches/cmake/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: branches/cmake/installer/release/lang/Japanese.lng
===================================================================
--- branches/cmake/installer/release/lang/Japanese.lng	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/installer/release/lang/Japanese.lng	2018-09-21 17:37:13 UTC (rev 7250)
@@ -224,7 +224,9 @@
 DLG_TAB_COPYPASTE_PASTEDELAY=\x93\\x82\xE8\x95t\x82\xAF\x82̍s\x8AԒx\x89\x84(&A)
 DLG_TAB_COPYPASTE_PASTEDELAY2=\x83~\x83\x8A\x95b
 
-DLG_TAB_VISUAL_ALPHA=\x94\xBC\x93\xA7\x96\xBE\x93x(&A)
+DLG_TAB_VISUAL_ALPHA=\x93\xA7\x89߃E\x83B\x83\x93\x83h\x83E
+DLG_TAB_VISUAL_ALPHA_ACTIVE_LABEL=\x83A\x83N\x83e\x83B\x83u(&A)
+DLG_TAB_VISUAL_ALPHA_INACTIVE_LABEL=\x94\xF1\x83A\x83N\x83e\x83B\x83u(&C)
 DLG_TAB_VISUAL_ETERM=&Eterm\x95\x97\x82ɂ\xB7\x82\xE9(*)
 DLG_TAB_VISUAL_BGIMG=\x94w\x8Ci\x89摜(&I)
 DLG_TAB_VISUAL_BGIMG_BRIGHTNESS=\x89摜\x82̖\xBE\x82邳(&T)

Modified: branches/cmake/teraterm/common/compat_win.cpp
===================================================================
--- branches/cmake/teraterm/common/compat_win.cpp	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/common/compat_win.cpp	2018-09-21 17:37:13 UTC (rev 7250)
@@ -1,24 +1,95 @@
-
+/*
+ * (C) 2018 TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* compat_win */
+
 #include "compat_win.h"
 
-TSetThreadDpiAwarenessContext PSetThreadDpiAwarenessContext;
-TGetDpiForWindow PGetDpiForWindow;
+HINSTANCE hDll_msimg32;
+HMODULE hDll_user32;
 
+BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
+BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
+DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
+UINT (WINAPI *pGetDpiForWindow)(HWND hwnd);
+BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
+
+typedef struct {
+	const char *ApiName;
+	void **func;
+} APIInfo;
+
+typedef struct {
+	const char *DllName;
+	HINSTANCE *hDll;
+	const APIInfo *APIInfoPtr;
+	size_t APIInfoCount;
+} DllInfo;
+
+static const APIInfo Lists_user32[] = {
+	{ "SetLayeredWindowAttributes", (void **)&pSetLayeredWindowAttributes },
+	{ "SetThreadDpiAwarenessContext", (void **)&pSetThreadDpiAwarenessContext },
+	{ "GetDpiForWindow", (void **)&pGetDpiForWindow }
+};
+	
+static const APIInfo Lists_msimg32[] = {
+	{ "AlphaBlend", (void **)&pAlphaBlend },
+};
+	
+static const DllInfo DllInfos[] = {
+	{ "user32.dll", &hDll_user32, Lists_user32, _countof(Lists_user32) },
+	{ "msimg32.dll", &hDll_msimg32, Lists_msimg32, _countof(Lists_msimg32) },
+};
+
 void WinCompatInit()
 {
-	static bool done = false;
+	static BOOL done = FALSE;
 	if (done) return;
-	done = true;
+	done = TRUE;
 
-	char user32_dll[MAX_PATH];
-	GetSystemDirectory(user32_dll, sizeof(user32_dll));
-	strncat_s(user32_dll, sizeof(user32_dll), "\\user32.dll", _TRUNCATE);
+	for (size_t i = 0; i < _countof(DllInfos); i++) {
+		const DllInfo *pDllInfo = &DllInfos[i];
 
-	HMODULE dll_handle = LoadLibrary(user32_dll);
-	PSetThreadDpiAwarenessContext =
-		(TSetThreadDpiAwarenessContext)
-		GetProcAddress(dll_handle, "SetThreadDpiAwarenessContext");
-	PGetDpiForWindow =
-		(TGetDpiForWindow)
-		GetProcAddress(dll_handle, "GetDpiForWindow");
+		char dllName[MAX_PATH];
+		GetSystemDirectory(dllName, sizeof(dllName));
+		strcat_s(dllName, sizeof(dllName), "/");
+		strcat_s(dllName, sizeof(dllName), pDllInfo->DllName);
+
+		HINSTANCE hDll = LoadLibrary(dllName);
+		*pDllInfo->hDll = hDll;
+
+		if (hDll != NULL) {
+			const APIInfo *pApiInfo = pDllInfo->APIInfoPtr;
+			for (size_t j = 0; j < pDllInfo->APIInfoCount; j++) {
+				void **func = pApiInfo->func;
+				*func = (void *)GetProcAddress(hDll, pApiInfo->ApiName);
+				pApiInfo++;
+			}
+		}
+	}
 }

Modified: branches/cmake/teraterm/common/compat_win.h
===================================================================
--- branches/cmake/teraterm/common/compat_win.h	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/common/compat_win.h	2018-09-21 17:37:13 UTC (rev 7250)
@@ -1,4 +1,35 @@
-
+/*
+ * (C) 2018 TeraTerm Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* compat_win */
+
+#pragma once
+
 #include <windows.h>
 
 #ifdef __cplusplus
@@ -16,13 +47,22 @@
 #define WM_DPICHANGED                   0x02E0
 #endif
 
-typedef DPI_AWARENESS_CONTEXT (WINAPI *TSetThreadDpiAwarenessContext)
-	(DPI_AWARENESS_CONTEXT dpiContext);
-extern TSetThreadDpiAwarenessContext PSetThreadDpiAwarenessContext;
+#if 0
+// BLENDFUNCTIONと同一
+typedef struct _BGBLENDFUNCTION
+{
+    BYTE     BlendOp;
+    BYTE     BlendFlags;
+    BYTE     SourceConstantAlpha;
+    BYTE     AlphaFormat;
+}BGBLENDFUNCTION;
+#endif
+extern BOOL (WINAPI *pAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
+extern BOOL (WINAPI *pEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
+extern DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT dpiContext);
+extern UINT (WINAPI *pGetDpiForWindow)(HWND hwnd);
+extern BOOL (WINAPI *pSetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
 
-typedef UINT (WINAPI *TGetDpiForWindow)(HWND hwnd);
-extern TGetDpiForWindow PGetDpiForWindow;
-
 void WinCompatInit();
 
 #ifdef __cplusplus

Modified: branches/cmake/teraterm/common/tt_res.h
===================================================================
--- branches/cmake/teraterm/common/tt_res.h	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/common/tt_res.h	2018-09-21 17:37:13 UTC (rev 7250)
@@ -31,7 +31,10 @@
 #define IDC_FULLPATH_LABEL              1002
 #define IDC_LINECOPY                    1003
 #define IDC_MOUSE_CURSOR                1004
-#define IDC_ALPHA_BLEND                 1008
+#define IDC_ALPHA_BLEND_ACTIVE          1005
+#define IDC_ALPHA_BLEND_INACTIVE        1006
+#define IDC_ALPHA_BLEND_ACTIVE_LABEL    1007
+#define IDC_ALPHA_BLEND_INACTIVE_LABEL  1008
 #define IDC_CYGWIN_PATH                 1009
 #define IDC_SELECT_FILE                 1010
 #define IDC_DELIM_LIST                  1011

Modified: branches/cmake/teraterm/common/ttlib.c
===================================================================
--- branches/cmake/teraterm/common/ttlib.c	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/common/ttlib.c	2018-09-21 17:37:13 UTC (rev 7250)
@@ -1717,18 +1717,67 @@
 	*body = p1;
 }
 
-#if 0
-void dprintf(char *format, ...)
+/**
+ *	\x83E\x83B\x83\x93\x83h\x83E\x8F\xE3\x82̈ʒu\x82\xF0\x8E擾\x82\xB7\x82\xE9
+ *	@Param[in]		hWnd
+ *	@Param[in]		point		\x88ʒu(x,y)
+ *	@Param[in,out]	InWindow	\x83E\x83B\x83\x93\x83h\x83E\x8F\xE3
+ *	@Param[in,out]	InClient	\x83N\x83\x89\x83C\x83A\x83\x93\x83g\x97̈\xE6\x8F\xE3
+ *	@Param[in,out]	InTitleBar	\x83^\x83C\x83g\x83\x8B\x83o\x81[\x8F\xE3
+ *	@retval			FALSE		\x96\xB3\x8C\xF8\x82\xC8hWnd
+ */
+BOOL GetPositionOnWindow(
+	HWND hWnd, const POINT *point,
+	BOOL *InWindow, BOOL *InClient, BOOL *InTitleBar)
 {
-	va_list args;
-	char    buffer[1024];
+	const int x = point->x;
+	const int y = point->y;
+	RECT winRect;
+	RECT clientRect;
 
-	va_start(args,format);
+	if (InWindow != NULL) *InWindow = FALSE;
+	if (InClient != NULL) *InClient = FALSE;
+	if (InTitleBar != NULL) *InTitleBar = FALSE;
 
-	_vsnprintf_s(buffer,sizeof(buffer),_TRUNCATE,format,args);
-	strncat_s(buffer,sizeof(buffer),"\n",_TRUNCATE);
+	if (!GetWindowRect(hWnd, &winRect)) {
+		return FALSE;
+	}
 
-	OutputDebugString(buffer);
+	if ((x < winRect.left) || (winRect.right < x) ||
+		(y < winRect.top) || (winRect.bottom < y))
+	{
+		return TRUE;
+	}
+	if (InWindow != NULL) *InWindow = TRUE;
+
+	{
+		POINT pos;
+		GetClientRect(hWnd, &clientRect);
+		pos.x = clientRect.left;
+		pos.y = clientRect.top;
+		ClientToScreen(hWnd, &pos);
+		clientRect.left = pos.x;
+		clientRect.top = pos.y;
+
+		pos.x = clientRect.right;
+		pos.y = clientRect.bottom;
+		ClientToScreen(hWnd, &pos);
+		clientRect.right = pos.x;
+		clientRect.bottom = pos.y;
+	}
+
+	if ((clientRect.left <= x) && (x < clientRect.right) &&
+		(clientRect.top <= y) && (y < clientRect.bottom))
+	{
+		if (InClient != NULL) *InClient = TRUE;
+		if (InTitleBar != NULL) *InTitleBar = FALSE;
+		return TRUE;
+	}
+	if (InClient != NULL) *InClient = FALSE;
+
+	if (InTitleBar != NULL) {
+		*InTitleBar = (y < clientRect.top) ? TRUE : FALSE;
+	}
+
+	return TRUE;
 }
-#endif
-

Modified: branches/cmake/teraterm/common/ttlib.h
===================================================================
--- branches/cmake/teraterm/common/ttlib.h	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/common/ttlib.h	2018-09-21 17:37:13 UTC (rev 7250)
@@ -114,6 +114,9 @@
 void WINAPI DeleteComment(PCHAR dest, int dest_size, PCHAR src);
 
 void split_buffer(char *buffer, int delimiter, char **head, char **body);
+BOOL GetPositionOnWindow(
+	HWND hWnd, const POINT *point,
+	BOOL *InWindow, BOOL *InClient, BOOL *InTitleBar);
 
 #define CheckFlag(var, flag)	(((var) & (flag)) != 0)
 

Modified: branches/cmake/teraterm/common/tttypes.h
===================================================================
--- branches/cmake/teraterm/common/tttypes.h	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/common/tttypes.h	2018-09-21 17:37:13 UTC (rev 7250)
@@ -549,8 +549,9 @@
 	COLORREF ANSIColor[16];
 	/* protocol used in connect() */
 	int ProtocolFamily;
-  char MouseCursorName[16];
-	int AlphaBlend;
+	char MouseCursorName[16];
+	int AlphaBlendActive;
+	int AlphaBlendInactive;
 	char CygwinDirectory[MAX_PATH];
 #define DEFAULT_LOCALE "japanese"
 	char Locale[80];

Modified: branches/cmake/teraterm/teraterm/addsetting.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/addsetting.cpp	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/teraterm/addsetting.cpp	2018-09-21 17:37:13 UTC (rev 7250)
@@ -45,13 +45,6 @@
 #include "dlglib.h"
 #include "compat_win.h"
 
-#ifndef max
-#define max(a,b)            (((a) > (b)) ? (a) : (b))
-#endif
-#ifndef min
-#define min(a,b)            (((a) < (b)) ? (a) : (b))
-#endif
-
 const mouse_cursor_t MouseCursor[] = {
 	{"ARROW", IDC_ARROW},
 	{"IBEAM", IDC_IBEAM},
@@ -61,10 +54,6 @@
 };
 #define MOUSE_CURSOR_MAX (sizeof(MouseCursor)/sizeof(MouseCursor[0]) - 1)
 
-// \x96{\x91̂\xCD vtwin.cpp
-extern void SetWindowStyle(TTTSet *ts);
-
-
 static void SetupRGBbox(HWND hDlgWnd, int index)
 {
 	HWND hWnd;
@@ -597,7 +586,9 @@
 	// (10)
 	GetDlgItemText(IDC_PASTEDELAY_EDIT, buf, sizeof(buf));
 	val = atoi(buf);
-	ts.PasteDelayPerLine = min(max(0, val), 5000);
+	ts.PasteDelayPerLine =
+		(val < 0) ? 0 :
+		(val > 5000) ? 5000 : val;
 }
 
 
@@ -627,6 +618,8 @@
 
 	static const DlgTextInfo TextInfos[] = {
 		{ IDC_ALPHABLEND, "DLG_TAB_VISUAL_ALPHA" },
+		{ IDC_ALPHA_BLEND_ACTIVE_LABEL, "DLG_TAB_VISUAL_ALPHA_ACTIVE_LABEL" },
+		{ IDC_ALPHA_BLEND_INACTIVE_LABEL, "DLG_TAB_VISUAL_ALPHA_INACTIVE_LABEL" },
 		{ IDC_ETERM_LOOKFEEL, "DLG_TAB_VISUAL_ETERM" },
 		{ IDC_BGIMG_CHECK, "DLG_TAB_VISUAL_BGIMG" },
 		{ IDC_BGIMG_BRIGHTNESS, "DLG_TAB_VISUAL_BGIMG_BRIGHTNESS" },
@@ -656,8 +649,10 @@
 	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)ts.UIMsg);
 
 	// (1)AlphaBlend
-	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", ts.AlphaBlend);
-	SetDlgItemText(IDC_ALPHA_BLEND, buf);
+	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", ts.AlphaBlendActive);
+	SetDlgItemText(IDC_ALPHA_BLEND_ACTIVE, buf);
+	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d", ts.AlphaBlendInactive);
+	SetDlgItemText(IDC_ALPHA_BLEND_INACTIVE, buf);
 
 	// (2)[BG] BGEnable
 	SetCheck(IDC_ETERM_LOOKFEEL, ts.EtermLookfeel.BGEnable);
@@ -750,7 +745,7 @@
 	SetCheck(IDC_URL_UNDERLINE, (ts.FontFlag&FF_URLUNDERLINE) != 0);
 
 	// \x83_\x83C\x83A\x83\x8D\x83O\x82Ƀt\x83H\x81[\x83J\x83X\x82𓖂Ă\xE9
-	::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_ALPHA_BLEND));
+	::SetFocus(::GetDlgItem(GetSafeHwnd(), IDC_ALPHA_BLEND_ACTIVE));
 }
 
 BOOL CVisualPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
@@ -905,19 +900,25 @@
 void CVisualPropPageDlg::OnOK()
 {
 	int sel;
-	int beforeAlphaBlend;
 	char buf[MAXPATHLEN];
 	COLORREF TmpColor;
 	int flag_changed = 0;
 
 	// (1)
-	beforeAlphaBlend = ts.AlphaBlend;
-	GetDlgItemText(IDC_ALPHA_BLEND, buf, sizeof(buf));
+	GetDlgItemText(IDC_ALPHA_BLEND_ACTIVE, buf, sizeof(buf));
 	if (isdigit(buf[0])) {
-		ts.AlphaBlend = atoi(buf);
-		ts.AlphaBlend = max(0, ts.AlphaBlend);
-		ts.AlphaBlend = min(255, ts.AlphaBlend);
+		int i = atoi(buf);
+		ts.AlphaBlendActive =
+			(i < 0) ? 0 :
+			(i > 255) ? 255 : i;
 	}
+	GetDlgItemText(IDC_ALPHA_BLEND_INACTIVE, buf, sizeof(buf));
+	if (isdigit(buf[0])) {
+		int i = atoi(buf);
+		ts.AlphaBlendInactive = 
+			(i < 0) ? 0 :
+			(i > 255) ? 255 : i;
+	}
 
 	// (2)
 	// \x83O\x83\x8D\x81[\x83o\x83\x8B\x95ϐ\x94 BGEnable \x82𒼐ڏ\x91\x82\xAB\x8A\xB7\x82\xA6\x82\xE9\x82ƁA\x83v\x83\x8D\x83O\x83\x89\x83\x80\x82\xAA\x97\x8E\x82\xBF\x82邱\x82Ƃ\xAA
@@ -934,9 +935,10 @@
 
 	GetDlgItemText(IDC_EDIT_BGIMG_BRIGHTNESS, buf, sizeof(buf));
 	if (isdigit(buf[0])) {
-		ts.BGImgBrightness = atoi(buf);
-		ts.BGImgBrightness = max(0, ts.BGImgBrightness);
-		ts.BGImgBrightness = min(255, ts.BGImgBrightness);
+		int i = atoi(buf);
+		ts.BGImgBrightness = 
+			(i < 0) ? 0 :
+			(i > 255) ? 255 : i;
 	}
 
 	// (3)
@@ -1013,17 +1015,6 @@
 		ts.FontFlag ^= FF_URLUNDERLINE;
 	}
 
-	// 2006/03/11 by 337 : Alpha\x92l\x82\xE0\x91\xA6\x8E\x9E\x95ύX
-	// Layered\x91\x8B\x82ɂȂ\xC1\x82Ă\xA2\x82Ȃ\xA2\x8Fꍇ\x82͌\xF8\x89ʂ\xAA\x96\xB3\x82\xA2
-	if (ts.EtermLookfeel.BGUseAlphaBlendAPI) {
-		// \x8BN\x93\xAE\x8E\x9E\x82ɔ\xBC\x93\xA7\x96\xBE\x83\x8C\x83C\x83\x84\x82ɂ\xB5\x82Ă\xA2\x82Ȃ\xA2\x8Fꍇ\x82ł\xE0\x81A\x91\xA6\x8D\xC0\x82ɔ\xBC\x93\xA7\x96\xBE\x82ƂȂ\xE9\x82悤\x82ɂ\xB7\x82\xE9\x81B(2006.4.1 yutaka)
-		//MySetLayeredWindowAttributes(HVTWin, 0, (ts.AlphaBlend > 255) ? 255: ts.AlphaBlend, LWA_ALPHA);
-		// \x92l\x82\xAA\x95ύX\x82\xB3\x82ꂽ\x82Ƃ\xAB\x82̂ݐݒ\xE8\x82𔽉f\x82\xB7\x82\xE9\x81B(2007.10.19 maya)
-		if (ts.AlphaBlend != beforeAlphaBlend) {
-			SetWindowStyle(&ts);
-		}
-	}
-
 	if (flag_changed) {
 		// re-launch
 		// RestartTeraTerm(GetSafeHwnd(), &ts);

Modified: branches/cmake/teraterm/teraterm/teraterm.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/teraterm.cpp	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/teraterm/teraterm.cpp	2018-09-21 17:37:13 UTC (rev 7250)
@@ -69,8 +69,8 @@
 	}
 
 	WinCompatInit();
-	if (PSetThreadDpiAwarenessContext) {
-		PSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
+	if (pSetThreadDpiAwarenessContext) {
+		pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
 	}
 }
 

Modified: branches/cmake/teraterm/teraterm/ttermpro.rc
===================================================================
--- branches/cmake/teraterm/teraterm/ttermpro.rc	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/teraterm/ttermpro.rc	2018-09-21 17:37:13 UTC (rev 7250)
@@ -150,8 +150,11 @@
 STYLE DS_SETFONT | DS_CONTROL | WS_CHILD | WS_SYSMENU
 FONT 8, "Tahoma", 0, 0, 0x0
 BEGIN
-    LTEXT           "&Alpha blend",IDC_ALPHABLEND,10,10,43,8
-    EDITTEXT        IDC_ALPHA_BLEND,58,8,28,12,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Transparent Window",IDC_ALPHABLEND,5,5,78,8
+    LTEXT           "&Active",IDC_ALPHA_BLEND_ACTIVE_LABEL,14,19,50,8
+    EDITTEXT        IDC_ALPHA_BLEND_ACTIVE,69,18,19,12,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Ina&ctive",IDC_ALPHA_BLEND_INACTIVE_LABEL,14,33,49,8
+    EDITTEXT        IDC_ALPHA_BLEND_INACTIVE,69,32,19,12,ES_AUTOHSCROLL | ES_NUMBER
     GROUPBOX        "",IDC_STATIC,97,2,155,54
     CONTROL         "&Eterm lookfeel(*)",IDC_ETERM_LOOKFEEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,99,8,66,12
     LTEXT           "Image Brightness",IDC_BGIMG_BRIGHTNESS,166,19,56,8
@@ -159,18 +162,18 @@
     CONTROL         "Background &Image",IDC_BGIMG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,104,27,73,10
     EDITTEXT        IDC_BGIMG_EDIT,103,38,108,14,ES_AUTOHSCROLL
     PUSHBUTTON      "...",IDC_BGIMG_BUTTON,217,38,14,14
-    LTEXT           "&Mouse cursor",IDC_MOUSE,10,22,70,8
-    LISTBOX         IDC_MOUSE_CURSOR,10,32,48,35,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
-    RTEXT           "&Font Quality",IDC_FONT_QUALITY_LABEL,93,59,70,8
+    LTEXT           "&Mouse cursor",IDC_MOUSE,5,46,70,8
+    COMBOBOX        IDC_MOUSE_CURSOR,15,57,80,66,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    RTEXT           "&Font Quality",IDC_FONT_QUALITY_LABEL,102,59,61,8
     COMBOBOX        IDC_FONT_QUALITY,167,58,80,52,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-    LTEXT           "ANSI color",IDC_ANSICOLOR,10,74,43,8
-    LISTBOX         IDC_ANSI_COLOR,10,84,28,51,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "AN&SI color",IDC_ANSICOLOR,5,73,43,8
+    LISTBOX         IDC_ANSI_COLOR,15,84,28,51,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
     LTEXT           "&Red",IDC_RED,45,87,22,8
-    EDITTEXT        IDC_COLOR_RED,69,85,15,14,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_COLOR_RED,69,85,19,14,ES_AUTOHSCROLL | ES_NUMBER
     LTEXT           "&Green",IDC_GREEN,45,104,22,8
-    EDITTEXT        IDC_COLOR_GREEN,69,102,15,14,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_COLOR_GREEN,69,102,19,14,ES_AUTOHSCROLL | ES_NUMBER
     LTEXT           "&Blue",IDC_BLUE,45,121,22,8
-    EDITTEXT        IDC_COLOR_BLUE,69,119,15,14,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_COLOR_BLUE,69,119,19,14,ES_AUTOHSCROLL | ES_NUMBER
     LTEXT           "SAMPLE",IDC_SAMPLE_COLOR,90,104,25,8
     CONTROL         "Enable B&old attribute color",IDC_ENABLE_ATTR_COLOR_BOLD,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,74,105,12
@@ -182,7 +185,7 @@
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,110,105,12
     CONTROL         "Enable A&NSI color",IDC_ENABLE_ANSI_COLOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,122,105,12
     CONTROL         "Un&derline URL string",IDC_URL_UNDERLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,134,105,12
-    LTEXT           "(*)Need to Save setup and restart Tera Term",IDC_RESTART,5,147,247,8
+    LTEXT           "(*)Need to Save setup and restart Tera Term",IDC_RESTART,15,152,237,8
 END
 
 IDD_TABSHEET_LOG DIALOGEX 0, 0, 258, 188

Modified: branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj
===================================================================
--- branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj	2018-09-21 17:37:13 UTC (rev 7250)
@@ -137,6 +137,7 @@
     </Manifest>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="..\common\compat_win.cpp" />
     <ClCompile Include="..\common\dlglib.c" />
     <ClCompile Include="..\common\stdafx.cpp" />
     <ClCompile Include="..\common\ttlib.c" />
@@ -186,6 +187,7 @@
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\common\compat_w95.h" />
+    <ClInclude Include="..\common\compat_win.h" />
     <ClInclude Include="..\common\dlglib.h" />
     <ClInclude Include="..\common\tektypes.h" />
     <ClInclude Include="..\common\teraterm.h" />
@@ -259,4 +261,4 @@
       <UserProperties RESOURCE_FILE="ttermpro.rc" />
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file

Modified: branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj.filters
===================================================================
--- branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj.filters	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/teraterm/ttermpro.v15.vcxproj.filters	2018-09-21 17:37:13 UTC (rev 7250)
@@ -117,6 +117,9 @@
     <ClCompile Include="..\common\dlglib.c">
       <Filter>dialog</Filter>
     </ClCompile>
+    <ClCompile Include="..\common\compat_win.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="..\..\cygterm\cygterm.ico">
@@ -270,5 +273,8 @@
     <ClInclude Include="addsetting.h">
       <Filter>dialog</Filter>
     </ClInclude>
+    <ClInclude Include="..\common\compat_win.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
-</Project>
+</Project>
\ No newline at end of file

Modified: branches/cmake/teraterm/teraterm/ttermpro.vcproj
===================================================================
--- branches/cmake/teraterm/teraterm/ttermpro.vcproj	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/teraterm/ttermpro.vcproj	2018-09-21 17:37:13 UTC (rev 7250)
@@ -213,7 +213,7 @@
 				>
 			</File>
 			<File
-				RelativePath="dnddlg.cpp"
+				RelativePath="..\common\compat_win.cpp"
 				>
 			</File>
 			<File
@@ -221,6 +221,10 @@
 				>
 			</File>
 			<File
+				RelativePath="dnddlg.cpp"
+				>
+			</File>
+			<File
 				RelativePath="filesys.cpp"
 				>
 			</File>

Modified: branches/cmake/teraterm/teraterm/vtdisp.c
===================================================================
--- branches/cmake/teraterm/teraterm/vtdisp.c	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/teraterm/vtdisp.c	2018-09-21 17:37:13 UTC (rev 7250)
@@ -154,17 +154,17 @@
   char       fileTmp[MAX_PATH];
 }BGSrc;
 
-BGSrc BGDest;
-BGSrc BGSrc1;
-BGSrc BGSrc2;
+static BGSrc BGDest;
+static BGSrc BGSrc1;
+static BGSrc BGSrc2;
 
 int  BGEnable;
-int  BGReverseTextAlpha;
-int  BGUseAlphaBlendAPI;
+static int  BGReverseTextAlpha;
+static int  BGUseAlphaBlendAPI;
 BOOL BGNoFrame;
-BOOL BGFastSizeMove;
+static BOOL BGFastSizeMove;
 
-char BGSPIPath[MAX_PATH];
+static char BGSPIPath[MAX_PATH];
 
 COLORREF BGVTColor[2];
 COLORREF BGVTBoldColor[2];
@@ -191,20 +191,8 @@
   int  pattern;
 }WallpaperInfo;
 
-typedef struct _BGBLENDFUNCTION
-{
-    BYTE     BlendOp;
-    BYTE     BlendFlags;
-    BYTE     SourceConstantAlpha;
-    BYTE     AlphaFormat;
-}BGBLENDFUNCTION;
+static BOOL (WINAPI *BGAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
 
-typedef BOOL (WINAPI *TBGAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BGBLENDFUNCTION);
-typedef BOOL (WINAPI *TBGEnumDisplayMonitors)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
-
-static TBGAlphaBlend BGAlphaBlend;
-static TBGEnumDisplayMonitors BGEnumDisplayMonitors;
-
 static HBITMAP GetBitmapHandle(char *File);
 
 
@@ -351,7 +339,7 @@
     return 0;
 }
 
-void RandomFile(char *filespec_src,char *filename, int destlen)
+static void RandomFile(const TCHAR *filespec_src, TCHAR *filename, int destlen)
 {
   int    i;
   int    file_num;
@@ -361,6 +349,7 @@
   HANDLE hFind;
   WIN32_FIND_DATA fd;
 
+  filename[0] = 0;
   ExpandEnvironmentStrings(filespec_src, filespec, sizeof(filespec));
 
   //\x90\xE2\x91΃p\x83X\x82ɕϊ\xB7
@@ -523,7 +512,7 @@
   return TRUE;
 }
 
-BOOL WINAPI AlphaBlendWithoutAPI(HDC hdcDest,int dx,int dy,int width,int height,HDC hdcSrc,int sx,int sy,int sw,int sh,BGBLENDFUNCTION bf)
+static BOOL WINAPI AlphaBlendWithoutAPI(HDC hdcDest,int dx,int dy,int width,int height,HDC hdcSrc,int sx,int sy,int sw,int sh,BLENDFUNCTION bf)
 {
   HDC hdcDestWork,hdcSrcWork;
   int i,invAlpha,alpha;
@@ -565,7 +554,7 @@
   char  filespec[MAX_PATH];
   char *filePart;
   int   fileSize;
-  int   readByte;
+  DWORD readByte;
   unsigned char *fileBuf;
 
   HBITMAP hbm;
@@ -671,7 +660,7 @@
 
 void BGGetWallpaperInfo(WallpaperInfo *wi)
 {
-  int  length;
+  DWORD length;
   int style;
   int  tile;
   char str[256];
@@ -891,10 +880,6 @@
 
 	BGGetWallpaperInfo(&wi);
 
-#ifdef DEBUG_XP
-	strcpy(wi.filename, "c:\\usr\\ttssh2\\1011_01.jpg");
-#endif
-
 	if (IsLoadImageOnlyEnabled()) {
 		//\x95ǎ\x86\x82\xF0\x93ǂݍ\x9E\x82\xDD
 		//LR_CREATEDIBSECTION \x82\xF0\x8Ew\x92肷\x82\xE9\x82̂\xAA\x83R\x83c
@@ -914,12 +899,6 @@
 			goto createdc;
 		}
 
-#ifdef DEBUG_XP
-		//wi.pattern = BG_STRETCH;
-		//wi.pattern = BG_FIT_WIDTH;
-		//wi.pattern = BG_FIT_HEIGHT;
-#endif
-
 		GetObject(hbm,sizeof(bm),&bm);
 		// \x95ǎ\x86\x82̐ݒ\xE8\x82ɍ\x87\x82킹\x82āA\x89摜\x82̃X\x83g\x83\x8C\x83b\x83`\x83T\x83C\x83Y\x82\xF0\x8C\x88\x82߂\xE9\x81B
 		if (wi.pattern == BG_STRETCH) {
@@ -1197,9 +1176,9 @@
   lws.src        = src;
   lws.hdcDest    = hdcDest;
 
-  if(BGEnumDisplayMonitors)
+  if(pEnumDisplayMonitors != NULL)
   {
-    (*BGEnumDisplayMonitors)(NULL,NULL,BGLoadWallpaperEnumFunc,(LPARAM)&lws);
+    (*pEnumDisplayMonitors)(NULL,NULL,BGLoadWallpaperEnumFunc,(LPARAM)&lws);
   }else{
     RECT rectMonitor;
 
@@ -1266,7 +1245,7 @@
 
   if(!BGInSizeMove)
   {
-    BGBLENDFUNCTION bf;
+    BLENDFUNCTION bf;
     HDC hdcSrc = NULL;
 
     //\x94w\x8Ci HDC
@@ -1298,7 +1277,7 @@
   }
 }
 
-COLORREF BGGetColor(char *name,COLORREF defcolor,char *file)
+COLORREF BGGetColor(const char *name,COLORREF defcolor,char *file)
 {
   unsigned int r,g,b;
   char colorstr[256],defstr[256];
@@ -1314,7 +1293,7 @@
   return RGB(r,g,b);
 }
 
-BG_PATTERN BGGetStrIndex(char *name,BG_PATTERN def,char *file,char **strList,int nList)
+BG_PATTERN BGGetStrIndex(char *name,BG_PATTERN def,char *file,const char *strList[],int nList)
 {
   char defstr[64],str[64];
   int  i;
@@ -1333,7 +1312,7 @@
 
 BOOL BGGetOnOff(char *name,BOOL def,char *file)
 {
-  char *strList[2] = {"Off","On"};
+  const static char *strList[2] = {"Off","On"};
 
   return BGGetStrIndex(name,def,file,strList,2);
 }
@@ -1340,7 +1319,7 @@
 
 BG_PATTERN BGGetPattern(char *name,BG_PATTERN def,char *file)
 {
-  char *strList[6]={"stretch","tile","center","fitwidth","fitheight","autofit"};
+  const static char *strList[6]={"stretch","tile","center","fitwidth","fitheight","autofit"};
 
   return BGGetStrIndex(name,def,file,strList,6);
 }
@@ -1347,7 +1326,7 @@
 
 BG_PATTERN BGGetType(char *name,BG_TYPE def,char *file)
 {
-  char *strList[3]={"color","picture","wallpaper"};
+  const static char *strList[3]={"color","picture","wallpaper"};
 
   return BGGetStrIndex(name,def,file,strList,3);
 }
@@ -1466,7 +1445,6 @@
 void BGInitialize(void)
 {
   char path[MAX_PATH],config_file[MAX_PATH],tempPath[MAX_PATH];
-  char msimg32_dll[MAX_PATH],user32_dll[MAX_PATH];
 
   // VTColor \x82\xF0\x93ǂݍ\x9E\x82\xDD
   BGVTColor[0] = ts.VTColor[0];
@@ -1544,11 +1522,6 @@
   BGFastSizeMove = ts.EtermLookfeel.BGFastSizeMove;
   BGNoCopyBits = ts.EtermLookfeel.BGNoCopyBits;
 
-#if 0
-  GetPrivateProfileString(BG_SECTION,"BGSPIPath","plugin",BGSPIPath,MAX_PATH,ts.SetupFName);
-  strncpy_s(ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath), BGSPIPath, _TRUNCATE);
-#endif
-
   //\x83e\x83\x93\x83|\x83\x89\x83\x8A\x81[\x83t\x83@\x83C\x83\x8B\x96\xBC\x82𐶐\xAC
   GetTempPath(MAX_PATH,tempPath);
   GetTempFileName(tempPath,"ttAK",0,BGDest.fileTmp);
@@ -1612,9 +1585,7 @@
 
   // AlphaBlend \x82̃A\x83h\x83\x8C\x83X\x82\xF0\x93ǂݍ\x9E\x82\xDD
   if(BGUseAlphaBlendAPI) {
-    GetSystemDirectory(msimg32_dll, sizeof(msimg32_dll));
-    strncat_s(msimg32_dll, sizeof(msimg32_dll), "\\msimg32.dll", _TRUNCATE);
-    BGAlphaBlend = (TBGAlphaBlend)GetProcAddressWithDllName(msimg32_dll,"AlphaBlend");
+	BGAlphaBlend = pAlphaBlend;
   }
   else {
     BGAlphaBlend = NULL;
@@ -1622,11 +1593,6 @@
 
   if(!BGAlphaBlend)
     BGAlphaBlend = AlphaBlendWithoutAPI;
-
-  //EnumDisplayMonitors \x82\xF0\x92T\x82\xB7
-  GetSystemDirectory(user32_dll, sizeof(user32_dll));
-  strncat_s(user32_dll, sizeof(user32_dll), "\\user32.dll", _TRUNCATE);
-  BGEnumDisplayMonitors = (TBGEnumDisplayMonitors)GetProcAddressWithDllName(user32_dll,"EnumDisplayMonitors");
 }
 
 void BGExchangeColor() {
@@ -1990,10 +1956,10 @@
 
   /* Normal Font */
   SetLogFont(&VTlf);
-  if (PGetDpiForWindow == NULL) {
+  if (pGetDpiForWindow == NULL) {
 	  uDpi = GetDeviceCaps(TmpDC,LOGPIXELSY);	// \x82\xA2\x82‚\xE096\x82\xF0\x95Ԃ\xB7?
   } else {
-	  uDpi = PGetDpiForWindow(HVTWin);
+	  uDpi = pGetDpiForWindow(HVTWin);
   }
   VTlf.lfWidth = -MulDiv(VTlf.lfWidth, uDpi, 72);
   VTlf.lfHeight = -MulDiv(VTlf.lfHeight, uDpi, 72);
@@ -2522,8 +2488,8 @@
     ANSIColor[IdBack ]   = ts.VTColor[1];
 
 #ifdef ALPHABLEND_TYPE2
-      ANSIColor[IdFore ]   = BGVTColor[0];
-     ANSIColor[IdBack ]   = BGVTColor[1];
+	ANSIColor[IdFore ]   = BGVTColor[0];
+	ANSIColor[IdBack ]   = BGVTColor[1];
 #endif  // ALPHABLEND_TYPE2
 
   }
@@ -2823,7 +2789,7 @@
     {
       if(BGReverseTextAlpha < 255)
       {
-        BGBLENDFUNCTION bf;
+        BLENDFUNCTION bf;
         HBRUSH hbr;
 
         hbr = CreateSolidBrush(GetBkColor(hdcBGBuffer));

Modified: branches/cmake/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.cpp	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/teraterm/vtwin.cpp	2018-09-21 17:37:13 UTC (rev 7250)
@@ -295,7 +295,7 @@
 
 
 // Tera Term\x8BN\x93\xAE\x8E\x9E\x82\xC6URL\x95\xB6\x8E\x9A\x97\xF1mouse over\x8E\x9E\x82ɌĂ΂\xEA\x82\xE9 (2005.4.2 yutaka)
-void SetMouseCursor(char *cursor)
+static void SetMouseCursor(const char *cursor)
 {
 	HCURSOR hc;
 	LPCTSTR name = NULL;
@@ -319,32 +319,36 @@
 	}
 }
 
-
-void SetWindowStyle(TTTSet *ts)
+/**
+ * @param[in]	alpha	0-255
+ */
+void CVTWindow::SetWindowAlpha(BYTE alpha)
 {
-	LONG_PTR lp;
+	if (pSetLayeredWindowAttributes == NULL) {
+		return;	// \x83\x8C\x83C\x83\x84\x81[\x83h\x83E\x83C\x83\x93\x83h\x83E\x82̃T\x83|\x81[\x83g\x82Ȃ\xB5
+	}
+	if (Alpha == alpha) {
+		return;	// \x95ω\xBB\x82Ȃ\xB5\x82Ȃ牽\x82\xE0\x82\xB5\x82Ȃ\xA2
+	}
+	LONG_PTR lp = GetWindowLongPtr(HVTWin, GWL_EXSTYLE);
+	if (lp == 0) {
+		return;
+	}
 
-	SetMouseCursor(ts->MouseCursorName);
-
 	// 2006/03/16 by 337: BGUseAlphaBlendAPI\x82\xAAOn\x82Ȃ\xE7\x82\xCELayered\x91\xAE\x90\xAB\x82Ƃ\xB7\x82\xE9
 	//if (ts->EtermLookfeel.BGUseAlphaBlendAPI) {
 	// \x83A\x83\x8B\x83t\x83@\x92l\x82\xAA255\x82̏ꍇ\x81A\x89\xE6\x96ʂ̂\xBF\x82\xE7\x82‚\xAB\x82\xF0\x97}\x82\xA6\x82邽\x82߉\xBD\x82\xE0\x82\xB5\x82Ȃ\xA2\x82\xB1\x82ƂƂ\xB7\x82\xE9\x81B(2006.4.1 yutaka)
 	// \x8CĂяo\x82\xB5\x8C\xB3\x82ŁA\x92l\x82\xAA\x95ύX\x82\xB3\x82ꂽ\x82Ƃ\xAB\x82̂ݐݒ\xE8\x82𔽉f\x82\xB7\x82\xE9\x81B(2007.10.19 maya)
-	if (ts->AlphaBlend < 255) {
-		lp = GetWindowLongPtr(HVTWin, GWL_EXSTYLE);
-		if (lp != 0) {
-			SetWindowLongPtr(HVTWin, GWL_EXSTYLE, lp | WS_EX_LAYERED);
-			MySetLayeredWindowAttributes(HVTWin, 0, ts->AlphaBlend, LWA_ALPHA);
-		}
+	if (alpha < 255) {
+		SetWindowLongPtr(HVTWin, GWL_EXSTYLE, lp | WS_EX_LAYERED);
+		pSetLayeredWindowAttributes(HVTWin, 0, alpha, LWA_ALPHA);
 	}
-	// \x83A\x83\x8B\x83t\x83@\x92l\x82\xAA 255 \x82̏ꍇ\x81A\x93\xA7\x96\xBE\x89\xBB\x91\xAE\x90\xAB\x82\xF0\x8D폜\x82\xB5\x82čĕ`\x89悷\x82\xE9\x81B(2007.10.22 maya)
 	else {
-		lp = GetWindowLongPtr(HVTWin, GWL_EXSTYLE);
-		if (lp != 0) {
-			SetWindowLongPtr(HVTWin, GWL_EXSTYLE, lp & ~WS_EX_LAYERED);
-			RedrawWindow(HVTWin, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
-		}
+		// \x83A\x83\x8B\x83t\x83@\x92l\x82\xAA 255 \x82̏ꍇ\x81A\x93\xA7\x96\xBE\x89\xBB\x91\xAE\x90\xAB\x82\xF0\x8D폜\x82\xB5\x82čĕ`\x89悷\x82\xE9\x81B(2007.10.22 maya)
+		SetWindowLongPtr(HVTWin, GWL_EXSTYLE, lp & ~WS_EX_LAYERED);
+		::RedrawWindow(HVTWin, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME);
 	}
+	Alpha = alpha;
 }
 
 void RegDeviceNotify(HWND hWnd)
@@ -689,7 +693,9 @@
 #endif
 
 	// \x97\xE1\x8AO\x83n\x83\x93\x83h\x83\x89\x82̃t\x83b\x83N (2007.9.30 yutaka)
+#if !defined(_M_X64)
 	SetUnhandledExceptionFilter(ApplicationFaultHandler);
+#endif
 
 	CommInit(&cv);
 	isFirstInstance = StartTeraTerm(&ts);
@@ -785,6 +791,7 @@
 	Hold = FALSE;
 	FirstPaint = TRUE;
 	ScrollLock = FALSE;  // \x8F\x89\x8A\xFA\x92l\x82͖\xB3\x8C\xF8 (2006.11.14 yutaka)
+	Alpha = 255;
 
 	/* Initialize scroll buffer */
 	InitBuffer();
@@ -845,7 +852,8 @@
 	SerialNo = RegWin(HVTWin,NULL);
 
 	logfile_lock_initialize();
-	SetWindowStyle(&ts);
+	SetMouseCursor(ts.MouseCursorName);
+	SetWindowAlpha(ts.AlphaBlendActive);
 	// \x83\x8D\x83P\x81[\x83\x8B\x82̐ݒ\xE8
 	// wctomb \x82̂\xBD\x82\xDF
 	setlocale(LC_ALL, ts.Locale);
@@ -1040,7 +1048,8 @@
 		return;
 	}
 
-	if (mousereport = MouseReport(IdMouseEventBtnDown, LMR, p.x, p.y)) {
+	mousereport = MouseReport(IdMouseEventBtnDown, LMR, p.x, p.y);
+	if (mousereport) {
 		::SetCapture(m_hWnd);
 		return;
 	}
@@ -1651,7 +1660,7 @@
 	//
 	// AlphaBlend \x82𑦎\x9E\x94\xBD\x89f\x82ł\xAB\x82\xE9\x82悤\x82ɂ\xB7\x82\xE9\x81B
 	// (2016.12.24 yutaka)
-	SetWindowStyle(&ts);
+	SetWindowAlpha(ts.AlphaBlendActive);
 #else
 	DispApplyANSIColor();
 #endif
@@ -1780,7 +1789,7 @@
 	else if ((ts.HideTitle>0) &&
 	         (message == WM_NCHITTEST)) {
 		Result = CFrameWnd::DefWindowProc(message,wParam,lParam);
-		if ((Result==HTCLIENT) && AltKey())
+		if ((Result==HTCLIENT) && AltKey()) {
 #ifdef ALPHABLEND_TYPE2
 			if(ShiftKey())
 				Result = HTBOTTOMRIGHT;
@@ -1789,6 +1798,7 @@
 #else
 			Result = HTCAPTION;
 #endif
+		}
 		return Result;
 	}
 
@@ -1884,6 +1894,11 @@
 void CVTWindow::OnActivate(UINT nState, HWND pWndOther, BOOL bMinimized)
 {
 	DispSetActive(nState!=WA_INACTIVE);
+	if (nState == WA_INACTIVE) {
+		SetWindowAlpha(ts.AlphaBlendInactive);
+	} else {
+		SetWindowAlpha(ts.AlphaBlendActive);
+	}
 }
 
 void CVTWindow::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
@@ -2094,7 +2109,8 @@
 	char msg[128];
 
 	if (h == NULL) {
-		if ( ((h = GetModuleHandle("ttxssh.dll")) == NULL) ) {
+		h = GetModuleHandle("ttxssh.dll");
+		if (h == NULL) {
 			_snprintf_s(msg, sizeof(msg), _TRUNCATE, "GetModuleHandle(\"ttxssh.dll\")) %d", GetLastError());
 		scp_send_error:
 			::MessageBox(NULL, msg, "Tera Term: scpsend command error", MB_OK | MB_ICONERROR);
@@ -2142,7 +2158,7 @@
 	for (int i = 0; i < DropListCount; i++) {
 		const char *FileName = DropLists[i];
 		const DWORD attr = GetFileAttributes(FileName);
-		if (attr == -1 ) {
+		if (attr == (DWORD)-1 ) {
 			FileCount++;
 		} else if (attr & FILE_ATTRIBUTE_DIRECTORY) {
 			DirectoryCount++;
@@ -5618,8 +5634,8 @@
 			// \x83T\x83u\x83N\x83\x89\x83X\x89\xBB\x82\xB3\x82\xB9\x82ă\x8A\x83A\x83\x8B\x83^\x83C\x83\x80\x83\x82\x81[\x83h\x82ɂ\xB7\x82\xE9 (2008.1.21 yutaka)
 			hwndBroadcast = GetDlgItem(hWnd, IDC_COMMAND_EDIT);
 			hwndBroadcastEdit = GetWindow(hwndBroadcast, GW_CHILD);
-			OrigBroadcastEditProc = (WNDPROC)GetWindowLong(hwndBroadcastEdit, GWL_WNDPROC);
-			SetWindowLong(hwndBroadcastEdit, GWL_WNDPROC, (LONG)BroadcastEditProc);
+			OrigBroadcastEditProc = (WNDPROC)GetWindowLong(hwndBroadcastEdit, GWLP_WNDPROC);
+			SetWindowLong(hwndBroadcastEdit, GWLP_WNDPROC, (LONG)BroadcastEditProc);
 			// \x83f\x83t\x83H\x83\x8B\x83g\x82\xCDon\x81B\x8Ec\x82\xE8\x82\xCDdisable\x81B
 			SendMessage(GetDlgItem(hWnd, IDC_REALTIME_CHECK), BM_SETCHECK, BST_CHECKED, 0);  // default on
 			EnableWindow(GetDlgItem(hWnd, IDC_HISTORY_CHECK), FALSE);
@@ -5694,8 +5710,8 @@
 					// new handler
 					hwndBroadcast = GetDlgItem(hWnd, IDC_COMMAND_EDIT);
 					hwndBroadcastEdit = GetWindow(hwndBroadcast, GW_CHILD);
-					OrigBroadcastEditProc = (WNDPROC)GetWindowLong(hwndBroadcastEdit, GWL_WNDPROC);
-					SetWindowLong(hwndBroadcastEdit, GWL_WNDPROC, (LONG)BroadcastEditProc);
+					OrigBroadcastEditProc = (WNDPROC)GetWindowLong(hwndBroadcastEdit, GWLP_WNDPROC);
+					SetWindowLong(hwndBroadcastEdit, GWLP_WNDPROC, (LONG)BroadcastEditProc);
 
 					EnableWindow(GetDlgItem(hWnd, IDC_HISTORY_CHECK), FALSE);
 					EnableWindow(GetDlgItem(hWnd, IDC_RADIO_CRLF), FALSE);
@@ -5706,7 +5722,7 @@
 					EnableWindow(GetDlgItem(hWnd, IDC_LIST), TRUE);  // true
 				} else {
 					// restore old handler
-					SetWindowLong(hwndBroadcastEdit, GWL_WNDPROC, (LONG)OrigBroadcastEditProc);
+					SetWindowLong(hwndBroadcastEdit, GWLP_WNDPROC, (LONG)OrigBroadcastEditProc);
 
 					EnableWindow(GetDlgItem(hWnd, IDC_HISTORY_CHECK), TRUE);
 					EnableWindow(GetDlgItem(hWnd, IDC_RADIO_CRLF), TRUE);
@@ -5781,7 +5797,7 @@
 					// \x83\x82\x81[\x83h\x83\x8C\x83X\x83_\x83C\x83A\x83\x8D\x83O\x82͈\xEA\x93x\x90\xB6\x90\xAC\x82\xB3\x82\xEA\x82\xE9\x82ƁA\x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82\xAA\x8FI\x97\xB9\x82\xB7\x82\xE9\x82܂\xC5
 					// \x94j\x8A\xFC\x82\xB3\x82\xEA\x82Ȃ\xA2\x82̂ŁA\x88ȉ\xBA\x82́u\x83E\x83B\x83\x93\x83h\x83E\x83v\x83\x8D\x83V\x81[\x83W\x83\x83\x96߂\xB5\x81v\x82͕s\x97v\x82Ǝv\x82\xED\x82\xEA\x82\xE9\x81B(yutaka)
 #if 0
-					SetWindowLong(hwndBroadcastEdit, GWL_WNDPROC, (LONG)OrigBroadcastEditProc);
+					SetWindowLong(hwndBroadcastEdit, GWLP_WNDPROC, (LONG)OrigBroadcastEditProc);
 #endif
 
 					//EndDialog(hDlgWnd, IDOK);

Modified: branches/cmake/teraterm/teraterm/vtwin.h
===================================================================
--- branches/cmake/teraterm/teraterm/vtwin.h	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/teraterm/vtwin.h	2018-09-21 17:37:13 UTC (rev 7250)
@@ -1,4 +1,4 @@
-/*
+/*
  * Copyright (C) 1994-1998 T. Teranishi
  * (C) 2004-2018 TeraTerm Project
  * All rights reserved.
@@ -57,6 +57,10 @@
   int DropListCount;
   void DropListFree();
 
+  // window attribute
+  BYTE Alpha;
+  void SetWindowAlpha(BYTE alpha);
+
 protected:
 
 public:
@@ -109,7 +113,7 @@
 	afx_msg void OnMouseMove(UINT nFlags, POINTS point);
 	afx_msg void OnMove(int x, int y);
 	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, POINTS pt);
-//	afx_msg void OnNcCalcSize(BOOL valid, NCCALCSIZE_PARAMS *calcsize); // 何もしていない、不要
+//	afx_msg void OnNcCalcSize(BOOL valid, NCCALCSIZE_PARAMS *calcsize); // \x89\xBD\x82\xE0\x82\xB5\x82Ă\xA2\x82Ȃ\xA2\x81A\x95s\x97v
 	afx_msg void OnNcLButtonDblClk(UINT nHitTest, POINTS point);
 	afx_msg void OnNcRButtonDown(UINT nHitTest, POINTS point);
 	afx_msg void OnPaint();
@@ -119,7 +123,7 @@
 	afx_msg void OnSize(UINT nType, int cx, int cy);
 	afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
 	afx_msg void OnSysChar(UINT nChar, UINT nRepCnt, UINT nFlags);
-//	afx_msg void OnSysColorChange();		// 何もしていない、不要
+//	afx_msg void OnSysColorChange();		// \x89\xBD\x82\xE0\x82\xB5\x82Ă\xA2\x82Ȃ\xA2\x81A\x95s\x97v
 	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
 	afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
 	afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
@@ -220,7 +224,7 @@
 	afx_msg void OnWindowRestoreAll();
 	afx_msg void OnWindowUndo();
 	afx_msg void OnHelpIndex();
-//	afx_msg void OnHelpUsing();		// 実体なし不要
+//	afx_msg void OnHelpUsing();		// \x8E\xC0\x91̂Ȃ\xB5\x95s\x97v
 	afx_msg void OnHelpAbout();
 	afx_msg LRESULT OnDropNotify(WPARAM ShowMenu, LPARAM lParam);
 	afx_msg LRESULT OnDpiChanged(WPARAM wParam, LPARAM lParam);

Modified: branches/cmake/teraterm/ttpdlg/ttpdlg.rc
===================================================================
--- branches/cmake/teraterm/ttpdlg/ttpdlg.rc	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/ttpdlg/ttpdlg.rc	2018-09-21 17:37:13 UTC (rev 7250)
@@ -259,7 +259,7 @@
     LTEXT           "&Language:",IDC_GENLANGLABEL,14,26,39,11,NOT WS_VISIBLE
     COMBOBOX        IDC_GENLANG,78,25,70,45,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
     LTEXT           "Language&UI:",IDC_GENLANGUI_LABEL,14,42,44,8
-    COMBOBOX        IDC_GENLANG_UI,58,41,90,44,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_GENLANG_UI,58,41,90,72,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     DEFPUSHBUTTON   "OK",IDOK,13,61,32,14,WS_GROUP
     PUSHBUTTON      "Cancel",IDCANCEL,60,61,40,14
     PUSHBUTTON      "&Help",IDC_GENHELP,115,61,36,14

Modified: branches/cmake/teraterm/ttpset/ttset.c
===================================================================
--- branches/cmake/teraterm/ttpset/ttset.c	2018-09-21 17:37:03 UTC (rev 7249)
+++ branches/cmake/teraterm/ttpset/ttset.c	2018-09-21 17:37:13 UTC (rev 7250)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2004-2017 TeraTerm Project
+ * (C) 2004-2018 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1564,13 +1564,17 @@
 	          _TRUNCATE);
 
 	// Translucent window
-	ts->AlphaBlend =
-		GetPrivateProfileInt(Section, "AlphaBlend ", 255, FName);
-	ts->AlphaBlend = max(0, ts->AlphaBlend);
-	ts->AlphaBlend = min(255, ts->AlphaBlend);
+	ts->AlphaBlendInactive =
+		GetPrivateProfileInt(Section, "AlphaBlend", 255, FName);
+	ts->AlphaBlendInactive = max(0, ts->AlphaBlendInactive);
+	ts->AlphaBlendInactive = min(255, ts->AlphaBlendInactive);
+	ts->AlphaBlendActive =
+		GetPrivateProfileInt(Section, "AlphaBlendActive", 255, FName);
+	ts->AlphaBlendActive = max(0, ts->AlphaBlendActive);
+	ts->AlphaBlendActive = min(255, ts->AlphaBlendActive);
 
 	// Cygwin install path
-	GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin",
+	GetPrivateProfileString(Section, "CygwinDirectory", "c:\\cygwin",
 	                        Temp, sizeof(Temp), FName);
 	strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp,
 	          _TRUNCATE);
@@ -1582,17 +1586,17 @@
 	else {
 		Temp[0] = '\0';
 	}
-	GetPrivateProfileString(Section, "ViewlogEditor ", Temp,
+	GetPrivateProfileString(Section, "ViewlogEditor", Temp,
 	                        ts->ViewlogEditor, sizeof(ts->ViewlogEditor), FName);
 
 	// Locale for UTF-8
-	GetPrivateProfileString(Section, "Locale ", DEFAULT_LOCALE,
+	GetPrivateProfileString(Section, "Locale", DEFAULT_LOCALE,
 	                        Temp, sizeof(Temp), FName);
 	strncpy_s(ts->Locale, sizeof(ts->Locale), Temp, _TRUNCATE);
 
 	// CodePage
 	ts->CodePage =
-		GetPrivateProfileInt(Section, "CodePage ", DEFAULT_CODEPAGE,
+		GetPrivateProfileInt(Section, "CodePage", DEFAULT_CODEPAGE,
 		                     FName);
 
 	// UI language message file
@@ -2292,8 +2296,10 @@
 	           ts->EnableContinuedLineCopy);
 	WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
 	                          FName);
-	_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
+	_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlendInactive);
 	WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
+	_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlendActive);
+	WritePrivateProfileString(Section, "AlphaBlendActive", Temp, FName);
 	WritePrivateProfileString(Section, "CygwinDirectory",
 	                          ts->CygwinDirectory, FName);
 	WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,



Ttssh2-commit メーリングリストの案内
アーカイブの一覧に戻る