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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1231 | 1231 |
1232 // TODO: use |display_id| to find host and send there. | 1232 // TODO: use |display_id| to find host and send there. |
1233 if (!window || !window->GetWindow()->GetHost()) { | 1233 if (!window || !window->GetWindow()->GetHost()) { |
1234 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); | 1234 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); |
1235 return; | 1235 return; |
1236 } | 1236 } |
1237 | 1237 |
1238 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); | 1238 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); |
1239 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or | 1239 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or |
1240 // ui::TouchEvent once we have proper support for pointer events. | 1240 // ui::TouchEvent once we have proper support for pointer events. |
1241 if (event->IsMousePointerEvent()) { | 1241 if (event->IsMousePointerEvent()) { |
sky
2017/03/31 17:41:24
In hopes of reducing copy/paste, WDYT of a MapEven
riajiang
2017/03/31 18:33:04
Yea that's cleaner! Done.
| |
1242 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) { | 1242 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) { |
1243 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent()); | 1243 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent()); |
1244 DispatchEventToTarget(&mapped_event, window); | 1244 DispatchEventToTarget(&mapped_event, window); |
1245 ack_handler.set_handled(mapped_event.handled()); | |
1245 } else { | 1246 } else { |
1246 ui::MouseEvent mapped_event(*event->AsPointerEvent()); | 1247 ui::MouseEvent mapped_event(*event->AsPointerEvent()); |
1247 DispatchEventToTarget(&mapped_event, window); | 1248 DispatchEventToTarget(&mapped_event, window); |
1249 ack_handler.set_handled(mapped_event.handled()); | |
1248 } | 1250 } |
1249 } else if (event->IsTouchPointerEvent()) { | 1251 } else if (event->IsTouchPointerEvent()) { |
1250 ui::TouchEvent mapped_event(*event->AsPointerEvent()); | 1252 ui::TouchEvent mapped_event(*event->AsPointerEvent()); |
1251 DispatchEventToTarget(&mapped_event, window); | 1253 DispatchEventToTarget(&mapped_event, window); |
1254 ack_handler.set_handled(mapped_event.handled()); | |
1252 } else { | 1255 } else { |
1253 DispatchEventToTarget(event.get(), window); | 1256 DispatchEventToTarget(event.get(), window); |
1257 ack_handler.set_handled(event->handled()); | |
1254 } | 1258 } |
1255 ack_handler.set_handled(event->handled()); | |
1256 } | 1259 } |
1257 | 1260 |
1258 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event, | 1261 void WindowTreeClient::OnPointerEventObserved(std::unique_ptr<ui::Event> event, |
1259 uint32_t window_id, | 1262 uint32_t window_id, |
1260 int64_t display_id) { | 1263 int64_t display_id) { |
1261 DCHECK(event); | 1264 DCHECK(event); |
1262 DCHECK(event->IsPointerEvent()); | 1265 DCHECK(event->IsPointerEvent()); |
1263 if (!has_pointer_watcher_) | 1266 if (!has_pointer_watcher_) |
1264 return; | 1267 return; |
1265 | 1268 |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1948 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1951 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
1949 this, capture_synchronizer_.get(), window)); | 1952 this, capture_synchronizer_.get(), window)); |
1950 } | 1953 } |
1951 | 1954 |
1952 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1955 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
1953 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1956 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
1954 this, focus_synchronizer_.get(), window)); | 1957 this, focus_synchronizer_.get(), window)); |
1955 } | 1958 } |
1956 | 1959 |
1957 } // namespace aura | 1960 } // namespace aura |
OLD | NEW |