SDL_GetMouseState problems

Hey,

I’m having a problem wherein SDL_GetMouseState gets ‘stuck’ reporting that
the mouse is down even though it’s not. This goes on until the mouse is
clicked again, at which time everything is properly ‘synched’ and the
correct mouse state is once again returned. I am not forgetting to call
SDL_PumpEvents(). I haven’t been able to pin down what exact cicumstances
cause this to happen, but it seems to happen in some places in my program
quasi-regularly, and other places it never happens. I figured somebody
reading this has probably had this problem before and could shine some
light. I am running on Win XP. Thanks in advance!

Dave

Unfortunately I don’t really think there’s anything you can do about
this - it has happened to me in my normal day to day running of XP.
Sometimes my left button get’s “stuck”, sometimes it’s the right
button, sometimes it’s the Alt key. As you say in your post, he only
way to right it is to click the button again.

It’s a weakness of XP or Windows in general, not SDL.

— David Beck wrote: >>

Hey,

I’m having a problem wherein SDL_GetMouseState gets ‘stuck’ reporting
that
the mouse is down even though it’s not. This goes on until the mouse
is
clicked again, at which time everything is properly ‘synched’ and the
correct mouse state is once again returned. I am not forgetting to
call
SDL_PumpEvents(). I haven’t been able to pin down what exact
cicumstances
cause this to happen, but it seems to happen in some places in my
program
quasi-regularly, and other places it never happens. I figured
somebody
reading this has probably had this problem before and could shine
some
light. I am running on Win XP. Thanks in advance!

Dave


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Want to chat instantly with your online friends? Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk

Hey,

I’m having a problem wherein SDL_GetMouseState gets ‘stuck’ reporting that
the mouse is down even though it’s not. This goes on until the mouse is
clicked again, at which time everything is properly ‘synched’ and the
correct mouse state is once again returned. I am not forgetting to call
SDL_PumpEvents().

Are you forgetting to pull all the events out of the queue? If you don’t
do this, the queue will fill up and new events will be dropped…

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Thanks Sam!

I didn’t think about that. I went back and tried to make sure that I was
pulling all the events, but either that wasn’t the problem or I didn’t
succeed in getting all of them. I am writing a game, and during level
switches and similar transitions I don’t poll for events. It was usually
after these transitions that the mouse got stuck in the ‘up’ state. Anyway,
I finally resolved the issue by keeping track of the mouse state myself, and
updating it every time I had a mousedown/up event. I still had problems with
’missing’ some mouseup events during level transitions, but I solved this by
calling a flushEvents() routine after each such transition that would take
all the events off the queue, and set the mouse state to up. Maybe a similar
routine could be helpful in the SDL API?

Anyway, thanks for your help.

Dave

on 9/30/03 12:01 PM, sdl-request at libsdl.org at sdl-request at libsdl.org wrote:>> Hey,

I’m having a problem wherein SDL_GetMouseState gets ‘stuck’ reporting that
the mouse is down even though it’s not. This goes on until the mouse is
clicked again, at which time everything is properly ‘synched’ and the
correct mouse state is once again returned. I am not forgetting to call
SDL_PumpEvents().

Are you forgetting to pull all the events out of the queue? If you don’t
do this, the queue will fill up and new events will be dropped…

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

I have to throw a ‘me to’ in here, unfortunately. I’ve had the same
problem and I’ve had zero luck reproducing it. I can say for sure that
the whole queue is being drained.

Whatever is causing it, it’s rare, and I think happens more often if the
mouse is clicked inside, held and released outside the window. Now that
I think about it, I can’t recall it happening since upgrading to 1.2.6
from 1.2.5

System:
Red Hat 8 (2.4.20-20.8)
XFree86 4.2.1-21
Enlightenment 0.16.6-0.4
SDL 1.2.6On Tue, 2003-09-30 at 14:24, Sam Lantinga wrote:

Hey,

I’m having a problem wherein SDL_GetMouseState gets ‘stuck’ reporting that
the mouse is down even though it’s not. This goes on until the mouse is
clicked again, at which time everything is properly ‘synched’ and the
correct mouse state is once again returned. I am not forgetting to call
SDL_PumpEvents().

Are you forgetting to pull all the events out of the queue? If you don’t
do this, the queue will fill up and new events will be dropped…

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Jimmy <@Jimmy>
Jimmy’s World.org
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20031014/94605c67/attachment.pgp