Problem with flicking mouse pointer, despite being grabbed

Started by scarzzurs, December 07, 2011, 15:02:07

Previous topic - Next topic

scarzzurs

As I have now released my game Hydro Hydra - 2nd Dive on chrome web store, I'm exploring the possibility of deploying it as a applet.
I thought I would initially start out setting the parent of my lwjgl window to a canvas which is then added to the java.Applet instance.
This works very well, except for the fact that the mouse pointer keeps flickering on top of the window, even though I have grabbed it using lwjgl.

I am deploying it using a jnlp file, which is almost identical to the one used in the standalone version.

I have tried to toggle the properties on and off with no luck:
<property name="sun.java2d.noddraw" value="true"/>
<property name="java.awt.headless" value="true"/>

I have loosely followed this guide, in order to avoid most stupid mistakes I could otherwise have introduced: http://ninjacave.com/lwjglapplet

Is this a known bug? Is there a solution? What do I do? :-)

- Scarzzurs

kappa

not seen the issue before (which OS and JVM version are you running?), also setting java.awt.headless to true isn't really recommended in this case.

You should includes the following awt parameters to make sure its not using any hardware rendering and to improve compatibility on some drivers.
<param name="java_arguments" value="-Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Dsun.java2d.opengl=false -Dsun.java2d.pmoffscreen=false">

You could try setting the native cursor to a blank cursor so even if it does show it'll still be invisible. Personally I prefer the AppletLoader method over Java's JNLP applets but either way you should have a read of the 4 part AppletLoader guide, it includes many tips that also apply to JNLP Applets.

scarzzurs

Thanks for the fast response. Let me see...

I'm testing this on a Windows 7 64 bit machine with
"Java Plug-in 1.6.0_29" (extracted from Java console running)

I tried specifying the arguments you wrote in html, the jnlp as properties, and in the jnlp as jvm parameters. None appeared to do any difference.

I did however notice that the flickering happens only when the mouse is moved.
It seems to changes between visible and invisible in a way that makes it possible to halt at either state, while the game is rendering in real-time.

I'm not too fond of doing the hack you propose, but if it's the only solution, I will probably have to give it a go.

I'm a bit hesitant to use external libraries for features that ought to be standard for various reasons, but again, I might have to try out the lwjgl applet loader, if it is more reliable...
I will read through the guide, hopefully it will shed some light as to what other advantages the appletloader has :-)

- Scarzzurs

princec

Quote from: kappa on December 07, 2011, 15:24:36
not seen the issue before (which OS and JVM version are you running?), also setting java.awt.headless to true isn't really recommended in this case.
Yes you have I think - I think I reported the mouse flickering quite a while back as one of the reasons I'm switching back to using the native display. You can see it in our current games in windowed mode. Seems that every time you click the mouse the mouse cursor flickers on visibly for a tiny fleeting moment.

Cas :)

kappa

Quote from: princec on December 07, 2011, 19:28:33
Quote from: kappa on December 07, 2011, 15:24:36
not seen the issue before (which OS and JVM version are you running?), also setting java.awt.headless to true isn't really recommended in this case.
Yes you have I think - I think I reported the mouse flickering quite a while back as one of the reasons I'm switching back to using the native display. You can see it in our current games in windowed mode. Seems that every time you click the mouse the mouse cursor flickers on visibly for a tiny fleeting moment.

Cas :)

Ah, right you are, should have connected the two. What is slightly odd/different here is that your report also included it as happing when running the native display without Display.setParent(). In this case it only happens when using Display.setParent(). It could be something like the AWT Canvas changing/releasing the mouse cursor which causes it to briefly appear, before LWJGL grabs it again in its Display.update() method.

Jonas

I saw this thread via the IRC bot today, and I'd like to chime in that I too suffer from the mouse flickering in and out of view despite being grabbed..and working just as I would expect while grabbed aside from the flickering.

I'm using a Canvas in a non-fullscreen configuration, running locally, not an applet.  LWJGL v. 2.8.2, Java v. 1.6.0.25 64bit, Windows 7 64bit.