diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 23:57:20 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-07 23:57:20 +0000 |
commit | c4ae36f2aca531a9d9abf39d1a54b1a267e2c1f1 (patch) | |
tree | d837911a58ec6afdf570426d87186cfa07bc9dc8 /win8 | |
parent | 53e38faa6860a4c8fec6752b36d77ec0c1ff585f (diff) | |
download | chromium_src-c4ae36f2aca531a9d9abf39d1a54b1a267e2c1f1.zip chromium_src-c4ae36f2aca531a9d9abf39d1a54b1a267e2c1f1.tar.gz chromium_src-c4ae36f2aca531a9d9abf39d1a54b1a267e2c1f1.tar.bz2 |
Pass touch events from the chrome viewer process in Metro Ash on Windows 8 to the browser process.
cpu:- Please review everything.
sky:- Please review changes to content\browser, chrome\browser and ui\aura.
This effectively also means that we won't be passing the fake mouse messages generated by Windows for touch events
from the Ash viewer process to chrome.
This only fixes touch handling in Metro Ash. Touch handling for desktop chrome Aura will be fixed in a subsequent CL.
BUG=151718
R=cpu,sky
Review URL: https://codereview.chromium.org/11472013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171888 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8')
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.cc | 73 |
1 files changed, 52 insertions, 21 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index 7a76c36..b01716b 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -94,7 +94,8 @@ class PointerInfoHandler { x_(0), y_(0), wheel_delta_(0), - update_kind_(winui::Input::PointerUpdateKind_Other) {}; + update_kind_(winui::Input::PointerUpdateKind_Other), + timestamp_(0) {} HRESULT Init(winui::Core::IPointerEventArgs* args) { HRESULT hr = args->get_CurrentPoint(&pointer_point_); @@ -121,15 +122,24 @@ class PointerInfoHandler { x_ = point.X; y_ = point.Y; + pointer_point_->get_Timestamp(×tamp_); return S_OK; } - bool IsMouse() const { + bool IsType(windevs::Input::PointerDeviceType type) const { mswr::ComPtr<windevs::Input::IPointerDevice> pointer_device; CheckHR(pointer_point_->get_PointerDevice(&pointer_device)); windevs::Input::PointerDeviceType device_type; CheckHR(pointer_device->get_PointerDeviceType(&device_type)); - return (device_type == windevs::Input::PointerDeviceType_Mouse); + return (device_type == type); + } + + bool IsMouse() const { + return IsType(windevs::Input::PointerDeviceType_Mouse); + } + + bool IsTouch() const { + return IsType(windevs::Input::PointerDeviceType_Touch); } int32 wheel_delta() const { @@ -158,12 +168,15 @@ class PointerInfoHandler { int x() const { return x_; } int y() const { return y_; } + uint64 timestamp() const { return timestamp_; } + private: int x_; int y_; int wheel_delta_; winui::Input::PointerUpdateKind update_kind_; mswr::ComPtr<winui::Input::IPointerPoint> pointer_point_; + uint64 timestamp_; }; void RunMessageLoop(winui::Core::ICoreDispatcher* dispatcher) { @@ -360,8 +373,6 @@ HRESULT ChromeAppViewAsh::OnActivate( globals.core_window = winrt_utils::FindCoreWindow(globals.main_thread_id, 10); - - DVLOG(1) << "CoreWindow found: " << std::hex << globals.core_window; return S_OK; } @@ -371,11 +382,17 @@ HRESULT ChromeAppViewAsh::OnPointerMoved(winui::Core::ICoreWindow* sender, HRESULT hr = pointer.Init(args); if (FAILED(hr)) return hr; - DCHECK(pointer.IsMouse()); - ui_channel_->Send(new MetroViewerHostMsg_MouseMoved(pointer.x(), - pointer.y(), - mouse_down_flags_)); + if (pointer.IsMouse()) { + ui_channel_->Send(new MetroViewerHostMsg_MouseMoved(pointer.x(), + pointer.y(), + mouse_down_flags_)); + } else { + DCHECK(pointer.IsTouch()); + ui_channel_->Send(new MetroViewerHostMsg_TouchMoved(pointer.x(), + pointer.y(), + pointer.timestamp())); + } return S_OK; } @@ -391,13 +408,20 @@ HRESULT ChromeAppViewAsh::OnPointerPressed( HRESULT hr = pointer.Init(args); if (FAILED(hr)) return hr; - DCHECK(pointer.IsMouse()); - mouse_down_flags_ = pointer.flags(); - ui_channel_->Send(new MetroViewerHostMsg_MouseButton(pointer.x(), pointer.y(), - 0, - ui::ET_MOUSE_PRESSED, - mouse_down_flags_)); + if (pointer.IsMouse()) { + mouse_down_flags_ = pointer.flags(); + ui_channel_->Send(new MetroViewerHostMsg_MouseButton(pointer.x(), + pointer.y(), + 0, + ui::ET_MOUSE_PRESSED, + mouse_down_flags_)); + } else { + DCHECK(pointer.IsTouch()); + ui_channel_->Send(new MetroViewerHostMsg_TouchDown(pointer.x(), + pointer.y(), + pointer.timestamp())); + } return S_OK; } @@ -408,13 +432,20 @@ HRESULT ChromeAppViewAsh::OnPointerReleased( HRESULT hr = pointer.Init(args); if (FAILED(hr)) return hr; - DCHECK(pointer.IsMouse()); - mouse_down_flags_ = ui::EF_NONE; - ui_channel_->Send(new MetroViewerHostMsg_MouseButton(pointer.x(), pointer.y(), - 0, - ui::ET_MOUSE_RELEASED, - pointer.flags())); + if (pointer.IsMouse()) { + mouse_down_flags_ = ui::EF_NONE; + ui_channel_->Send(new MetroViewerHostMsg_MouseButton(pointer.x(), + pointer.y(), + 0, + ui::ET_MOUSE_RELEASED, + pointer.flags())); + } else { + DCHECK(pointer.IsTouch()); + ui_channel_->Send(new MetroViewerHostMsg_TouchUp(pointer.x(), + pointer.y(), + pointer.timestamp())); + } return S_OK; } |