Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: webkit/api/src/win/WebInputEventFactory.cpp

Issue 115330: linux: Adding events to windowless plugins on Linux (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/api/src/mac/WebInputEventFactory.mm ('k') | webkit/glue/event_conversion.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/api/src/win/WebInputEventFactory.cpp
===================================================================
--- webkit/api/src/win/WebInputEventFactory.cpp (revision 16673)
+++ webkit/api/src/win/WebInputEventFactory.cpp (working copy)
@@ -91,6 +91,12 @@
{
WebKeyboardEvent result;
+ // TODO(pkasting): http://b/1117926 Are we guaranteed that the message that
+ // GetMessageTime() refers to is the same one that we're passed in? Perhaps
+ // one of the construction parameters should be the time passed by the
+ // caller, who would know for sure.
+ result.timeStampSeconds = GetMessageTime() / 1000.0;
+
result.windowsKeyCode = result.nativeKeyCode = static_cast<int>(wparam);
switch (message) {
@@ -130,6 +136,8 @@
result.modifiers |= WebInputEvent::ControlKey;
if (GetKeyState(VK_MENU) & 0x8000)
result.modifiers |= WebInputEvent::AltKey;
+ // NOTE: There doesn't seem to be a way to query the mouse button state in
+ // this case.
if (LOWORD(lparam) > 1)
result.modifiers |= WebInputEvent::IsAutoRepeat;
@@ -222,6 +230,8 @@
result.x = static_cast<short>(LOWORD(lparam));
result.y = static_cast<short>(HIWORD(lparam));
+ result.windowX = result.x;
+ result.windowY = result.y;
POINT globalPoint = { result.x, result.y };
ClientToScreen(hwnd, &globalPoint);
@@ -272,6 +282,12 @@
result.modifiers |= WebInputEvent::ShiftKey;
if (GetKeyState(VK_MENU) & 0x8000)
result.modifiers |= WebInputEvent::AltKey;
+ if (wparam & MK_LBUTTON)
+ result.modifiers |= WebInputEvent::LeftButtonDown;
+ if (wparam & MK_MBUTTON)
+ result.modifiers |= WebInputEvent::MiddleButtonDown;
+ if (wparam & MK_RBUTTON)
+ result.modifiers |= WebInputEvent::RightButtonDown;
return result;
}
@@ -284,6 +300,13 @@
WebMouseWheelEvent result; //(WebInputEvent::Uninitialized());
result.type = WebInputEvent::MouseWheel;
+
+ // TODO(pkasting): http://b/1117926 Are we guaranteed that the message that
+ // GetMessageTime() refers to is the same one that we're passed in? Perhaps
+ // one of the construction parameters should be the time passed by the
+ // caller, who would know for sure.
+ result.timeStampSeconds = GetMessageTime() / 1000.0;
+
result.button = WebMouseEvent::ButtonNone;
// Get key state, coordinates, and wheel delta from event.
@@ -302,6 +325,8 @@
keyState |= MK_SHIFT;
if (getKeyState(VK_CONTROL))
keyState |= MK_CONTROL;
+ // NOTE: There doesn't seem to be a way to query the mouse button state
+ // in this case.
POINT cursorPosition = {0};
GetCursorPos(&cursorPosition);
@@ -354,12 +379,20 @@
result.modifiers |= WebInputEvent::ControlKey;
if (getKeyState(VK_MENU) & 0x8000)
result.modifiers |= WebInputEvent::AltKey;
+ if (keyState & MK_LBUTTON)
+ result.modifiers |= WebInputEvent::LeftButtonDown;
+ if (keyState & MK_MBUTTON)
+ result.modifiers |= WebInputEvent::MiddleButtonDown;
+ if (keyState & MK_RBUTTON)
+ result.modifiers |= WebInputEvent::RightButtonDown;
// Set coordinates by translating event coordinates from screen to client.
POINT clientPoint = { result.globalX, result.globalY };
MapWindowPoints(NULL, hwnd, &clientPoint, 1);
result.x = clientPoint.x;
result.y = clientPoint.y;
+ result.windowX = result.x;
+ result.windowY = result.y;
// Convert wheel delta amount to a number of pixels to scroll.
//
« no previous file with comments | « webkit/api/src/mac/WebInputEventFactory.mm ('k') | webkit/glue/event_conversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698