Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2523 from ulion/mousestat_button_xy_fix

[Fix] MouseStat use button.x/button.y for mouse button event.
  • Loading branch information...
commit 4a700df32597fe02ba7418b5b04314c6576a80b1 2 parents da51c6d + 6149a28
@jmarshallnz jmarshallnz authored
Showing with 15 additions and 3 deletions.
  1. +15 −3 xbmc/input/MouseStat.cpp
View
18 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));
Please sign in to comment.
Something went wrong with that request. Please try again.