aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/icedteanp/IcedTeaNPPlugin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/icedteanp/IcedTeaNPPlugin.cc')
-rw-r--r--plugin/icedteanp/IcedTeaNPPlugin.cc53
1 files changed, 43 insertions, 10 deletions
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);