The first build from
https://www.newdawnsoftware.com/hudson/view/LWJGL/ that I tested was #222.
It seems to be a Windows-only issue. And on top of that,
it happens only when the mouse is not grabbed. Fullscreen or not, makes no difference (though in Linux I could not get to fullscreen, but that's another story).
Report of tests:
two windows xp machines:
v2.1.0
grabbed: mouse up reported ONCE
not grabbed: mouse up reported ONCE
v2.2.0 #222
grabbed: mouse up reported ONCE
not grabbed: mouse up reported TWICE
v2.2.0 #235
grabbed: mouse up reported ONCE
not grabbed: mouse up reported TWICE
one linux machine:
v2.1.0
grabbed: mouse up reported ONCE
not grabbed: mouse up reported ONCE
v2.2.0 #222
grabbed: mouse up reported ONCE
not grabbed: mouse up reported ONCE
v2.2.0 #235
grabbed: mouse up reported ONCE
not grabbed: mouse up reported ONCE
The code I used to test:
package gima.apps.tests;
import java.util.Random;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
public class MouseUpTwice {
public static void main( String[] args ) {
boolean isFullscreen=false, isGrabbed=false; int width=800, height=600, bppMin=24;
if ( args.length >= 1 ) if ( args[0].equals("true" ) ) isFullscreen = true;
if ( args.length >= 2 ) if ( args[1].equals( "true" ) ) isGrabbed = true;
if ( args.length >= 3 ) width = Integer.parseInt( args[2] );
if ( args.length >= 4 ) height = Integer.parseInt( args[3] );
if ( args.length >= 5 ) bppMin = Integer.parseInt( args[4] );
new MouseUpTwice( isFullscreen, isGrabbed, width, height, bppMin );
}
public MouseUpTwice( boolean isFullscreen, boolean isGrabbed, int width, int height, int bppMin ) {
System.out.println( String.format( "Fullscreen: %b, Grabbed: %b, Width: %d, Height: %d, BPPMin: %d", isFullscreen, isGrabbed, width, height, bppMin ) );
try {
DisplayMode foundDM = null;
for ( DisplayMode dm : Display.getAvailableDisplayModes() ) { if ( dm.getBitsPerPixel() >= bppMin ) if ( dm.getFrequency() >= 60 ) if ( dm.getWidth() == width ) if ( dm.getHeight() == height ) {
foundDM = dm;
break;
} }
if ( foundDM == null ) foundDM = new DisplayMode( width, height );
Display.setDisplayMode( foundDM );
Display.setFullscreen( isFullscreen );
Mouse.setGrabbed( isGrabbed );
Display.create();
}
catch ( LWJGLException e ) { e.printStackTrace(); }
while (! Display.isCloseRequested() ) {
while ( Mouse.next() ) {
if ( ( Mouse.getEventButton() != -1 ) && ( Mouse.getEventButtonState() == false ) ) {
/*
* Mouse up event
* Random, because it is easier to distinguish when few events come up very quickly
*/
String rand = String.valueOf( new Random().nextBoolean() ).replace( "true", "gecko" );
rand = String.valueOf( rand.replace( "false", "canine" ) );
System.out.println( "Mouse up .. " + rand );
}
}
Display.update();
try { Thread.sleep( 10 ); } catch ( InterruptedException e ) {}
}
}
}[CODE]
[/code]