JDK-4929291 : AWT should use Unicode strings for properties when possible
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2003-09-27
  • Updated: 2005-09-07
  • Resolved: 2005-09-07
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.
JDK 6
6 b51Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Name: dmR10075			Date: 09/27/2003



Right now we set some text properties(for example - WM_NAME) to 
XTextProperty which is either STRING or COMPOUND_TEXT. However,
COMPOUND_TEXT might not be well supported by some platforms or WMs. _NET
protocol has the ability to provide Unicode equivalents for some
properties. We should set these properties to Unicode to take advantage
of Unicode support on the platform (and leave existing properties as is
for backward compatibility).

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

Comments
SUGGESTED FIX *** /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XAtom.java- 2005-08-18 18:44:40.121679000 +0400 --- /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XAtom.java 2005-08-18 18:44:40.064356000 +0400 *************** *** 284,289 **** --- 284,309 ---- } /** + * Sets UTF8_STRING type property. Explicitly converts str to UTF-8 byte sequence. + */ + public void setPropertyUTF8(long window, String str) { + XAtom XA_UTF8_STRING = XAtom.get("UTF8_STRING"); /* like STRING but encoding is UTF-8 */ + if (atom == 0) { + throw new IllegalStateException("Atom should be initialized"); + } + checkWindow(window); + byte[] bdata = null; + try { + bdata = str.getBytes("UTF-8"); + } catch (java.io.UnsupportedEncodingException uee) { + uee.printStackTrace(); + } + if (bdata != null) { + setAtomData(window, XA_UTF8_STRING.atom, bdata); + } + } + + /** * Sets STRING/8 type property. Explicitly converts str to Latin-1 byte sequence. */ public void setProperty8(long window, String str) { *** /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XBaseWindow.java- 2005-08-18 18:44:40.709341000 +0400 --- /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XBaseWindow.java 2005-08-18 18:44:40.644324000 +0400 *************** *** 116,122 **** */ void postInit(XCreateWindowParams params) { if (log.isLoggable(Level.FINE)) log.fine("WM name is " + getWMName()); ! setWMName(getWMName()); // Set WM_CLIENT_LEADER property initClientLeader(); --- 116,122 ---- */ void postInit(XCreateWindowParams params) { if (log.isLoggable(Level.FINE)) log.fine("WM name is " + getWMName()); ! updateWMName(); // Set WM_CLIENT_LEADER property initClientLeader(); *************** *** 546,560 **** return mapped; } ! void setWMName(String name) { ! XAtom xa; XToolkit.awtLock(); try { - xa = XAtom.get(XAtom.XA_WM_NAME); if (name == null) { name = " "; } ! xa.setProperty(getWindow(), name); } finally { XToolkit.awtUnlock(); } --- 546,562 ---- return mapped; } ! void updateWMName() { ! String name = getWMName(); XToolkit.awtLock(); try { if (name == null) { name = " "; } ! XAtom nameAtom = XAtom.get(XAtom.XA_WM_NAME); ! nameAtom.setProperty(getWindow(), name); ! XAtom netNameAtom = XAtom.get("_NET_WM_NAME"); ! netNameAtom.setPropertyUTF8(getWindow(), name); } finally { XToolkit.awtUnlock(); } *** /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java- 2005-08-18 18:44:41.316508000 +0400 --- /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java 2005-08-18 18:44:41.255890000 +0400 *************** *** 155,161 **** public void setTitle(String title) { if (log.isLoggable(Level.FINE)) log.fine("Title is " + title); ! setWMName(title); } // NOTE: This method may be called by privileged threads. --- 155,187 ---- public void setTitle(String title) { if (log.isLoggable(Level.FINE)) log.fine("Title is " + title); ! winAttr.title = title; ! updateWMName(); ! } ! ! protected String getWMName() { ! if (winAttr.title == null || winAttr.title.trim().equals("")) { ! return " "; ! } else { ! return winAttr.title; ! } ! } ! ! void updateWMName() { ! super.updateWMName(); ! String name = getWMName(); ! XToolkit.awtLock(); ! try { ! if (name == null || name.trim().equals("")) { ! name = "Java"; ! } ! XAtom iconNameAtom = XAtom.get(XAtom.XA_WM_ICON_NAME); ! iconNameAtom.setProperty(getWindow(), name); ! XAtom netIconNameAtom = XAtom.get("_NET_WM_ICON_NAME"); ! netIconNameAtom.setPropertyUTF8(getWindow(), name); ! } finally { ! XToolkit.awtUnlock(); ! } } // NOTE: This method may be called by privileged threads. *** /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XDialogPeer.java- 2005-08-18 18:44:41.920052000 +0400 --- /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XDialogPeer.java 2005-08-18 18:44:41.893309000 +0400 *************** *** 38,51 **** winAttr.icon = null; } - protected String getWMName() { - if (winAttr.title == null || winAttr.title.trim().equals("")) { - return " "; - } else { - return winAttr.title; - } - } - public void setVisible(boolean vis) { XToolkit.awtLock(); try { --- 38,43 ---- *** /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XFramePeer.java- 2005-08-18 18:44:42.397735000 +0400 --- /net/sterna/export/vb157120/mu/webrev/src/solaris/classes/sun/awt/X11/XFramePeer.java 2005-08-18 18:44:42.356482000 +0400 *************** *** 65,71 **** setIconImage(winAttr.icon); } setupState(true); - setIconName(); } protected Insets guessInsets() { --- 65,70 ---- *************** *** 84,110 **** } } - String getIconName() { - return getWMName(); - } - - void setIconName() { - XAtom atom = XAtom.get(XAtom.XA_WM_ICON_NAME); - String name = getIconName(); - if (name == null || name.trim().equals("")) { - name = "Java"; - } - atom.setProperty(getWindow(), name); - } - - protected String getWMName() { - if (winAttr.title == null || winAttr.title.trim().equals("")) { - return " "; - } else { - return winAttr.title; - } - } - void setupState(boolean onInit) { if (onInit) { state = winAttr.initialState; --- 83,88 ----
19-08-2005

EVALUATION See http://standards.freedesktop.org/wm-spec/1.4/ar01s05.html#id2522739 for _NET_WM_NAME specification. So far we do not support other _NET names.
29-07-2005

EVALUATION Name: rpR10076 Date: 09/29/2003 This is probably too late to change in Tiger. Commiting to Dragonfly instead. ====================================================================== Gnome is default even on Windows, this bug is critical for producing good-looking Swing applications ###@###.### 2005-05-26 12:01:28 GMT
26-05-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
07-09-2004