aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmarshallnz <jcmarsha@gmail.com>2013-04-02 23:33:29 -0700
committerjmarshallnz <jcmarsha@gmail.com>2013-04-02 23:33:29 -0700
commit4a700df32597fe02ba7418b5b04314c6576a80b1 (patch)
tree6b2ba9014cc9b71bda763315232dc8965fd5218d
parentda51c6ddf021df137811035efabe6d658f24d25e (diff)
parent6149a284f6bad5ccb8e5c8672f85c589e3b2ff2d (diff)
Merge pull request #2523 from ulion/mousestat_button_xy_fix
[Fix] MouseStat use button.x/button.y for mouse button event.
-rw-r--r--xbmc/input/MouseStat.cpp18
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));