summaryrefslogtreecommitdiffstats
path: root/webkit/api/src/gtk/WebInputEventFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/api/src/gtk/WebInputEventFactory.cpp')
-rw-r--r--webkit/api/src/gtk/WebInputEventFactory.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/webkit/api/src/gtk/WebInputEventFactory.cpp b/webkit/api/src/gtk/WebInputEventFactory.cpp
index 9939523..27298bd 100644
--- a/webkit/api/src/gtk/WebInputEventFactory.cpp
+++ b/webkit/api/src/gtk/WebInputEventFactory.cpp
@@ -190,6 +190,15 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(const GdkEventKey* event)
ASSERT_NOT_REACHED();
}
+ // According to MSDN:
+ // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx
+ // Key events with Alt modifier and F10 are system key events.
+ // We just emulate this behavior. It's necessary to prevent webkit from
+ // processing keypress event generated by alt-d, etc.
+ // F10 is not special on Linux, so don't treat it as system key.
+ if (result.modifiers & WebInputEvent::AltKey)
+ result.isSystemKey = true;
+
// The key code tells us which physical key was pressed (for example, the
// A key went down or up). It does not determine whether A should be lower
// or upper case. This is what text does, which should be the keyval.
@@ -207,6 +216,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(const GdkEventKey* event)
default:
// This should set text to 0 when it's not a real character.
// FIXME: fix for non BMP chars
+ // TODO(james.su@gmail.com):
+ // Support control characters input like Windows.
+ // See: http://en.wikipedia.org/wiki/Control_characters
result.unmodifiedText[0] = result.text[0] =
static_cast<WebUChar>(gdk_keyval_to_unicode(event->keyval));
}
@@ -233,6 +245,16 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(wchar_t character, int stat
result.nativeKeyCode = character;
result.text[0] = character;
result.unmodifiedText[0] = character;
+
+ // According to MSDN:
+ // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx
+ // Key events with Alt modifier and F10 are system key events.
+ // We just emulate this behavior. It's necessary to prevent webkit from
+ // processing keypress event generated by alt-d, etc.
+ // F10 is not special on Linux, so don't treat it as system key.
+ if (result.modifiers & WebInputEvent::AltKey)
+ result.isSystemKey = true;
+
return result;
}