diff options
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/web_contents_view_gtk.cc | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.cc b/chrome/browser/tab_contents/web_contents_view_gtk.cc index 35ca7b1..d90c9ae 100644 --- a/chrome/browser/tab_contents/web_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/web_contents_view_gtk.cc @@ -4,6 +4,8 @@ #include "chrome/browser/tab_contents/web_contents_view_gtk.h" +#include <gdk/gdk.h> +#include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> #include "base/gfx/point.h" @@ -13,6 +15,8 @@ #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/browser/tab_contents/web_contents.h" +#include "webkit/glue/webinputevent.h" + namespace { // Called when the content view gtk widget is tabbed to. We always return true @@ -146,12 +150,28 @@ void WebContentsViewGtk::TakeFocus(bool reverse) { web_contents_->delegate()->SetFocusToLocationBar(); } -void WebContentsViewGtk::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { - // The renderer returned a keyboard event it did not process. This may be - // a keyboard shortcut that we have to process. - // The windows code forwards this event onwards to accelerator handling, - // and then to DefWindowProc. TODO(port): should do something similar. - NOTIMPLEMENTED(); + +void WebContentsViewGtk::HandleKeyboardEvent( + const NativeWebKeyboardEvent& event) { + // The renderer returned a keyboard event it did not process. This may be a + // keyboard shortcut that we have to process or a cursor key/page up/down + // etc. + switch (event.os_event->keyval) { + case GDK_Page_Up: + case GDK_Page_Down: + case GDK_Left: + case GDK_Right: + case GDK_Up: + case GDK_Down: + NOTIMPLEMENTED() + << "Need better navigation support in HandleKeyboardEvent"; + break; + default: + // This may be an accelerator. Pass it on to GTK. + gtk_accel_groups_activate(G_OBJECT(vbox_->window), + event.os_event->keyval, + GdkModifierType(event.os_event->state)); + } } void WebContentsViewGtk::OnFindReply(int request_id, |