diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-27 20:49:17 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-27 20:49:17 +0000 |
commit | d5bdab63fd2d7c3195de86d7c9f69b9d91b23beb (patch) | |
tree | 5b93ea49dbc6f1de7069ee89757ce4a541d9a6b9 | |
parent | de894b004fd9c1aa21ed9cbcf13c7fe463714739 (diff) | |
download | chromium_src-d5bdab63fd2d7c3195de86d7c9f69b9d91b23beb.zip chromium_src-d5bdab63fd2d7c3195de86d7c9f69b9d91b23beb.tar.gz chromium_src-d5bdab63fd2d7c3195de86d7c9f69b9d91b23beb.tar.bz2 |
Support multi touch on Windows 8 AURA and ASH.
The touch events coming in from desktop chrome AURA and ASH have hardcoded touch ids
which breaks the gesture recognizer as it is unable to figure out that multiple touch points
are involved.
Fix on desktop Chrome AURA is to use the OS generated touch id mapped to the gesture recognizer range.
For ASH Windows 8 we pass in the mapped touch ids from the metro driver in the touch IPC messages.
Fixes bug https://code.google.com/p/chromium/issues/detail?id=179977
BUG=179977
R=cpu,sky
Review URL: https://codereview.chromium.org/13003004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191015 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.cc | 5 | ||||
-rw-r--r-- | ui/aura/remote_root_window_host_win.cc | 22 | ||||
-rw-r--r-- | ui/aura/remote_root_window_host_win.h | 6 | ||||
-rw-r--r-- | ui/metro_viewer/metro_viewer_messages.h | 15 | ||||
-rw-r--r-- | ui/views/win/hwnd_message_handler.cc | 7 | ||||
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.cc | 23 |
6 files changed, 50 insertions, 28 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index c7d3aff..913e63c 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -67,6 +67,7 @@ #include "ui/gfx/skia_util.h" #if defined(OS_WIN) +#include "base/win/windows_version.h" #include "content/browser/accessibility/browser_accessibility_manager_win.h" #include "content/browser/accessibility/browser_accessibility_win.h" #include "ui/base/win/hidden_window.h" @@ -265,6 +266,10 @@ void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { } bool ShouldSendPinchGesture() { +#if defined(OS_WIN) + if (base::win::GetVersion() >= base::win::VERSION_WIN8) + return true; +#endif static bool pinch_allowed = CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableViewport) || CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePinch); diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc index ae50ced..16cbdb6 100644 --- a/ui/aura/remote_root_window_host_win.cc +++ b/ui/aura/remote_root_window_host_win.cc @@ -27,9 +27,6 @@ namespace { const char* kRootWindowHostWinKey = "__AURA_REMOTE_ROOT_WINDOW_HOST_WIN__"; -// The touch id to be used for touch events coming in from Windows Ash. -const int kRemoteWindowTouchId = 10; - // Sets the keystate for the virtual key passed in to down or up. void SetKeyState(uint8* key_states, bool key_down, uint32 virtual_key_code) { DCHECK(key_states); @@ -373,28 +370,35 @@ void RemoteRootWindowHostWin::OnVisibilityChanged(bool visible) { delegate_->OnHostActivated(); } -void RemoteRootWindowHostWin::OnTouchDown(int32 x, int32 y, uint64 timestamp) { +void RemoteRootWindowHostWin::OnTouchDown(int32 x, + int32 y, + uint64 timestamp, + uint32 pointer_id) { ui::TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::Point(x, y), - kRemoteWindowTouchId, + pointer_id, base::TimeDelta::FromMicroseconds(timestamp)); delegate_->OnHostTouchEvent(&event); } -void RemoteRootWindowHostWin::OnTouchUp(int32 x, int32 y, uint64 timestamp) { +void RemoteRootWindowHostWin::OnTouchUp(int32 x, + int32 y, + uint64 timestamp, + uint32 pointer_id) { ui::TouchEvent event(ui::ET_TOUCH_RELEASED, gfx::Point(x, y), - kRemoteWindowTouchId, + pointer_id, base::TimeDelta::FromMicroseconds(timestamp)); delegate_->OnHostTouchEvent(&event); } void RemoteRootWindowHostWin::OnTouchMoved(int32 x, int32 y, - uint64 timestamp) { + uint64 timestamp, + uint32 pointer_id) { ui::TouchEvent event(ui::ET_TOUCH_MOVED, gfx::Point(x, y), - kRemoteWindowTouchId, + pointer_id, base::TimeDelta::FromMicroseconds(timestamp)); delegate_->OnHostTouchEvent(&event); } diff --git a/ui/aura/remote_root_window_host_win.h b/ui/aura/remote_root_window_host_win.h index 61494ff..eb094b0 100644 --- a/ui/aura/remote_root_window_host_win.h +++ b/ui/aura/remote_root_window_host_win.h @@ -127,9 +127,9 @@ class AURA_EXPORT RemoteRootWindowHostWin : public RootWindowHost { uint32 scan_code, uint32 flags); void OnVisibilityChanged(bool visible); - void OnTouchDown(int32 x, int32 y, uint64 timestamp); - void OnTouchUp(int32 x, int32 y, uint64 timestamp); - void OnTouchMoved(int32 x, int32 y, uint64 timestamp); + void OnTouchDown(int32 x, int32 y, uint64 timestamp, uint32 pointer_id); + void OnTouchUp(int32 x, int32 y, uint64 timestamp, uint32 pointer_id); + void OnTouchMoved(int32 x, int32 y, uint64 timestamp, uint32 pointer_id); void OnFileSaveAsDone(bool success, string16 filename, int filter_index); diff --git a/ui/metro_viewer/metro_viewer_messages.h b/ui/metro_viewer/metro_viewer_messages.h index fd2c5a6..53ee112 100644 --- a/ui/metro_viewer/metro_viewer_messages.h +++ b/ui/metro_viewer/metro_viewer_messages.h @@ -54,18 +54,21 @@ IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_Character, IPC_MESSAGE_CONTROL1(MetroViewerHostMsg_VisibilityChanged, bool /* visible */); -IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_TouchDown, +IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_TouchDown, int32, /* x-coordinate */ int32, /* y-coordinate */ - uint64) /* timestamp */ -IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_TouchUp, + uint64, /* timestamp */ + uint32) /* pointer_id */ +IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_TouchUp, int32, /* x-coordinate */ int32, /* y-coordinate */ - uint64) /* timestamp */ -IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_TouchMoved, + uint64, /* timestamp */ + uint32) /* pointer_id */ +IPC_MESSAGE_CONTROL4(MetroViewerHostMsg_TouchMoved, int32, /* x-coordinate */ int32, /* y-coordinate */ - uint64) /* timestamp */ + uint64, /* timestamp */ + uint32) /* pointer_id */ // Informs the browser of the result of a file save as operation. IPC_MESSAGE_CONTROL3(MetroViewerHostMsg_FileSaveAsDone, diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index dc6632d..e40acd0 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -12,6 +12,7 @@ #include "base/win/windows_version.h" #include "ui/base/events/event.h" #include "ui/base/events/event_utils.h" +#include "ui/base/gestures/gesture_sequence.h" #include "ui/base/keycodes/keyboard_code_conversion_win.h" #include "ui/base/win/hwnd_util.h" #include "ui/base/win/mouse_wheel_util.h" @@ -292,10 +293,6 @@ bool ProcessChildWindowMessage(UINT message, // 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; - // For windows with the standard frame removed, the client area needs to be // different from the window area to avoid a "feature" in Windows's handling of // WM_NCCALCSIZE data. See the comment near the bottom of GetClientAreaInsets @@ -2003,7 +2000,7 @@ LRESULT HWNDMessageHandler::OnTouchEvent(UINT message, ui::TouchEvent event( touch_event_type, gfx::Point(point.x, point.y), - kDesktopChromeAuraTouchId, + input[i].dwID % ui::GestureSequence::kMaxGesturePoints, base::TimeDelta::FromMilliseconds(input[i].dwTime)); delegate_->HandleTouchEvent(event); } diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index 56c9afb..ec59ba1 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -19,6 +19,7 @@ #include "ipc/ipc_channel.h" #include "ipc/ipc_channel_proxy.h" #include "ipc/ipc_sender.h" +#include "ui/base/gestures/gesture_sequence.h" #include "ui/metro_viewer/metro_viewer_messages.h" #include "win8/metro_driver/file_picker_ash.h" #include "win8/metro_driver/metro_driver.h" @@ -145,7 +146,8 @@ class PointerInfoHandler { y_(0), wheel_delta_(0), update_kind_(winui::Input::PointerUpdateKind_Other), - timestamp_(0) {} + timestamp_(0), + pointer_id_(0) {} HRESULT Init(winui::Core::IPointerEventArgs* args) { HRESULT hr = args->get_CurrentPoint(&pointer_point_); @@ -169,10 +171,13 @@ class PointerInfoHandler { hr = properties->get_MouseWheelDelta(&wheel_delta_); if (FAILED(hr)) return hr; - x_ = point.X; y_ = point.Y; pointer_point_->get_Timestamp(×tamp_); + pointer_point_->get_PointerId(&pointer_id_); + // Map the OS touch event id to a range allowed by the gesture recognizer. + if (IsTouch()) + pointer_id_ %= ui::GestureSequence::kMaxGesturePoints; return S_OK; } @@ -218,12 +223,17 @@ class PointerInfoHandler { int x() const { return x_; } int y() const { return y_; } + uint32 pointer_id() const { + return pointer_id_; + } + uint64 timestamp() const { return timestamp_; } private: int x_; int y_; int wheel_delta_; + uint32 pointer_id_; winui::Input::PointerUpdateKind update_kind_; mswr::ComPtr<winui::Input::IPointerPoint> pointer_point_; uint64 timestamp_; @@ -548,7 +558,8 @@ HRESULT ChromeAppViewAsh::OnPointerMoved(winui::Core::ICoreWindow* sender, DCHECK(pointer.IsTouch()); ui_channel_->Send(new MetroViewerHostMsg_TouchMoved(pointer.x(), pointer.y(), - pointer.timestamp())); + pointer.timestamp(), + pointer.pointer_id())); } return S_OK; } @@ -577,7 +588,8 @@ HRESULT ChromeAppViewAsh::OnPointerPressed( DCHECK(pointer.IsTouch()); ui_channel_->Send(new MetroViewerHostMsg_TouchDown(pointer.x(), pointer.y(), - pointer.timestamp())); + pointer.timestamp(), + pointer.pointer_id())); } return S_OK; } @@ -601,7 +613,8 @@ HRESULT ChromeAppViewAsh::OnPointerReleased( DCHECK(pointer.IsTouch()); ui_channel_->Send(new MetroViewerHostMsg_TouchUp(pointer.x(), pointer.y(), - pointer.timestamp())); + pointer.timestamp(), + pointer.pointer_id())); } return S_OK; } |