OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/ws/window_tree_host_impl.h" | 5 #include "components/mus/ws/window_tree_host_impl.h" |
6 | 6 |
7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/mus/common/types.h" | 9 #include "components/mus/common/types.h" |
10 #include "components/mus/public/interfaces/input_event_constants.mojom.h" | 10 #include "components/mus/public/interfaces/input_event_constants.mojom.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 return base::TimeDelta::FromMilliseconds(100); | 26 return base::TimeDelta::FromMilliseconds(100); |
27 #else | 27 #else |
28 return base::TimeDelta::FromMilliseconds(1000); | 28 return base::TimeDelta::FromMilliseconds(1000); |
29 #endif | 29 #endif |
30 } | 30 } |
31 | 31 |
32 bool EventsCanBeCoalesced(const mojom::Event& one, const mojom::Event& two) { | 32 bool EventsCanBeCoalesced(const mojom::Event& one, const mojom::Event& two) { |
33 if (one.action != two.action || one.flags != two.flags) | 33 if (one.action != two.action || one.flags != two.flags) |
34 return false; | 34 return false; |
35 // TODO(sad): wheel events can also be merged. | 35 // TODO(sad): wheel events can also be merged. |
36 if (one.action != mojom::EVENT_TYPE_POINTER_MOVE) | 36 if (one.action != mojom::EventType::POINTER_MOVE) |
37 return false; | 37 return false; |
38 DCHECK(one.pointer_data); | 38 DCHECK(one.pointer_data); |
39 DCHECK(two.pointer_data); | 39 DCHECK(two.pointer_data); |
40 if (one.pointer_data->kind != two.pointer_data->kind || | 40 if (one.pointer_data->kind != two.pointer_data->kind || |
41 one.pointer_data->pointer_id != two.pointer_data->pointer_id) | 41 one.pointer_data->pointer_id != two.pointer_data->pointer_id) |
42 return false; | 42 return false; |
43 | 43 |
44 return true; | 44 return true; |
45 } | 45 } |
46 | 46 |
47 mojom::EventPtr CoalesceEvents(mojom::EventPtr first, mojom::EventPtr second) { | 47 mojom::EventPtr CoalesceEvents(mojom::EventPtr first, mojom::EventPtr second) { |
48 DCHECK_EQ(first->action, mojom::EVENT_TYPE_POINTER_MOVE) | 48 DCHECK_EQ(first->action, mojom::EventType::POINTER_MOVE) |
49 << " Non-move events cannot be merged yet."; | 49 << " Non-move events cannot be merged yet."; |
50 // For mouse moves, the new event just replaces the old event. | 50 // For mouse moves, the new event just replaces the old event. |
51 return second; | 51 return second; |
52 } | 52 } |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 class WindowTreeHostImpl::ProcessedEventTarget { | 56 class WindowTreeHostImpl::ProcessedEventTarget { |
57 public: | 57 public: |
58 ProcessedEventTarget(ServerWindow* window, bool in_nonclient_area) | 58 ProcessedEventTarget(ServerWindow* window, bool in_nonclient_area) |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 std::move(queued_event->event)); | 321 std::move(queued_event->event)); |
322 return; | 322 return; |
323 } | 323 } |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 void WindowTreeHostImpl::DispatchInputEventToWindowImpl(ServerWindow* target, | 327 void WindowTreeHostImpl::DispatchInputEventToWindowImpl(ServerWindow* target, |
328 bool in_nonclient_area, | 328 bool in_nonclient_area, |
329 mojom::EventPtr event) { | 329 mojom::EventPtr event) { |
330 if (event->pointer_data && | 330 if (event->pointer_data && |
331 event->pointer_data->kind == mojom::PointerKind::POINTER_KIND_MOUSE) { | 331 event->pointer_data->kind == mojom::PointerKind::MOUSE) { |
332 DCHECK(event_dispatcher_.mouse_cursor_source_window()); | 332 DCHECK(event_dispatcher_.mouse_cursor_source_window()); |
333 UpdateNativeCursor( | 333 UpdateNativeCursor( |
334 event_dispatcher_.mouse_cursor_source_window()->cursor()); | 334 event_dispatcher_.mouse_cursor_source_window()->cursor()); |
335 } | 335 } |
336 | 336 |
337 // If the event is in the non-client area the event goes to the owner of | 337 // If the event is in the non-client area the event goes to the owner of |
338 // the window. Otherwise if the window is an embed root, forward to the | 338 // the window. Otherwise if the window is an embed root, forward to the |
339 // embedded window. | 339 // embedded window. |
340 WindowTreeImpl* connection = | 340 WindowTreeImpl* connection = |
341 in_nonclient_area | 341 in_nonclient_area |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event)); | 529 DispatchInputEventToWindowImpl(target, in_nonclient_area, std::move(event)); |
530 } | 530 } |
531 | 531 |
532 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { | 532 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { |
533 windows_needing_frame_destruction_.erase(window); | 533 windows_needing_frame_destruction_.erase(window); |
534 window->RemoveObserver(this); | 534 window->RemoveObserver(this); |
535 } | 535 } |
536 | 536 |
537 } // namespace ws | 537 } // namespace ws |
538 } // namespace mus | 538 } // namespace mus |
OLD | NEW |