aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--netx/com/jogamp/plugin/ui/NativeWindowDownstream.java5
-rw-r--r--netx/com/jogamp/plugin/ui/NativeWindowUpstream.java14
-rw-r--r--netx/jogamp/applet/Applet3Panel.java103
-rw-r--r--netx/jogamp/plugin/jnlp/NetxApplet3Panel.java4
-rw-r--r--netx/net/sourceforge/jnlp/PluginParameters.java31
-rw-r--r--plugin/icedteanp/IcedTeaNPPlugin.cc53
-rw-r--r--plugin/icedteanp/IcedTeaNPPlugin.h6
-rw-r--r--plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3PanelFactory.java6
-rw-r--r--plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3Viewer.java120
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginParameterParser.java12
10 files changed, 279 insertions, 75 deletions
diff --git a/netx/com/jogamp/plugin/ui/NativeWindowDownstream.java b/netx/com/jogamp/plugin/ui/NativeWindowDownstream.java
index 0846505..bed433b 100644
--- a/netx/com/jogamp/plugin/ui/NativeWindowDownstream.java
+++ b/netx/com/jogamp/plugin/ui/NativeWindowDownstream.java
@@ -78,4 +78,9 @@ public interface NativeWindowDownstream {
* </p>
*/
public void display();
+
+ /**
+ * Notify applet that the plugin's window has changed it's position.
+ */
+ void notifyPositionChanged(NativeWindowUpstream nw);
}
diff --git a/netx/com/jogamp/plugin/ui/NativeWindowUpstream.java b/netx/com/jogamp/plugin/ui/NativeWindowUpstream.java
index ccd42e0..942b509 100644
--- a/netx/com/jogamp/plugin/ui/NativeWindowUpstream.java
+++ b/netx/com/jogamp/plugin/ui/NativeWindowUpstream.java
@@ -57,6 +57,20 @@ public interface NativeWindowUpstream {
public long getWindowHandle();
/**
+ * @return the current x position of the top-left corner
+ * of the client area relative to it's parent.
+ * Since the position reflects the client area, it does not include the insets.
+ */
+ int getX();
+
+ /**
+ * @return the current y position of the top-left corner
+ * of the client area relative to it's parent.
+ * Since the position reflects the client area, it does not include the insets.
+ */
+ int getY();
+
+ /**
* Returns the width of the client area excluding insets (window decorations).
* @return width of the client area
*/
diff --git a/netx/jogamp/applet/Applet3Panel.java b/netx/jogamp/applet/Applet3Panel.java
index 5acad4d..27bb305 100644
--- a/netx/jogamp/applet/Applet3Panel.java
+++ b/netx/jogamp/applet/Applet3Panel.java
@@ -97,7 +97,7 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
*/
private NativeWindowDownstream appletWindow;
- private final MyNativeWindow parentWindow;
+ private final MyNativeWindow browserWindow;
/**
* Applet will allow initialization. Should be
@@ -172,6 +172,11 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
*/
int[] currentAppletSize = { 10, 10 };
+ /**
+ * The current applet position.
+ */
+ int[] currentAppletPos = { 0, 0 };
+
MessageUtils mu = new MessageUtils();
/**
@@ -214,10 +219,12 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
public abstract ClassLoader getAppletClassLoader();
- public Applet3Panel(long nativeWindowHandle, int width, int height, URL documentURL, Hashtable<String, String> parameters) {
+ public Applet3Panel(long nativeWindowHandle, int xpos, int ypos, int width, int height, URL documentURL, Hashtable<String, String> parameters) {
this.documentURL = documentURL;
this.parameters = parameters;
this.updateSizeInParameters(width, height);
+ this.currentAppletPos[0] = xpos;
+ this.currentAppletPos[1] = ypos;
this.currentAppletSize[0] = width;
this.currentAppletSize[1] = height;
{
@@ -249,7 +256,7 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
baseURL = _baseURL;
}
- this.parentWindow = new MyNativeWindow(nativeWindowHandle);
+ this.browserWindow = new MyNativeWindow(nativeWindowHandle);
}
class MyNativeWindow implements NativeWindowUpstream {
final long handle;
@@ -269,6 +276,16 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
@Override
+ public final int getX() {
+ return Applet3Panel.this.getX();
+ }
+
+ @Override
+ public final int getY() {
+ return Applet3Panel.this.getY();
+ }
+
+ @Override
public final long getWindowHandle() {
return this.handle;
}
@@ -287,6 +304,10 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
public final void notifySurfaceUpdated(NativeWindowDownstream swappedWin) {
// TODO: May hook for composite extension
}
+ @Override
+ public final String toString() {
+ return "PluginWin[0x"+Long.toHexString(handle)+", "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+"]";
+ }
};
public void destroy(boolean notifyApplet, boolean notifyUser) throws java.security.AccessControlException {
@@ -320,7 +341,7 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
return appletWindow;
}
public MyNativeWindow getBrowserWindow() {
- return parentWindow;
+ return browserWindow;
}
public int getStatus() { return status; }
@@ -355,7 +376,7 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
@Override
- public final URL getDocumentBase() { // TODO
+ public final URL getDocumentBase() {
return documentURL;
}
@@ -364,29 +385,17 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
return baseURL;
}
- public void updateSizeInParameters(int width, int height) {
+ private void updateSizeInParameters(int width, int height) {
parameters.put("width", Integer.toString(width));
parameters.put("height", Integer.toString(height));
}
+ private void updatePosInParameters(int x, int y) {
+ parameters.put("xpos", Integer.toString(x));
+ parameters.put("ypos", Integer.toString(y));
+ }
@Override
public void resize(int width, int height) {
- appletResize(width, height);
- }
-
- /**
- * Called when the applet wants to be resized.
- *
- * @param width the new requested width for the applet.
- * @param height the new requested height for the applet.
- */
- public void appletResize(int width, int height) {
- updateSizeInParameters(width, height);
- currentAppletSize[0] = width;
- currentAppletSize[1] = height;
- if( null != appletWindow ) {
- appletWindow.setSize(width, height);
- }
/** FIXME
if(loader != null) {
App3Context appCtxt = loader.getAppContext();
@@ -406,6 +415,31 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
}));
} */
+ browserSizeChanged(width, height);
+ }
+
+ /**
+ * Called when the applet needs to be resized.
+ */
+ public void browserSizeChanged(int width, int height) {
+ updateSizeInParameters(width, height);
+ currentAppletSize[0] = width;
+ currentAppletSize[1] = height;
+ if( null != appletWindow ) {
+ appletWindow.setSize(width, height);
+ }
+ }
+
+ /**
+ * Called when the applet needs to be informed about about position change.
+ */
+ public void browserPositionChanged(int x, int y) {
+ updatePosInParameters(x, y);
+ currentAppletPos[0] = y;
+ currentAppletPos[1] = y;
+ if( null != appletWindow ) {
+ appletWindow.notifyPositionChanged(browserWindow);
+ }
}
@Override
@@ -451,6 +485,12 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
//
// Internal Impl.
//
+ @Override
+ public String toString() {
+ return getClass().getSimpleName()+"@"+Integer.toHexString(hashCode())+
+ "["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+
+ ", "+getCode()+" @ "+getCodeBase()+", doc "+getDocumentBase()+"]";
+ }
/**
* Get the code parameter
@@ -492,6 +532,21 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
}
/**
+ * Get the x-pos.
+ */
+ public final int getX() {
+ return currentAppletPos[0];
+ }
+
+
+ /**
+ * Get the y-pos.
+ */
+ public final int getY() {
+ return currentAppletPos[1];
+ }
+
+ /**
* Get the width.
*/
public final int getWidth() {
@@ -812,8 +867,8 @@ public abstract class Applet3Panel implements Applet3Context, Runnable {
break;
}
if( null == appletWindow ) {
- appletWindow = applet.createNativeWindow(this, parentWindow);
- if( parentWindow != appletWindow.getParent() ) {
+ appletWindow = applet.createNativeWindow(this, browserWindow);
+ if( browserWindow != appletWindow.getParent() ) {
throw new IllegalArgumentException("Applet's parent doesn't match!");
}
// FIXME loader.getAppContext().registerAppletWindow(appletWindow);
diff --git a/netx/jogamp/plugin/jnlp/NetxApplet3Panel.java b/netx/jogamp/plugin/jnlp/NetxApplet3Panel.java
index 0d79911..c9f0dd1 100644
--- a/netx/jogamp/plugin/jnlp/NetxApplet3Panel.java
+++ b/netx/jogamp/plugin/jnlp/NetxApplet3Panel.java
@@ -73,8 +73,8 @@ public class NetxApplet3Panel extends Applet3Panel implements SplashController {
private static final ConcurrentMap<String, Boolean> appContextCreated =
new ConcurrentHashMap<String, Boolean>();
- public NetxApplet3Panel(long nativeWindowHandle, int width, int height, URL documentURL, PluginParameters params) {
- super(nativeWindowHandle, width, height, documentURL, params.getUnderlyingHashtable());
+ public NetxApplet3Panel(long nativeWindowHandle, int xpos, int ypos, int width, int height, URL documentURL, PluginParameters params) {
+ super(nativeWindowHandle, xpos, ypos, width, height, documentURL, params.getUnderlyingHashtable());
this.pluginParameters = params;
this.initialized = false;
diff --git a/netx/net/sourceforge/jnlp/PluginParameters.java b/netx/net/sourceforge/jnlp/PluginParameters.java
index c3a958c..99e01c4 100644
--- a/netx/net/sourceforge/jnlp/PluginParameters.java
+++ b/netx/net/sourceforge/jnlp/PluginParameters.java
@@ -37,13 +37,13 @@ exception statement from your version. */
package net.sourceforge.jnlp;
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
import java.net.URL;
import java.util.Collections;
import java.util.Hashtable;
import java.util.Map;
-import static net.sourceforge.jnlp.runtime.Translator.R;
-
/**
* Represents plugin applet parameters, backed by a Hashtable.
*/
@@ -77,7 +77,7 @@ public class PluginParameters {
/**
* Used for compatibility with Hashtable-expecting classes.
- *
+ *
* @return the underlying hashtable.
*/
public Hashtable<String, String> getUnderlyingHashtable() {
@@ -150,13 +150,23 @@ public class PluginParameters {
return getDefaulted("archive", "");
}
+ public int getX() {
+ final String yposStr = getDefaulted("xpos", "0");
+ return Integer.valueOf(yposStr);
+ }
+
+ public int getY() {
+ final String xposStr = getDefaulted("ypos", "0");
+ return Integer.valueOf(xposStr);
+ }
+
public int getWidth() {
- String widthStr = getDefaulted("width", "0");
+ final String widthStr = getDefaulted("width", "0");
return Integer.valueOf(widthStr);
}
public int getHeight() {
- String heightStr = getDefaulted("height", "0");
+ final String heightStr = getDefaulted("height", "0");
return Integer.valueOf(heightStr);
}
@@ -166,12 +176,12 @@ public class PluginParameters {
}
public String getUniqueKey(URL codebase) {
- /* According to http://download.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/applet-compatibility.html,
+ /* According to http://download.oracle.com/javase/6/docs/technotes/guides/deployment/deployment-guide/applet-compatibility.html,
* classloaders are shared iff these properties match:
* codebase, cache_archive, java_archive, archive
- *
+ *
* To achieve this, we create the uniquekey based on those 4 values,
- * always in the same order. The initial "<NAME>=" parts ensure a
+ * always in the same order. The initial "<NAME>=" parts ensure a
* bad tag cannot trick the loader into getting shared with another.
*/
return "codebase=" + codebase.toExternalForm() + "cache_archive="
@@ -180,7 +190,7 @@ public class PluginParameters {
}
/**
- * Replace an attribute with its 'java_'-prefixed version.
+ * Replace an attribute with its 'java_'-prefixed version.
* Note that java_* aliases override older names:
* http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html#in-nav
*/
@@ -195,7 +205,7 @@ public class PluginParameters {
/**
* Creates the underlying hash table with the proper overrides. Ensure all
* keys are lowercase consistently.
- *
+ *
* @param params
* the properties, before parameter aliasing rules.
* @return the resulting parameter table
@@ -236,6 +246,7 @@ public class PluginParameters {
return params;
}
+ @Override
public String toString() {
return parameters.toString();
}
diff --git a/plugin/icedteanp/IcedTeaNPPlugin.cc b/plugin/icedteanp/IcedTeaNPPlugin.cc
index 1317831..500bd01 100644
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc
@@ -204,8 +204,8 @@ NPError get_proxy_info(const char* siteAddr, char** proxy, uint32_t* len);
void consume_message(gchar* message);
static void appletviewer_monitor(GPid pid, gint status, gpointer data);
void plugin_send_initialization_message(char* instance, gulong handle,
- int width, int height,
- char* url);
+ int width, int height, int x, int y,
+ char* url);
/* Returns JVM options set in itw-settings */
std::vector<std::string*>* get_jvm_args();
@@ -799,6 +799,7 @@ ITNP_SetWindow (NPP instance, NPWindow* window)
if (jvm_up)
{
gboolean dim_changed = FALSE;
+ gboolean pos_changed = FALSE;
// The window is the same as it was for the last
// SetWindow call.
@@ -823,9 +824,39 @@ ITNP_SetWindow (NPP instance, NPWindow* window)
dim_changed = TRUE;
}
- if (dim_changed) {
- gchar* message = g_strdup_printf ("instance %d width %d height %d",
- id, window->width, window->height);
+ if (window->x != data->window_x)
+ {
+ PLUGIN_DEBUG ("ITNP_SetWindow: window x changed.\n");
+ // The width of the plugin window has changed.
+
+ // Store the new width.
+ data->window_x = window->x;
+ pos_changed = TRUE;
+ }
+
+ if (window->y != data->window_y)
+ {
+ PLUGIN_DEBUG ("ITNP_SetWindow: window y changed.\n");
+ // The height of the plugin window has changed.
+
+ // Store the new height.
+ data->window_y = window->y;
+
+ pos_changed = TRUE;
+ }
+
+ if (dim_changed || pos_changed) {
+ gchar* message;
+ if( dim_changed && pos_changed ) {
+ message = g_strdup_printf ("instance %d set-sizepos xpos %d ypos %d width %d height %d",
+ id, window->x, window->y, window->width, window->height);
+ } else if( dim_changed ) {
+ message = g_strdup_printf ("instance %d set-size width %d height %d",
+ id, window->width, window->height);
+ } else {
+ message = g_strdup_printf ("instance %d set-pos xpos %d ypos %d",
+ id, window->x, window->y);
+ }
plugin_send_message_to_appletviewer (message);
g_free (message);
message = NULL;
@@ -861,11 +892,13 @@ ITNP_SetWindow (NPP instance, NPWindow* window)
data->window_handle = window->window;
data->window_width = window->width;
data->window_height = window->height;
+ data->window_x = window->x;
+ data->window_y = window->y;
// Now we have everything. Send this data to the Java side
plugin_send_initialization_message(
data->instance_id, (gulong) data->window_handle,
- data->window_width, data->window_height, data->parameters_string);
+ data->window_width, data->window_height, data->window_x, data->window_y, data->parameters_string);
g_mutex_unlock (data->appletviewer_mutex);
@@ -1702,12 +1735,12 @@ void flush_plugin_send_message_to_appletviewer_console (){
*/
void
plugin_send_initialization_message(char* instance, gulong handle,
- int width, int height, char* url)
+ int width, int height, int x, int y, char* url)
{
PLUGIN_DEBUG ("plugin_send_initialization_message\n");
- gchar *window_message = g_strdup_printf ("instance %s handle %ld width %d height %d %s",
- instance, handle, width, height, url);
+ gchar *window_message = g_strdup_printf ("instance %s handle %ld xpos %d ypos %d width %d height %d %s",
+ instance, handle, x, y, width, height, url);
plugin_send_message_to_appletviewer (window_message);
g_free (window_message);
window_message = NULL;
@@ -2253,7 +2286,7 @@ get_scriptable_object(NPP instance)
// a 0 handle
if (!data->window_handle)
{
- plugin_send_initialization_message(data->instance_id, 0, 0, 0, data->parameters_string);
+ plugin_send_initialization_message(data->instance_id, 0, 0, 0, 0, 0, data->parameters_string);
}
java_result = java_request.getAppletObjectInstance(id_str);
diff --git a/plugin/icedteanp/IcedTeaNPPlugin.h b/plugin/icedteanp/IcedTeaNPPlugin.h
index 3e66599..2356abf 100644
--- a/plugin/icedteanp/IcedTeaNPPlugin.h
+++ b/plugin/icedteanp/IcedTeaNPPlugin.h
@@ -73,6 +73,10 @@ struct ITNPPluginData
guint32 window_width;
// The last plugin window height sent to us by the browser.
guint32 window_height;
+ // The last plugin window x-coord sent to us by the browser.
+ gint32 window_x;
+ // The last plugin window y-coord sent to us by the browser.
+ gint32 window_y;
// The source location for this instance
std::string source;
// If this is an actual applet instance, or a dummy instance for static calls
@@ -86,6 +90,8 @@ struct ITNPPluginData
window_handle = NULL;
window_width = 0;
window_height = 0;
+ window_x = 0;
+ window_y = 0;
is_applet_instance = false;
}
~ITNPPluginData() {
diff --git a/plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3PanelFactory.java b/plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3PanelFactory.java
index 3d141a4..dc1098d 100644
--- a/plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3PanelFactory.java
+++ b/plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3PanelFactory.java
@@ -86,14 +86,16 @@ public class PluginApplet3PanelFactory {
final long nativeWindowHandle,
final URL doc,
final PluginParameters params) {
+ final int xpos = params.getX();
+ final int ypos = params.getY();
final int width = params.getWidth();
final int height = params.getHeight();
PluginDebug.debug("NativeWindow (Browser) Handle: 0x" + Long.toHexString(nativeWindowHandle));
- PluginDebug.debug("NativeWindow (Browser) Size: " + width + " x " + height);
+ PluginDebug.debug("NativeWindow (Browser) Pos: "+xpos+" / "+ypos+", size: " + width + " x " + height);
final NetxApplet3Panel panel = AccessController.doPrivileged(new PrivilegedAction<NetxApplet3Panel>() {
@Override
public NetxApplet3Panel run() {
- NetxApplet3Panel panel = new NetxApplet3Panel(nativeWindowHandle, width, height, doc, params);
+ NetxApplet3Panel panel = new NetxApplet3Panel(nativeWindowHandle, xpos, ypos, width, height, doc, params);
NetxApplet3Panel.debug("Using NetX panel");
PluginDebug.debug(params.toString());
return panel;
diff --git a/plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3Viewer.java b/plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3Viewer.java
index a123baa..6db065d 100644
--- a/plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3Viewer.java
+++ b/plugin/icedteanp/java/jogamp/plugin/applet/PluginApplet3Viewer.java
@@ -360,7 +360,7 @@ public class PluginApplet3Viewer implements Applet3Context, SplashController {
requestFactory = rf;
}
- private static void handleInitializationMessage(int identifier, String message) throws IOException, LaunchException {
+ private static void handleInitializationMessage(final int identifier, final String origMessage) throws IOException, LaunchException {
/* The user has specified via a global setting that applets should not be run.*/
if (AppletStartupSecuritySettings.getInstance().getSecurityLevel() == AppletSecurityLevel.DENY_ALL) {
@@ -374,9 +374,10 @@ public class PluginApplet3Viewer implements Applet3Context, SplashController {
return;
}
+ String message = origMessage;
// Extract the information from the message
- String[] msgParts = new String[4];
- for (int i = 0; i < 3; i++) {
+ String[] msgParts = new String[6];
+ for (int i = 0; i < 5; i++) {
int spaceLocation = message.indexOf(' ');
int nextSpaceLocation = message.indexOf(' ', spaceLocation + 1);
msgParts[i] = message.substring(spaceLocation + 1, nextSpaceLocation);
@@ -384,14 +385,19 @@ public class PluginApplet3Viewer implements Applet3Context, SplashController {
}
final long nativeWindowHandle = Long.parseLong(msgParts[0]);
- String width = msgParts[1];
- String height = msgParts[2];
+ final String xpos = msgParts[1];
+ final String ypos = msgParts[2];
+ final String width = msgParts[3];
+ final String height = msgParts[4];
int spaceLocation = message.indexOf(' ', "tag".length() + 1);
String documentBase = message.substring("tag".length() + 1, spaceLocation);
String paramString = message.substring(spaceLocation + 1);
- PluginDebug.debug("Handle = 0x", Long.toHexString(nativeWindowHandle), "\n",
+ PluginDebug.debug("Message = <", origMessage, ">\n",
+ "handle = 0x", Long.toHexString(nativeWindowHandle), "\n",
+ "xpos = ", xpos, "\n",
+ "ypos = ", ypos, "\n",
"Width = ", width, "\n",
"Height = ", height, "\n",
"DocumentBase = ", documentBase, "\n",
@@ -406,7 +412,7 @@ public class PluginApplet3Viewer implements Applet3Context, SplashController {
*/
url = conn.getURL();
- PluginParameters params = new PluginParameterParser().parse(width, height, paramString);
+ PluginParameters params = new PluginParameterParser().parse(xpos, ypos, width, height, paramString);
// Let user know we are starting up
streamhandler.write("instance " + identifier + " status " + amh.getMessage("status.start"));
@@ -612,28 +618,84 @@ public class PluginApplet3Viewer implements Applet3Context, SplashController {
}
public void handleMessage(int reference, String message) {
- if (message.startsWith("width")) {
+ if (message.startsWith("set-sizepos")) {
- // 0 => width, 1=> width_value, 2 => height, 3=> height_value
- String[] dimMsg = message.split(" ");
+ // 0 => set-sizepos
+ // 1 => xpos, 2 => xpos_value, 3 => ypos, 4 => ypos_value
+ // 5 => width, 6 => width_value, 7 => height, 8 => height_value
+ final String[] dimMsg = message.split(" ");
- final int width = Integer.parseInt(dimMsg[1]);
- final int height = Integer.parseInt(dimMsg[3]);
+ final int xpos= Integer.parseInt(dimMsg[2]);
+ final int ypos= Integer.parseInt(dimMsg[4]);
+ final int width = Integer.parseInt(dimMsg[6]);
+ final int height = Integer.parseInt(dimMsg[8]);
+
+ PluginDebug.debug("Applet panel ", panel, " set-sizepos ", xpos, " / ", ypos, width, " x ", height, " - ", message);
+
+ /* Resize and reposition the applet asynchronously, to avoid the chance of
+ * deadlock while waiting for the applet to initialize.
+ *
+ * In general, worker threads should spawn new threads for any blocking operations. */
+ final Thread resizeposAppletThread = new Thread("resizeposAppletThread") {
+ @Override
+ public void run() {
+ browserSizePosChanged(xpos, ypos, width, height);
+ }
+ };
+
+ /* Let it eventually complete */
+ resizeposAppletThread.start();
+
+ } else if (message.startsWith("set-size")) {
+
+ // 0 => set-size
+ // 1 => width, 2 => width_value, 3 => height, 4 => height_value
+ final String[] dimMsg = message.split(" ");
+
+ final int width = Integer.parseInt(dimMsg[2]);
+ final int height = Integer.parseInt(dimMsg[4]);
+
+ PluginDebug.debug("Applet panel ", panel, " set-size ", width, " x ", height, " - ", message);
/* Resize the applet asynchronously, to avoid the chance of
* deadlock while waiting for the applet to initialize.
*
* In general, worker threads should spawn new threads for any blocking operations. */
- Thread resizeAppletThread = new Thread("resizeAppletThread") {
+ final Thread resizeAppletThread = new Thread("resizeAppletThread") {
@Override
public void run() {
- resize(width, height);
+ browserSizeChanged(width, height);
}
};
/* Let it eventually complete */
resizeAppletThread.start();
+ } else if (message.startsWith("set-pos")) {
+
+ // 0 => set-pos
+ // 1 => xpos, 2 => xpos_value, 3 => ypos, 4 => ypos_value
+ final String[] dimMsg = message.split(" ");
+
+ final int xpos= Integer.parseInt(dimMsg[2]);
+ final int ypos= Integer.parseInt(dimMsg[4]);
+
+ PluginDebug.debug("Applet panel ", panel, " set-size ", xpos, " / ", ypos, " - ", message);
+
+ /* Reposition the applet asynchronously, to avoid the chance of
+ * deadlock while waiting for the applet to initialize.
+ *
+ * In general, worker threads should spawn new threads for any blocking operations. */
+ final Thread reposAppletThread = new Thread("reposAppletThread") {
+ @Override
+ public void run() {
+ browserPositionChanged(xpos, ypos);
+ }
+ };
+
+ /* Let it eventually complete */
+ reposAppletThread.start();
+
} else if (message.startsWith("GetJavaObject")) {
// FIXME: how do we determine what security context this
@@ -765,19 +827,35 @@ public class PluginApplet3Viewer implements Applet3Context, SplashController {
}));
}
*/
- appletResize(width, height);
+ browserSizeChanged(width, height);
}
/**
- * Called when the applet wants to be resized.
- *
- * @param width the new requested width for the applet.
- * @param height the new requested height for the applet.
+ * Called when the applet needs to be resized.
+ */
+ public void browserSizePosChanged(int x, int y, int width, int height) {
+ // Wait for panel to come alive
+ waitForAppletInit(panel);
+ panel.browserPositionChanged(x, y);
+ panel.browserSizeChanged(width, height);
+ }
+
+ /**
+ * Called when the applet needs to be resized.
+ */
+ public void browserSizeChanged(int width, int height) {
+ // Wait for panel to come alive
+ waitForAppletInit(panel);
+ panel.browserSizeChanged(width, height);
+ }
+
+ /**
+ * Called when the applet needs to be informed about about position change.
*/
- public void appletResize(int width, int height) {
+ public void browserPositionChanged(int x, int y) {
// Wait for panel to come alive
waitForAppletInit(panel);
- panel.appletResize(width, height);
+ panel.browserPositionChanged(x, y);
}
@Override
diff --git a/plugin/icedteanp/java/sun/applet/PluginParameterParser.java b/plugin/icedteanp/java/sun/applet/PluginParameterParser.java
index 56dabc9..51ffc9e 100644
--- a/plugin/icedteanp/java/sun/applet/PluginParameterParser.java
+++ b/plugin/icedteanp/java/sun/applet/PluginParameterParser.java
@@ -1,6 +1,5 @@
package sun.applet;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -69,16 +68,15 @@ public class PluginParameterParser {
}
/**
- * Parsers parameters given a string containing
+ * Parsers parameters given a string containing
* parameters in quotes.
- *
* @param width default applet width
* @param height default applet height
- * @param parameterString the parameters
+ * @param parameterString the parameters
+ *
* @return the attributes in a hash table
*/
- public PluginParameters parse(String width,
- String height, String parameterString) {
+ public PluginParameters parse(String xpos, String ypos, String width, String height, String parameterString) {
Map<String, String> params = parseEscapedKeyValuePairs(parameterString);
if (params.get("width") == null || !isInt(params.get("width"))) {
@@ -88,6 +86,8 @@ public class PluginParameterParser {
if (params.get("height") == null || !isInt(params.get("height"))) {
params.put("height", height);
}
+ params.put("xpos", xpos);
+ params.put("ypos", ypos);
return new PluginParameters(params);
}