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 WindowTreeHostImpl::WindowTreeHostImpl( | 56 WindowTreeHostImpl::WindowTreeHostImpl( |
57 mojom::WindowTreeHostClientPtr client, | 57 mojom::WindowTreeHostClientPtr client, |
58 ConnectionManager* connection_manager, | 58 ConnectionManager* connection_manager, |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { | 419 ServerWindow* WindowTreeHostImpl::GetFocusedWindowForEventDispatcher() { |
420 return GetFocusedWindow(); | 420 return GetFocusedWindow(); |
421 } | 421 } |
422 | 422 |
423 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, | 423 void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, |
424 bool in_nonclient_area, | 424 bool in_nonclient_area, |
425 mojom::EventPtr event) { | 425 mojom::EventPtr event) { |
426 DCHECK(!event_ack_timer_.IsRunning()); | 426 DCHECK(!event_ack_timer_.IsRunning()); |
427 | 427 |
428 if (event->pointer_data && | 428 if (event->pointer_data && |
429 event->pointer_data->kind == mojom::PointerKind::POINTER_KIND_MOUSE) { | 429 event->pointer_data->kind == mojom::PointerKind::MOUSE) { |
430 DCHECK(event_dispatcher_.mouse_cursor_source_window()); | 430 DCHECK(event_dispatcher_.mouse_cursor_source_window()); |
431 UpdateNativeCursor( | 431 UpdateNativeCursor( |
432 event_dispatcher_.mouse_cursor_source_window()->cursor()); | 432 event_dispatcher_.mouse_cursor_source_window()->cursor()); |
433 } | 433 } |
434 | 434 |
435 // If the event is in the non-client area the event goes to the owner of | 435 // If the event is in the non-client area the event goes to the owner of |
436 // the window. Otherwise if the window is an embed root, forward to the | 436 // the window. Otherwise if the window is an embed root, forward to the |
437 // embedded window. | 437 // embedded window. |
438 WindowTreeImpl* connection = | 438 WindowTreeImpl* connection = |
439 in_nonclient_area | 439 in_nonclient_area |
(...skipping 14 matching lines...) Expand all Loading... |
454 &WindowTreeHostImpl::OnEventAckTimeout); | 454 &WindowTreeHostImpl::OnEventAckTimeout); |
455 } | 455 } |
456 | 456 |
457 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { | 457 void WindowTreeHostImpl::OnWindowDestroyed(ServerWindow* window) { |
458 windows_needing_frame_destruction_.erase(window); | 458 windows_needing_frame_destruction_.erase(window); |
459 window->RemoveObserver(this); | 459 window->RemoveObserver(this); |
460 } | 460 } |
461 | 461 |
462 } // namespace ws | 462 } // namespace ws |
463 } // namespace mus | 463 } // namespace mus |
OLD | NEW |