Index: chrome/browser/renderer_host/render_widget_host_view_gtk.cc |
=================================================================== |
--- chrome/browser/renderer_host/render_widget_host_view_gtk.cc (revision 20762) |
+++ chrome/browser/renderer_host/render_widget_host_view_gtk.cc (working copy) |
@@ -72,8 +72,10 @@ |
G_CALLBACK(ButtonPressReleaseEvent), host_view); |
g_signal_connect(widget, "motion-notify-event", |
G_CALLBACK(MouseMoveEvent), host_view); |
- g_signal_connect(widget, "scroll-event", |
- G_CALLBACK(MouseScrollEvent), host_view); |
+ // Connect after so that we are called after the handler installed by the |
+ // TabContentsView which handles zoom events. |
+ g_signal_connect_after(widget, "scroll-event", |
+ G_CALLBACK(MouseScrollEvent), host_view); |
// Create a GtkIMContext instance and attach its signal handlers. |
host_view->im_context_ = gtk_im_multicontext_new(); |
@@ -291,6 +293,16 @@ |
static gboolean MouseScrollEvent(GtkWidget* widget, GdkEventScroll* event, |
RenderWidgetHostViewGtk* host_view) { |
+ // If the user is holding shift, translate it into a horizontal scroll. We |
+ // don't care what other modifiers the user may be holding (zooming is |
+ // handled at the TabContentsView level). |
+ if (event->state & GDK_SHIFT_MASK) { |
+ if (event->direction == GDK_SCROLL_UP) |
+ event->direction = GDK_SCROLL_LEFT; |
+ else if (event->direction == GDK_SCROLL_DOWN) |
+ event->direction = GDK_SCROLL_RIGHT; |
+ } |
+ |
host_view->GetRenderWidgetHost()->ForwardWheelEvent( |
WebInputEventFactory::mouseWheelEvent(event)); |
return FALSE; |