[FIXED] LWJGL in a canvas - Captures keyboard input even when unfocused on JRE7

Started by terryhau, October 06, 2011, 14:59:18

Previous topic - Next topic

spasi

You need to keep in mind though that making the Canvas unfocusable doesn't do anything for the LWJGL Display on top of it. LWJGL doesn't support unfocusable Displays.

Sorry about the build, I pushed the latest change late last night.

JeroenWarmerdam

It does affect the ability to open the menu though. When it's set to unfocusable the menu works, but the mousewheel does not register in LWJGL. If it's set to focusable the mousewheel works, but the menu does not work.

I've added your code suggestions (rather roughly) and made sure to use the dll's and jars from the daily build. This doesn't seem to solve the issue though. The results can be seen here (newly deployed at time of this post): http://www.tygron.com/bug/index.html

Try opening the File menu as soon as the applet loads.


spasi


JeroenWarmerdam

Chrome 26.0.1410.64
Java Plug-in 10.21.2.11
Using JRE version 1.7.0_21-b11 Java HotSpot(TM) Client VM

Firefox 20.0.1
Java Plug-in 10.21.2.11
Using JRE version 1.7.0_21-b11 Java HotSpot(TM) Client VM


spasi

I've been able to reproduce the problem. Basically AWT behaves very differently in applets than it does in normal applications. I've been trying all evening yesterday to make the LWJGL display behave "naturally" with focus (like any other AWT component), but it seems impossible. I did find a solution for standalone execution, but then it would be problematic in applets. I have currently pushed some code that fixes most of the issues in both applets and standalone apps, but acts weirdly in some corner-cases; e.g. if the LWJGL display has focus and you open a menu and close it immediately, normally you'd expect that the last focused component would be refocused. This doesn't happen.

Please try the next build and let me know how it goes.

JeroenWarmerdam

This seems to fix the issue in the test case. I'm going to test in our main application now.

JeroenWarmerdam

The latest update fixed the issues. Thanks. If anything pops up in production I'll let you know.