Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4103229
Votes 2
Synopsis some keys on the numpad do not work correctly when NumLock is off (Solaris)
Category java:classes_awt
Reported Against 1.1.4 , 1.1.6 , 1.2.2
Release Fixed 1.4(merlin-beta)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs 4083691 , 4224725 , 4295577 , 4308606
Submit Date 10-JAN-1998
Description




Some keys on the numpad do not behave correctly.
For example, the '*' and '+' keys do not work
properly whether NUM-LOCK is on or off.  Also,
the '/', '-' and '.' keys do not behave correctly
when the SHIFT key has been pressed.

The problems can be observed by running the
applet

http://java.sun.com/docs/books/tutorial/ui/components/keylistener.html
  xxxxx@xxxxx   (Jan 10, 1998):
Here are my findings: *, /, -, and . will only print when NUMLOCK=on;
when in addition to NUMLOCK=on the SHIFT-key is pressed, these character
will no longer print.  The +-key will print + only when SHIFT is pressed,
and will print = otherwise; this behavior is not affected by the state
of NUMLOCK.  Related bugs: 4083691 and 4087994.
(Review ID: 23064)
======================================================================
Work Around
N/A
Evaluation

Here are my observations based on an early build of 1.1.8 (after A 
but before B) and the JDK1.2fcs-K build:  

The . key is not supposed to show up when the NumLock is not on.  
When the NumLock is off, it is the DEL key.  When it is on, it is 
the . key.  

The problem with the + and * keys working incorrectly was fixed by 
the putback for 4083691.  

The /, *, and - keys do not print unless the NumLock key is on.  
They also do not print when both the NumLock and Shift keys are 
on, or when the NumLock and CapsLock keys are on.  
On windows in 1.2, they print whether the NumLock key is on or off, 
and the Shift and CapsLock keys make no difference.  

Note: the numpad / and - are mapping to their keyChar values in the 
modify_event function in canvas.c, whereas the + and * keys are 
mapping to their keysyms after the putback for 4083691.  

============================================================================

Most of the problems in this bug report have been addressed, probably by the 
putback for 4083691.  The only remaining problem is that under other Motif 
applications (e.g. BugTraq), the behavior of the /*- keys differs from the 
bahavior seen in Java apps as follows:  

When the NumLock is on, and the Shift key is depressed, Motif apps will 
respond to /*- by entering those characters in a TextComponent.  In Java, 
the characters will not be entered.  Note that the + key will be entered 
in both cases.  

Note:  In Motif applications and in Java applications, the /*- keys will 
not be entered unless the NumLock is depressed.  This differs from Windows.  

  xxxxx@xxxxx   1999-03-29


Another note: in most applications on Solaris, the numpad /*- keys act 
differently depending on whether the NumLock is on or off.  This is because 
they generate different keysyms depending on the state of the NumLock.  
The same is not true for the numpad + key.  

              NumLock On    NumLock Off
key  keycode  keysym        keysym
---------------------------------------
 /     53     65455=0xffaf  65494=0xffd6
 *     54     65450=0xffaa  65495=0xffd7
 -     78     65453=0xffad  65493=0xffd5
 +    132     65451=0xffab  65451=0xffab

From /usr/include/X11/keysymdef.h

#define XK_KP_Multiply          0xFFAA
#define XK_KP_Add               0xFFAB
#define XK_KP_Separator         0xFFAC  /* separator, often comma */
#define XK_KP_Subtract          0xFFAD
#define XK_KP_Decimal           0xFFAE
#define XK_KP_Divide            0xFFAF

#define XK_F24                  0xFFD5
#define XK_R4                   0xFFD5
#define XK_F25                  0xFFD6
#define XK_R5                   0xFFD6
#define XK_F26                  0xFFD7
#define XK_R6                   0xFFD7

You can see that the /*- keys act differently by typing them into various 
motif applications, such as Netscape or Bugtraq.  

Interestingly, typing the keys at a dtterm prompt produces the same status 
whether or not the NumLock is down.  Of course, I don't think a dtterm is 
a Motif application.  

We may be able to map both sets of keysyms to the /*- keycodes.  I assume 
that this would be desirable, although I have to wonder if there are cases 
where it would not be.  

  xxxxx@xxxxx   2000-07-26

I figured out how to translate the X events so that the Java events are 
generated correctly.  The problem seems to be that the native Motif widgets 
just ignore the /*- numpad keys when NumLock is off.  So, the events are 
generated, but no characters are entered into the Motif widget.  

Of course, lightweight components (e.g. Swing) have the characters entered 
correctly, so maybe this is worth doing.  

  xxxxx@xxxxx   2000-08-20

Decided to change the X event by setting the awt_NumLockMask as the ONLY 
modifier in xevent->xkey.state before dispatching it to the Motif widget.  
This fools it into accepting the /*- key events when NumLock is off, and 
also when other modifiers are on.  
 
  xxxxx@xxxxx   2000-08-24
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang