Index: ui/views/widget/desktop_aura/desktop_root_window_host_win.cc |
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc |
index 5ad8a9a151437d35161b5f9833a7eaed846e068f..19c28bec16f5672004ffe923747345a05584c77d 100644 |
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc |
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc |
@@ -44,6 +44,10 @@ namespace views { |
DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); |
+// Identifies the DesktopRootWindowHostWin associated with the RootWindow. |
+DEFINE_WINDOW_PROPERTY_KEY(DesktopRootWindowHostWin*, kDesktopRootWindowHostKey, |
+ NULL); |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// DesktopRootWindowHostWin, public: |
@@ -129,6 +133,7 @@ void DesktopRootWindowHostWin::OnRootWindowCreated( |
root_window_ = root; |
root_window_->SetProperty(kContentWindowForRootWindow, content_window_); |
+ root_window_->SetProperty(kDesktopRootWindowHostKey, this); |
should_animate_window_close_ = |
content_window_->type() != aura::client::WINDOW_TYPE_NORMAL && |
@@ -778,6 +783,25 @@ void DesktopRootWindowHostWin::HandleTouchEvent( |
// we attempt to process them. |
if (!GetWidget()->GetNativeView()) |
return; |
+ |
+ // Currently we assume the window that has capture gets touch events too. |
+ aura::RootWindow* root = |
+ aura::RootWindow::GetForAcceleratedWidget(GetCapture()); |
+ if (root) { |
+ DesktopRootWindowHostWin* target = |
+ root->GetProperty(kDesktopRootWindowHostKey); |
+ if (target && target->HasCapture() && target != this) { |
+ POINT target_location(event.location().ToPOINT()); |
+ ClientToScreen(GetHWND(), &target_location); |
+ ScreenToClient(target->GetHWND(), &target_location); |
+ ui::TouchEvent target_event(event, static_cast<View*>(NULL), |
+ static_cast<View*>(NULL)); |
+ target_event.set_location(gfx::Point(target_location)); |
+ target_event.set_root_location(target_event.location()); |
+ target->root_window_host_delegate_->OnHostTouchEvent(&target_event); |
+ return; |
+ } |
+ } |
root_window_host_delegate_->OnHostTouchEvent( |
const_cast<ui::TouchEvent*>(&event)); |
} |