зеркало из https://github.com/mozilla/pjs.git
[OS/2] Bug 503744: use the few system sounds that we have available on OS/2, r=dragtext
This commit is contained in:
Родитель
69fe204dbc
Коммит
ed972bfa6b
|
@ -457,14 +457,14 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsSound::Beep()
|
||||
NS_IMETHODIMP nsSound::Beep()
|
||||
{
|
||||
WinAlarm(HWND_DESKTOP, WA_WARNING);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsSound::Play(nsIURL *aURL)
|
||||
NS_IMETHODIMP nsSound::Play(nsIURL *aURL)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -481,18 +481,22 @@ NS_IMETHODIMP nsSound::Init()
|
|||
|
||||
NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias)
|
||||
{
|
||||
// Just beep if MMPM isn't installed.
|
||||
if (!sMMPMInstalled) {
|
||||
Beep();
|
||||
return NS_OK;
|
||||
return Beep();
|
||||
}
|
||||
|
||||
if (NS_IsMozAliasSound(aSoundAlias)) {
|
||||
NS_WARNING("nsISound::playSystemSound is called with \"_moz_\" events, they are obsolete, use nsISound::playEventSound instead");
|
||||
// We don't have a default mail sound on OS/2, so just beep.
|
||||
if (aSoundAlias.Equals(NS_SYSSOUND_MAIL_BEEP))
|
||||
Beep();
|
||||
return NS_OK;
|
||||
PRUint32 eventId;
|
||||
if (aSoundAlias.Equals(NS_SYSSOUND_ALERT_DIALOG))
|
||||
eventId = EVENT_ALERT_DIALOG_OPEN;
|
||||
else if (aSoundAlias.Equals(NS_SYSSOUND_CONFIRM_DIALOG))
|
||||
eventId = EVENT_CONFIRM_DIALOG_OPEN;
|
||||
else if (aSoundAlias.Equals(NS_SYSSOUND_MAIL_BEEP))
|
||||
eventId = EVENT_NEW_MAIL_RECEIVED;
|
||||
else
|
||||
return NS_OK;
|
||||
return PlayEventSound(eventId);
|
||||
}
|
||||
nsCAutoString nativeSoundAlias;
|
||||
NS_CopyUnicodeToNative(aSoundAlias, nativeSoundAlias);
|
||||
|
@ -515,11 +519,21 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias)
|
|||
|
||||
NS_IMETHODIMP nsSound::PlayEventSound(PRUint32 aEventId)
|
||||
{
|
||||
// Just beep if MMPM isn't installed.
|
||||
if (!sMMPMInstalled) {
|
||||
return Beep();
|
||||
// Prompt dialog and select dialog sounds do not correspond to OS/2
|
||||
// system sounds, ignore them. Ignore the menu sounds, too. Try to handle
|
||||
// the rest. Skip the beeps on systems without MMPM, too many of them are
|
||||
// confusing and annoying.
|
||||
switch(aEventId) {
|
||||
case EVENT_NEW_MAIL_RECEIVED:
|
||||
// We don't have a default mail sound on OS/2, so just "beep"
|
||||
return Beep(); // this corresponds to the "Warning" sound
|
||||
case EVENT_ALERT_DIALOG_OPEN:
|
||||
WinAlarm(HWND_DESKTOP, WA_ERROR); // play "Error" sound
|
||||
break;
|
||||
case EVENT_CONFIRM_DIALOG_OPEN:
|
||||
WinAlarm(HWND_DESKTOP, WA_NOTE); // play "Information" sound
|
||||
break;
|
||||
}
|
||||
|
||||
// We don't have a default mail sound on OS/2, so just beep.
|
||||
return aEventId == EVENT_NEW_MAIL_RECEIVED ? Beep() : NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче