summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-07 01:03:48 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-07 01:03:48 +0000
commit70801a56ae3169b7aa28328a3a52dd6f7872c2f4 (patch)
tree5879671f91f1a1d9d5716f22f546114afe9d50f5 /webkit/tools/test_shell
parentae78b256715d34337a126ea6912f9b61439060e3 (diff)
downloadchromium_src-70801a56ae3169b7aa28328a3a52dd6f7872c2f4.zip
chromium_src-70801a56ae3169b7aa28328a3a52dd6f7872c2f4.tar.gz
chromium_src-70801a56ae3169b7aa28328a3a52dd6f7872c2f4.tar.bz2
Some basic keyboard and focus support.
Review URL: http://codereview.chromium.org/9626 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4944 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell')
-rw-r--r--webkit/tools/test_shell/gtk/webwidget_host.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/webkit/tools/test_shell/gtk/webwidget_host.cc b/webkit/tools/test_shell/gtk/webwidget_host.cc
index f89f5f9..eb324d8 100644
--- a/webkit/tools/test_shell/gtk/webwidget_host.cc
+++ b/webkit/tools/test_shell/gtk/webwidget_host.cc
@@ -44,6 +44,17 @@ gboolean KeyPressReleaseEvent(GtkWidget* widget, GdkEventKey* event,
DLOG(INFO) << " -- Key press or release";
WebKeyboardEvent wke(event);
host->webwidget()->HandleInputEvent(&wke);
+
+ // The WebKeyboardEvent model, when holding down a key, is:
+ // KEY_DOWN, CHAR, (repeated CHAR as key repeats,) KEY_UP
+ // The GDK model for the same sequence is just:
+ // KEY_PRESS, (repeated KEY_PRESS as key repeats,) KEY_RELEASE
+ // So we must simulate a CHAR event for every key press.
+ if (event->type == GDK_KEY_PRESS) {
+ wke.type = WebKeyboardEvent::CHAR;
+ host->webwidget()->HandleInputEvent(&wke);
+ }
+
return FALSE;
}
@@ -96,7 +107,7 @@ gfx::WindowHandle WebWidgetHost::CreateWindow(gfx::WindowHandle box,
GDK_BUTTON_RELEASE_MASK |
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK);
- // TODO(agl): set GTK_CAN_FOCUS flag
+ GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
g_signal_connect(widget, "configure-event", G_CALLBACK(ConfigureEvent), host);
g_signal_connect(widget, "expose-event", G_CALLBACK(ExposeEvent), host);
g_signal_connect(widget, "destroy-event", G_CALLBACK(DestroyEvent), host);