Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FIX: Send Touch actions to the proper window

  • Loading branch information...
commit b891c240908ddd0b93547afdbe6d261b635b930a 1 parent c4d4916
@koying koying authored
View
7 xbmc/Application.cpp
@@ -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 Owner

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

See #3978

@koying Collaborator
koying added a note

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

@jmarshallnz Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
break;
}
}
View
5 xbmc/input/ButtonTranslator.cpp
@@ -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 Owner

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 Collaborator
koying added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
action = GetTouchActionCode(-1, touchAction);
+ }
return action > 0;
}
View
2  xbmc/input/ButtonTranslator.h
@@ -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
Collaborator

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

Please sign in to comment.
Something went wrong with that request. Please try again.