From 56a66d5199051672a5887c0120a86f14a463dba7 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Tue, 17 Jun 2008 12:14:38 +0000 Subject: Emit zoom change signal and implement pixel scrolling svn path=/trunk/; revision=8282 --- embed/webkit/webkit-embed.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c index f902d9a76..f5d622fee 100644 --- a/embed/webkit/webkit-embed.c +++ b/embed/webkit/webkit-embed.c @@ -65,6 +65,7 @@ typedef enum struct WebKitEmbedPrivate { WebKitWebView *web_view; + GtkScrolledWindow *scrolled_window; WebKitEmbedLoadState load_state; char *loading_uri; EphyHistory *history; @@ -298,6 +299,7 @@ webkit_embed_init (WebKitEmbed *embed) embed->priv = WEBKIT_EMBED_GET_PRIVATE (embed); sw = gtk_scrolled_window_new (NULL, NULL); + embed->priv->scrolled_window = GTK_SCROLLED_WINDOW (sw); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -443,7 +445,10 @@ static void impl_set_zoom (EphyEmbed *embed, float zoom) { + g_return_if_fail (zoom > 0.0); + g_object_set (WEBKIT_EMBED (embed)->priv->web_view, "zoom-level", zoom, NULL); + g_signal_emit_by_name (embed, "ge_zoom_change", zoom); } static void @@ -463,6 +468,18 @@ impl_scroll_pixels (EphyEmbed *embed, int dx, int dy) { + GtkAdjustment *hadj; + GtkAdjustment *vadj; + WebKitEmbed *wembed = WEBKIT_EMBED (embed); + + hadj = gtk_scrolled_window_get_hadjustment (wembed->priv->scrolled_window); + vadj = gtk_scrolled_window_get_vadjustment (wembed->priv->scrolled_window); + + hadj->value += dx; + vadj->value += dy; + + gtk_adjustment_value_changed (hadj); + gtk_adjustment_value_changed (vadj); } static void -- cgit v1.2.3