mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Add new call to OnKeyEvent() to allow handling of keyboard events before they're passed to the renderer (issue #406).
- Windows: only scroll with middle mouse button when the cursor is over the view (issue #410). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@356 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -168,21 +168,7 @@ class WebWidgetHostGtkWidget {
|
||||
static gboolean HandleKeyPress(GtkWidget* widget,
|
||||
GdkEventKey* event,
|
||||
WebWidgetHost* host) {
|
||||
host->webwidget()->handleInputEvent(
|
||||
WebInputEventFactory::keyboardEvent(event));
|
||||
|
||||
// In the browser we do a ton of work with IMEs. This is some minimal
|
||||
// code to make basic text work in test_shell, but doesn't cover IME.
|
||||
// This is a copy of the logic in ProcessUnfilteredKeyPressEvent in
|
||||
// render_widget_host_view_gtk.cc .
|
||||
if (event->type == GDK_KEY_PRESS) {
|
||||
WebKeyboardEvent wke = WebInputEventFactory::keyboardEvent(event);
|
||||
if (wke.text[0]) {
|
||||
wke.type = WebKit::WebInputEvent::Char;
|
||||
host->webwidget()->handleInputEvent(wke);
|
||||
}
|
||||
}
|
||||
|
||||
host->KeyEvent(event);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -523,3 +509,20 @@ void WebWidgetHost::ResetTooltip()
|
||||
{
|
||||
// TODO(port): Implement this method as part of tooltip support.
|
||||
}
|
||||
|
||||
void WebWidgetHost::KeyEvent(GdkEventKey* event)
|
||||
{
|
||||
WebKeyboardEvent keyboard_event(WebInputEventFactory::keyboardEvent(event));
|
||||
last_key_event_ = keyboard_event;
|
||||
webwidget()->handleInputEvent(keyboard_event);
|
||||
|
||||
// In the browser we do a ton of work with IMEs. This is some minimal
|
||||
// code to make basic text work in test_shell, but doesn't cover IME.
|
||||
// This is a copy of the logic in ProcessUnfilteredKeyPressEvent in
|
||||
// render_widget_host_view_gtk.cc .
|
||||
if (event->type == GDK_KEY_PRESS && keyboard_event.text[0]) {
|
||||
keyboard_event.type = WebKit::WebInputEvent::Char;
|
||||
last_key_event_ = keyboard_event;
|
||||
webwidget()->handleInputEvent(keyboard_event);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user