From 7f118657d7e821471b454d459fbdd73e676151d5 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 7 Jan 2013 21:58:38 -0800 Subject: Resize plug window rather than returning after initial SetWindow Epiphany seems to like to call SetWindow a lot and depends on the plugin resizing its window appropriately. If the plug already exists, resize it to the requested dimensions rather than just returning even if the dimensions are the same. --- src/evbp.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/evbp.c b/src/evbp.c index 4e77a7a..916ba73 100644 --- a/src/evbp.c +++ b/src/evbp.c @@ -41,7 +41,6 @@ typedef struct evbp_priv { NPP npp; - NPWindow *window; GtkWidget *plug; GtkWidget *viewer; } evbp_priv_t; @@ -184,24 +183,24 @@ static NPError evbp_set_window(NPP instance, NPWindow *window) { evbp_priv_t *priv = instance->pdata; - Window id; g_debug("%s", __func__); - /* If this is the same window we already have, don't create a - new plug */ - if (window == priv->window) { - g_debug("window to set is the same, returning"); - return NPERR_NO_ERROR; + /* Create a plug from the window id or just resize the existing one + * appropriately. */ + if (priv->plug) { + g_debug("resizing existing plug to %ux%u", window->width, + window->height); + gtk_window_resize(GTK_WINDOW(priv->plug), window->width, + window->height); + } else { + Window id = (Window)window->window; + + g_debug("plugging into window id %lu", (unsigned long)id); + priv->plug = gtk_plug_new(id); + gtk_container_add(GTK_CONTAINER(priv->plug), priv->viewer); + gtk_widget_show(priv->plug); } - priv->window = window; - - /* Create a plug from the window id we were told about */ - id = (Window)window->window; - g_debug("plugging into window id %lu", (unsigned long)id); - priv->plug = gtk_plug_new(id); - gtk_container_add(GTK_CONTAINER(priv->plug), priv->viewer); - gtk_widget_show(priv->plug); return NPERR_NO_ERROR; } -- cgit v1.2.3