aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2011-04-17 02:36:14 +0800
committerGustavo Noronha Silva <gns@gnome.org>2011-04-18 02:00:34 +0800
commit44fe7350b9c253d974b050d49c6f88b3d4ef8bdb (patch)
tree80554340c47cf2c6c3f86ed561fd61e22af97613 /embed
parentd436a108f1c30a5f937df2b05a5e5cbdf12b4d0a (diff)
downloadgsoc2013-epiphany-44fe7350b9c253d974b050d49c6f88b3d4ef8bdb.tar
gsoc2013-epiphany-44fe7350b9c253d974b050d49c6f88b3d4ef8bdb.tar.gz
gsoc2013-epiphany-44fe7350b9c253d974b050d49c6f88b3d4ef8bdb.tar.bz2
gsoc2013-epiphany-44fe7350b9c253d974b050d49c6f88b3d4ef8bdb.tar.lz
gsoc2013-epiphany-44fe7350b9c253d974b050d49c6f88b3d4ef8bdb.tar.xz
gsoc2013-epiphany-44fe7350b9c253d974b050d49c6f88b3d4ef8bdb.tar.zst
gsoc2013-epiphany-44fe7350b9c253d974b050d49c6f88b3d4ef8bdb.zip
Better behaviour when openning new windows that are resized as tabs
When a new window is opened and given a specific size and position by javascript, the request should only be respected if the new window is being opened stand alone, and considered a popup. This fixes bad behaviour observed when the new window became a tab on an existing window and messed with its size. Bug #612155
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-prefs.c1
-rw-r--r--embed/ephy-embed.c39
2 files changed, 39 insertions, 1 deletions
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index 23a07a470..3b035ab88 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -484,7 +484,6 @@ ephy_embed_prefs_init (void)
"enable-default-context-menu", FALSE,
"enable-site-specific-quirks", TRUE,
"enable-page-cache", TRUE,
- "auto-resize-window", TRUE,
"enable-developer-extras", TRUE,
NULL);
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index f41dc39ca..130abdc71 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -456,6 +456,35 @@ status_message_notify_cb (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed
}
static void
+window_resize_requested (WebKitWebWindowFeatures *features, GParamSpec *pspec, EphyEmbed *embed)
+{
+ GtkWidget *window;
+ gboolean is_popup;
+ const char *property_name;
+ int width, height;
+
+ window = gtk_widget_get_toplevel (GTK_WIDGET (embed));
+ if (!window || !gtk_widget_is_toplevel (window))
+ return;
+
+ g_object_get (window, "is-popup", &is_popup, NULL);
+ if (!is_popup)
+ return;
+
+ property_name = g_param_spec_get_name (pspec);
+
+ if (g_str_equal (property_name, "x") || g_str_equal (property_name, "y")) {
+ int x, y;
+ g_object_get (features, "x", &x, "y", &y, NULL);
+ gtk_window_move (GTK_WINDOW (window), x, y);
+ return;
+ }
+
+ g_object_get (features, "width", &width, "height", &height, NULL);
+ gtk_window_resize (GTK_WINDOW (window), width, height);
+}
+
+static void
ephy_embed_constructed (GObject *object)
{
EphyEmbed *embed = (EphyEmbed*)object;
@@ -463,6 +492,7 @@ ephy_embed_constructed (GObject *object)
GtkWidget *scrolled_window;
GtkWidget *paned;
WebKitWebView *web_view;
+ WebKitWebWindowFeatures *window_features;
WebKitWebInspector *inspector;
GtkWidget *overlay;
GtkWidget *frame;
@@ -523,6 +553,15 @@ ephy_embed_constructed (GObject *object)
"signal::notify::status-message", G_CALLBACK (status_message_notify_cb), embed,
NULL);
+ /* Window features */
+ window_features = webkit_web_view_get_window_features (web_view);
+ g_object_connect (window_features,
+ "signal::notify::x", G_CALLBACK (window_resize_requested), embed,
+ "signal::notify::y", G_CALLBACK (window_resize_requested), embed,
+ "signal::notify::width", G_CALLBACK (window_resize_requested), embed,
+ "signal::notify::height", G_CALLBACK (window_resize_requested), embed,
+ NULL);
+
/* The inspector */
embed->priv->inspector_web_view = ephy_web_view_new ();
embed->priv->inspector_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);