Commit 44fe7350 authored by Gustavo Noronha Silva's avatar Gustavo Noronha Silva

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
parent d436a108
......@@ -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,
......@@ -455,6 +455,35 @@ status_message_notify_cb (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed
ephy_embed_statusbar_push (embed, priv->tab_message_id, message);
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))
g_object_get (window, "is-popup", &is_popup, NULL);
if (!is_popup)
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);
g_object_get (features, "width", &width, "height", &height, NULL);
gtk_window_resize (GTK_WINDOW (window), width, height);
static void
ephy_embed_constructed (GObject *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,
/* 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,
/* The inspector */
embed->priv->inspector_web_view = ephy_web_view_new ();
embed->priv->inspector_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment