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

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 11773007: Add initial support for handling touch events in desktop chrome AURA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 | « ui/views/widget/native_widget_win.cc ('k') | ui/views/win/hwnd_message_handler_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.cc
===================================================================
--- ui/views/win/hwnd_message_handler.cc (revision 175450)
+++ ui/views/win/hwnd_message_handler.cc (working copy)
@@ -295,6 +295,10 @@
// The thickness of an auto-hide taskbar in pixels.
const int kAutoHideTaskbarThicknessPx = 2;
+// The touch id to be used for touch events coming in from Windows Aura
+// Desktop.
+const int kDesktopChromeAuraTouchId = 9;
+
} // namespace
// A scoping class that prevents a window from being able to redraw in response
@@ -1463,6 +1467,12 @@
LRESULT HWNDMessageHandler::OnMouseRange(UINT message,
WPARAM w_param,
LPARAM l_param) {
+#if defined(USE_AURA)
+ // We handle touch events on Windows Aura. Ignore synthesized mouse messages
+ // from Windows.
+ if (!touch_ids_.empty() || ui::IsMouseEventFromTouch(message))
+ return 0;
+#endif
if (message == WM_RBUTTONUP && is_right_mouse_pressed_on_caption_) {
is_right_mouse_pressed_on_caption_ = false;
ReleaseCapture();
@@ -1974,10 +1984,34 @@
if (GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(l_param),
num_points, input.get(), sizeof(TOUCHINPUT))) {
for (int i = 0; i < num_points; ++i) {
- if (input[i].dwFlags & TOUCHEVENTF_DOWN)
+ ui::EventType touch_event_type = ui::ET_UNKNOWN;
+
+ if (input[i].dwFlags & TOUCHEVENTF_DOWN) {
touch_ids_.insert(input[i].dwID);
- if (input[i].dwFlags & TOUCHEVENTF_UP)
+ touch_event_type = ui::ET_TOUCH_PRESSED;
+ } else if (input[i].dwFlags & TOUCHEVENTF_UP) {
touch_ids_.erase(input[i].dwID);
+ touch_event_type = ui::ET_TOUCH_RELEASED;
+ } else if (input[i].dwFlags & TOUCHEVENTF_MOVE) {
+ touch_event_type = ui::ET_TOUCH_MOVED;
+ }
+ // Handle touch events only on Aura for now.
+#if defined(USE_AURA)
+ if (touch_event_type != ui::ET_UNKNOWN) {
+ POINT point;
+ point.x = TOUCH_COORD_TO_PIXEL(input[i].x);
+ point.y = TOUCH_COORD_TO_PIXEL(input[i].y);
+
+ ScreenToClient(hwnd(), &point);
+
+ ui::TouchEvent event(
+ touch_event_type,
+ gfx::Point(point.x, point.y),
+ kDesktopChromeAuraTouchId,
+ base::TimeDelta::FromMilliseconds(input[i].dwTime));
+ delegate_->HandleTouchEvent(event);
+ }
+#endif
}
}
CloseTouchInputHandle(reinterpret_cast<HTOUCHINPUT>(l_param));
« no previous file with comments | « ui/views/widget/native_widget_win.cc ('k') | ui/views/win/hwnd_message_handler_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698