mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
Fix typing sound not working with forward delete
This commit is contained in:
@@ -432,6 +432,32 @@ void UpdateNameDialog (Dialog *theDialog)
|
|||||||
SetDialogNumToStr(theDialog, kNameNCharsItem, (long)nChars);
|
SetDialogNumToStr(theDialog, kNameNCharsItem, (long)nChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------- EventIsTyping
|
||||||
|
// Checks if a keyboard event should make a typing sound
|
||||||
|
|
||||||
|
static bool EventIsTyping(const GpKeyboardInputEvent &kbEvent)
|
||||||
|
{
|
||||||
|
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
|
||||||
|
{
|
||||||
|
// Duplicate backspace event
|
||||||
|
if (kbEvent.m_keyIDSubset == GpKeyIDSubsets::kASCII && kbEvent.m_key.m_asciiChar == '\b')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDown || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAuto)
|
||||||
|
{
|
||||||
|
if (kbEvent.m_keyIDSubset == GpKeyIDSubsets::kSpecial)
|
||||||
|
{
|
||||||
|
if (kbEvent.m_key.m_specialKey == GpKeySpecials::kBackspace || kbEvent.m_key.m_specialKey == GpKeySpecials::kDelete)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- NameFilter
|
//-------------------------------------------------------------- NameFilter
|
||||||
// Dialog filter for the "Enter High Score Name" dialog.
|
// Dialog filter for the "Enter High Score Name" dialog.
|
||||||
|
|
||||||
@@ -453,7 +479,7 @@ int16_t NameFilter (Dialog *dial, const TimeTaggedVOSEvent *evt)
|
|||||||
{
|
{
|
||||||
const GpKeyboardInputEvent &kbEvent = evt->m_vosEvent.m_event.m_keyboardInputEvent;
|
const GpKeyboardInputEvent &kbEvent = evt->m_vosEvent.m_event.m_keyboardInputEvent;
|
||||||
|
|
||||||
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
|
if (EventIsTyping(kbEvent))
|
||||||
{
|
{
|
||||||
PlayPrioritySound(kTypingSound, kTypingPriority);
|
PlayPrioritySound(kTypingSound, kTypingPriority);
|
||||||
keyStroke = true;
|
keyStroke = true;
|
||||||
@@ -568,7 +594,7 @@ int16_t BannerFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
|||||||
{
|
{
|
||||||
const GpKeyboardInputEvent &kbEvent = evt->m_vosEvent.m_event.m_keyboardInputEvent;
|
const GpKeyboardInputEvent &kbEvent = evt->m_vosEvent.m_event.m_keyboardInputEvent;
|
||||||
|
|
||||||
if (kbEvent.m_eventType == GpKeyboardInputEventTypes::kDownChar || kbEvent.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
|
if (EventIsTyping(kbEvent))
|
||||||
{
|
{
|
||||||
PlayPrioritySound(kTypingSound, kTypingPriority);
|
PlayPrioritySound(kTypingSound, kTypingPriority);
|
||||||
keyStroke = true;
|
keyStroke = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user