[Ttssh2-commit] [7390] 透過具合をActive/Inactiveで各々調整できるようにした

scmno****@osdn***** scmno****@osdn*****
2019年 1月 13日 (日) 18:24:24 JST


Revision: 7390
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7390
Author:   zmatsuo
Date:     2019-01-13 18:24:24 +0900 (Sun, 13 Jan 2019)
Log Message:
-----------
透過具合をActive/Inactiveで各々調整できるようにした
タイトルバー上でホイール操作をすると透過調整できるようにした

Modified Paths:
--------------
    trunk/teraterm/common/tt_res.h
    trunk/teraterm/common/ttlib.c
    trunk/teraterm/common/ttlib.h
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/addsetting.cpp
    trunk/teraterm/teraterm/ttermpro.rc
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/teraterm/vtwin.h
    trunk/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: trunk/teraterm/common/tt_res.h
===================================================================
--- trunk/teraterm/common/tt_res.h	2019-01-13 09:24:11 UTC (rev 7389)
+++ trunk/teraterm/common/tt_res.h	2019-01-13 09:24:24 UTC (rev 7390)
@@ -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: trunk/teraterm/common/ttlib.c
===================================================================
--- trunk/teraterm/common/ttlib.c	2019-01-13 09:24:11 UTC (rev 7389)
+++ trunk/teraterm/common/ttlib.c	2019-01-13 09:24:24 UTC (rev 7390)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2006-2017 TeraTerm Project
+ * (C) 2006-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1718,3 +1718,68 @@
 
 	*body = p1;
 }
+
+/**
+ *	\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)
+{
+	const int x = point->x;
+	const int y = point->y;
+	RECT winRect;
+	RECT clientRect;
+
+	if (InWindow != NULL) *InWindow = FALSE;
+	if (InClient != NULL) *InClient = FALSE;
+	if (InTitleBar != NULL) *InTitleBar = FALSE;
+
+	if (!GetWindowRect(hWnd, &winRect)) {
+		return FALSE;
+	}
+
+	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;
+}

Modified: trunk/teraterm/common/ttlib.h
===================================================================
--- trunk/teraterm/common/ttlib.h	2019-01-13 09:24:11 UTC (rev 7389)
+++ trunk/teraterm/common/ttlib.h	2019-01-13 09:24:24 UTC (rev 7390)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1994-1998 T. Teranishi
+ * Copyright (C) 1994-1999 T. Teranishi
  * (C) 2006-2017 TeraTerm Project
  * All rights reserved.
  *
@@ -98,6 +98,9 @@
 void PASCAL 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: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2019-01-13 09:24:11 UTC (rev 7389)
+++ trunk/teraterm/common/tttypes.h	2019-01-13 09:24:24 UTC (rev 7390)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2004-2018 TeraTerm Project
+ * (C) 2004-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -549,8 +549,9 @@
 	COLORREF ANSIColor[16];
 	/* protocol used in connect() */
 	int ProtocolFamily;
-  char MouseCursorName[16];
-	int AlphaBlend;
+	char MouseCursorName[16];
+	BYTE AlphaBlendActive;
+	BYTE AlphaBlendInactive;
 	char CygwinDirectory[MAX_PATH];
 #define DEFAULT_LOCALE "japanese"
 	char Locale[80];

