aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2008-11-30 03:14:13 +0800
committerXan Lopez <xan@src.gnome.org>2008-11-30 03:14:13 +0800
commit06eb49ff9adc6a5038abe630da95ffa2f99d91a9 (patch)
treea25458b777305db378f2998beaeb58f1be7f919d /src
parent1c6fdb2761de494f6ce4c6cd2e2e57c03827c88f (diff)
downloadgsoc2013-epiphany-06eb49ff9adc6a5038abe630da95ffa2f99d91a9.tar.gz
gsoc2013-epiphany-06eb49ff9adc6a5038abe630da95ffa2f99d91a9.tar.zst
gsoc2013-epiphany-06eb49ff9adc6a5038abe630da95ffa2f99d91a9.zip
window: zoom in/out with ctrl+scroll-{up,down}
We connect to the scroll-event of the view directly because GtkScrolledWindow eats all the GdkEventScroll it gets without checking the modifier keys mask, making it impossible to set-up our own handler for scroll-event. svn path=/trunk/; revision=8619
Diffstat (limited to 'src')
-rw-r--r--src/ephy-window.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index d047aa462..a3ccffbdf 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -883,6 +883,24 @@ menubar_deactivate_cb (GtkWidget *menubar,
}
static gboolean
+scroll_event_cb (GtkWidget *widget,
+ GdkEventScroll *event,
+ EphyWindow *window)
+{
+ guint modifier = event->state & gtk_accelerator_get_default_mod_mask ();
+
+ if (modifier != GDK_CONTROL_MASK)
+ return FALSE;
+
+ if (event->direction == GDK_SCROLL_UP)
+ ephy_window_set_zoom (window, ZOOM_IN);
+ else if (event->direction == GDK_SCROLL_DOWN)
+ ephy_window_set_zoom (window, ZOOM_OUT);
+
+ return TRUE;
+}
+
+static gboolean
ephy_window_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
@@ -2412,6 +2430,9 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed)
g_signal_handlers_disconnect_by_func (web_view,
G_CALLBACK (sync_tab_zoom),
window);
+ g_signal_handlers_disconnect_by_func (web_view,
+ G_CALLBACK (scroll_event_cb),
+ window);
g_signal_handlers_disconnect_by_func (embed,
G_CALLBACK (sync_tab_popup_windows),
@@ -2484,6 +2505,15 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed)
g_signal_connect_object (web_view, "notify::zoom-level",
G_CALLBACK (sync_tab_zoom),
window, 0);
+ /* FIXME: we should set our own handler for
+ scroll-event, but right now it's pointless because
+ GtkScrolledWindow will eat all the events, even
+ those with modifier keys we want to catch to zoom
+ in and out. See bug #562630
+ */
+ g_signal_connect_object (web_view, "scroll-event",
+ G_CALLBACK (scroll_event_cb),
+ window, 0);
g_signal_connect_object (embed, "notify::hidden-popup-count",
G_CALLBACK (sync_tab_popup_windows),