diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2012-05-30 19:02:33 +0800 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2012-06-25 18:19:47 +0800 |
commit | bd89147c9cf4df8fdc1cd2757a86f03f197a1862 (patch) | |
tree | 9275247f47d3933d3605dbfd2167dd2072b3e663 /embed | |
parent | 85a2991c85929be430cc9252adce98185e33c5be (diff) | |
download | gsoc2013-epiphany-bd89147c9cf4df8fdc1cd2757a86f03f197a1862.tar gsoc2013-epiphany-bd89147c9cf4df8fdc1cd2757a86f03f197a1862.tar.gz gsoc2013-epiphany-bd89147c9cf4df8fdc1cd2757a86f03f197a1862.tar.bz2 gsoc2013-epiphany-bd89147c9cf4df8fdc1cd2757a86f03f197a1862.tar.lz gsoc2013-epiphany-bd89147c9cf4df8fdc1cd2757a86f03f197a1862.tar.xz gsoc2013-epiphany-bd89147c9cf4df8fdc1cd2757a86f03f197a1862.tar.zst gsoc2013-epiphany-bd89147c9cf4df8fdc1cd2757a86f03f197a1862.zip |
Add support for new windows in WebKit2
https://bugzilla.gnome.org/show_bug.cgi?id=678593
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed.c | 35 | ||||
-rw-r--r-- | embed/ephy-web-view.c | 14 |
2 files changed, 43 insertions, 6 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index fb27e4710..6cff6c0ee 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -648,7 +648,27 @@ status_message_notify_cb (EphyWebView *view, GParamSpec *pspec, EphyEmbed *embed } #ifdef HAVE_WEBKIT2 -/* TODO: WebKitWindowProperties */ +static void +window_geometry_changed (WebKitWindowProperties *properties, GParamSpec *pspec, EphyEmbed *embed) +{ + GtkWidget *window; + gboolean is_popup; + GdkRectangle geometry; + + 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; + + webkit_window_properties_get_geometry (properties, &geometry); + if (geometry.x >= 0 && geometry.y >= 0) + gtk_window_move (GTK_WINDOW (window), geometry.x, geometry.y); + if (geometry.width > 0 && geometry.height > 0) + gtk_window_resize (GTK_WINDOW (window), geometry.width, geometry.height); +} #else static void window_resize_requested (WebKitWebWindowFeatures *features, GParamSpec *pspec, EphyEmbed *embed) @@ -735,8 +755,13 @@ ephy_embed_constructed (GObject *object) #endif GtkWidget *paned; WebKitWebView *web_view; -#ifndef HAVE_WEBKIT2 +#ifdef HAVE_WEBKIT2 + WebKitWindowProperties *window_properties; +#else WebKitWebWindowFeatures *window_features; +#endif +#ifndef HAVE_WEBKIT2 + /* TODO: Inspector */ WebKitWebInspector *inspector; #endif GtkWidget *overlay; @@ -832,7 +857,11 @@ ephy_embed_constructed (GObject *object) #endif #ifdef HAVE_WEBKIT2 - /* TODO: WebKitWindowProperties */ + /* Window properties */ + window_properties = webkit_web_view_get_window_properties (web_view); + g_signal_connect (window_properties, "notify::geometry", + G_CALLBACK (window_geometry_changed), + embed); #else /* Window features */ window_features = webkit_web_view_get_window_features (web_view); diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 93f79aa90..220bc7052 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -2521,11 +2521,15 @@ load_error_cb (WebKitWebView *web_view, } #ifdef HAVE_WEBKIT2 -/* TODO: WebKitWebView::close */ +static void +close_web_view_cb (WebKitWebView *web_view, + gpointer user_data) + #else static gboolean close_web_view_cb (WebKitWebView *web_view, gpointer user_data) +#endif { GtkWidget *widget = gtk_widget_get_toplevel (GTK_WIDGET (web_view)); @@ -2537,9 +2541,11 @@ close_web_view_cb (WebKitWebView *web_view, else gtk_widget_destroy (widget); +#ifndef HAVE_WEBKIT2 return TRUE; -} #endif +} + static void zoom_changed_cb (WebKitWebView *web_view, @@ -2662,7 +2668,9 @@ ephy_web_view_init (EphyWebView *web_view) #endif #ifdef HAVE_WEBKIT2 - /* TODO: WebKitWebView::close */ + g_signal_connect (web_view, "close", + G_CALLBACK (close_web_view_cb), + NULL); #else g_signal_connect (web_view, "close-web-view", G_CALLBACK (close_web_view_cb), |