Modified: trunk/teraterm/teraterm/addsetting.cpp
===================================================================
--- trunk/teraterm/teraterm/addsetting.cpp	2019-01-13 09:24:11 UTC (rev 7389)
+++ trunk/teraterm/teraterm/addsetting.cpp	2019-01-13 09:24:24 UTC (rev 7390)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2017 TeraTerm Project
+ * Copyright (C) 2008-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -906,8 +906,10 @@
 	font = (HFONT)SendMessage(WM_GETFONT, 0, 0);
 	GetObject(font, sizeof(LOGFONT), &logfont);
 	if (get_lang_font("DLG_TAHOMA_FONT", GetSafeHwnd(), &logfont, &DlgVisualFont, ts.UILanguageFile)) {
-		SendDlgItemMessage(IDC_ALPHABLEND, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
-		SendDlgItemMessage(IDC_ALPHA_BLEND, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
+		SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
+		SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
+		SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE_LABEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
+		SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE_LABEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE, 0));
 		SendDlgItemMessage(IDC_ETERM_LOOKFEEL, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
 		SendDlgItemMessage(IDC_MOUSE, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
 		SendDlgItemMessage(IDC_MOUSE_CURSOR, WM_SETFONT, (WPARAM)DlgVisualFont, MAKELPARAM(TRUE,0));
@@ -1001,8 +1003,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
 	btn = (CButton *)GetDlgItem(IDC_ETERM_LOOKFEEL);
@@ -1043,11 +1047,11 @@
 	}
 
 	// (3)Mouse cursor type
-	listbox = (CListBox *)GetDlgItem(IDC_MOUSE_CURSOR);
+	cmb = (CComboBox *)GetDlgItem(IDC_MOUSE_CURSOR);
 	for (i = 0 ; MouseCursor[i].name ; i++) {
-		listbox->InsertString(i, MouseCursor[i].name);
+		cmb->InsertString(i, MouseCursor[i].name);
 	}
-	listbox->SelectString(0, ts.MouseCursorName);
+	cmb->SelectString(0, ts.MouseCursorName);
 
 	// (4)Font quality
 	cmb = (CComboBox *)GetDlgItem(IDC_FONT_QUALITY);
@@ -1104,7 +1108,7 @@
 	btn->SetCheck((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));
 
 	return FALSE;
 }
@@ -1280,23 +1284,28 @@
 
 void CVisualPropPageDlg::OnOK()
 {
-	CListBox *listbox;
 	CButton *btn;
 	CComboBox *cmb;
 	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
@@ -1321,8 +1330,8 @@
 	}
 
 	// (3)
-	listbox = (CListBox *)GetDlgItem(IDC_MOUSE_CURSOR);
-	sel = listbox->GetCurSel();
+	cmb = (CComboBox *)GetDlgItem(IDC_MOUSE_CURSOR);
+	sel = cmb->GetCurSel();
 	if (sel >= 0 && sel < MOUSE_CURSOR_MAX) {
 		strncpy_s(ts.MouseCursorName, sizeof(ts.MouseCursorName), MouseCursor[sel].name, _TRUNCATE);
 	}
@@ -1402,17 +1411,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: trunk/teraterm/teraterm/ttermpro.rc
===================================================================
--- trunk/teraterm/teraterm/ttermpro.rc	2019-01-13 09:24:11 UTC (rev 7389)
+++ trunk/teraterm/teraterm/ttermpro.rc	2019-01-13 09:24:24 UTC (rev 7390)
@@ -149,8 +149,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
@@ -158,18 +161,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
@@ -181,7 +184,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: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-01-13 09:24:11 UTC (rev 7389)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-01-13 09:24:24 UTC (rev 7390)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2004-2018 TeraTerm Project
+ * (C) 2004-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -259,11 +259,12 @@
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
-static BOOL MySetLayeredWindowAttributes(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)
+typedef BOOL(WINAPI *_SetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD);
+static _SetLayeredWindowAttributes g_pSetLayeredWindowAttributes = NULL;
+
+static void MySetLayeredWindowAttributes_init()
 {
-	typedef BOOL (WINAPI *func)(HWND,COLORREF,BYTE,DWORD);
 	static HMODULE g_hmodUser32 = NULL;
-	static func g_pSetLayeredWindowAttributes = NULL;
 	char user32_dll[MAX_PATH];
 
 	GetSystemDirectory(user32_dll, sizeof(user32_dll));
@@ -271,13 +272,16 @@
 	if (g_hmodUser32 == NULL) {
 		g_hmodUser32 = LoadLibrary(user32_dll);
 		if (g_hmodUser32 == NULL) {
-			return FALSE;
+			return;
 		}
 
 		g_pSetLayeredWindowAttributes =
-			(func)GetProcAddress(g_hmodUser32, "SetLayeredWindowAttributes");
+			(_SetLayeredWindowAttributes)GetProcAddress(g_hmodUser32, "SetLayeredWindowAttributes");
 	}
+}
 
+static BOOL MySetLayeredWindowAttributes(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)
+{
 	if (g_pSetLayeredWindowAttributes == NULL) {
 		return FALSE;
 	}
@@ -312,32 +316,33 @@
 	}
 }
 
