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

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

Issue 2680043004: WIP: have aura-mus convert to dips before sending out events (Closed)
Patch Set: caveat 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 | « mash/quick_launch/quick_launch.cc ('k') | ui/aura/window_event_dispatcher.cc » ('j') | no next file with comments »
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 26 matching lines...) Expand all
37 #include "ui/aura/mus/window_mus.h" 37 #include "ui/aura/mus/window_mus.h"
38 #include "ui/aura/mus/window_port_mus.h" 38 #include "ui/aura/mus/window_port_mus.h"
39 #include "ui/aura/mus/window_tree_client_delegate.h" 39 #include "ui/aura/mus/window_tree_client_delegate.h"
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/compositor/compositor.h"
47 #include "ui/display/display.h" 48 #include "ui/display/display.h"
48 #include "ui/display/screen.h" 49 #include "ui/display/screen.h"
49 #include "ui/events/event.h" 50 #include "ui/events/event.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
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 if (!window || !window->GetWindow()->GetHost()) { 1126 if (!window || !window->GetWindow()->GetHost()) {
1126 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); 1127 tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
1127 return; 1128 return;
1128 } 1129 }
1129 InputMethodMus* input_method = GetWindowTreeHostMus(window)->input_method(); 1130 InputMethodMus* input_method = GetWindowTreeHostMus(window)->input_method();
1130 input_method->DispatchKeyEvent(event->AsKeyEvent(), 1131 input_method->DispatchKeyEvent(event->AsKeyEvent(),
1131 CreateEventResultCallback(event_id)); 1132 CreateEventResultCallback(event_id));
1132 return; 1133 return;
1133 } 1134 }
1134 1135
1136 // Mus sends screen coordinates, need to convert to DIPs.
1137 if (event->IsLocatedEvent() && !roots_.empty()) {
1138 // TODO: this isn't right, we need to find the matching host and use it's
1139 // scale.
1140 const float scale_factor = (*roots_.begin())
1141 ->GetWindow()
1142 ->GetHost()
1143 ->compositor()
1144 ->device_scale_factor();
1145 if (scale_factor != 1) {
1146 gfx::Point host_location = gfx::ConvertPointToDIP(
1147 scale_factor, event->AsLocatedEvent()->location());
1148 event->AsLocatedEvent()->set_location(host_location);
1149 gfx::Point root_location = gfx::ConvertPointToDIP(
1150 scale_factor, event->AsLocatedEvent()->root_location());
1151 event->AsLocatedEvent()->set_root_location(root_location);
1152 }
1153 }
1154
1135 if (matches_pointer_watcher && has_pointer_watcher_) { 1155 if (matches_pointer_watcher && has_pointer_watcher_) {
1136 DCHECK(event->IsPointerEvent()); 1156 DCHECK(event->IsPointerEvent());
1137 delegate_->OnPointerEventObserved(*event->AsPointerEvent(), 1157 delegate_->OnPointerEventObserved(*event->AsPointerEvent(),
1138 window ? window->GetWindow() : nullptr); 1158 window ? window->GetWindow() : nullptr);
1139 } 1159 }
1140 1160
1141 // TODO: deal with no window or host here. This could happen if during 1161 // TODO: deal with no window or host here. This could happen if during
1142 // dispatch a window is deleted or moved. In either case we still need to 1162 // dispatch a window is deleted or moved. In either case we still need to
1143 // dispatch. Most likely need the display id. 1163 // dispatch. Most likely need the display id.
1144 if (!window || !window->GetWindow()->GetHost()) { 1164 if (!window || !window->GetWindow()->GetHost()) {
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1838 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1819 this, capture_synchronizer_.get(), window)); 1839 this, capture_synchronizer_.get(), window));
1820 } 1840 }
1821 1841
1822 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1842 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1823 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1843 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1824 this, focus_synchronizer_.get(), window)); 1844 this, focus_synchronizer_.get(), window));
1825 } 1845 }
1826 1846
1827 } // namespace aura 1847 } // namespace aura
OLDNEW
« no previous file with comments | « mash/quick_launch/quick_launch.cc ('k') | ui/aura/window_event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698