Mercurial > hg > icedtea6-hg
changeset 2247:1fc64b023005
Backport S6438179: XToolkit.isTraySupported() result has nothing to do with the system tray
2010-08-25 Omair Majid <omajid@redhat.com>
Fixes RH569121, S6438179
* NEWS: Update with new backport.
* Makefile.am (ICEDTEA_PATCHES): Apply new patch.
* patches/openjdk/6438179-systray_check.patch: Backport of S6438179.
author | omajid |
---|---|
date | Wed, 25 Aug 2010 15:49:56 -0400 |
parents | 6f017e9047ab |
children | 627620efacc8 |
files | ChangeLog Makefile.am NEWS patches/openjdk/6438179-systray_check.patch |
diffstat | 4 files changed, 102 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Aug 24 23:19:33 2010 +0100 +++ b/ChangeLog Wed Aug 25 15:49:56 2010 -0400 @@ -1,3 +1,10 @@ +2010-08-25 Omair Majid <omajid@redhat.com> + + 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-08-24 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: Compile NimbusLookAndFeel as a
--- a/Makefile.am Tue Aug 24 23:19:33 2010 +0100 +++ b/Makefile.am Wed Aug 25 15:49:56 2010 -0400 @@ -289,7 +289,8 @@ patches/ipv4-mapped-ipv6-addresses.patch \ patches/openjdk/6795060-icu_crash.patch \ patches/openjdk/4356282-opentype.patch \ - patches/openjdk/6954424-opentype_javadoc.patch + patches/openjdk/6954424-opentype_javadoc.patch \ + patches/openjdk/6438179-systray_check.patch if WITH_RHINO ICEDTEA_PATCHES += \
--- a/NEWS Tue Aug 24 23:19:33 2010 +0100 +++ b/NEWS Wed Aug 25 15:49:56 2010 -0400 @@ -12,6 +12,7 @@ * Backports from OpenJDK6 - S4356282, RH525870: RFE: T2K should be used to rasterize CID/CFF fonts - S6954424: Support OpenType/CFF fonts in JDK 7 + - S6438179: XToolkit.isTraySupported() result has nothing to do with the system tray * Netx - RH601281: Possible NullPointerException in splash screen code
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/6438179-systray_check.patch Wed Aug 25 15:49:56 2010 -0400 @@ -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; + } +