LWJGL Forum

Programming => Bug Reports / RFE => Topic started by: princec on October 19, 2011, 13:29:15

Title: [BUG] Mouse.setGrabbed(true) fails to actually grab the mouse 50% of the time
Post by: princec on October 19, 2011, 13:29:15
As per the title. OS: Vista64, LWJGL 2.8.1 (and all previous versions for I don't know how long) for what it's worth. Happens whether using native LWJGL display or AWT Frame/Canvas/setParent jobbie.
Calling setGrabbed(true) again works - it'd be nice to just call it every frame because it eventually just works - but unfortunately this resets the mouse coordinates every time so no mouse movement is possible.

I'm not sure what the best fix would be - probably making sure that implementation.grabMouse actually guarantees to work 100% of the time - but failing that, allowing setGrabbed(true) to be called repeatedly without screwing the mouse would work too.

Cas :)
Title: Re: [BUG] Mouse.setGrabbed(true) fails to actually grab the mouse 50% of the time
Post by: Matzon on October 20, 2011, 08:04:15
org.lwjgl.test.input.MouseTest (space to grab/ungrab) works 100% of the time for me? - windows 7, 32bit
Title: Re: [BUG] Mouse.setGrabbed(true) fails to actually grab the mouse 50% of the time
Post by: princec on October 20, 2011, 09:50:35
It's never worked for me, on any incarnation of windows, for time immemorial. FWIW I've worked around the bug for now by simply calling setGrabbed(true) once a frame for 4 frames just to be sure - so far it hasn't let me down.

I suspect due to the difficult-to-reproduce nature of this bug it is a race condition of some sort.

Cas :)
Title: Re: [BUG] Mouse.setGrabbed(true) fails to actually grab the mouse 50% of the time
Post by: princec on October 20, 2011, 12:12:35
The workaround is still not 100% reliable. I do notice however that certain applications (eclipse cough cough) appear to cause this problem far more often than anything else. I now actually suspect that it's something to do with window focus.

Cas :)