diff options
-rw-r--r-- | src/evbp.c | 29 |
1 files changed, 14 insertions, 15 deletions
@@ -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; } |