changeset in /hg/icedtea: 2007-12-12 Lillian Angel <langel at redh...

Lillian Angel langel at redhat.com
Wed Dec 12 07:58:38 PST 2007


changeset 208a6277eb21 in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=208a6277eb21
description:
	2007-12-12  Lillian Angel <langel at redhat.com>

	        Fixes Bug #76
	        * gcjwebplugin.cc
	        (GCJ_SetWindow): Passes width and height with handle.
	        * patches/icedtea-plugin.patch
	        (PluginMain.java): Fixed to accept width and height, and change size
	        of plugin when required.
	        (PluginAppletViewer.java): Added listeners to window, change
	        attributes of applet when required.

diffstat:

3 files changed, 116 insertions(+), 36 deletions(-)
ChangeLog                    |   11 +++
gcjwebplugin.cc              |    6 +
patches/icedtea-plugin.patch |  135 +++++++++++++++++++++++++++++++-----------

diffs (270 lines):

diff -r 5e6aacdf3f50 -r 208a6277eb21 ChangeLog
--- a/ChangeLog	Wed Dec 12 10:44:53 2007 -0500
+++ b/ChangeLog	Wed Dec 12 10:57:37 2007 -0500
@@ -1,3 +1,14 @@ 2007-12-12  Gary Benson  <gbenson at redhat
+2007-12-12  Lillian Angel <langel at redhat.com>
+
+	Fixes Bug #76
+	* gcjwebplugin.cc
+	(GCJ_SetWindow): Passes width and height with handle.
+	* patches/icedtea-plugin.patch
+	(PluginMain.java): Fixed to accept width and height, and change size
+	of plugin when required.
+	(PluginAppletViewer.java): Added listeners to window, change
+	attributes of applet when required.
+
 2007-12-12  Gary Benson  <gbenson at redhat.com>
 
 	* ports/hotspot/src/cpu/ppc/vm/disassembler_ppc.hpp
