Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: ui/aura/mus/window_tree_client.cc

Issue 2681613002: Avoid two targeting phases in aura client-lib and EventProcessor. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/event_processor.h » ('j') | ui/events/event_processor.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 #include "ui/aura/mus/window_tree_client_observer.h" 40 #include "ui/aura/mus/window_tree_client_observer.h"
41 #include "ui/aura/mus/window_tree_client_test_observer.h" 41 #include "ui/aura/mus/window_tree_client_test_observer.h"
42 #include "ui/aura/mus/window_tree_host_mus.h" 42 #include "ui/aura/mus/window_tree_host_mus.h"
43 #include "ui/aura/window.h" 43 #include "ui/aura/window.h"
44 #include "ui/aura/window_delegate.h" 44 #include "ui/aura/window_delegate.h"
45 #include "ui/aura/window_tracker.h" 45 #include "ui/aura/window_tracker.h"
46 #include "ui/base/ui_base_types.h" 46 #include "ui/base/ui_base_types.h"
47 #include "ui/display/display.h" 47 #include "ui/display/display.h"
48 #include "ui/display/screen.h" 48 #include "ui/display/screen.h"
49 #include "ui/events/event.h" 49 #include "ui/events/event.h"
50 #include "ui/events/event_processor.h"
50 #include "ui/gfx/geometry/dip_util.h" 51 #include "ui/gfx/geometry/dip_util.h"
51 #include "ui/gfx/geometry/insets.h" 52 #include "ui/gfx/geometry/insets.h"
52 #include "ui/gfx/geometry/size.h" 53 #include "ui/gfx/geometry/size.h"
53 54
54 #if defined(HiWord) 55 #if defined(HiWord)
55 #undef HiWord 56 #undef HiWord
56 #endif 57 #endif
57 #if defined(LoWord) 58 #if defined(LoWord)
58 #undef LoWord 59 #undef LoWord
59 #endif 60 #endif
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 // dispatch a window is deleted or moved. In either case we still need to 1143 // dispatch a window is deleted or moved. In either case we still need to
1143 // dispatch. Most likely need the display id. 1144 // dispatch. Most likely need the display id.
1144 if (!window || !window->GetWindow()->GetHost()) { 1145 if (!window || !window->GetWindow()->GetHost()) {
1145 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); 1146 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
1146 return; 1147 return;
1147 } 1148 }
1148 1149
1149 WindowTreeHostMus* host = GetWindowTreeHostMus(window); 1150 WindowTreeHostMus* host = GetWindowTreeHostMus(window);
1150 DCHECK(host); 1151 DCHECK(host);
1151 1152
1152 // The location of the event is relative to |window|. As the event is handed 1153 // Send the target window that this event should be dispatched to to the event
1153 // to WindowTreeHost we need it to be relative to WindowTreeHost. 1154 // processor.
1154 if (event->IsLocatedEvent()) { 1155 window->GetWindow()->GetHost()->event_processor()->set_event_target(
1155 gfx::Point host_location = event->AsLocatedEvent()->location(); 1156 window->GetWindow());
sadrul 2017/02/07 04:04:54 This is somewhat awkward. Can we set ui::Event::t
sky 2017/02/07 04:19:48 Extremely! What's wrong with trying to find the lo
riajiang 2017/02/07 17:42:40 Done! I didn't know we can set the target for an e
1156 aura::Window::ConvertPointToTarget(window->GetWindow(), host->window(),
1157 &host_location);
1158 event->AsLocatedEvent()->set_location(host_location);
1159 }
1160 1157
1161 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); 1158 EventAckHandler ack_handler(CreateEventResultCallback(event_id));
1162 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or 1159 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
1163 // ui::TouchEvent once we have proper support for pointer events. 1160 // ui::TouchEvent once we have proper support for pointer events.
1164 if (event->IsMousePointerEvent()) { 1161 if (event->IsMousePointerEvent()) {
1165 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) { 1162 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) {
1166 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent()); 1163 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent());
1167 host->SendEventToProcessor(&mapped_event); 1164 host->SendEventToProcessor(&mapped_event);
1168 } else { 1165 } else {
1169 ui::MouseEvent mapped_event(*event->AsPointerEvent()); 1166 ui::MouseEvent mapped_event(*event->AsPointerEvent());
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1815 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1819 this, capture_synchronizer_.get(), window)); 1816 this, capture_synchronizer_.get(), window));
1820 } 1817 }
1821 1818
1822 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1819 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1823 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1820 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1824 this, focus_synchronizer_.get(), window)); 1821 this, focus_synchronizer_.get(), window));
1825 } 1822 }
1826 1823
1827 } // namespace aura 1824 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/events/event_processor.h » ('j') | ui/events/event_processor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698