aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/icedteanp/IcedTeaNPPlugin.cc
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-31 10:19:48 +0100
committerSven Gothel <[email protected]>2014-01-31 10:19:48 +0100
commitf826663e9609b73783deea475872646242c8abb9 (patch)
tree64f60a686ffae66753bb62b7b135964e9b2fcc83 /plugin/icedteanp/IcedTeaNPPlugin.cc
parentf5a0517ac704b36e3d94aa3d5547ddf95889ab95 (diff)
ITW NPP: Pass window position through all layers, added as 'xpos' and 'ypos' in message and parameters ; ...
- Relative position of window maybe important in regards to overlapping applet windows as well as for an upcoming OSX support. However, client may still need to calculate the location on screen. - Applet3Panel added toString() - Applet3Panel, PluginApplet3Viewer: Better naming for browser notification - appletResize -> browserSizeChanged, etc
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);