Jump to content
  • Advertisement
Sign in to follow this  

SDL and resetting the mouse

This topic is 4007 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I'm having a bit of a quirky problem. This happens on OSX, but might happen on windows as well. I've found an SDL situation that causes the mouse to forget or mess up its state via a series of right/left clicks. While the OS maintains the correct state, SDL starts reporting mousedowns as mouseups and vice versa. What I wanted to know is, is there any way to reset the state of the mouse? I'd like to go ahead and just reset the mouse's state whenever the app reactivates and not even worry about this. Thanks, John

Share this post

Link to post
Share on other sites
You can duplicate it like so:

Make a simple SDL app. Just have it display mouseup/mousedown and your mouse motion. I can only vouch for OSX, not Windows.

1) Left click and hold on the app screen
2) Drag the cursor off screen over the desktop
3) Right click on the desktop (left click should still be held down)
4) Right click on game screen and hold (left click is STILL down)
5) Release left click and left click the game screen (Right click is STILL down)
6) Release right click.

Now, if you watch your messages, you'll see that you only get mousemotion events when you're dragging-- i.e. the left button has to be down. Otherwise, no mouse motion events. Very screwy.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!