Skip to content
This repository
Browse code

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 authored April 02, 2013

Showing 1 changed file with 15 additions and 3 deletions. Show diff stats Hide diff stats

  1. 18  xbmc/input/MouseStat.cpp
18  xbmc/input/MouseStat.cpp
@@ -46,9 +46,21 @@ void CMouseStat::Initialize()
46 46
 void CMouseStat::HandleEvent(XBMC_Event& newEvent)
47 47
 {
48 48
   // Save the mouse position and the size of the last move
49  
-  int dx = newEvent.motion.x - m_mouseState.x;
50  
-  int dy = newEvent.motion.y - m_mouseState.y;
51  
-  
  49
+  int dx, dy;
  50
+  if (newEvent.type == XBMC_MOUSEMOTION)
  51
+  {
  52
+    dx = newEvent.motion.x - m_mouseState.x;
  53
+    dy = newEvent.motion.y - m_mouseState.y;
  54
+  }
  55
+  else if (newEvent.type == XBMC_MOUSEBUTTONDOWN || newEvent.type == XBMC_MOUSEBUTTONUP)
  56
+  {
  57
+    dx = newEvent.button.x - m_mouseState.x;
  58
+    dy = newEvent.button.y - m_mouseState.y;
  59
+  }
  60
+  else
  61
+  {
  62
+    return;
  63
+  }
52 64
   m_mouseState.dx = dx;
53 65
   m_mouseState.dy = dy;
54 66
   m_mouseState.x  = std::max(0, std::min(m_maxX, m_mouseState.x + dx));

0 notes on commit 4a700df

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