-
-void SetWindowStyle(TTTSet *ts)
+/**
+ * @param[in]	alpha	0-255
+ */
+void CVTWindow::SetWindowAlpha(BYTE alpha)
 {
-	LONG_PTR lp;
+	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);
+		MySetLayeredWindowAttributes(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)
@@ -779,6 +784,8 @@
 	Hold = FALSE;
 	FirstPaint = TRUE;
 	ScrollLock = FALSE;  // \x8F\x89\x8A\xFA\x92l\x82͖\xB3\x8C\xF8 (2006.11.14 yutaka)
+	Alpha = 255;
+	MySetLayeredWindowAttributes_init();
 
 	/* Initialize scroll buffer */
 	InitBuffer();
@@ -838,6 +845,7 @@
 	SerialNo = RegWin(HVTWin,NULL);
 
 	logfile_lock_initialize();
+	SetMouseCursor(ts.MouseCursorName);
 	// \x83\x8D\x83P\x81[\x83\x8B\x82̐ݒ\xE8
 	// wctomb \x82̂\xBD\x82\xDF
 	setlocale(LC_ALL, ts.Locale);
@@ -913,7 +921,7 @@
 	if (ts.Minimize>0) {
 		CmdShow = SW_SHOWMINIMIZED;
 	}
-	SetWindowStyle(&ts);
+	SetWindowAlpha(ts.AlphaBlendActive);
 	ShowWindow(CmdShow);
 	ChangeCaret();
 
@@ -1644,7 +1652,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
@@ -1877,6 +1885,11 @@
 void CVTWindow::OnActivate(UINT nState, CWnd* 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)
@@ -2570,6 +2583,24 @@
 {
 	int line, i;
 
+	if (g_pSetLayeredWindowAttributes != NULL) {
+		BOOL InTitleBar;
+		POINT point = pt;
+		GetPositionOnWindow(HVTWin, &point,
+							NULL, NULL, &InTitleBar);
+		if (InTitleBar) {
+			int delta = zDelta < 0 ? -1 : 1;
+			int newAlpha = Alpha;
+			newAlpha += delta * ts.MouseWheelScrollLine;
+			if (newAlpha > 255)
+				newAlpha = 255;
+			else if (newAlpha < 0)
+				newAlpha = 0;
+			SetWindowAlpha(newAlpha);
+			return TRUE;
+		}
+	}
+
 	::ScreenToClient(HVTWin, &pt);
 
 	line = abs(zDelta) / WHEEL_DELTA; // \x83\x89\x83C\x83\x93\x90\x94

Modified: trunk/teraterm/teraterm/vtwin.h
===================================================================
--- trunk/teraterm/teraterm/vtwin.h	2019-01-13 09:24:11 UTC (rev 7389)
+++ trunk/teraterm/teraterm/vtwin.h	2019-01-13 09:24:24 UTC (rev 7390)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2004-2018 TeraTerm Project
+ * (C) 2004-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,10 @@
   bool DropWithLeftbutton;
   bool DropWithRightbutton;
 
+  // window attribute
+  BYTE Alpha;
+  void SetWindowAlpha(BYTE alpha);
+
 protected:
 
 public:

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2019-01-13 09:24:11 UTC (rev 7389)
+++ trunk/teraterm/ttpset/ttset.c	2019-01-13 09:24:24 UTC (rev 7390)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 1994-1998 T. Teranishi
- * (C) 2004-2017 TeraTerm Project
+ * (C) 2004-2019 TeraTerm Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1561,10 +1561,14 @@
 	          _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",
@@ -2289,8 +2293,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 メーリングリストの案内