title: SDL - Mouse input
body: <p>I've read through the documentation regarding mouse events, and I have worked through tutorials regarding mouse input handling too. Though, this problem still exists:</p>
  
  <p>I have a camera and an opengl context and I simply want the camera to rotate IF the mouse moves and the left mouse is clicked. So, naturally I wrote this code:</p>
  
  <pre><code>void processEvents()
  {
      float deltaX = 0;
      float deltaY = 0;
  
      while (SDL_PollEvent(&amp;pEvent) != 0)
      {
          if (pEvent.type == SDL_QUIT)
              pApp_isRunning = false;
  
          if (pEvent.type == SDL_MOUSEMOTION &amp;&amp; pEvent.button.button == SDL_BUTTON_LEFT)
          {
              deltaX += pEvent.motion.x;
              deltaY += pEvent.motion.y;
              pCamera.rotate(deltaX / REFRESH_RATE, deltaY / REFRESH_RATE);
  
              cout &lt;&lt; "Mouse = (" &lt;&lt; deltaX &lt;&lt; ", " &lt;&lt; deltaY &lt;&lt; ")" &lt;&lt; endl;
          }
  
          if (pEvent.type == SDL_MOUSEMOTION &amp;&amp; pEvent.button.button == SDL_BUTTON_RIGHT)
          {
              deltaX += pEvent.motion.x;
              deltaY += pEvent.motion.y;
              pCamera.rotate(deltaX / REFRESH_RATE, deltaY / REFRESH_RATE);
  
              cout &lt;&lt; "Mouse = (" &lt;&lt; deltaX &lt;&lt; ", " &lt;&lt; deltaY &lt;&lt; ")" &lt;&lt; endl;
          }
      }
  }
  </code></pre>
  
  <p>The left mouse seems to be responding to the event since it updates the motion coordinates. But, if I were to use the exact same code but just with SDL_BUTTON_RIGHT, nothing happens! It's as though SDL needs another way of understanding the right mouse button. I've worked with GLFW, SFML, GLUT, Qt, and for SDL to not have consistency in grepping right mouse button events is dazzling imo. What am I doing wrong here? Is there a correct way of handling mouse input in the way I've described? As in:</p>
  
  <p>If the left mouse button is clicked and the mouse has moved: rotate camera.
  If the right mouse button is clicked and the mouse has moved: rotate camera. I must be missing something here, or maybe it's a bug with SDL2.</p>