summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 21:36:35 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 21:36:35 +0000
commiteb855d86a3eeaa1b6fc4940d2eb303a927dd8e6f (patch)
tree3e8295dc7b5296e0a47d4595acda197470b60ec4
parent6322c471382ebb52b1fa47ad83ff629bff9d4672 (diff)
downloadchromium_src-eb855d86a3eeaa1b6fc4940d2eb303a927dd8e6f.zip
chromium_src-eb855d86a3eeaa1b6fc4940d2eb303a927dd8e6f.tar.gz
chromium_src-eb855d86a3eeaa1b6fc4940d2eb303a927dd8e6f.tar.bz2
GTK: Add some missing hotkeys.
There doesn't seem to be a platform default behavior for shift+scroll (for native apps like epiphany and gedit it vertically scrolls, and for firefox it navigates the back/forward list). Likewise I can't find any default way to get gnome to send a horiztonal scroll event except by having a horiztonal scrollwheel (like on a trackpad or fancy mouse). Also it seems like the direction ought to switch for RTL-encoded pages, but this doesn't appear to happen in windows. Also, fix bug where a ctrl+scroll would scroll AND zoom (which you can test by scrolling to the top of the page then pressing ctrl+down wheel). BUG=16792 TEST=horizontally scroll via shift + Scrollwheel Review URL: http://codereview.chromium.org/149729 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21010 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index 7980dffd..2fb35b4 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -38,6 +38,7 @@ class RenderWidgetHostViewGtkWidget {
GtkWidget* widget = gtk_fixed_new();
gtk_fixed_set_has_window(GTK_FIXED(widget), TRUE);
gtk_widget_set_double_buffered(widget, FALSE);
+ gtk_widget_set_redraw_on_allocate(widget, FALSE);
#if defined(NDEBUG)
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &gfx::kGdkWhite);
#else
@@ -72,8 +73,10 @@ class RenderWidgetHostViewGtkWidget {
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();
@@ -98,6 +101,7 @@ class RenderWidgetHostViewGtkWidget {
static gboolean ExposeEvent(GtkWidget* widget, GdkEventExpose* expose,
RenderWidgetHostViewGtk* host_view) {
+ NOTIMPLEMENTED() << " paint " << expose->area.width << " " << expose->area.height;
const gfx::Rect damage_rect(expose->area);
host_view->Paint(damage_rect);
return FALSE;
@@ -291,6 +295,16 @@ class RenderWidgetHostViewGtkWidget {
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;