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

Unified Diff: ui/views/corewm/compound_event_filter.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 | « ash/wm/window_manager_unittest.cc ('k') | ui/views/corewm/compound_event_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/compound_event_filter.cc
diff --git a/ui/views/corewm/compound_event_filter.cc b/ui/views/corewm/compound_event_filter.cc
index 146edb30547ca96cc3d2a9b9e7f8790c360c7f2b..b76161844356e48cd944128227baba5103aff2ce 100644
--- a/ui/views/corewm/compound_event_filter.cc
+++ b/ui/views/corewm/compound_event_filter.cc
@@ -69,6 +69,18 @@ bool ShouldHideCursorOnKeyEvent(const ui::KeyEvent& event) {
#endif // defined(OS_CHROMEOS)
}
+// Returns true if the cursor should be hidden on touch events.
+bool ShouldHideCursorOnTouch() {
+#if defined(OS_CHROMEOS)
+ return true;
+#else
+ // Not necessary on windows as windows does it for us. If we do need this
+ // funcionality on linux (non-chromeos) we need to make sure
+ // CompoundEventFilter shows on the right root (it currently doesn't always).
+ return false;
+#endif
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -173,6 +185,7 @@ void CompoundEventFilter::FilterTouchEvent(ui::TouchEvent* event) {
void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target,
ui::Event* event,
bool show) {
+ DCHECK(ShouldHideCursorOnTouch());
if (event->flags() & ui::EF_IS_SYNTHESIZED)
return;
@@ -241,8 +254,10 @@ void CompoundEventFilter::OnMouseEvent(ui::MouseEvent* event) {
event->type() == ui::ET_MOUSE_MOVED ||
event->type() == ui::ET_MOUSE_PRESSED ||
event->type() == ui::ET_MOUSEWHEEL) {
- SetMouseEventsEnableStateOnEvent(window, event, true);
- SetCursorVisibilityOnEvent(window, event, true);
+ if (ShouldHideCursorOnTouch()) {
+ SetMouseEventsEnableStateOnEvent(window, event, true);
+ SetCursorVisibilityOnEvent(window, event, true);
+ }
UpdateCursor(window, event);
}
@@ -254,7 +269,8 @@ void CompoundEventFilter::OnScrollEvent(ui::ScrollEvent* event) {
void CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) {
FilterTouchEvent(event);
- if (!event->handled() && event->type() == ui::ET_TOUCH_PRESSED &&
+ if (ShouldHideCursorOnTouch() && !event->handled() &&
+ event->type() == ui::ET_TOUCH_PRESSED &&
!aura::Env::GetInstance()->IsMouseButtonDown()) {
SetMouseEventsEnableStateOnEvent(
static_cast<aura::Window*>(event->target()), event, false);
« no previous file with comments | « ash/wm/window_manager_unittest.cc ('k') | ui/views/corewm/compound_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698