[epiphany/mcatanzaro/scroll-zoom] Zoom on ctrl+scroll
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/scroll-zoom] Zoom on ctrl+scroll
- Date: Wed, 12 Dec 2018 20:11:21 +0000 (UTC)
commit 5b129c5b4ff5553298e2586001c56ceab3d42402
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Wed Dec 12 14:08:09 2018 -0600
Zoom on ctrl+scroll
Somebody noticed that holding Ctrl and scrolling does not cause the web
view to zoom in and out like on other browsers. Implement it.
I have one reservation with this: the zoom increments are too large.
Firefox zooms by 10% for each scroll event. Ours is 25%. We should
reconsider this.
src/ephy-window.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 8211673de..0e5cf9c77 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -600,6 +600,31 @@ ephy_window_delete_event (GtkWidget *widget,
return FALSE;
}
+static gboolean
+ephy_window_scroll_event (GtkWidget *window,
+ GdkEventScroll *event)
+{
+ GAction *action;
+ GActionGroup *action_group;
+ const char *action_name;
+
+ if ((event->state & gtk_accelerator_get_default_mod_mask ()) != GDK_CONTROL_MASK)
+ return GDK_EVENT_PROPAGATE;
+
+ if (event->direction == GDK_SCROLL_UP)
+ action_name = "zoom-in";
+ else if (event->direction == GDK_SCROLL_DOWN)
+ action_name = "zoom-out";
+ else
+ return GDK_EVENT_PROPAGATE;
+
+ action_group = gtk_widget_get_action_group (window, "win");
+ action = g_action_map_lookup_action (G_ACTION_MAP (action_group), action_name);
+ g_action_activate (action, NULL);
+
+ return GDK_EVENT_STOP;
+}
+
#define MAX_SPELL_CHECK_GUESSES 4
static void
@@ -3415,6 +3440,7 @@ ephy_window_class_init (EphyWindowClass *klass)
widget_class->show = ephy_window_show;
widget_class->destroy = ephy_window_destroy;
widget_class->delete_event = ephy_window_delete_event;
+ widget_class->scroll_event = ephy_window_scroll_event;
g_object_class_override_property (object_class,
PROP_ACTIVE_CHILD,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]