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); |