diff options
Diffstat (limited to 'WebKit/chromium/src/win/WebInputEventFactory.cpp')
-rw-r--r-- | WebKit/chromium/src/win/WebInputEventFactory.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/WebKit/chromium/src/win/WebInputEventFactory.cpp b/WebKit/chromium/src/win/WebInputEventFactory.cpp index d1d5869..c71a3b6 100644 --- a/WebKit/chromium/src/win/WebInputEventFactory.cpp +++ b/WebKit/chromium/src/win/WebInputEventFactory.cpp @@ -86,6 +86,16 @@ static bool isKeyPad(WPARAM wparam, LPARAM lparam) return keypad; } +// Loads the state for toggle keys into the event. +static void SetToggleKeyState(WebInputEvent* event) +{ + // Low bit set from GetKeyState indicates "toggled". + if (::GetKeyState(VK_NUMLOCK) & 1) + event->modifiers |= WebInputEvent::NumLockOn; + if (::GetKeyState(VK_CAPITAL) & 1) + event->modifiers |= WebInputEvent::CapsLockOn; +} + WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { @@ -144,6 +154,7 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message, if (isKeyPad(wparam, lparam)) result.modifiers |= WebInputEvent::IsKeyPad; + SetToggleKeyState(&result); return result; } @@ -289,6 +300,7 @@ WebMouseEvent WebInputEventFactory::mouseEvent(HWND hwnd, UINT message, if (wparam & MK_RBUTTON) result.modifiers |= WebInputEvent::RightButtonDown; + SetToggleKeyState(&result); return result; } @@ -386,6 +398,8 @@ WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(HWND hwnd, UINT message if (keyState & MK_RBUTTON) result.modifiers |= WebInputEvent::RightButtonDown; + SetToggleKeyState(&result); + // Set coordinates by translating event coordinates from screen to client. POINT clientPoint = { result.globalX, result.globalY }; MapWindowPoints(0, hwnd, &clientPoint, 1); |