diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2013-01-07 21:58:38 -0800 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2013-01-19 16:02:28 -0800 |
commit | 7f118657d7e821471b454d459fbdd73e676151d5 (patch) | |
tree | e7509e00472a9ce5038793addc4ffd6782e08869 | |
parent | 21ec36947ab900ac4a7ab8793890fc9282f9a474 (diff) |
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.
-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; } |