United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6506966 : COMPATIBILITY: Can't use the keypad to simulate game actions

Details
Type:
Bug
Submit Date:
2006-12-21
Status:
Closed
Updated Date:
2011-03-07
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
client-libs
OS:
generic,windows_xp
Sub-Component:
java.awt
CPU:
x86,generic
Priority:
P1
Resolution:
Fixed
Affected Versions:
6u1,7
Fixed Versions:

Related Reports
Backport:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Relates:
Relates:

Sub Tasks

Description
Tested OS/Browser:      
                        win 2000 pro(sp4)/ IE6
                        XP-Pro(sp2)/IE6 
                        
                                   
Tested build: jre-6u1-b01

Problem:
-------
Can't use keypad to play the game (simulate game actions).  It is a regression, compatibility issue with jre-6-fcs and MS VM. The problem starts to occur in 6u1-b01.


Steps to reproduce:
------------------
1) Install jre-6u1-b01 into the test system 
2) Using IE browser to load the game applet
   http://www.permadi.com/java/battletank/index.html   
3) Applet should be loaded. Follow instructions to start the game. 

In 6u1-b01, you can't use any of:
 
Left arrow to rotate left
Right arrow to rotate right
Up arrow to forward
Space to shoot
.....
.....

In short, you can't use keypad to play the game as instructed.  The game works fine using jre-6-fcs and MSVM.
This regression issue affects many client game applets from different sites (when applet games use keypad to simulate, operate game actions). Hence its priority is raised to P1 as must fix in 6u1.

We have noticed the same issue on following applets:

- http://www.permadi.com/java (Alien Troopers) --> the game controls are not working
- http://www.pogo.com (pogo.com - 3-Point Showdown) --> When used 'S' key to grab the ball or 'spacebar' to interact with applet, functionality is not
-  http://www.pogo.com (pogo.com - Heavy Cannon) --> Controls like 'spacebar???,??? Arrow keys??? are not working.  Unable to interact with the applet
- http://www.javaonthebrain.com. (Jayzees Maze) --> Controls of  ???Arrow keys???  are not working for the applet
- http://www.jagex.com (jagex.com - Monkey Puzzle) --> No Controls (Arrow keys/Space Bar) are working in the applet
- http://www.jgames.com (JGames.com - Navy Battle) -->  Key commands like N, 2 , 3, 4, 5 , Tab etc keys are not working.
- http://www.realapplets.com/app_arcade.asp (Real Invaders)--> Can't use "Enter" key to start the game

- http://www.java.com/en/games (vredungmand.dk - Mr, Hopwit and the Mysterious)
--> Arrow key controls are not working

- http://www.java.com/en/games (Radicalplay- Radical Aces) --> Can't user "Enter" key to continue with the game. 

-  http://www.jagex.com (Vertigo, Monkey Puzzle)--> No Controls (Arrow keys/Space Bar) are working in the applet.

                                    

Comments
EVALUATION

Most probably this is the same issue as 6506743 and 6503816.
                                     
2006-12-26
EVALUATION

this is a regression for fix for 6458497 (Reopen #4841881: Alt tab with Windows L&F moves
focus to the application menubar).  In that fix we do not allow to set native focus if
current foreground window is not Java one.  In our case foreground window is browser's 
window and we do not request focus.  But the check is too restrictive, it should check if 
current foreground window created in another process.

So, the fix is rather simple, but for 6u1 it would be safer to simple back out the original fix :(
                                     
2006-12-27
EVALUATION

6506743 - Unable to enter the login information
6503816 - COMPATIBILITY: Chatting option doesn't work on many pogo, yahoo applets

were closed as duplicates of this bug (need to test applets, mentioned in these CRs, with
fix for this CR)
                                     
2006-12-27
SUGGESTED FIX

+++ awt_Component.cpp        2006-12-27 22:03:10.000000000 +0300
@@ -2195,11 +2195,14 @@
     if (sm_focusOwner == hwnd) {
         return TRUE;
     }
 
     HWND fgWindow = ::GetForegroundWindow();
-    if (AwtComponent::GetComponent(fgWindow) == NULL) {
+    DWORD fgProcessID;
+    ::GetWindowThreadProcessId(fgWindow, &fgProcessID);
+
+    if (fgProcessID != ::GetCurrentProcessId()) {
         // fix for 6458497.  we shouldn't request focus if it is out of our application.
         return FALSE;
     }
 
     AwtFrame *owner = GetContainer()->GetOwningFrameOrDialog();
                                     
2007-01-08



Hardware and Software, Engineered to Work Together