# HG changeset patch # User Omair Majid # Date 1292000042 18000 # Node ID c12e7cd9ae66e8a051b0fde8af5e7eaabc570636 # Parent 8ee32987a1722353ead12d6aadc548055d9a0a85 Backport S6438179: XToolkit.isTraySupported() result has nothing to do with the system tray 2010-12-10 Omair Majid Fixes RH569121, S6438179 * NEWS: Update with new backport. * Makefile.am (ICEDTEA_PATCHES): Apply new patch. * patches/openjdk/6438179-systray_check.patch: Backport of S6438179. diff -r 8ee32987a172 -r c12e7cd9ae66 ChangeLog --- a/ChangeLog Thu Dec 09 15:16:19 2010 -0500 +++ b/ChangeLog Fri Dec 10 11:54:02 2010 -0500 @@ -1,3 +1,10 @@ +2010-12-10 Omair Majid + + Fixes RH569121, S6438179 + * NEWS: Update with new backport. + * Makefile.am (ICEDTEA_PATCHES): Apply new patch. + * patches/openjdk/6438179-systray_check.patch: Backport of S6438179. + 2010-12-09 Denis Lila * Makefile.am: diff -r 8ee32987a172 -r c12e7cd9ae66 Makefile.am --- a/Makefile.am Thu Dec 09 15:16:19 2010 -0500 +++ b/Makefile.am Fri Dec 10 11:54:02 2010 -0500 @@ -376,7 +376,8 @@ patches/getannotation-cast.patch \ patches/applet_hole.patch \ patches/openjdk/7003777-bad-html-entity-parse.patch \ - patches/openjdk/6967436-6976265-6967434-pisces.patch + patches/openjdk/6967436-6976265-6967434-pisces.patch \ + patches/openjdk/6438179-systray_check.patch if WITH_ALT_HSBUILD ICEDTEA_PATCHES += patches/hotspot/$(HSBUILD)/openjdk-6886353-ignore_deoptimizealot.patch \ diff -r 8ee32987a172 -r c12e7cd9ae66 NEWS --- a/NEWS Thu Dec 09 15:16:19 2010 -0500 +++ b/NEWS Fri Dec 10 11:54:02 2010 -0500 @@ -9,6 +9,8 @@ CVE-XXXX-YYYY: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=XXXX-YYYY New in release 1.7.7 (201X-XX-XX): +* Backports + - S6438179, RH569121: XToolkit.isTraySupported() result has nothing to do with the system tray New in release 1.7.6 (2010-11-24): diff -r 8ee32987a172 -r c12e7cd9ae66 patches/openjdk/6438179-systray_check.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6438179-systray_check.patch Fri Dec 10 11:54:02 2010 -0500 @@ -0,0 +1,92 @@ +# HG changeset patch +# User omajid +# Date 1281710168 14400 +# Node ID ac23e40d3880c30085d7a76826145afbe73dd465 +# Parent 636250081b3b27e4b9f536903aa2ddad135f24f2 +6438179: XToolkit.isTraySupported() result has nothing to do with the system tray +Summary: Use System Tray Protocol Specification +Reviewed-by: prr, dcherepanov + +--- openjdk.orig/jdk/src/share/classes/java/awt/SystemTray.java Wed Aug 11 19:06:15 2010 +0100 ++++ openjdk/jdk/src/share/classes/java/awt/SystemTray.java Fri Aug 13 10:36:08 2010 -0400 +@@ -164,16 +164,14 @@ public class SystemTray { + if (GraphicsEnvironment.isHeadless()) { + throw new HeadlessException(); + } ++ ++ initializeSystemTrayIfNeeded(); ++ + if (!isSupported()) { + throw new UnsupportedOperationException( + "The system tray is not supported on the current platform."); + } + +- synchronized (SystemTray.class) { +- if (systemTray == null) { +- systemTray = new SystemTray(); +- } +- } + return systemTray; + } + +@@ -204,7 +202,7 @@ public class SystemTray { + */ + public static boolean isSupported() { + if (Toolkit.getDefaultToolkit() instanceof SunToolkit) { +- ++ initializeSystemTrayIfNeeded(); + return ((SunToolkit)Toolkit.getDefaultToolkit()).isTraySupported(); + + } else if (Toolkit.getDefaultToolkit() instanceof HeadlessToolkit) { +@@ -472,4 +470,12 @@ public class SystemTray { + security.checkPermission(SecurityConstants.ACCESS_SYSTEM_TRAY_PERMISSION); + } + } ++ ++ private static void initializeSystemTrayIfNeeded() { ++ synchronized (SystemTray.class) { ++ if (systemTray == null) { ++ systemTray = new SystemTray(); ++ } ++ } ++ } + } +--- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java Wed Aug 11 19:06:15 2010 +0100 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java Fri Aug 13 10:36:08 2010 -0400 +@@ -55,6 +55,19 @@ public class XSystemTrayPeer implements + return new Dimension(XTrayIconPeer.TRAY_ICON_HEIGHT, XTrayIconPeer.TRAY_ICON_WIDTH); + } + ++ boolean isAvailable() { ++ boolean available = false; ++ XToolkit.awtLock(); ++ try { ++ long selection_owner = XlibWrapper.XGetSelectionOwner(XToolkit.getDisplay(), ++ _NET_SYSTEM_TRAY.getAtom()); ++ available = (selection_owner != XConstants.None); ++ } finally { ++ XToolkit.awtUnlock(); ++ } ++ return available; ++ } ++ + // *********************************************************************** + // *********************************************************************** + +--- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java Wed Aug 11 19:06:15 2010 +0100 ++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java Fri Aug 13 10:36:08 2010 -0400 +@@ -1073,10 +1073,9 @@ public class XToolkit extends UNIXToolki + } + + public boolean isTraySupported() { +- int wm = XWM.getWMID(); +- if (wm == XWM.METACITY_WM || wm == XWM.KDE2_WM) +- { +- return true; ++ XSystemTrayPeer peer = XSystemTrayPeer.getPeerInstance(); ++ if (peer != null) { ++ return peer.isAvailable(); + } + return false; + } +