Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: chrome/browser/tab_contents/web_contents_view_gtk.cc

Issue 28105: Implement accelerators in the gtk port. (Closed)
Patch Set: Fixes for evanm Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/web_contents_view_gtk.cc
diff --git a/chrome/browser/tab_contents/web_contents_view_gtk.cc b/chrome/browser/tab_contents/web_contents_view_gtk.cc
index c63d2bfd969f72a593d656459282d1e8c6ae6438..8a2538183822c06969d5c65df8638f86747ae997 100644
--- a/chrome/browser/tab_contents/web_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/web_contents_view_gtk.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/tab_contents/web_contents_view_gtk.h"
+#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "base/gfx/point.h"
@@ -12,6 +13,8 @@
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
#include "chrome/browser/tab_contents/web_contents.h"
+#include "webkit/glue/webinputevent.h"
+
namespace {
// Callback used in WebContentsViewGtk::CreateViewForWidget().
@@ -116,11 +119,25 @@ void WebContentsViewGtk::TakeFocus(bool reverse) {
}
void WebContentsViewGtk::HandleKeyboardEvent(const WebKeyboardEvent& 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();
+ // 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.gdk_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.gdk_keyval,
+ GdkModifierType(event.gdk_modifier));
+ }
Avi (use Gerrit) 2009/02/25 22:38:40 No. Handling random crap that the renderer sends b
}
void WebContentsViewGtk::OnFindReply(int request_id,

Powered by Google App Engine
This is Rietveld 408576698