Permalink
Browse files

FIX: Send Touch actions to the proper window

  • Loading branch information...
1 parent c4d4916 commit b891c240908ddd0b93547afdbe6d261b635b930a @koying koying committed with koying Mar 22, 2013
Showing with 10 additions and 4 deletions.
  1. +5 −2 xbmc/Application.cpp
  2. +4 −1 xbmc/input/ButtonTranslator.cpp
  3. +1 −1 xbmc/input/ButtonTranslator.h
@@ -528,12 +528,15 @@ bool CApplication::OnEvent(XBMC_Event& newEvent)
int windowId = g_windowManager.GetActiveWindow() & WINDOW_ID_MASK;
int actionId = 0;
if (newEvent.touch.action == ACTION_GESTURE_BEGIN || newEvent.touch.action == ACTION_GESTURE_END)
+ {
actionId = newEvent.touch.action;
- else if (!CButtonTranslator::GetInstance().TranslateTouchAction(windowId, newEvent.touch.action, newEvent.touch.pointers, actionId) ||
+ windowId = WINDOW_INVALID;
+ }
+ else if (!CButtonTranslator::GetInstance().TranslateTouchAction(newEvent.touch.action, newEvent.touch.pointers, windowId, actionId) ||
actionId <= 0)
return false;
- CApplicationMessenger::Get().SendAction(CAction(actionId, 0, newEvent.touch.x, newEvent.touch.y, newEvent.touch.x2, newEvent.touch.y2), WINDOW_INVALID, false);
+ CApplicationMessenger::Get().SendAction(CAction(actionId, 0, newEvent.touch.x, newEvent.touch.y, newEvent.touch.x2, newEvent.touch.y2), windowId, false);
@jmarshallnz
jmarshallnz Jan 6, 2014 Member

What's the reasoning here? AFAICT the usual CApplication::OnAction() route will send the action to the appropriate windowId anyway, right?

See #3978

@koying
koying Jan 6, 2014 Member

I guess my state-of-mind was that there is no point using WINDOW_INVALID when we already know the windowid ?

@jmarshallnz
jmarshallnz Jan 6, 2014 Member

Right, but calling CApplication::OnAction() will get to the correct window through calling CGUIWindowManager::OnAction() which will (eventually) wind through to the appropriate window. Assuming some dialog or other block doesn't get in the way...

Though if it did work, I don't think the changes in this PR would have been needed at all, so something must be getting in the way.

It would be useful to know where things are going wrong, so we can push the actions through the correct chain that other actions go through.

break;
}
}
@@ -870,7 +870,7 @@ bool CButtonTranslator::TranslateJoystickString(int window, const char* szDevice
return (action > 0);
}
-bool CButtonTranslator::TranslateTouchAction(int window, int touchAction, int touchPointers, int &action)
+bool CButtonTranslator::TranslateTouchAction(int touchAction, int touchPointers, int &window, int &action)
{
action = 0;
if (touchPointers <= 0)
@@ -881,7 +881,10 @@ bool CButtonTranslator::TranslateTouchAction(int window, int touchAction, int to
action = GetTouchActionCode(window, touchAction);
if (action <= 0)
+ {
+ window = WINDOW_INVALID;
@jmarshallnz
jmarshallnz Jan 6, 2014 Member

Do some windows "handle" an action they're not supposed to? Why do you need certain actions to go via CApplication::OnAction() while others go directly to the current window, given that CApplication::OnAction() will call into the current window?

@koying
koying Jan 6, 2014 Member

And here I reset the windowid because an action for this specific windowid could not be found ?

action = GetTouchActionCode(-1, touchAction);
+ }
return action > 0;
}
@@ -97,7 +97,7 @@ class CButtonTranslator
bool &fullrange);
#endif
- bool TranslateTouchAction(int window, int touchAction, int touchPointers, int &action);
+ bool TranslateTouchAction(int touchAction, int touchPointers, int &window, int &action);
private:
typedef std::multimap<uint32_t, CButtonAction> buttonMap; // our button map to fill in

1 comment on commit b891c24

@koying
Member
koying commented on b891c24 Jan 6, 2014

Arf... Old stuff.
See #2485 for backstory.

Please sign in to comment.