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

Unified Diff: ui/views/widget/desktop_aura/desktop_root_window_host_win.cc

Issue 56053004: Dispatches touch events to captured window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable test Created 7 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 | « ui/views/corewm/compound_event_filter_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « ui/views/corewm/compound_event_filter_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698