JDK-5097241 : None of the comps in FileDlg receive keyevents on Solaris9 (CDE) with XToolkit
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2004-09-04
  • Updated: 2010-06-02
  • Resolved: 2004-10-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0u4Fixed 6 b10Fixed
Description
I am popping up a frame with a button. When the user clicks the button, a native file dialog is shown to the user. When running this app on Solaris9/10 (CDE) with XToolkit, bringing up this file dialog through keyboard (pressing space bar on the button) prevents any of the components in the file dialog from receiving key events. 

This is reproducible only on Solaris and not on win32/ linux. This is reproducible only on XToolkit and not on Motif. Reproducible with tiger-beta builds. This is reproducible only when the file dialog is brought up by pressing the button through keyboard. When clicking with mouse, it works fine. 

I have attached a sample test. Execute the sample test on Solaris9 (CDE) with XToolkit. You would see a frame with a button. Press tab and keep the focus on 'Show Dialog' button. Press the space bar. A file dialog will be shown. Try to enter text in any of the fields and try to navigate through the components by pressing tab. If nothing works, then the bug is reproduced.

This is reproducible when logging into a remote linux machine through rlogin from a local solaris sparc machine and using the sparc machine's display for executing the above test.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon mustang FIXED IN: mustang
02-10-2004

EVALUATION Name: at153223 Date: 09/07/2004 I reproduced the bug only directly on solaris-machine (and was unable to do it remotely through my X Server). With 1.5.0-rc-b63, on XToolkit. ###@###.### 09/07/2004 ====================================================================== Name: at153223 Date: 09/09/2004 What I've found is quite unexpected. The problem is that XToolkit 'timeFetcher' which extracts 'timeStamp' from PropertyNotify events while dispatching them gets negative values. I suspect the time values are simply uninitialized. This results in that some KeyEvent marker is queued with a certainly wrong position. It then can't be deleted normally and thus prevents DefaultKeyboardFocusManager from correct KeyEvent dispatching. ###@###.### 09/09/2004 ====================================================================== Name: at153223 Date: 09/15/2004 The suspicion of uninitialized time field turned to be wrong. The point is that Xlib 'Time' type is unsigned (int or long). In case of 32 bit mode 'unsigned int' time value is converted to 'long' Java type in XAWT code, but the conversion performed is signed while valid conversion must be unsiged. All this results in that huge (where an upper bit is used) 'unsigned int' values become negative 'long'. ======================================================================
02-10-2004

