OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 //////////////////////////////////////////////////////////////////////////////// | 65 //////////////////////////////////////////////////////////////////////////////// |
66 // WindowEventDispatcher, public: | 66 // WindowEventDispatcher, public: |
67 | 67 |
68 WindowEventDispatcher::WindowEventDispatcher(WindowTreeHost* host) | 68 WindowEventDispatcher::WindowEventDispatcher(WindowTreeHost* host) |
69 : host_(host), | 69 : host_(host), |
70 mouse_pressed_handler_(NULL), | 70 mouse_pressed_handler_(NULL), |
71 mouse_moved_handler_(NULL), | 71 mouse_moved_handler_(NULL), |
72 event_dispatch_target_(NULL), | 72 event_dispatch_target_(NULL), |
73 old_dispatch_target_(NULL), | 73 old_dispatch_target_(NULL), |
| 74 transform_events_(true), |
74 synthesize_mouse_move_(false), | 75 synthesize_mouse_move_(false), |
75 move_hold_count_(0), | 76 move_hold_count_(0), |
76 dispatching_held_event_(nullptr), | 77 dispatching_held_event_(nullptr), |
77 observer_manager_(this), | 78 observer_manager_(this), |
78 env_controller_(new EnvInputStateController), | 79 env_controller_(new EnvInputStateController), |
79 repost_event_factory_(this), | 80 repost_event_factory_(this), |
80 held_event_factory_(this) { | 81 held_event_factory_(this) { |
81 ui::GestureRecognizer::Get()->AddGestureEventHelper(this); | 82 ui::GestureRecognizer::Get()->AddGestureEventHelper(this); |
82 Env::GetInstance()->AddObserver(this); | 83 Env::GetInstance()->AddObserver(this); |
83 if (Env::GetInstance()->mode() == Env::Mode::MUS) | 84 if (Env::GetInstance()->mode() == Env::Mode::MUS) |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 //////////////////////////////////////////////////////////////////////////////// | 418 //////////////////////////////////////////////////////////////////////////////// |
418 // WindowEventDispatcher, ui::EventProcessor implementation: | 419 // WindowEventDispatcher, ui::EventProcessor implementation: |
419 ui::EventTarget* WindowEventDispatcher::GetRootTarget() { | 420 ui::EventTarget* WindowEventDispatcher::GetRootTarget() { |
420 return window(); | 421 return window(); |
421 } | 422 } |
422 | 423 |
423 void WindowEventDispatcher::OnEventProcessingStarted(ui::Event* event) { | 424 void WindowEventDispatcher::OnEventProcessingStarted(ui::Event* event) { |
424 // The held events are already in |window()|'s coordinate system. So it is | 425 // The held events are already in |window()|'s coordinate system. So it is |
425 // not necessary to apply the transform to convert from the host's | 426 // not necessary to apply the transform to convert from the host's |
426 // coordinate system to |window()|'s coordinate system. | 427 // coordinate system to |window()|'s coordinate system. |
427 if (event->IsLocatedEvent() && !is_dispatched_held_event(*event)) | 428 if (event->IsLocatedEvent() && !is_dispatched_held_event(*event) && |
| 429 transform_events_) { |
428 TransformEventForDeviceScaleFactor(static_cast<ui::LocatedEvent*>(event)); | 430 TransformEventForDeviceScaleFactor(static_cast<ui::LocatedEvent*>(event)); |
| 431 } |
429 | 432 |
430 if (mus_mouse_location_updater_) | 433 if (mus_mouse_location_updater_) |
431 mus_mouse_location_updater_->OnEventProcessingStarted(*event); | 434 mus_mouse_location_updater_->OnEventProcessingStarted(*event); |
432 } | 435 } |
433 | 436 |
434 void WindowEventDispatcher::OnEventProcessingFinished(ui::Event* event) { | 437 void WindowEventDispatcher::OnEventProcessingFinished(ui::Event* event) { |
435 if (mus_mouse_location_updater_) | 438 if (mus_mouse_location_updater_) |
436 mus_mouse_location_updater_->OnEventProcessingFinished(); | 439 mus_mouse_location_updater_->OnEventProcessingFinished(); |
437 } | 440 } |
438 | 441 |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 } | 873 } |
871 | 874 |
872 // This flag is set depending on the gestures recognized in the call above, | 875 // This flag is set depending on the gestures recognized in the call above, |
873 // and needs to propagate with the forwarded event. | 876 // and needs to propagate with the forwarded event. |
874 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); | 877 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); |
875 | 878 |
876 return PreDispatchLocatedEvent(target, event); | 879 return PreDispatchLocatedEvent(target, event); |
877 } | 880 } |
878 | 881 |
879 } // namespace aura | 882 } // namespace aura |
OLD | NEW |