changeset 2732:15d88aeb3dc4

683768: Add a workaround for Java applications using tray icon for Gnome Shell.
author Danesh Dadachanji <ddadacha@redhat.com>
date Tue, 15 Nov 2011 15:02:41 -0500
parents 0e1ae9c38563
children b26203d46fdd
files ChangeLog Makefile.am NEWS patches/openjdk/683768-System-tray-icon.patch
diffstat 4 files changed, 93 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 08 06:03:17 2011 -0500
+++ b/ChangeLog	Tue Nov 15 15:02:41 2011 -0500
@@ -1,3 +1,11 @@
+2011-11-14  Danesh Dadachanji  <ddadacha@redhat.com>
+
+	* Makefile.am: 
+	(ICEDTEA_PATCHES): Add patches/openjdk/683768-System-tray-icon.patch 
+	* NEWS: Updated. 
+	* patches/openjdk/683768-System-tray-icon.patch: New file. Sets XAtoms 
+	_NET_WM_PID and WM_CLIENT_MACHINE for X windows.
+
 2011-11-07  Andrew Haley  <aph@redhat.com>
 
 	* arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp (Thumb2_iOp): Mask
--- a/Makefile.am	Tue Nov 08 06:03:17 2011 -0500
+++ b/Makefile.am	Tue Nov 15 15:02:41 2011 -0500
@@ -410,7 +410,8 @@
 	patches/openjdk/5082756-ImageIO_plugins_metadata_boolean_attributes.patch \
 	patches/openjdk/6296893-BMP_Writer_handles_TopDown_prop_incorrectly.patch \
 	patches/openjdk/7103224-glibc_name_collision.patch \
-	patches/arm-debug.patch
+	patches/arm-debug.patch \
+	patches/openjdk/683768-System-tray-icon.patch
 
 if WITH_RHINO
 ICEDTEA_PATCHES += \
--- a/NEWS	Tue Nov 08 06:03:17 2011 -0500
+++ b/NEWS	Tue Nov 15 15:02:41 2011 -0500
@@ -22,6 +22,7 @@
   - PR732: Use xsltproc for bootstrap xslt in place of Xerces/Xalan
   - RH727195: Japanese font mappings are broken
   - LP862286: Fix exception on trying to start PulseAudio playback
+  - RH683768: Add a workaround for Java applications using tray icon for Gnome Shell
 * Import of OpenJDK6 b23 including upgrade to HotSpot 20
   - S7023111: Add webrev script to make/scripts
   - S6909331: Add vsvars.sh to the jdk repository (handy cygwin way to get vcvars32.bat run)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/openjdk/683768-System-tray-icon.patch	Tue Nov 15 15:02:41 2011 -0500
@@ -0,0 +1,82 @@
+--- openjdk.orig/jdk/make/sun/xawt/mapfile-vers	2011-11-10 14:24:02.954504503 -0500
++++ openjdk/jdk/make/sun/xawt/mapfile-vers	2011-11-14 15:17:31.710505342 -0500
+@@ -304,6 +304,8 @@
+         Java_sun_awt_X11_XlibWrapper_XSynchronize;
+         Java_java_awt_FileDialog_initIDs;
+         Java_sun_awt_X11_XWindow_initIDs;
++        Java_sun_awt_X11_XWindowPeer_getLocalHostname;
++        Java_sun_awt_X11_XWindowPeer_getJvmPID;
+ 
+         Java_sun_java2d_opengl_OGLContext_getOGLIdString;
+         Java_sun_java2d_opengl_OGLMaskFill_maskFill;
+--- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	2011-11-10 14:24:02.702508353 -0500
++++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	2011-11-14 15:17:31.735504849 -0500
+@@ -199,11 +199,18 @@
+         return name;
+     }
+ 
++    private static native String getLocalHostname();
++    private static native int getJvmPID();
++    
+     void postInit(XCreateWindowParams params) {
+         super.postInit(params);
+ 
+         // Init WM_PROTOCOLS atom
+         initWMProtocols();
++        
++        // Set _NET_WM_PID and WM_CLIENT_MACHINE using this JVM
++        XAtom.get("WM_CLIENT_MACHINE").setProperty(getWindow(), getLocalHostname());
++        XAtom.get("_NET_WM_PID").setCard32Property(getWindow(), getJvmPID());
+ 
+         // Set WM_TRANSIENT_FOR and group_leader
+         Window t_window = (Window)target;
+--- openjdk.orig/jdk/src/solaris/native/sun/xawt/XToolkit.c	2011-07-05 14:36:12.000000000 -0400
++++ openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c	2011-11-14 15:17:31.775504063 -0500
+@@ -46,6 +46,8 @@
+ #include "java_awt_SystemColor.h"
+ #include "java_awt_TrayIcon.h"
+ 
++#include <unistd.h>
++
+ uint32_t awt_NumLockMask = 0;
+ Boolean  awt_ModLockIsShiftLock = False;
+ 
+@@ -914,3 +916,38 @@
+         AWT_UNLOCK();
+     }
+ }
++
++/*
++ * Class:     sun_awt_X11_XWindowPeer
++ * Method:    getJvmPID
++ * Signature: ()I
++ */
++JNIEXPORT jint JNICALL Java_sun_awt_X11_XWindowPeer_getJvmPID
++(JNIEnv *env, jclass cls) 
++{
++    /* Return the JVM's PID. */
++    return getpid();
++}
++
++#ifndef HOST_NAME_MAX
++#define HOST_NAME_MAX 1024 /* Overestimated */
++#endif
++
++/*
++ * Class:     sun_awt_X11_XWindowPeer
++ * Method:    getLocalHostname
++ * Signature: ()Ljava/lang/String;
++ */
++JNIEXPORT jstring JNICALL Java_sun_awt_X11_XWindowPeer_getLocalHostname
++(JNIEnv *env, jclass cls) 
++{
++    /* Return the machine's FQDN. */
++    char hostname[HOST_NAME_MAX + 1];
++    if (gethostname(hostname, HOST_NAME_MAX + 1) == 0) {
++        hostname[HOST_NAME_MAX] = '\0';
++        jstring res = (*env)->NewStringUTF(env, hostname);
++        return res;
++    }
++
++    return (jstring)NULL;
++}