diff options
author | ulion <ulion2002@gmail.com> | 2013-04-01 12:48:25 +0800 |
---|---|---|
committer | ulion <ulion2002@gmail.com> | 2013-04-02 23:41:45 +0800 |
commit | 6149a284f6bad5ccb8e5c8672f85c589e3b2ff2d (patch) | |
tree | b05d80506e7078526837ed01f5c0d4579e20b5eb | |
parent | 4b1d055bf104008a7531bdc0668f65adb02a625f (diff) |
[Fix] MouseStat use button.x/button.y for mouse button event.
-rw-r--r-- | xbmc/input/MouseStat.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/xbmc/input/MouseStat.cpp b/xbmc/input/MouseStat.cpp index 30e3740690..cc72b3465a 100644 --- a/xbmc/input/MouseStat.cpp +++ b/xbmc/input/MouseStat.cpp @@ -46,9 +46,21 @@ void CMouseStat::Initialize() void CMouseStat::HandleEvent(XBMC_Event& newEvent) { // Save the mouse position and the size of the last move - int dx = newEvent.motion.x - m_mouseState.x; - int dy = newEvent.motion.y - m_mouseState.y; - + int dx, dy; + if (newEvent.type == XBMC_MOUSEMOTION) + { + dx = newEvent.motion.x - m_mouseState.x; + dy = newEvent.motion.y - m_mouseState.y; + } + else if (newEvent.type == XBMC_MOUSEBUTTONDOWN || newEvent.type == XBMC_MOUSEBUTTONUP) + { + dx = newEvent.button.x - m_mouseState.x; + dy = newEvent.button.y - m_mouseState.y; + } + else + { + return; + } m_mouseState.dx = dx; m_mouseState.dy = dy; m_mouseState.x = std::max(0, std::min(m_maxX, m_mouseState.x + dx)); |