mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Fixed an issue that audio commands fail in some cases.
Following cases are now available: ButtonCommand=PLAY #SKINSPATH#Beeper\Sounds\beep.wav ButtonCommand=PLAY "#SKINSPATH#Beeper\Sounds\beep.wav" ButtonCommand=!execute [PLAY #SKINSPATH#Beeper\Sounds\beep.wav] ButtonCommand=!execute [PLAY "#SKINSPATH#Beeper\Sounds\beep.wav"]
This commit is contained in:
parent
e29b2a2d4b
commit
7f2c47a956
@ -287,8 +287,7 @@ bool CMeterButton::MouseUp(POINT pos, CMeterWindow* window)
|
|||||||
{
|
{
|
||||||
if (window && m_Clicked && m_Executable && HitTest2(pos.x, pos.y, true))
|
if (window && m_Clicked && m_Executable && HitTest2(pos.x, pos.y, true))
|
||||||
{
|
{
|
||||||
// Do a delayed execute or ortherwise !RainmeterRefresh crashes
|
Rainmeter->ExecuteCommand(m_Command.c_str(), window);
|
||||||
PostMessage(window->GetWindow(), WM_DELAYED_EXECUTE, (WPARAM)NULL, (LPARAM)m_Command.c_str());
|
|
||||||
}
|
}
|
||||||
m_State = BUTTON_STATE_NORMAL;
|
m_State = BUTTON_STATE_NORMAL;
|
||||||
m_Clicked = false;
|
m_Clicked = false;
|
||||||
|
@ -4312,7 +4312,7 @@ LRESULT CMeterWindow::OnDelayedExecute(WPARAM wParam, LPARAM lParam)
|
|||||||
COPYDATASTRUCT copyData;
|
COPYDATASTRUCT copyData;
|
||||||
|
|
||||||
copyData.dwData = 1;
|
copyData.dwData = 1;
|
||||||
copyData.cbData = (DWORD)((lstrlen(szExecute))* sizeof(WCHAR));
|
copyData.cbData = (DWORD)((wcslen(szExecute) + 1) * sizeof(WCHAR));
|
||||||
copyData.lpData = (void*)szExecute;
|
copyData.lpData = (void*)szExecute;
|
||||||
|
|
||||||
OnCopyData(NULL, (LPARAM)©Data);
|
OnCopyData(NULL, (LPARAM)©Data);
|
||||||
@ -4402,6 +4402,16 @@ LRESULT CMeterWindow::OnCopyData(WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::wstring str = (const WCHAR*)pCopyDataStruct->lpData;
|
std::wstring str = (const WCHAR*)pCopyDataStruct->lpData;
|
||||||
|
|
||||||
|
if (wcsnicmp(L"PLAY ", str.c_str(), 5) == 0 ||
|
||||||
|
wcsnicmp(L"PLAYLOOP ", str.c_str(), 9) == 0 ||
|
||||||
|
wcsnicmp(L"PLAYSTOP", str.c_str(), 8) == 0)
|
||||||
|
{
|
||||||
|
// Audio commands are special cases.
|
||||||
|
Rainmeter->ExecuteCommand(str.c_str(), this);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
std::wstring bang;
|
std::wstring bang;
|
||||||
std::wstring arg;
|
std::wstring arg;
|
||||||
|
|
||||||
|
@ -2653,10 +2653,31 @@ void CRainmeter::ExecuteCommand(const WCHAR* command, CMeterWindow* meterWindow)
|
|||||||
|
|
||||||
if (!strCommand.empty())
|
if (!strCommand.empty())
|
||||||
{
|
{
|
||||||
// Check for build-ins
|
// Check for built-ins
|
||||||
if (wcsncmp(L"PLAY ", strCommand.c_str(), 5) == 0)
|
if (wcsnicmp(L"PLAY ", strCommand.c_str(), 5) == 0 ||
|
||||||
|
wcsnicmp(L"PLAYLOOP ", strCommand.c_str(), 9) == 0)
|
||||||
{
|
{
|
||||||
BOOL ret = PlaySound(strCommand.c_str() + 5, NULL, SND_FILENAME | SND_ASYNC);
|
// Strip built-in command
|
||||||
|
size_t pos = strCommand.find(L' ');
|
||||||
|
strCommand.erase(0, pos + 1);
|
||||||
|
|
||||||
|
if (!strCommand.empty())
|
||||||
|
{
|
||||||
|
DWORD flags = SND_FILENAME | SND_ASYNC;
|
||||||
|
if (pos == 8) // PLAYLOOP
|
||||||
|
{
|
||||||
|
flags |= SND_LOOP | SND_NODEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strip the quotes
|
||||||
|
std::wstring::size_type len = strCommand.length();
|
||||||
|
if (len >= 2 && strCommand[0] == L'\"' && strCommand[len - 1] == L'\"')
|
||||||
|
{
|
||||||
|
strCommand.swap(strCommand.substr(1, len - 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
PlaySound(strCommand.c_str(), NULL, flags);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (wcsncmp(L"PLAYSTOP", strCommand.c_str(), 8) == 0)
|
else if (wcsncmp(L"PLAYSTOP", strCommand.c_str(), 8) == 0)
|
||||||
@ -2664,11 +2685,6 @@ void CRainmeter::ExecuteCommand(const WCHAR* command, CMeterWindow* meterWindow)
|
|||||||
PlaySound(NULL, NULL, SND_PURGE);
|
PlaySound(NULL, NULL, SND_PURGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (wcsncmp(L"PLAYLOOP ", strCommand.c_str(), 9) == 0)
|
|
||||||
{
|
|
||||||
PlaySound(strCommand.c_str() + 9, NULL, SND_ASYNC | SND_FILENAME | SND_LOOP | SND_NODEFAULT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run the command
|
// Run the command
|
||||||
if(strCommand.c_str()[0] == L'!' && Rainmeter->GetDummyLitestep())
|
if(strCommand.c_str()[0] == L'!' && Rainmeter->GetDummyLitestep())
|
||||||
|
@ -588,15 +588,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
|
|
||||||
if (!bang.empty())
|
if (!bang.empty())
|
||||||
{
|
{
|
||||||
std::wstring arg;
|
Rainmeter->ExecuteCommand(bang.c_str(), NULL);
|
||||||
size_t pos = bang.find(L' ');
|
|
||||||
if (pos != std::wstring::npos)
|
|
||||||
{
|
|
||||||
arg = bang;
|
|
||||||
arg.erase(0, pos + 1);
|
|
||||||
bang = bang.substr(0, pos);
|
|
||||||
}
|
|
||||||
Rainmeter->ExecuteBang(bang, arg, NULL);
|
|
||||||
}
|
}
|
||||||
else if (uMouseMsg == WM_RBUTTONDOWN)
|
else if (uMouseMsg == WM_RBUTTONDOWN)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user