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/mus/window_tree_client.h" | 5 #include "ui/aura/mus/window_tree_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 11 matching lines...) Expand all Loading... | |
22 #include "services/ui/common/accelerator_util.h" | 22 #include "services/ui/common/accelerator_util.h" |
23 #include "services/ui/public/cpp/gpu/gpu.h" | 23 #include "services/ui/public/cpp/gpu/gpu.h" |
24 #include "services/ui/public/cpp/property_type_converters.h" | 24 #include "services/ui/public/cpp/property_type_converters.h" |
25 #include "services/ui/public/interfaces/constants.mojom.h" | 25 #include "services/ui/public/interfaces/constants.mojom.h" |
26 #include "services/ui/public/interfaces/window_manager.mojom.h" | 26 #include "services/ui/public/interfaces/window_manager.mojom.h" |
27 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h" | 27 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h" |
28 #include "ui/aura/client/aura_constants.h" | 28 #include "ui/aura/client/aura_constants.h" |
29 #include "ui/aura/client/drag_drop_client.h" | 29 #include "ui/aura/client/drag_drop_client.h" |
30 #include "ui/aura/client/transient_window_client.h" | 30 #include "ui/aura/client/transient_window_client.h" |
31 #include "ui/aura/env.h" | 31 #include "ui/aura/env.h" |
32 #include "ui/aura/env_input_state_controller.h" | |
32 #include "ui/aura/mus/capture_synchronizer.h" | 33 #include "ui/aura/mus/capture_synchronizer.h" |
33 #include "ui/aura/mus/drag_drop_controller_mus.h" | 34 #include "ui/aura/mus/drag_drop_controller_mus.h" |
34 #include "ui/aura/mus/focus_synchronizer.h" | 35 #include "ui/aura/mus/focus_synchronizer.h" |
35 #include "ui/aura/mus/in_flight_change.h" | 36 #include "ui/aura/mus/in_flight_change.h" |
36 #include "ui/aura/mus/input_method_mus.h" | 37 #include "ui/aura/mus/input_method_mus.h" |
37 #include "ui/aura/mus/mus_context_factory.h" | 38 #include "ui/aura/mus/mus_context_factory.h" |
38 #include "ui/aura/mus/property_converter.h" | 39 #include "ui/aura/mus/property_converter.h" |
39 #include "ui/aura/mus/property_utils.h" | 40 #include "ui/aura/mus/property_utils.h" |
40 #include "ui/aura/mus/window_manager_delegate.h" | 41 #include "ui/aura/mus/window_manager_delegate.h" |
41 #include "ui/aura/mus/window_mus.h" | 42 #include "ui/aura/mus/window_mus.h" |
42 #include "ui/aura/mus/window_port_mus.h" | 43 #include "ui/aura/mus/window_port_mus.h" |
43 #include "ui/aura/mus/window_tree_client_delegate.h" | 44 #include "ui/aura/mus/window_tree_client_delegate.h" |
44 #include "ui/aura/mus/window_tree_client_observer.h" | 45 #include "ui/aura/mus/window_tree_client_observer.h" |
45 #include "ui/aura/mus/window_tree_client_test_observer.h" | 46 #include "ui/aura/mus/window_tree_client_test_observer.h" |
46 #include "ui/aura/mus/window_tree_host_mus.h" | 47 #include "ui/aura/mus/window_tree_host_mus.h" |
47 #include "ui/aura/mus/window_tree_host_mus_init_params.h" | 48 #include "ui/aura/mus/window_tree_host_mus_init_params.h" |
48 #include "ui/aura/window.h" | 49 #include "ui/aura/window.h" |
49 #include "ui/aura/window_delegate.h" | 50 #include "ui/aura/window_delegate.h" |
51 #include "ui/aura/window_event_dispatcher.h" | |
50 #include "ui/aura/window_tracker.h" | 52 #include "ui/aura/window_tracker.h" |
51 #include "ui/base/layout.h" | 53 #include "ui/base/layout.h" |
52 #include "ui/base/ui_base_types.h" | 54 #include "ui/base/ui_base_types.h" |
53 #include "ui/display/screen.h" | 55 #include "ui/display/screen.h" |
54 #include "ui/events/event.h" | 56 #include "ui/events/event.h" |
55 #include "ui/gfx/geometry/dip_util.h" | 57 #include "ui/gfx/geometry/dip_util.h" |
56 #include "ui/gfx/geometry/insets.h" | 58 #include "ui/gfx/geometry/insets.h" |
57 #include "ui/gfx/geometry/size.h" | 59 #include "ui/gfx/geometry/size.h" |
58 | 60 |
59 #if defined(HiWord) | 61 #if defined(HiWord) |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1295 } | 1297 } |
1296 | 1298 |
1297 if (matches_pointer_watcher && has_pointer_watcher_) { | 1299 if (matches_pointer_watcher && has_pointer_watcher_) { |
1298 DCHECK(event->IsPointerEvent()); | 1300 DCHECK(event->IsPointerEvent()); |
1299 std::unique_ptr<ui::Event> event_in_dip(ui::Event::Clone(*event)); | 1301 std::unique_ptr<ui::Event> event_in_dip(ui::Event::Clone(*event)); |
1300 ConvertEventLocationToDip(display_id, event_in_dip->AsLocatedEvent()); | 1302 ConvertEventLocationToDip(display_id, event_in_dip->AsLocatedEvent()); |
1301 delegate_->OnPointerEventObserved(*event_in_dip->AsPointerEvent(), | 1303 delegate_->OnPointerEventObserved(*event_in_dip->AsPointerEvent(), |
1302 window ? window->GetWindow() : nullptr); | 1304 window ? window->GetWindow() : nullptr); |
1303 } | 1305 } |
1304 | 1306 |
1305 // TODO: use |display_id| to find host and send there. | 1307 // If the window has already been deleted, use |event| to update event states |
1308 // kept in aura::Env. Any WindowTreeHost should be okay to get | |
1309 // aura::EnvInputStateController from since these are global states. | |
sadrul
2017/05/01 17:39:36
Also, it may make sense to have Env own a single i
riajiang
2017/05/02 21:05:31
Done in https://codereview.chromium.org/2854663002
| |
1306 if (!window || !window->GetWindow()->GetHost()) { | 1310 if (!window || !window->GetWindow()->GetHost()) { |
1311 DCHECK(!roots_.empty()); | |
1312 EnvInputStateController* env_controller = | |
1313 GetWindowTreeHostMus(*roots_.begin())->dispatcher()->env_controller(); | |
sky
2017/05/01 17:37:27
How do you know roots_ is not empty here?
riajiang
2017/05/02 21:05:31
Yes sorry didn't consider that case. Changed EnvIn
| |
1314 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get()); | |
1315 if (mapped_event->IsMouseEvent()) { | |
1316 env_controller->UpdateStateForMouseEvent(nullptr, | |
1317 *mapped_event->AsMouseEvent()); | |
1318 } else if (mapped_event->IsTouchEvent()) { | |
1319 env_controller->UpdateStateForTouchEvent(*mapped_event->AsTouchEvent()); | |
1320 } | |
1307 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); | 1321 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); |
1308 return; | 1322 return; |
1309 } | 1323 } |
1310 | 1324 |
1311 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); | 1325 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); |
1312 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or | 1326 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or |
1313 // ui::TouchEvent once we have proper support for pointer events. | 1327 // ui::TouchEvent once we have proper support for pointer events. |
1314 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get()); | 1328 std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get()); |
1315 DispatchEventToTarget(mapped_event.get(), window); | 1329 DispatchEventToTarget(mapped_event.get(), window); |
1316 ack_handler.set_handled(mapped_event->handled()); | 1330 ack_handler.set_handled(mapped_event->handled()); |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2028 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 2042 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
2029 this, capture_synchronizer_.get(), window)); | 2043 this, capture_synchronizer_.get(), window)); |
2030 } | 2044 } |
2031 | 2045 |
2032 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 2046 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
2033 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 2047 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
2034 this, focus_synchronizer_.get(), window)); | 2048 this, focus_synchronizer_.get(), window)); |
2035 } | 2049 } |
2036 | 2050 |
2037 } // namespace aura | 2051 } // namespace aura |
OLD | NEW |