SUGGESTED FIX Name: at153223 Date: 10/01/2004 The fix below is suggested by ###@###.### *** /export/dom/work/ws/tiger1/webrev/./src/solaris/classes/sun/awt/X11/Native.java- 2004-09-16 16:31:55.656182688 +0400 --- /export/dom/work/ws/tiger1/webrev/./src/solaris/classes/sun/awt/X11/Native.java 2004-09-16 16:31:55.485208680 +0400 *************** *** 356,361 **** --- 356,380 ---- } return res; } + + + /** + * Access to C "unsigned long" date type, which is XID in X + */ + static long getULong(long ptr) { + if (XlibWrapper.dataModel == 32) { + // Compensate sign-expansion + return unsafe.getInt(ptr) & 0xFFFFFFFFL; + } else { + // Can't do anything!!! + return unsafe.getLong(ptr); + } + } + + static void putULong(long ptr, long value) { + putLong(ptr, value); + } + /** * Allocates memory for array of native <code>long</code>s of the size <code>length</code> */ *** /export/dom/work/ws/tiger1/webrev/./src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java- 2004-09-16 16:31:56.246093008 +0400 --- /export/dom/work/ws/tiger1/webrev/./src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java 2004-09-16 16:31:56.133110184 +0400 *************** *** 85,90 **** --- 85,91 ---- static final int TYPE_ARRAY = 10; static final int TYPE_BYTE=11; static final int TYPE_ATOM = 12; + static final int TYPE_ULONG = 13; static int getTypeForString(String str) { int type=-1; if (str.equals("int")) *************** *** 113,118 **** --- 114,121 ---- type = AtomicType.TYPE_ATOM; else if (str.equals("array")) type = TYPE_ARRAY; + else if (str.equals("ulong")) + type = TYPE_ULONG; else throw new IllegalArgumentException("Uknown type string: " + str); return type; *************** *** 139,144 **** --- 142,148 ---- case TYPE_LONG: case TYPE_LONG_LONG: case TYPE_PTR: + case TYPE_ULONG: return "long"; case TYPE_DOUBLE: return "double"; *************** *** 181,196 **** case TYPE_PTR: if (referencedType == null || referencedType instanceof StructType) { res = base + "+" + offset; - // res = MessageFormat.format("(Native.get{0}(pData+{1}))", - // new Object[] {getNativeAccessForType(TYPE_PTR), offset}); } else if (referencedType instanceof AtomicType) { res = MessageFormat.format("Native.get{0}({1})", new Object[] {getNativeAccessForType(((AtomicType)referencedType).type), base + "+" + offset}); - // res = MessageFormat.format("Native.get{1}({0})", new Object[] {offset, getNativeAccessForType(((AtomicType)referencedType).type)}); - // res = MessageFormat.format("Native.get{2}(Native.get{0}(pData+{1}))", - // new Object[] {getNativeAccessForType(TYPE_PTR), offset, - // getNativeAccessForType(((AtomicType)referencedType).type)}); } break; case TYPE_ARRAY: --- 185,194 ---- *************** *** 217,223 **** return MessageFormat.format("new {0}({1})", new Object[] {referencedType.getName(),value}); } } else { ! return value; //"unsafe.get" + ((AtomicType)referencedType).getJavaAccess(wide) + "(" + value + ")"; } } else { return getJavaResultConversionForType(type, value); --- 215,221 ---- return MessageFormat.format("new {0}({1})", new Object[] {referencedType.getName(),value}); } } else { ! return value; } } else { return getJavaResultConversionForType(type, value); *************** *** 248,253 **** --- 246,253 ---- return (wide?"Long":"Int"); case TYPE_LONG_LONG: return "Long"; + case TYPE_ULONG: + return (wide?"ULong":"UInt"); case TYPE_DOUBLE: return "Double"; case TYPE_FLOAT: *************** *** 275,280 **** --- 275,282 ---- return "Long"; case TYPE_LONG_LONG: return "Long"; + case TYPE_ULONG: + return "ULong"; case TYPE_DOUBLE: return "Double"; case TYPE_FLOAT: *************** *** 298,303 **** --- 300,307 ---- else if (access.equals("Float")) return 4; else if (access.equals("Char")) return 2; else if (access.equals("Short")) return 2; + else if (access.equals("ULong")) return 8; + else if (access.equals("UInt")) return 4; else throw new IllegalArgumentException("Unknow access type: " + access); } *************** *** 419,424 **** --- 423,430 ---- return "Int"; case TYPE_ATOM: return "Long"; + case TYPE_ULONG: + return "ULong"; default: throw new IllegalArgumentException("Uknown type"); } } *************** *** 1179,1184 **** --- 1185,1191 ---- symbolTable.put("pointer", new AtomicType(AtomicType.TYPE_PTR, "", "pointer")); symbolTable.put("longlong", new AtomicType(AtomicType.TYPE_LONG_LONG, "", "longlong")); symbolTable.put("Atom", new AtomicType(AtomicType.TYPE_ATOM, "", "Atom")); + symbolTable.put("ulong", new AtomicType(AtomicType.TYPE_ULONG, "", "ulong")); } public WrapperGenerator(String outputDir, String xlibFilename) { initTypes(); *** /export/dom/work/ws/tiger1/webrev/./src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt- 2004-09-16 16:31:56.712022176 +0400 --- /export/dom/work/ws/tiger1/webrev/./src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt 2004-09-16 16:31:56.663029624 +0400 *************** *** 103,109 **** window long root long subwindow long ! time long x int y int x_root int --- 103,109 ---- window long root long subwindow long ! time ulong x int y int x_root int *************** *** 175,181 **** selection Atom target Atom property Atom ! time long XVisibilityEvent{IXAnyEvent} type int serial long --- 175,181 ---- selection Atom target Atom property Atom ! time ulong XVisibilityEvent{IXAnyEvent} type int serial long *************** *** 292,298 **** display long window long atom Atom ! time long state int XEvent --- 292,298 ---- display long window long atom Atom ! time ulong state int XEvent *************** *** 349,355 **** display long window long selection Atom ! time long XKeyboardControl key_click_percent int bell_percent int --- 349,355 ---- display long window long selection Atom ! time ulong XKeyboardControl key_click_percent int bell_percent int *************** *** 366,372 **** display long window long XTimeCoord ! time long x short y short XGravityEvent{IXAnyEvent} --- 366,372 ---- display long window long XTimeCoord ! time ulong x short y short XGravityEvent{IXAnyEvent} *************** *** 452,458 **** window long root long subwindow long ! time long x int y int x_root int --- 452,458 ---- window long root long subwindow long ! time ulong x int y int x_root int *************** *** 479,485 **** window long root long subwindow long ! time long x int y int x_root int --- 479,485 ---- window long root long subwindow long ! time ulong x int y int x_root int *************** *** 495,501 **** window long root long subwindow long ! time long x int y int x_root int --- 495,501 ---- window long root long subwindow long ! time ulong x int y int x_root int *************** *** 528,534 **** selection Atom target Atom property Atom ! time long XGCValues function int plane_mask long --- 528,534 ---- selection Atom target Atom property Atom ! time ulong XGCValues function int plane_mask long *** /export/dom/work/ws/tiger1/webrev/./src/solaris/classes/sun/awt/X11/XWrapperBase.java- 2004-09-16 16:31:56.017127816 +0400 --- /export/dom/work/ws/tiger1/webrev/./src/solaris/classes/sun/awt/X11/XWrapperBase.java 2004-09-16 16:31:55.895146360 +0400 *************** *** 6,12 **** abstract class XWrapperBase { static final Logger log = Logger.getLogger("sun.awt.X11.wrappers"); - long pData; public String toString() { String ret = ""; --- 6,11 ---- *************** *** 24,31 **** } public void zero() { log.finest("Cleaning memory"); ! if (pData != 0) { ! XlibWrapper.unsafe.setMemory(pData, (long)getDataSize(), (byte)0); } } public abstract int getDataSize(); --- 23,30 ---- } public void zero() { log.finest("Cleaning memory"); ! if (getPData() != 0) { ! XlibWrapper.unsafe.setMemory(getPData(), (long)getDataSize(), (byte)0); } } public abstract int getDataSize(); *************** *** 37,40 **** --- 36,40 ---- return w.toString(); } } + public abstract long getPData(); } ###@###.### ======================================================================
02-10-2004