diff -r 5e6aacdf3f50 -r 208a6277eb21 gcjwebplugin.cc
--- a/gcjwebplugin.cc	Wed Dec 12 10:44:53 2007 -0500
+++ b/gcjwebplugin.cc	Wed Dec 12 10:57:37 2007 -0500
@@ -687,8 +687,10 @@ GCJ_SetWindow (NPP instance, NPWindow* w
       g_mutex_lock (data->appletviewer_mutex);
 
       plugin_send_message_to_appletviewer (data, data->instance_string);
-      gchar *window_message = g_strdup_printf ("handle %ld",
-                                               (gulong) window->window);
+      gchar *window_message = g_strdup_printf ("handle %ld width %d height %d",
+                                               (gulong) window->window,
+						window->width,
+						window->height);
       plugin_send_message_to_appletviewer (data, window_message);
       g_free (window_message);
       window_message = NULL;
diff -r 5e6aacdf3f50 -r 208a6277eb21 patches/icedtea-plugin.patch
--- a/patches/icedtea-plugin.patch	Wed Dec 12 10:44:53 2007 -0500
+++ b/patches/icedtea-plugin.patch	Wed Dec 12 10:57:37 2007 -0500
@@ -66,10 +66,10 @@ diff -urN openjdk.orig/jdk/make/sun/plug
 +JAVA_ARGS = "{ \"sun.applet.PluginMain\" }"
 +include $(BUILDDIR)/common/Program.gmk
 +
-diff -urN openjdk.orig/jdk/src/share/classes/sun/applet/PluginAppletViewer.java openjdk/jdk/src/share/classes/sun/applet/PluginAppletViewer.java
+diff -ruN openjdk.orig/jdk/src/share/classes/sun/applet/PluginAppletViewer.java openjdk/jdk/src/share/classes/sun/applet/PluginAppletViewer.java
 --- openjdk.orig/jdk/src/share/classes/sun/applet/PluginAppletViewer.java	1969-12-31 19:00:00.000000000 -0500
-+++ openjdk/jdk/src/share/classes/sun/applet/PluginAppletViewer.java	2007-10-12 17:37:54.000000000 -0400
-@@ -0,0 +1,945 @@
++++ openjdk/jdk/src/share/classes/sun/applet/PluginAppletViewer.java	2007-12-12 10:37:26.000000000 -0500
+@@ -0,0 +1,1000 @@
 +/*
 + * Copyright 1995-2004 Sun Microsystems, Inc.  All Rights Reserved.
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -165,7 +165,6 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +     * For cloning
 +     */
 +    PluginAppletViewerFactory factory;
-+
 +
 +    /**
 +     * Create the applet viewer
@@ -248,7 +247,57 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +	    }
 +	};
 +
++	ComponentListener componentListener = new ComponentAdapter() {
++		public void componentResized(ComponentEvent event)
++  		{
++		    if (panel != null)
++		      {
++		        ComponentListener[] l = panel.getComponentListeners();
++		        for (int i = 0; i < l.length; i++)
++		          l[i].componentResized(event);
++			panel.validate();
++		      }
++		  }
++
++		public void componentMoved(ComponentEvent event)
++		  {
++		    if (panel != null)
++		      {
++		        ComponentListener[] l = panel.getComponentListeners();
++		        for (int i = 0; i < l.length; i++)
++		          l[i].componentMoved(event);
++			panel.validate();
++		      }
++		  }
++        };
++
++	HierarchyBoundsListener hierarchyBoundsListener = new HierarchyBoundsAdapter() {
++		public void ancestorMoved(HierarchyEvent e)
++		  {
++		     if (panel != null)
++                      {
++		        HierarchyBoundsListener[] l = panel.getHierarchyBoundsListeners();
++		        for (int i = 0; i < l.length; i++)
++		          l[i].ancestorMoved(e);
++			panel.validate();
++		      }
++		  }
++
++		public void ancestorResized(HierarchyEvent e)
++		  {
++		    if (panel != null)
++		      {
++		        HierarchyBoundsListener[] l = panel.getHierarchyBoundsListeners();
++		        for (int i = 0; i < l.length; i++)
++		          l[i].ancestorResized(e);
++			panel.validate();
++		      }
++		  }
++	};
++
 +	addWindowListener(windowEventListener);
++        addComponentListener(componentListener);
++        addHierarchyBoundsListener(hierarchyBoundsListener);
 +	panel.addAppletListener(new AppletEventListener(this));
 +
 +	// Start the applet
@@ -338,7 +387,7 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +	v.copyInto(retVal);
 + 	return retVal;
 +    }
-+
++
 +    /*
 +     * Methods for java.applet.AppletContext
 +     */
@@ -573,15 +622,13 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +    }
 +
 +    /**
-+     * Make sure the atrributes are uptodate.
-+     */
-+    public void updateAtts() {
-+	Dimension d = panel.size();
-+	Insets in = panel.insets();
-+	panel.atts.put("width",
-+		       new Integer(d.width - (in.left + in.right)).toString());
-+	panel.atts.put("height",
-+		       new Integer(d.height - (in.top + in.bottom)).toString());
++     * Make sure the attributes are up-to-date.
++     */
++    public void updateAtts(int width, int height) {
++	panel.atts.remove("width");
++	panel.atts.remove("height");
++	panel.atts.put("width", new Integer(width).toString());
++	panel.atts.put("height", new Integer(height).toString());
 +    }
 +
 +    /**
@@ -808,17 +855,19 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +    public static void parse(long handle, Reader in, URL url, String enc)
 +        throws IOException {
 +        encoding = enc;
-+        parse(handle, in, url, System.out, new PluginAppletViewerFactory());
-+    }
-+
-+    public static void parse(long handle, Reader in, URL url)
++        parse(handle, 1, 1, in, url, System.out, new PluginAppletViewerFactory());
++    }
++
++    public static void parse(long handle, int width, int height, Reader in, URL url)
 +        throws IOException {
-+        parse(handle, in, url, System.out, new PluginAppletViewerFactory());
-+    }
-+
-+    public static void parse(long handle, Reader in, URL url,
-+                             PrintStream statusMsgStream,
-+                             PluginAppletViewerFactory factory)
++        parse(handle, width, height,
++		in, url, System.out, new PluginAppletViewerFactory());
++    }
++
++    public static void parse(long handle, int width, int height, Reader in, 
++				URL url,
++	                        PrintStream statusMsgStream,
++        	                PluginAppletViewerFactory factory)
 +        throws IOException
 +    {
 +        // <OBJECT> <EMBED> tag flags
@@ -873,11 +922,16 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +                        }
 +
 +			if (atts != null) {
++			    atts.remove("width");
++			    atts.remove("height");
++			    atts.put("width", new Integer(width).toString());
++			    atts.put("height", new Integer(height).toString());
++
 +			    // XXX 5/18 In general this code just simply
 +			    // shouldn't be part of parsing.  It's presence
 +			    // causes things to be a little too much of a
 +			    // hack.
-+			    factory.createAppletViewer(handle, x, y, url, atts);
++                            factory.createAppletViewer(handle, x, y, url, atts);
 +			    x += XDELTA;
 +			    y += YDELTA;
 +			    // make sure we don't go too far!
@@ -906,7 +960,8 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +			    if (val == null) {
 +				statusMsgStream.println(requiresNameWarning);
 +			    } else if (atts != null) {
-+				atts.put(att.toLowerCase(), val);
++				String name = att.toLowerCase();
++				atts.put(name, val);
 +			    } else {
 +				statusMsgStream.println(paramOutsideWarning);
 +			    }
@@ -1015,10 +1070,10 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +	}
 +    }
 +}
-diff -urN openjdk.orig/jdk/src/share/classes/sun/applet/PluginMain.java openjdk/jdk/src/share/classes/sun/applet/PluginMain.java
+diff -ruN openjdk.orig/jdk/src/share/classes/sun/applet/PluginMain.java openjdk/jdk/src/share/classes/sun/applet/PluginMain.java
 --- openjdk.orig/jdk/src/share/classes/sun/applet/PluginMain.java	1969-12-31 19:00:00.000000000 -0500
-+++ openjdk/jdk/src/share/classes/sun/applet/PluginMain.java	2007-10-12 17:37:54.000000000 -0400
-@@ -0,0 +1,262 @@
++++ openjdk/jdk/src/share/classes/sun/applet/PluginMain.java	2007-12-11 13:45:15.000000000 -0500
+@@ -0,0 +1,274 @@
 +/*
 + * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1199,7 +1254,7 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +		    if (currentRequest.handle != 0
 +			&& !currentRequest.alreadySent) {
 +			PluginAppletViewer.parse
-+			    (currentRequest.handle,
++			    (currentRequest.handle, 1, 1,
 +			     new StringReader(currentRequest.tag),
 +			     new URL(currentRequest.documentbase));
 +			parseRequests.remove(currentKey);
@@ -1208,11 +1263,19 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +	    } else if (message.startsWith("handle")) {
 +		if (currentRequest != null) {
 +		    currentRequest.handle = Long.parseLong
-+			(message.substring("handle".length() + 1));
++			(message.substring("handle".length() + 1, 
++						message.indexOf("width") - 1));
++		    int width = Integer.parseInt(message.substring
++					(message.indexOf("width") + 
++					"width".length() + 1, 
++					message.indexOf("height") - 1));
++		    int height = Integer.parseInt(message.substring(
++					message.indexOf("height") + 
++					"height".length() + 1));
 +		    if (currentRequest.tag != null
 +		       && !currentRequest.alreadySent) {
 +			PluginAppletViewer.parse
-+			    (currentRequest.handle,
++			    (currentRequest.handle, width, height,
 +			     new StringReader(currentRequest.tag),
 +			     new URL(currentRequest.documentbase));
 +			parseRequests.remove(currentKey);
@@ -1221,11 +1284,15 @@ diff -urN openjdk.orig/jdk/src/share/cla
 +	    } else if (message.startsWith("width")) {
 +		int width =
 +		    Integer.parseInt(message.substring("width".length() + 1));
-+		currentWindow.setSize(width, currentWindow.getHeight());
++		int height = currentWindow.getHeight();
++		currentWindow.updateAtts(width, height);
++	 	currentWindow.setSize(width, height);
 +	    } else if (message.startsWith("height")) {
 +		int height =
 +		    Integer.parseInt(message.substring("height".length() + 1));
-+		currentWindow.setSize(currentWindow.getWidth(), height);
++		int width = currentWindow.getWidth();
++		currentWindow.updateAtts(width, height);
++	        currentWindow.setSize(width, height);
 +	    } else if (message.startsWith("destroy")
 +		       && currentWindow != null) {
 +		deregisterWindow(currentWindow);



More information about the distro-pkg-dev mailing list