Commit c5067907 authored by vestbo@webkit.org's avatar vestbo@webkit.org

2008-10-06 Tor Arne Vestbø <tavestbo@trolltech.com>

        Reviewed by Simon.

        Add native virtual keycode to PlatformKeyboardEvent

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 89d13717
2008-10-06 Tor Arne Vestbø <tavestbo@trolltech.com>
Reviewed by Simon.
Add native virtual keycode to PlatformKeyboardEvent
* platform/PlatformKeyboardEvent.h:
* platform/gtk/KeyEventGtk.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/mac/KeyEventMac.mm:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/qt/PlatformKeyboardEventQt.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/win/KeyEventWin.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/wx/KeyboardEventWx.cpp:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
2008-10-06 Tor Arne Vestbø <tavestbo@trolltech.com>
Reviewed by Simon.
......
......@@ -105,6 +105,9 @@ namespace WebCore {
int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
void setWindowsVirtualKeyCode(int code) { m_windowsVirtualKeyCode = code; }
int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; }
void setNativeVirtualKeyCode(int code) { m_nativeVirtualKeyCode = code; }
String keyIdentifier() const { return m_keyIdentifier; }
bool isAutoRepeat() const { return m_autoRepeat; }
void setIsAutoRepeat(bool in) { m_autoRepeat = in; }
......@@ -153,6 +156,7 @@ namespace WebCore {
String m_keyIdentifier;
bool m_autoRepeat;
int m_windowsVirtualKeyCode;
int m_nativeVirtualKeyCode;
bool m_isKeypad;
bool m_shiftKey;
bool m_ctrlKey;
......
......@@ -503,6 +503,7 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(GdkEventKey* event)
, m_keyIdentifier(keyIdentifierForGdkKeyCode(event->keyval))
, m_autoRepeat(false)
, m_windowsVirtualKeyCode(windowsKeyCodeForKeyEvent(event->keyval))
, m_nativeVirtualKeyCode(event->keyval)
, m_isKeypad(event->keyval >= GDK_KP_Space && event->keyval <= GDK_KP_9)
, m_shiftKey((event->state & GDK_SHIFT_MASK) || (event->keyval == GDK_3270_BackTab))
, m_ctrlKey(event->state & GDK_CONTROL_MASK)
......
......@@ -815,6 +815,7 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(NSEvent *event)
, m_keyIdentifier(keyIdentifierForKeyEvent(event))
, m_autoRepeat(([event type] != NSFlagsChanged) && [event isARepeat])
, m_windowsVirtualKeyCode(windowsKeyCodeForKeyEvent(event))
, m_nativeVirtualKeyCode([event keyCode])
, m_isKeypad(isKeypadEvent(event))
, m_shiftKey([event modifierFlags] & NSShiftKeyMask)
, m_ctrlKey([event modifierFlags] & NSControlKeyMask)
......
......@@ -446,6 +446,7 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(QKeyEvent* event)
m_altKey = (state & Qt::AltModifier) != 0;
m_metaKey = (state & Qt::MetaModifier) != 0;
m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event->key());
m_nativeVirtualKeyCode = event->nativeVirtualKey();
m_isKeypad = (state & Qt::KeypadModifier) != 0;
m_shiftKey = (state & Qt::ShiftModifier) != 0 || event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab
m_qtEvent = event;
......
......@@ -193,6 +193,7 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(HWND, WPARAM code, LPARAM keyData,
, m_keyIdentifier((type == Char) ? String() : keyIdentifierForWindowsKeyCode(code))
, m_autoRepeat(HIWORD(keyData) & KF_REPEAT)
, m_windowsVirtualKeyCode((type == RawKeyDown || type == KeyUp) ? code : 0)
, m_nativeVirtualKeyCode(m_windowsVirtualKeyCode)
, m_isKeypad(isKeypadEvent(code, keyData, type))
, m_shiftKey(GetKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT)
, m_ctrlKey(GetKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT)
......
......@@ -341,6 +341,7 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(wxKeyEvent& event)
}
m_autoRepeat = false; // FIXME: not correct.
m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event.GetKeyCode());
m_nativeVirtualKeyCode = event.GetKeyCode();
m_isKeypad = (event.GetKeyCode() >= WXK_NUMPAD_SPACE) && (event.GetKeyCode() <= WXK_NUMPAD_DIVIDE);
m_shiftKey = event.ShiftDown();
m_ctrlKey = event.CmdDown();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment