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

Unified Diff: content/browser/renderer_host/render_widget_host_view_win.h

Issue 8341125: Forward Windows touch messages to the renderer (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | « no previous file | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_win.h
===================================================================
--- content/browser/renderer_host/render_widget_host_view_win.h (revision 108760)
+++ content/browser/renderer_host/render_widget_host_view_win.h (working copy)
@@ -141,6 +141,7 @@
MESSAGE_HANDLER(WM_VSCROLL, OnWheelEvent)
MESSAGE_HANDLER(WM_CHAR, OnKeyEvent)
MESSAGE_HANDLER(WM_SYSCHAR, OnKeyEvent)
+ MESSAGE_HANDLER(WM_TOUCH, OnTouchEvent)
MESSAGE_HANDLER(WM_IME_CHAR, OnKeyEvent)
MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate)
MESSAGE_HANDLER(WM_GETOBJECT, OnGetObject)
@@ -247,6 +248,8 @@
UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
LRESULT OnWheelEvent(
UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
+ LRESULT OnTouchEvent(
+ UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled);
LRESULT OnMouseActivate(UINT message,
WPARAM wparam,
LPARAM lparam,
@@ -367,6 +370,43 @@
// true if the View is not visible.
bool is_hidden_;
+ // Wrapper for maintaining touchstate associated with a WebTouchEvent.
+ class WebTouchState {
+ public:
+ explicit WebTouchState(const CWindowImpl* window);
+
+ // Updates the current touchpoint state with the supplied touches.
+ // Touches will be consumed only if they are of the same type (e.g. down,
+ // up, move). Returns the number of consumed touches.
+ size_t UpdateTouchPoints(TOUCHINPUT* points, size_t count);
+
+ // Marks all active touchpoints as released.
+ bool ReleaseTouchPoints();
+
+ // The contained WebTouchEvent.
+ const WebKit::WebTouchEvent& touch_event() { return touch_event_; }
+
+ // Returns if any touches are modified in the event.
+ bool is_changed() { return touch_event_.changedTouchesLength != 0; }
+
+ private:
+ // Adds a touch point or returns NULL if there's not enough space.
+ WebKit::WebTouchPoint* AddTouchPoint(TOUCHINPUT* touch_input);
+
+ // Copy details from a TOUCHINPUT to an existing WebTouchPoint, returning
+ // true if the resulting point is a stationary move.
+ bool UpdateTouchPoint(WebKit::WebTouchPoint* touch_point,
+ TOUCHINPUT* touch_input);
+
+ WebKit::WebTouchEvent touch_event_;
+ const CWindowImpl* const window_;
+ };
+
+ // The touch-state. Its touch-points are updated as necessary. A new
+ // touch-point is added from an TOUCHEVENTF_DOWN message, and a touch-point
+ // is removed from the list on an TOUCHEVENTF_UP message.
+ WebTouchState touch_state_;
+
// True if we're in the midst of a paint operation and should respond to
// DidPaintRect() notifications by merely invalidating. See comments on
// render_widget_host_view.h:DidPaintRect().
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698