Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[gui] - on repeated keypress actions where the action has to be dropp…

…ed for maintaining the scroll speed - return false for "not handled"

- in CApplication::ProcessJoystickEvent and CApplication::OnKey if the action has a holdtime (e.x. is hold pressed) and the action was not handled (returned false) don't play the actionsound
  • Loading branch information...
commit 0f0221a6e45165223e3f9cd9a02cd25d11f8f720 1 parent dd6822c
@Memphiz authored
Showing with 34 additions and 6 deletions.
  1. +33 −5 xbmc/Application.cpp
  2. +1 −1  xbmc/guilib/GUIBaseContainer.cpp
View
38 xbmc/Application.cpp
@@ -2478,10 +2478,23 @@ bool CApplication::OnKey(const CKey& key)
if (!key.IsAnalogButton())
CLog::Log(LOGDEBUG, "%s: %s pressed, action is %s", __FUNCTION__, g_Keyboard.GetKeyName((int) key.GetButtonCode()).c_str(), action.GetName().c_str());
- // Play a sound based on the action
- g_audioManager.PlayActionSound(action);
+ bool bResult = false;
- return OnAction(action);
+ // play sound before the action unless the button is held,
+ // where we execute after the action as held actions aren't fired every time.
+ if(action.GetHoldTime())
+ {
+ bResult = OnAction(action);
+ if(bResult)
+ g_audioManager.PlayActionSound(action);
+ }
+ else
+ {
+ g_audioManager.PlayActionSound(action);
+ bResult = OnAction(action);
+ }
+
+ return bResult;
}
// OnAppCommand is called in response to a XBMC_APPCOMMAND event.
@@ -3308,8 +3321,23 @@ bool CApplication::ProcessJoystickEvent(const std::string& joystickName, int wKe
if (CButtonTranslator::GetInstance().TranslateJoystickString(iWin, joystickName.c_str(), wKeyID, isAxis ? JACTIVE_AXIS : JACTIVE_BUTTON, actionID, actionName, fullRange))
{
CAction action(actionID, fAmount, 0.0f, actionName, holdTime);
- g_audioManager.PlayActionSound(action);
- return OnAction(action);
+ bool bResult = false;
+
+ // play sound before the action unless the button is held,
+ // where we execute after the action as held actions aren't fired every time.
+ if(action.GetHoldTime())
+ {
+ bResult = OnAction(action);
+ if(bResult)
+ g_audioManager.PlayActionSound(action);
+ }
+ else
+ {
+ g_audioManager.PlayActionSound(action);
+ bResult = OnAction(action);
+ }
+
+ return bResult;
}
else
{
View
2  xbmc/guilib/GUIBaseContainer.cpp
@@ -308,7 +308,7 @@ bool CGUIBaseContainer::OnAction(const CAction &action)
m_lastHoldTime = CTimeUtils::GetFrameTime();
if(m_scrollItemsPerFrame < 1.0f)//not enough hold time accumulated for one step
- return true;
+ return false;
if (action.GetID() == ACTION_MOVE_LEFT || action.GetID() == ACTION_MOVE_UP)
while (m_scrollItemsPerFrame-- >= 1) MoveUp(false);
Please sign in to comment.
Something went wrong with that request. Please try again.