# HG changeset patch # User Deepak Bhole # Date 1303146999 14400 # Node ID 2b7512af4dccf01af981866f8b2f951c5a040cec # Parent 4169f6296ed7ac8e5766a3e919c30e6037d5c87a Fix applet rezising issue seen with some browsers (Midori) diff -r 4169f6296ed7 -r 2b7512af4dcc ChangeLog --- a/ChangeLog Mon Apr 18 11:36:52 2011 -0400 +++ b/ChangeLog Mon Apr 18 13:16:39 2011 -0400 @@ -1,3 +1,10 @@ +2011-04-18 Deepak Bhole + + * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java + (PluginAppletPanelFactory::createPanel): Make the NetxPanel variable + final. Resize frame to work around problem whereby AppletViewerPanel + doesn't always set the right size initially. + 2011-04-18 Deepak Bhole RH691259: Midori sends a SIGSEGV with the IcedTea NP Plugin diff -r 4169f6296ed7 -r 2b7512af4dcc plugin/icedteanp/java/sun/applet/PluginAppletViewer.java --- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Mon Apr 18 11:36:52 2011 -0400 +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Mon Apr 18 13:16:39 2011 -0400 @@ -126,7 +126,7 @@ long handle, int x, int y, final URL doc, final Hashtable atts) { - AppletViewerPanel panel = AccessController.doPrivileged(new PrivilegedAction() { + final AppletViewerPanel panel = AccessController.doPrivileged(new PrivilegedAction() { public AppletViewerPanel run() { try { AppletViewerPanel panel = new NetxPanel(doc, atts, false); @@ -192,6 +192,30 @@ PluginDebug.debug("Applet " + a.getClass() + " initialized"); streamhandler.write("instance " + identifier + " reference 0 initialized"); + /* AppletViewerPanel sometimes doesn't set size right initially. This + * causes the parent frame to be the default (10x10) size. + * + * Normally it goes unnoticed since browsers like Firefox make a resize + * call after init. However some browsers (e.g. Midori) don't. + * + * We therefore manually set the parent to the right size. + */ + try { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + panel.getParent().setSize(Integer.valueOf(atts.get("width")), Integer.valueOf(atts.get("height"))); + } + }); + } catch (InvocationTargetException ite) { + // Not being able to resize is non-fatal + PluginDebug.debug("Unable to resize panel: "); + ite.printStackTrace(); + } catch (InterruptedException ie) { + // Not being able to resize is non-fatal + PluginDebug.debug("Unable to resize panel: "); + ie.printStackTrace(); + } + AppletSecurityContextManager.getSecurityContext(0).associateSrc(((NetxPanel) panel).getAppletClassLoader(), doc); AppletSecurityContextManager.getSecurityContext(0).associateInstance(identifier, ((NetxPanel) panel).getAppletClassLoader());