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

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

Issue 2682443002: Fix event dispatching offset problem in the client-lib in high-dpi mode. (transform) (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 | no next file » | 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 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 return; 1146 return;
1147 } 1147 }
1148 1148
1149 WindowTreeHostMus* host = GetWindowTreeHostMus(window); 1149 WindowTreeHostMus* host = GetWindowTreeHostMus(window);
1150 DCHECK(host); 1150 DCHECK(host);
1151 1151
1152 // The location of the event is relative to |window|. As the event is handed 1152 // The location of the event is relative to |window|. As the event is handed
1153 // to WindowTreeHost we need it to be relative to WindowTreeHost. 1153 // to WindowTreeHost we need it to be relative to WindowTreeHost.
1154 if (event->IsLocatedEvent()) { 1154 if (event->IsLocatedEvent()) {
1155 gfx::Point host_location = event->AsLocatedEvent()->location(); 1155 gfx::Point host_location = event->AsLocatedEvent()->location();
1156 aura::Window::ConvertPointToTarget(window->GetWindow(), host->window(), 1156 gfx::Transform transform;
1157 &host_location); 1157 window->GetWindow()->layer()->GetTargetTransformRelativeTo(
1158 host->window()->layer(), &transform);
1159 transform.Scale(1, ScaleFactorForDisplay(window->GetWindow()));
1160 auto transformed_host_location = gfx::Point3F(gfx::PointF(host_location));
1161 transform.TransformPoint(&transformed_host_location);
1162 host_location = gfx::ToFlooredPoint(transformed_host_location.AsPointF());
1158 event->AsLocatedEvent()->set_location(host_location); 1163 event->AsLocatedEvent()->set_location(host_location);
1159 } 1164 }
1160 1165
1161 EventAckHandler ack_handler(CreateEventResultCallback(event_id)); 1166 EventAckHandler ack_handler(CreateEventResultCallback(event_id));
1162 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or 1167 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
1163 // ui::TouchEvent once we have proper support for pointer events. 1168 // ui::TouchEvent once we have proper support for pointer events.
1164 if (event->IsMousePointerEvent()) { 1169 if (event->IsMousePointerEvent()) {
1165 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) { 1170 if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) {
1166 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent()); 1171 ui::MouseWheelEvent mapped_event(*event->AsPointerEvent());
1167 host->SendEventToProcessor(&mapped_event); 1172 host->SendEventToProcessor(&mapped_event);
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1823 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1819 this, capture_synchronizer_.get(), window)); 1824 this, capture_synchronizer_.get(), window));
1820 } 1825 }
1821 1826
1822 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1827 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1823 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1828 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1824 this, focus_synchronizer_.get(), window)); 1829 this, focus_synchronizer_.get(), window));
1825 } 1830 }
1826 1831
1827 } // namespace aura 1832 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698