OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/corewm/compound_event_filter.h" | 5 #include "ui/views/corewm/compound_event_filter.h" |
6 | 6 |
7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/aura/client/activation_client.h" | 9 #include "ui/aura/client/activation_client.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 ObserverListBase<ui::EventHandler>::Iterator it(handlers_); | 178 ObserverListBase<ui::EventHandler>::Iterator it(handlers_); |
179 ui::EventHandler* handler; | 179 ui::EventHandler* handler; |
180 while (!event->stopped_propagation() && (handler = it.GetNext()) != NULL) | 180 while (!event->stopped_propagation() && (handler = it.GetNext()) != NULL) |
181 handler->OnTouchEvent(event); | 181 handler->OnTouchEvent(event); |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target, | 185 void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target, |
186 ui::Event* event, | 186 ui::Event* event, |
187 bool show) { | 187 bool show) { |
188 DCHECK(ShouldHideCursorOnTouch()); | |
189 if (event->flags() & ui::EF_IS_SYNTHESIZED) | 188 if (event->flags() & ui::EF_IS_SYNTHESIZED) |
190 return; | 189 return; |
191 | 190 |
192 aura::client::CursorClient* client = | 191 aura::client::CursorClient* client = |
193 aura::client::GetCursorClient(target->GetRootWindow()); | 192 aura::client::GetCursorClient(target->GetRootWindow()); |
194 if (!client) | 193 if (!client) |
195 return; | 194 return; |
196 | 195 |
197 if (show && cursor_hidden_by_filter_) { | 196 if (show && cursor_hidden_by_filter_) { |
198 cursor_hidden_by_filter_ = false; | 197 cursor_hidden_by_filter_ = false; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // It should also update the cursor for clicking and wheels for ChromeOS boot. | 246 // It should also update the cursor for clicking and wheels for ChromeOS boot. |
248 // When ChromeOS is booted, it hides the mouse cursor but immediate mouse | 247 // When ChromeOS is booted, it hides the mouse cursor but immediate mouse |
249 // operation will show the cursor. | 248 // operation will show the cursor. |
250 // We also update the cursor for mouse enter in case a mouse cursor is sent to | 249 // We also update the cursor for mouse enter in case a mouse cursor is sent to |
251 // outside of the root window and moved back for some reasons (e.g. running on | 250 // outside of the root window and moved back for some reasons (e.g. running on |
252 // on Desktop for testing, or a bug in pointer barrier). | 251 // on Desktop for testing, or a bug in pointer barrier). |
253 if (event->type() == ui::ET_MOUSE_ENTERED || | 252 if (event->type() == ui::ET_MOUSE_ENTERED || |
254 event->type() == ui::ET_MOUSE_MOVED || | 253 event->type() == ui::ET_MOUSE_MOVED || |
255 event->type() == ui::ET_MOUSE_PRESSED || | 254 event->type() == ui::ET_MOUSE_PRESSED || |
256 event->type() == ui::ET_MOUSEWHEEL) { | 255 event->type() == ui::ET_MOUSEWHEEL) { |
257 if (ShouldHideCursorOnTouch()) { | 256 SetMouseEventsEnableStateOnEvent(window, event, true); |
258 SetMouseEventsEnableStateOnEvent(window, event, true); | 257 SetCursorVisibilityOnEvent(window, event, true); |
259 SetCursorVisibilityOnEvent(window, event, true); | |
260 } | |
261 UpdateCursor(window, event); | 258 UpdateCursor(window, event); |
262 } | 259 } |
263 | 260 |
264 FilterMouseEvent(event); | 261 FilterMouseEvent(event); |
265 } | 262 } |
266 | 263 |
267 void CompoundEventFilter::OnScrollEvent(ui::ScrollEvent* event) { | 264 void CompoundEventFilter::OnScrollEvent(ui::ScrollEvent* event) { |
268 } | 265 } |
269 | 266 |
270 void CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) { | 267 void CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) { |
(...skipping 10 matching lines...) Expand all Loading... |
281 if (handlers_.might_have_observers()) { | 278 if (handlers_.might_have_observers()) { |
282 ObserverListBase<ui::EventHandler>::Iterator it(handlers_); | 279 ObserverListBase<ui::EventHandler>::Iterator it(handlers_); |
283 ui::EventHandler* handler; | 280 ui::EventHandler* handler; |
284 while (!event->stopped_propagation() && (handler = it.GetNext()) != NULL) | 281 while (!event->stopped_propagation() && (handler = it.GetNext()) != NULL) |
285 handler->OnGestureEvent(event); | 282 handler->OnGestureEvent(event); |
286 } | 283 } |
287 } | 284 } |
288 | 285 |
289 } // namespace corewm | 286 } // namespace corewm |
290 } // namespace views | 287 } // namespace views |
OLD | NEW |