mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Fixed an issue that ClickThrough mode is broken since r486.
Fixed an issue that cached window message is incorrect in some cases.
This commit is contained in:
		| @@ -423,7 +423,7 @@ void CMeterWindow::Refresh(bool init, bool all) | |||||||
|  |  | ||||||
| void CMeterWindow::SetMouseLeaveEvent(bool cancel) | void CMeterWindow::SetMouseLeaveEvent(bool cancel) | ||||||
| { | { | ||||||
| 	if (!cancel && !m_MouseOver) return; | 	if (!cancel && (!m_MouseOver || m_ClickThrough)) return; | ||||||
|  |  | ||||||
| 	// Check whether the mouse event is set | 	// Check whether the mouse event is set | ||||||
| 	TRACKMOUSEEVENT tme = {sizeof(TRACKMOUSEEVENT)}; | 	TRACKMOUSEEVENT tme = {sizeof(TRACKMOUSEEVENT)}; | ||||||
| @@ -772,71 +772,57 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg) | |||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 	case BANG_CLICKTHROUGH: | 	case BANG_CLICKTHROUGH: | ||||||
| 		if (_wtoi(arg) == -1) |  | ||||||
| 		{ | 		{ | ||||||
| 			m_ClickThrough = !m_ClickThrough; | 			int f = _wtoi(arg); | ||||||
| 		} | 			if (f == -1) | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_ClickThrough = _wtoi(arg); |  | ||||||
| 		} |  | ||||||
| 		WriteConfig(); |  | ||||||
|  |  | ||||||
| 		if (!m_ClickThrough) |  | ||||||
| 		{ |  | ||||||
| 			// Remove transparent flag |  | ||||||
| 			LONG style = GetWindowLong(m_Window, GWL_EXSTYLE); |  | ||||||
| 			if ((style & WS_EX_TRANSPARENT) != 0) |  | ||||||
| 			{ | 			{ | ||||||
| 				SetWindowLong(m_Window, GWL_EXSTYLE, style & ~WS_EX_TRANSPARENT); | 				SetClickThrough(!m_ClickThrough); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				SetClickThrough(f != 0); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 	case BANG_DRAGGABLE: | 	case BANG_DRAGGABLE: | ||||||
| 		if (_wtoi(arg) == -1) |  | ||||||
| 		{ | 		{ | ||||||
| 			m_WindowDraggable = !m_WindowDraggable; | 			int f = _wtoi(arg); | ||||||
|  | 			if (f == -1) | ||||||
|  | 			{ | ||||||
|  | 				SetWindowDraggable(!m_WindowDraggable); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				SetWindowDraggable(f != 0); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_WindowDraggable = _wtoi(arg); |  | ||||||
| 		} |  | ||||||
| 		WriteConfig(); |  | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 	case BANG_SNAPEDGES: | 	case BANG_SNAPEDGES: | ||||||
| 		if (_wtoi(arg) == -1) |  | ||||||
| 		{ | 		{ | ||||||
| 			m_SnapEdges = !m_SnapEdges; | 			int f = _wtoi(arg); | ||||||
|  | 			if (f == -1) | ||||||
|  | 			{ | ||||||
|  | 				SetSnapEdges(!m_SnapEdges); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				SetSnapEdges(f != 0); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_SnapEdges = _wtoi(arg); |  | ||||||
| 		} |  | ||||||
| 		WriteConfig(); |  | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 	case BANG_KEEPONSCREEN: | 	case BANG_KEEPONSCREEN: | ||||||
| 		if (_wtoi(arg) == -1) |  | ||||||
| 		{ | 		{ | ||||||
| 			m_KeepOnScreen = !m_KeepOnScreen; | 			int f = _wtoi(arg); | ||||||
| 		} | 			if (f == -1) | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 			m_KeepOnScreen = _wtoi(arg); |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		WriteConfig(); |  | ||||||
|  |  | ||||||
| 		if (m_KeepOnScreen)  |  | ||||||
| 		{ |  | ||||||
| 			int x = m_ScreenX; |  | ||||||
| 			int y = m_ScreenY; |  | ||||||
| 			MapCoordsToScreen(x, y, m_WindowW, m_WindowH); |  | ||||||
| 			if (x != m_ScreenX || y != m_ScreenY) |  | ||||||
| 			{ | 			{ | ||||||
| 				MoveWindow(x, y); | 				SetKeepOnScreen(!m_KeepOnScreen); | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 			{ | ||||||
|  | 				SetKeepOnScreen(f != 0); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		break; | 		break; | ||||||
| @@ -2604,7 +2590,7 @@ void CMeterWindow::UpdateTransparency(int alpha, bool reset) | |||||||
| ** Repaints the window. This does not cause update of the measures. | ** Repaints the window. This does not cause update of the measures. | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnPaint(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	PAINTSTRUCT ps; | 	PAINTSTRUCT ps; | ||||||
| 	HDC winDC = BeginPaint(m_Window, &ps); | 	HDC winDC = BeginPaint(m_Window, &ps); | ||||||
| @@ -2623,7 +2609,7 @@ LRESULT CMeterWindow::OnPaint(WPARAM wParam, LPARAM lParam) | |||||||
| ** MOUSETIMER is used to hide/show the window. | ** MOUSETIMER is used to hide/show the window. | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnTimer(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	if(wParam == METERTIMER)  | 	if(wParam == METERTIMER)  | ||||||
| 	{ | 	{ | ||||||
| @@ -2675,20 +2661,34 @@ LRESULT CMeterWindow::OnTimer(WPARAM wParam, LPARAM lParam) | |||||||
| 			{ | 			{ | ||||||
| 				POINT pos; | 				POINT pos; | ||||||
| 				GetCursorPos(&pos); | 				GetCursorPos(&pos); | ||||||
| 				if (WindowFromPoint(pos) == m_Window) |  | ||||||
|  | 				if (!m_ClickThrough) | ||||||
| 				{ | 				{ | ||||||
| 					SetMouseLeaveEvent(false); | 					if (WindowFromPoint(pos) == m_Window) | ||||||
|  | 					{ | ||||||
|  | 						SetMouseLeaveEvent(false); | ||||||
|  |  | ||||||
| 					MapWindowPoints(NULL, m_Window, &pos, 1); | 						MapWindowPoints(NULL, m_Window, &pos, 1); | ||||||
| 					DoMoveAction(pos.x, pos.y, MOUSE_OVER); | 						while (DoMoveAction(pos.x, pos.y, MOUSE_OVER)) ; | ||||||
|  |  | ||||||
| 					// Handle buttons | 						// Handle buttons | ||||||
| 					HandleButtons(pos, BUTTONPROC_MOVE, NULL, false); | 						HandleButtons(pos, BUTTONPROC_MOVE, NULL, false); | ||||||
|  | 					} | ||||||
|  | 					else | ||||||
|  | 					{ | ||||||
|  | 						// Run all mouse leave actions | ||||||
|  | 						OnMouseLeave(m_WindowDraggable ? WM_NCMOUSELEAVE : WM_MOUSELEAVE, 0, 0); | ||||||
|  | 					} | ||||||
| 				} | 				} | ||||||
| 				else | 				else | ||||||
| 				{ | 				{ | ||||||
| 					// Run all mouse leave actions | 					bool keyDown = GetKeyState(VK_CONTROL) & 0x8000 || GetKeyState(VK_SHIFT) & 0x8000 || GetKeyState(VK_MENU) & 0x8000; | ||||||
| 					OnMouseLeave(0, 0); |  | ||||||
|  | 					if (!keyDown || GetWindowFromPoint(pos) != m_Window) | ||||||
|  | 					{ | ||||||
|  | 						// Run all mouse leave actions | ||||||
|  | 						OnMouseLeave(m_WindowDraggable ? WM_NCMOUSELEAVE : WM_MOUSELEAVE, 0, 0); | ||||||
|  | 					} | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @@ -2797,7 +2797,7 @@ void CMeterWindow::ShowWindowIfAppropriate() | |||||||
|  |  | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	GetCursorPos(&pos); | 	GetCursorPos(&pos); | ||||||
| 	if (WindowFromPoint(pos) == m_Window) | 	if (GetWindowFromPoint(pos) == m_Window) | ||||||
| 	{ | 	{ | ||||||
| 		MapWindowPoints(NULL, m_Window, &pos, 1); | 		MapWindowPoints(NULL, m_Window, &pos, 1); | ||||||
|  |  | ||||||
| @@ -2860,6 +2860,39 @@ void CMeterWindow::ShowWindowIfAppropriate() | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | ** GetWindowFromPoint | ||||||
|  | ** | ||||||
|  | ** Retrieves a handle to the window that contains the specified point. | ||||||
|  | ** | ||||||
|  | */ | ||||||
|  | HWND CMeterWindow::GetWindowFromPoint(POINT pos) | ||||||
|  | { | ||||||
|  | 	HWND hwndPos = WindowFromPoint(pos); | ||||||
|  |  | ||||||
|  | 	if (hwndPos == m_Window || !m_ClickThrough) | ||||||
|  | 	{ | ||||||
|  | 		return hwndPos; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	MapWindowPoints(NULL, m_Window, &pos, 1); | ||||||
|  |  | ||||||
|  | 	if (HitTest(pos.x, pos.y)) | ||||||
|  | 	{ | ||||||
|  | 		HWND hWnd = GetAncestor(hwndPos, GA_ROOT); | ||||||
|  | 		while (hWnd = ::GetNextWindow(hWnd, GW_HWNDNEXT)) | ||||||
|  | 		{ | ||||||
|  | 			if (hWnd == m_Window) | ||||||
|  | 			{ | ||||||
|  | 				return hwndPos; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		return m_Window; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return hwndPos; | ||||||
|  | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
| ** HitTest | ** HitTest | ||||||
| ** | ** | ||||||
| @@ -2957,7 +2990,7 @@ void CMeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, CMeterWindow* meter | |||||||
| ** When we get WM_MOUSEMOVE messages, hide the window as the mouse is over it. | ** When we get WM_MOUSEMOVE messages, hide the window as the mouse is over it. | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnMouseMove(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	bool keyDown = GetKeyState(VK_CONTROL) & 0x8000 || GetKeyState(VK_SHIFT) & 0x8000 || GetKeyState(VK_MENU) & 0x8000; | 	bool keyDown = GetKeyState(VK_CONTROL) & 0x8000 || GetKeyState(VK_SHIFT) & 0x8000 || GetKeyState(VK_MENU) & 0x8000; | ||||||
|  |  | ||||||
| @@ -3001,21 +3034,24 @@ LRESULT CMeterWindow::OnMouseMove(WPARAM wParam, LPARAM lParam) | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	POINT pos; | 	if (!m_ClickThrough || keyDown) | ||||||
| 	pos.x = (SHORT)LOWORD(lParam); |  | ||||||
| 	pos.y = (SHORT)HIWORD(lParam); |  | ||||||
|  |  | ||||||
| 	if (m_Message == WM_NCMOUSEMOVE) |  | ||||||
| 	{ | 	{ | ||||||
| 		// Map to local window | 		POINT pos; | ||||||
| 		MapWindowPoints(NULL, m_Window, &pos, 1); | 		pos.x = (SHORT)LOWORD(lParam); | ||||||
|  | 		pos.y = (SHORT)HIWORD(lParam); | ||||||
|  |  | ||||||
|  | 		if (uMsg == WM_NCMOUSEMOVE) | ||||||
|  | 		{ | ||||||
|  | 			// Map to local window | ||||||
|  | 			MapWindowPoints(NULL, m_Window, &pos, 1); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		while (DoMoveAction(pos.x, pos.y, MOUSE_OVER)) ; | ||||||
|  |  | ||||||
|  | 		// Handle buttons | ||||||
|  | 		HandleButtons(pos, BUTTONPROC_MOVE, NULL, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	DoMoveAction(pos.x, pos.y, MOUSE_OVER); |  | ||||||
|  |  | ||||||
| 	// Handle buttons |  | ||||||
| 	HandleButtons(pos, BUTTONPROC_MOVE, NULL, true); |  | ||||||
|  |  | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -3025,7 +3061,7 @@ LRESULT CMeterWindow::OnMouseMove(WPARAM wParam, LPARAM lParam) | |||||||
| ** When we get WM_MOUSELEAVE messages, run all leave actions. | ** When we get WM_MOUSELEAVE messages, run all leave actions. | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnMouseLeave(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnMouseLeave(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	GetCursorPos(&pos); | 	GetCursorPos(&pos); | ||||||
| @@ -3048,7 +3084,7 @@ LRESULT CMeterWindow::OnMouseLeave(WPARAM wParam, LPARAM lParam) | |||||||
| ** During window creation we do nothing. | ** During window creation we do nothing. | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnCreate(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| @@ -3059,7 +3095,7 @@ LRESULT CMeterWindow::OnCreate(WPARAM wParam, LPARAM lParam) | |||||||
| ** Handle the menu commands. | ** Handle the menu commands. | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnCommand(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	try  | 	try  | ||||||
| 	{ | 	{ | ||||||
| @@ -3118,39 +3154,15 @@ LRESULT CMeterWindow::OnCommand(WPARAM wParam, LPARAM lParam) | |||||||
| 		} | 		} | ||||||
| 		else if(wParam == ID_CONTEXT_SKINMENU_KEEPONSCREEN) | 		else if(wParam == ID_CONTEXT_SKINMENU_KEEPONSCREEN) | ||||||
| 		{ | 		{ | ||||||
| 			m_KeepOnScreen = !m_KeepOnScreen; | 			SetKeepOnScreen(!m_KeepOnScreen); | ||||||
| 			WriteConfig(); |  | ||||||
|  |  | ||||||
| 			if (m_KeepOnScreen)  |  | ||||||
| 			{ |  | ||||||
| 				int x = m_ScreenX; |  | ||||||
| 				int y = m_ScreenY; |  | ||||||
| 				MapCoordsToScreen(x, y, m_WindowW, m_WindowH); |  | ||||||
| 				if (x != m_ScreenX || y != m_ScreenY) |  | ||||||
| 				{ |  | ||||||
| 					MoveWindow(x, y); |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
| 		else if(wParam == ID_CONTEXT_SKINMENU_CLICKTHROUGH) | 		else if(wParam == ID_CONTEXT_SKINMENU_CLICKTHROUGH) | ||||||
| 		{ | 		{ | ||||||
| 			m_ClickThrough = !m_ClickThrough; | 			SetClickThrough(!m_ClickThrough); | ||||||
| 			WriteConfig(); |  | ||||||
|  |  | ||||||
| 			if (!m_ClickThrough) |  | ||||||
| 			{ |  | ||||||
| 				// Remove transparent flag |  | ||||||
| 				LONG style = GetWindowLong(m_Window, GWL_EXSTYLE); |  | ||||||
| 				if ((style & WS_EX_TRANSPARENT) != 0) |  | ||||||
| 				{ |  | ||||||
| 					SetWindowLong(m_Window, GWL_EXSTYLE, style & ~WS_EX_TRANSPARENT); |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
| 		else if(wParam == ID_CONTEXT_SKINMENU_DRAGGABLE) | 		else if(wParam == ID_CONTEXT_SKINMENU_DRAGGABLE) | ||||||
| 		{ | 		{ | ||||||
| 			m_WindowDraggable = !m_WindowDraggable; | 			SetWindowDraggable(!m_WindowDraggable); | ||||||
| 			WriteConfig(); |  | ||||||
| 		} | 		} | ||||||
| 		else if(wParam == ID_CONTEXT_SKINMENU_HIDEONMOUSE) | 		else if(wParam == ID_CONTEXT_SKINMENU_HIDEONMOUSE) | ||||||
| 		{ | 		{ | ||||||
| @@ -3193,13 +3205,11 @@ LRESULT CMeterWindow::OnCommand(WPARAM wParam, LPARAM lParam) | |||||||
| 		} | 		} | ||||||
| 		else if(wParam == ID_CONTEXT_SKINMENU_REMEMBERPOSITION) | 		else if(wParam == ID_CONTEXT_SKINMENU_REMEMBERPOSITION) | ||||||
| 		{ | 		{ | ||||||
| 			m_SavePosition = !m_SavePosition; | 			SetSavePosition(!m_SavePosition); | ||||||
| 			WriteConfig(); |  | ||||||
| 		} | 		} | ||||||
| 		else if(wParam == ID_CONTEXT_SKINMENU_SNAPTOEDGES) | 		else if(wParam == ID_CONTEXT_SKINMENU_SNAPTOEDGES) | ||||||
| 		{ | 		{ | ||||||
| 			m_SnapEdges = !m_SnapEdges; | 			SetSnapEdges(!m_SnapEdges); | ||||||
| 			WriteConfig(); |  | ||||||
| 		} | 		} | ||||||
| 		else if(wParam >= ID_CONTEXT_SKINMENU_TRANSPARENCY_0 && wParam <= ID_CONTEXT_SKINMENU_TRANSPARENCY_90) | 		else if(wParam >= ID_CONTEXT_SKINMENU_TRANSPARENCY_0 && wParam <= ID_CONTEXT_SKINMENU_TRANSPARENCY_90) | ||||||
| 		{ | 		{ | ||||||
| @@ -3311,17 +3321,103 @@ LRESULT CMeterWindow::OnCommand(WPARAM wParam, LPARAM lParam) | |||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | ** SetClickThrough | ||||||
|  | ** | ||||||
|  | ** Helper function for setting ClickThrough | ||||||
|  | ** | ||||||
|  | */ | ||||||
|  | void CMeterWindow::SetClickThrough(bool b) | ||||||
|  | { | ||||||
|  | 	m_ClickThrough = b; | ||||||
|  | 	WriteConfig(); | ||||||
|  |  | ||||||
|  | 	if (!m_ClickThrough) | ||||||
|  | 	{ | ||||||
|  | 		// Remove transparent flag | ||||||
|  | 		LONG style = GetWindowLong(m_Window, GWL_EXSTYLE); | ||||||
|  | 		if ((style & WS_EX_TRANSPARENT) != 0) | ||||||
|  | 		{ | ||||||
|  | 			SetWindowLong(m_Window, GWL_EXSTYLE, style & ~WS_EX_TRANSPARENT); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	if (m_MouseOver) | ||||||
|  | 	{ | ||||||
|  | 		SetMouseLeaveEvent(m_ClickThrough); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | ** SetKeepOnScreen | ||||||
|  | ** | ||||||
|  | ** Helper function for setting KeepOnScreen | ||||||
|  | ** | ||||||
|  | */ | ||||||
|  | void CMeterWindow::SetKeepOnScreen(bool b) | ||||||
|  | { | ||||||
|  | 	m_KeepOnScreen = b; | ||||||
|  | 	WriteConfig(); | ||||||
|  |  | ||||||
|  | 	if (m_KeepOnScreen)  | ||||||
|  | 	{ | ||||||
|  | 		int x = m_ScreenX; | ||||||
|  | 		int y = m_ScreenY; | ||||||
|  | 		MapCoordsToScreen(x, y, m_WindowW, m_WindowH); | ||||||
|  | 		if (x != m_ScreenX || y != m_ScreenY) | ||||||
|  | 		{ | ||||||
|  | 			MoveWindow(x, y); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | ** SetWindowDraggable | ||||||
|  | ** | ||||||
|  | ** Helper function for setting WindowDraggable | ||||||
|  | ** | ||||||
|  | */ | ||||||
|  | void CMeterWindow::SetWindowDraggable(bool b) | ||||||
|  | { | ||||||
|  | 	m_WindowDraggable = b; | ||||||
|  | 	WriteConfig(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | ** SetSavePosition | ||||||
|  | ** | ||||||
|  | ** Helper function for setting SavePosition | ||||||
|  | ** | ||||||
|  | */ | ||||||
|  | void CMeterWindow::SetSavePosition(bool b) | ||||||
|  | { | ||||||
|  | 	m_SavePosition = b; | ||||||
|  | 	WriteConfig(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | ** SetSnapEdges | ||||||
|  | ** | ||||||
|  | ** Helper function for setting SnapEdges | ||||||
|  | ** | ||||||
|  | */ | ||||||
|  | void CMeterWindow::SetSnapEdges(bool b) | ||||||
|  | { | ||||||
|  | 	m_SnapEdges = b; | ||||||
|  | 	WriteConfig(); | ||||||
|  | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
| ** OnSysCommand | ** OnSysCommand | ||||||
| ** | ** | ||||||
| ** Handle dragging the window | ** Handle dragging the window | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnSysCommand(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	if ((wParam & 0xFFF0) != SC_MOVE) | 	if ((wParam & 0xFFF0) != SC_MOVE) | ||||||
| 	{ | 	{ | ||||||
| 		return DefWindowProc(m_Window, m_Message, wParam, lParam); | 		return DefWindowProc(m_Window, uMsg, wParam, lParam); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// --- SC_MOVE --- | 	// --- SC_MOVE --- | ||||||
| @@ -3331,7 +3427,7 @@ LRESULT CMeterWindow::OnSysCommand(WPARAM wParam, LPARAM lParam) | |||||||
| 	m_Dragged = false; | 	m_Dragged = false; | ||||||
|  |  | ||||||
| 	// Run the DefWindowProc so the dragging works | 	// Run the DefWindowProc so the dragging works | ||||||
| 	LRESULT result = DefWindowProc(m_Window, m_Message, wParam, lParam); | 	LRESULT result = DefWindowProc(m_Window, uMsg, wParam, lParam); | ||||||
|  |  | ||||||
| 	if (m_Dragged) | 	if (m_Dragged) | ||||||
| 	{ | 	{ | ||||||
| @@ -3372,7 +3468,7 @@ LRESULT CMeterWindow::OnSysCommand(WPARAM wParam, LPARAM lParam) | |||||||
| ** Starts dragging | ** Starts dragging | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnEnterSizeMove(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnEnterSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	if (m_Dragging) | 	if (m_Dragging) | ||||||
| 	{ | 	{ | ||||||
| @@ -3391,7 +3487,7 @@ LRESULT CMeterWindow::OnEnterSizeMove(WPARAM wParam, LPARAM lParam) | |||||||
| ** Ends dragging | ** Ends dragging | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnExitSizeMove(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnExitSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| @@ -3402,7 +3498,7 @@ LRESULT CMeterWindow::OnExitSizeMove(WPARAM wParam, LPARAM lParam) | |||||||
| ** This is overwritten so that the window can be dragged | ** This is overwritten so that the window can be dragged | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnNcHitTest(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	if (m_WindowDraggable) | 	if (m_WindowDraggable) | ||||||
| 	{ | 	{ | ||||||
| @@ -3438,7 +3534,7 @@ LRESULT CMeterWindow::OnNcHitTest(WPARAM wParam, LPARAM lParam) | |||||||
| ** Called when windows position is about to change | ** Called when windows position is about to change | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnWindowPosChanging(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	LPWINDOWPOS wp=(LPWINDOWPOS)lParam; | 	LPWINDOWPOS wp=(LPWINDOWPOS)lParam; | ||||||
|  |  | ||||||
| @@ -3503,7 +3599,7 @@ LRESULT CMeterWindow::OnWindowPosChanging(WPARAM wParam, LPARAM lParam) | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return DefWindowProc(m_Window, m_Message, wParam, lParam); | 	return DefWindowProc(m_Window, uMsg, wParam, lParam); | ||||||
| } | } | ||||||
|  |  | ||||||
| void CMeterWindow::SnapToWindow(CMeterWindow* window, LPWINDOWPOS wp) | void CMeterWindow::SnapToWindow(CMeterWindow* window, LPWINDOWPOS wp) | ||||||
| @@ -3538,7 +3634,7 @@ void CMeterWindow::SnapToWindow(CMeterWindow* window, LPWINDOWPOS wp) | |||||||
| ** During destruction of the window do nothing. | ** During destruction of the window do nothing. | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnDestroy(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| @@ -3550,7 +3646,7 @@ LRESULT CMeterWindow::OnDestroy(WPARAM wParam, LPARAM lParam) | |||||||
| ** (OnDelayedMove function is used instead.) | ** (OnDelayedMove function is used instead.) | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnDisplayChange(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| @@ -3562,7 +3658,7 @@ LRESULT CMeterWindow::OnDisplayChange(WPARAM wParam, LPARAM lParam) | |||||||
| ** (OnDelayedMove function is used instead.) | ** (OnDelayedMove function is used instead.) | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnSettingChange(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| @@ -3573,13 +3669,13 @@ LRESULT CMeterWindow::OnSettingChange(WPARAM wParam, LPARAM lParam) | |||||||
| ** Runs the action when left mouse button is down | ** Runs the action when left mouse button is down | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnLeftButtonDown(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnLeftButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	pos.x = (SHORT)LOWORD(lParam);  | 	pos.x = (SHORT)LOWORD(lParam);  | ||||||
| 	pos.y = (SHORT)HIWORD(lParam);  | 	pos.y = (SHORT)HIWORD(lParam);  | ||||||
|  |  | ||||||
| 	if (m_Message == WM_NCLBUTTONDOWN) | 	if (uMsg == WM_NCLBUTTONDOWN) | ||||||
| 	{ | 	{ | ||||||
| 		// Transform the point to client rect | 		// Transform the point to client rect | ||||||
| 		RECT rect; | 		RECT rect; | ||||||
| @@ -3597,7 +3693,7 @@ LRESULT CMeterWindow::OnLeftButtonDown(WPARAM wParam, LPARAM lParam) | |||||||
| 		SetMouseLeaveEvent(true); | 		SetMouseLeaveEvent(true); | ||||||
|  |  | ||||||
| 		// Run the DefWindowProc so the dragging works | 		// Run the DefWindowProc so the dragging works | ||||||
| 		return DefWindowProc(m_Window, m_Message, wParam, lParam); | 		return DefWindowProc(m_Window, uMsg, wParam, lParam); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return 0; | 	return 0; | ||||||
| @@ -3609,13 +3705,13 @@ LRESULT CMeterWindow::OnLeftButtonDown(WPARAM wParam, LPARAM lParam) | |||||||
| ** Runs the action when left mouse button is up | ** Runs the action when left mouse button is up | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnLeftButtonUp(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnLeftButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	pos.x = (SHORT)LOWORD(lParam);  | 	pos.x = (SHORT)LOWORD(lParam);  | ||||||
| 	pos.y = (SHORT)HIWORD(lParam);  | 	pos.y = (SHORT)HIWORD(lParam);  | ||||||
|  |  | ||||||
| 	if (m_Message == WM_NCLBUTTONUP) | 	if (uMsg == WM_NCLBUTTONUP) | ||||||
| 	{ | 	{ | ||||||
| 		// Transform the point to client rect | 		// Transform the point to client rect | ||||||
| 		RECT rect; | 		RECT rect; | ||||||
| @@ -3638,13 +3734,13 @@ LRESULT CMeterWindow::OnLeftButtonUp(WPARAM wParam, LPARAM lParam) | |||||||
| ** Runs the action when left mouse button is double-clicked | ** Runs the action when left mouse button is double-clicked | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnLeftButtonDoubleClick(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnLeftButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	pos.x = (SHORT)LOWORD(lParam);  | 	pos.x = (SHORT)LOWORD(lParam);  | ||||||
| 	pos.y = (SHORT)HIWORD(lParam);  | 	pos.y = (SHORT)HIWORD(lParam);  | ||||||
|  |  | ||||||
| 	if (m_Message == WM_NCLBUTTONDBLCLK) | 	if (uMsg == WM_NCLBUTTONDBLCLK) | ||||||
| 	{ | 	{ | ||||||
| 		// Transform the point to client rect | 		// Transform the point to client rect | ||||||
| 		RECT rect; | 		RECT rect; | ||||||
| @@ -3670,13 +3766,13 @@ LRESULT CMeterWindow::OnLeftButtonDoubleClick(WPARAM wParam, LPARAM lParam) | |||||||
| ** Runs the action when right mouse button is down | ** Runs the action when right mouse button is down | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnRightButtonDown(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnRightButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	pos.x = (SHORT)LOWORD(lParam);  | 	pos.x = (SHORT)LOWORD(lParam);  | ||||||
| 	pos.y = (SHORT)HIWORD(lParam);  | 	pos.y = (SHORT)HIWORD(lParam);  | ||||||
|  |  | ||||||
| 	if (m_Message == WM_NCRBUTTONDOWN) | 	if (uMsg == WM_NCRBUTTONDOWN) | ||||||
| 	{ | 	{ | ||||||
| 		// Transform the point to client rect | 		// Transform the point to client rect | ||||||
| 		RECT rect; | 		RECT rect; | ||||||
| @@ -3699,7 +3795,7 @@ LRESULT CMeterWindow::OnRightButtonDown(WPARAM wParam, LPARAM lParam) | |||||||
| ** Runs the action when right mouse button is up | ** Runs the action when right mouse button is up | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnRightButtonUp(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnRightButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	pos.x = (SHORT)LOWORD(lParam); | 	pos.x = (SHORT)LOWORD(lParam); | ||||||
| @@ -3723,13 +3819,13 @@ LRESULT CMeterWindow::OnRightButtonUp(WPARAM wParam, LPARAM lParam) | |||||||
| ** Runs the action when right mouse button is double-clicked | ** Runs the action when right mouse button is double-clicked | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnRightButtonDoubleClick(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnRightButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	pos.x = (SHORT)LOWORD(lParam);  | 	pos.x = (SHORT)LOWORD(lParam);  | ||||||
| 	pos.y = (SHORT)HIWORD(lParam);  | 	pos.y = (SHORT)HIWORD(lParam);  | ||||||
|  |  | ||||||
| 	if (m_Message == WM_NCRBUTTONDBLCLK) | 	if (uMsg == WM_NCRBUTTONDBLCLK) | ||||||
| 	{ | 	{ | ||||||
| 		// Transform the point to client rect | 		// Transform the point to client rect | ||||||
| 		RECT rect; | 		RECT rect; | ||||||
| @@ -3755,13 +3851,13 @@ LRESULT CMeterWindow::OnRightButtonDoubleClick(WPARAM wParam, LPARAM lParam) | |||||||
| ** Runs the action when middle mouse button is down | ** Runs the action when middle mouse button is down | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnMiddleButtonDown(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnMiddleButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	pos.x = (SHORT)LOWORD(lParam);  | 	pos.x = (SHORT)LOWORD(lParam);  | ||||||
| 	pos.y = (SHORT)HIWORD(lParam);  | 	pos.y = (SHORT)HIWORD(lParam);  | ||||||
|  |  | ||||||
| 	if (m_Message == WM_NCMBUTTONDOWN) | 	if (uMsg == WM_NCMBUTTONDOWN) | ||||||
| 	{ | 	{ | ||||||
| 		// Transform the point to client rect | 		// Transform the point to client rect | ||||||
| 		RECT rect; | 		RECT rect; | ||||||
| @@ -3784,13 +3880,13 @@ LRESULT CMeterWindow::OnMiddleButtonDown(WPARAM wParam, LPARAM lParam) | |||||||
| ** Runs the action when middle mouse button is up | ** Runs the action when middle mouse button is up | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnMiddleButtonUp(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnMiddleButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	pos.x = (SHORT)LOWORD(lParam);  | 	pos.x = (SHORT)LOWORD(lParam);  | ||||||
| 	pos.y = (SHORT)HIWORD(lParam);  | 	pos.y = (SHORT)HIWORD(lParam);  | ||||||
|  |  | ||||||
| 	if (m_Message == WM_NCMBUTTONUP) | 	if (uMsg == WM_NCMBUTTONUP) | ||||||
| 	{ | 	{ | ||||||
| 		// Transform the point to client rect | 		// Transform the point to client rect | ||||||
| 		RECT rect; | 		RECT rect; | ||||||
| @@ -3813,13 +3909,13 @@ LRESULT CMeterWindow::OnMiddleButtonUp(WPARAM wParam, LPARAM lParam) | |||||||
| ** Runs the action when middle mouse button is double-clicked | ** Runs the action when middle mouse button is double-clicked | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnMiddleButtonDoubleClick(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnMiddleButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	pos.x = (SHORT)LOWORD(lParam);  | 	pos.x = (SHORT)LOWORD(lParam);  | ||||||
| 	pos.y = (SHORT)HIWORD(lParam);  | 	pos.y = (SHORT)HIWORD(lParam);  | ||||||
|  |  | ||||||
| 	if (m_Message == WM_NCMBUTTONDBLCLK) | 	if (uMsg == WM_NCMBUTTONDBLCLK) | ||||||
| 	{ | 	{ | ||||||
| 		// Transform the point to client rect | 		// Transform the point to client rect | ||||||
| 		RECT rect; | 		RECT rect; | ||||||
| @@ -3845,7 +3941,7 @@ LRESULT CMeterWindow::OnMiddleButtonDoubleClick(WPARAM wParam, LPARAM lParam) | |||||||
| ** Handles the context menu. The menu is recreated every time it is shown. | ** Handles the context menu. The menu is recreated every time it is shown. | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnContextMenu(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	POINT pos; | 	POINT pos; | ||||||
| 	int x = (SHORT)LOWORD(lParam);  | 	int x = (SHORT)LOWORD(lParam);  | ||||||
| @@ -4090,6 +4186,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) | |||||||
| 					if (!m_MouseOverAction.empty()) | 					if (!m_MouseOverAction.empty()) | ||||||
| 					{ | 					{ | ||||||
| 						m_Rainmeter->ExecuteCommand(m_MouseOverAction.c_str(), this); | 						m_Rainmeter->ExecuteCommand(m_MouseOverAction.c_str(), this); | ||||||
|  | 						return true; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| @@ -4130,6 +4227,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) | |||||||
| 						if (!((*j)->GetMouseOverAction().empty())) | 						if (!((*j)->GetMouseOverAction().empty())) | ||||||
| 						{ | 						{ | ||||||
| 							m_Rainmeter->ExecuteCommand((*j)->GetMouseOverAction().c_str(), this); | 							m_Rainmeter->ExecuteCommand((*j)->GetMouseOverAction().c_str(), this); | ||||||
|  | 							return true; | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| @@ -4158,6 +4256,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) | |||||||
| 				if (!((*j)->GetMouseLeaveAction().empty())) | 				if (!((*j)->GetMouseLeaveAction().empty())) | ||||||
| 				{ | 				{ | ||||||
| 					m_Rainmeter->ExecuteCommand((*j)->GetMouseLeaveAction().c_str(), this); | 					m_Rainmeter->ExecuteCommand((*j)->GetMouseLeaveAction().c_str(), this); | ||||||
|  | 					return true; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @@ -4209,7 +4308,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) | |||||||
| ** Stores the new place of the window, in screen coordinates. | ** Stores the new place of the window, in screen coordinates. | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnMove(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnMove(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	// The lParam's x/y parameters are given in screen coordinates for overlapped and pop-up windows | 	// The lParam's x/y parameters are given in screen coordinates for overlapped and pop-up windows | ||||||
| 	// and in parent-client coordinates for child windows. | 	// and in parent-client coordinates for child windows. | ||||||
| @@ -4252,8 +4351,6 @@ LRESULT CALLBACK CMeterWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR | |||||||
| 		Window = (CMeterWindow*)GetProp(hWnd, L"RAINMETER"); | 		Window = (CMeterWindow*)GetProp(hWnd, L"RAINMETER"); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (Window) Window->m_Message = uMsg; |  | ||||||
|  |  | ||||||
| 	BEGIN_MESSAGEPROC | 	BEGIN_MESSAGEPROC | ||||||
| 	MESSAGE(OnPaint, WM_PAINT) | 	MESSAGE(OnPaint, WM_PAINT) | ||||||
| 	MESSAGE(OnMove, WM_MOVE) | 	MESSAGE(OnMove, WM_MOVE) | ||||||
| @@ -4304,7 +4401,7 @@ LRESULT CALLBACK CMeterWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR | |||||||
| ** Handles delayed executes | ** Handles delayed executes | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnDelayedExecute(WPARAM wParam, LPARAM lParam) | LRESULT CMeterWindow::OnDelayedExecute(UINT uMsg, WPARAM wParam, LPARAM lParam) | ||||||
| { | { | ||||||
| 	if (lParam) | 	if (lParam) | ||||||
| 	{ | 	{ | ||||||
| @@ -4315,7 +4412,7 @@ LRESULT CMeterWindow::OnDelayedExecute(WPARAM wParam, LPARAM lParam) | |||||||
| 		copyData.cbData = (DWORD)((wcslen(szExecute) + 1) * sizeof(WCHAR)); | 		copyData.cbData = (DWORD)((wcslen(szExecute) + 1) * sizeof(WCHAR)); | ||||||
| 		copyData.lpData = (void*)szExecute; | 		copyData.lpData = (void*)szExecute; | ||||||
|  |  | ||||||
| 		OnCopyData(NULL, (LPARAM)©Data); | 		OnCopyData(WM_COPYDATA, NULL, (LPARAM)©Data); | ||||||
| 	} | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| @@ -4326,7 +4423,7 @@ LRESULT CMeterWindow::OnDelayedExecute(WPARAM wParam, LPARAM lParam) | |||||||
| ** Handles delayed refresh | ** Handles delayed refresh | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnDelayedRefresh(WPARAM wParam, LPARAM lParam) | LRESULT CMeterWindow::OnDelayedRefresh(UINT uMsg, WPARAM wParam, LPARAM lParam) | ||||||
| { | { | ||||||
| 	try | 	try | ||||||
| 	{ | 	{ | ||||||
| @@ -4345,7 +4442,7 @@ LRESULT CMeterWindow::OnDelayedRefresh(WPARAM wParam, LPARAM lParam) | |||||||
| ** Handles delayed move | ** Handles delayed move | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnDelayedMove(WPARAM wParam, LPARAM lParam)  | LRESULT CMeterWindow::OnDelayedMove(UINT uMsg, WPARAM wParam, LPARAM lParam)  | ||||||
| { | { | ||||||
| 	if (m_NativeTransparency) | 	if (m_NativeTransparency) | ||||||
| 	{ | 	{ | ||||||
| @@ -4376,7 +4473,7 @@ LRESULT CMeterWindow::OnDelayedMove(WPARAM wParam, LPARAM lParam) | |||||||
| ** Handles bangs from the exe | ** Handles bangs from the exe | ||||||
| ** | ** | ||||||
| */ | */ | ||||||
| LRESULT CMeterWindow::OnCopyData(WPARAM wParam, LPARAM lParam) | LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam) | ||||||
| { | { | ||||||
| 	COPYDATASTRUCT* pCopyDataStruct = (COPYDATASTRUCT*) lParam; | 	COPYDATASTRUCT* pCopyDataStruct = (COPYDATASTRUCT*) lParam; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ | |||||||
| #include "Export.h" | #include "Export.h" | ||||||
|  |  | ||||||
| #define BEGIN_MESSAGEPROC switch(uMsg) { | #define BEGIN_MESSAGEPROC switch(uMsg) { | ||||||
| #define MESSAGE(handler, msg) case msg: return Window?Window->handler(wParam, lParam):DefWindowProc(hWnd, uMsg, wParam, lParam); | #define MESSAGE(handler, msg) case msg: return Window?Window->handler(uMsg, wParam, lParam):DefWindowProc(hWnd, uMsg, wParam, lParam); | ||||||
| #define REJECT_MESSAGE(msg) case msg: return 0; | #define REJECT_MESSAGE(msg) case msg: return 0; | ||||||
| #define END_MESSAGEPROC } return DefWindowProc(hWnd, uMsg, wParam, lParam); | #define END_MESSAGEPROC } return DefWindowProc(hWnd, uMsg, wParam, lParam); | ||||||
|  |  | ||||||
| @@ -199,7 +199,7 @@ public: | |||||||
|  |  | ||||||
| 	void AddMeasureBang(const WCHAR* bang, int index, CMeasure* measure); | 	void AddMeasureBang(const WCHAR* bang, int index, CMeasure* measure); | ||||||
|  |  | ||||||
| 	LRESULT OnCopyData(WPARAM wParam, LPARAM lParam); | 	LRESULT OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
|  |  | ||||||
| 	std::wstring MakePathAbsolute(std::wstring path); | 	std::wstring MakePathAbsolute(std::wstring path); | ||||||
|  |  | ||||||
| @@ -208,34 +208,34 @@ public: | |||||||
| protected: | protected: | ||||||
| 	static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); | 	static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
|  |  | ||||||
| 	LRESULT OnPaint(WPARAM wParam, LPARAM lParam); | 	LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnMove(WPARAM wParam, LPARAM lParam); | 	LRESULT OnMove(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnCreate(WPARAM wParam, LPARAM lParam); | 	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnDestroy(WPARAM wParam, LPARAM lParam); | 	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnTimer(WPARAM wParam, LPARAM lParam); | 	LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnCommand(WPARAM wParam, LPARAM lParam); | 	LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnSysCommand(WPARAM wParam, LPARAM lParam); | 	LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnEnterSizeMove(WPARAM wParam, LPARAM lParam); | 	LRESULT OnEnterSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnExitSizeMove(WPARAM wParam, LPARAM lParam); | 	LRESULT OnExitSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnNcHitTest(WPARAM wParam, LPARAM lParam); | 	LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnWindowPosChanging(WPARAM wParam, LPARAM lParam); | 	LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnMouseMove(WPARAM wParam, LPARAM lParam); | 	LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam); | 	LRESULT OnMouseLeave(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnContextMenu(WPARAM wParam, LPARAM lParam); | 	LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnLeftButtonDown(WPARAM wParam, LPARAM lParam); | 	LRESULT OnLeftButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnRightButtonDown(WPARAM wParam, LPARAM lParam); | 	LRESULT OnRightButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnMiddleButtonDown(WPARAM wParam, LPARAM lParam); | 	LRESULT OnMiddleButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnLeftButtonUp(WPARAM wParam, LPARAM lParam); | 	LRESULT OnLeftButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnRightButtonUp(WPARAM wParam, LPARAM lParam); | 	LRESULT OnRightButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnMiddleButtonUp(WPARAM wParam, LPARAM lParam); | 	LRESULT OnMiddleButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnLeftButtonDoubleClick(WPARAM wParam, LPARAM lParam); | 	LRESULT OnLeftButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnRightButtonDoubleClick(WPARAM wParam, LPARAM lParam); | 	LRESULT OnRightButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnMiddleButtonDoubleClick(WPARAM wParam, LPARAM lParam); | 	LRESULT OnMiddleButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnDelayedExecute(WPARAM wParam, LPARAM lParam); | 	LRESULT OnDelayedExecute(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnDelayedRefresh(WPARAM wParam, LPARAM lParam); | 	LRESULT OnDelayedRefresh(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnDelayedMove(WPARAM wParam, LPARAM lParam); | 	LRESULT OnDelayedMove(UINT uMsg, WPARAM wParam, LPARAM lParam); | ||||||
| 	LRESULT OnSettingChange(WPARAM wParam, LPARAM lParam);   | 	LRESULT OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam);   | ||||||
| 	LRESULT OnDisplayChange(WPARAM wParam, LPARAM lParam);   | 	LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam);   | ||||||
|  |  | ||||||
| private: | private: | ||||||
| 	bool HitTest(int x, int y); | 	bool HitTest(int x, int y); | ||||||
| @@ -255,7 +255,13 @@ private: | |||||||
| 	void InitializeMeasures(); | 	void InitializeMeasures(); | ||||||
| 	void InitializeMeters(); | 	void InitializeMeters(); | ||||||
| 	void ShowWindowIfAppropriate(); | 	void ShowWindowIfAppropriate(); | ||||||
|  | 	HWND GetWindowFromPoint(POINT pos); | ||||||
| 	void HandleButtons(POINT pos, BUTTONPROC proc, CMeterWindow* meterWindow, bool changeCursor); | 	void HandleButtons(POINT pos, BUTTONPROC proc, CMeterWindow* meterWindow, bool changeCursor); | ||||||
|  | 	void SetClickThrough(bool b); | ||||||
|  | 	void SetKeepOnScreen(bool b); | ||||||
|  | 	void SetWindowDraggable(bool b); | ||||||
|  | 	void SetSavePosition(bool b); | ||||||
|  | 	void SetSnapEdges(bool b); | ||||||
| 	bool DoAction(int x, int y, MOUSE mouse, bool test); | 	bool DoAction(int x, int y, MOUSE mouse, bool test); | ||||||
| 	bool DoMoveAction(int x, int y, MOUSE mouse); | 	bool DoMoveAction(int x, int y, MOUSE mouse); | ||||||
| 	bool ResizeWindow(bool reset); | 	bool ResizeWindow(bool reset); | ||||||
| @@ -356,8 +362,6 @@ private: | |||||||
| 	std::wstring m_SkinName;					// Name of the current skin folder | 	std::wstring m_SkinName;					// Name of the current skin folder | ||||||
| 	std::wstring m_SkinIniFile;					// Name of the current skin iniFile | 	std::wstring m_SkinIniFile;					// Name of the current skin iniFile | ||||||
|  |  | ||||||
| 	UINT m_Message;								// The current window message |  | ||||||
|  |  | ||||||
| 	int m_UpdateCounter; | 	int m_UpdateCounter; | ||||||
|  |  | ||||||
| 	CRainmeter* m_Rainmeter;					// Pointer to the main object | 	CRainmeter* m_Rainmeter;					// Pointer to the main object | ||||||
|   | |||||||
| @@ -2696,7 +2696,7 @@ void CRainmeter::ExecuteCommand(const WCHAR* command, CMeterWindow* meterWindow) | |||||||
| 				CopyDataStruct.cbData = (DWORD)((wcslen(command) + 1) * sizeof(WCHAR)); | 				CopyDataStruct.cbData = (DWORD)((wcslen(command) + 1) * sizeof(WCHAR)); | ||||||
| 				CopyDataStruct.dwData = 1; | 				CopyDataStruct.dwData = 1; | ||||||
| 				CopyDataStruct.lpData = (void*)strCommand.c_str(); | 				CopyDataStruct.lpData = (void*)strCommand.c_str(); | ||||||
| 				meterWindow->OnCopyData(NULL, (LPARAM)&CopyDataStruct); | 				meterWindow->OnCopyData(WM_COPYDATA, NULL, (LPARAM)&CopyDataStruct); | ||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
| 			{ | 			{ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 spx
					spx