Index: ui/aura/mus/window_tree_client.cc |
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc |
index b71391bc5bab8f5977235c55f7e570fe3f791b1c..27200233613e7a7091088f10cfba238a263947e8 100644 |
--- a/ui/aura/mus/window_tree_client.cc |
+++ b/ui/aura/mus/window_tree_client.cc |
@@ -44,6 +44,7 @@ |
#include "ui/aura/window_delegate.h" |
#include "ui/aura/window_tracker.h" |
#include "ui/base/ui_base_types.h" |
+#include "ui/compositor/compositor.h" |
#include "ui/display/display.h" |
#include "ui/display/screen.h" |
#include "ui/events/event.h" |
@@ -1132,6 +1133,25 @@ void WindowTreeClient::OnWindowInputEvent(uint32_t event_id, |
return; |
} |
+ // Mus sends screen coordinates, need to convert to DIPs. |
+ if (event->IsLocatedEvent() && !roots_.empty()) { |
+ // TODO: this isn't right, we need to find the matching host and use it's |
+ // scale. |
+ const float scale_factor = (*roots_.begin()) |
+ ->GetWindow() |
+ ->GetHost() |
+ ->compositor() |
+ ->device_scale_factor(); |
+ if (scale_factor != 1) { |
+ gfx::Point host_location = gfx::ConvertPointToDIP( |
+ scale_factor, event->AsLocatedEvent()->location()); |
+ event->AsLocatedEvent()->set_location(host_location); |
+ gfx::Point root_location = gfx::ConvertPointToDIP( |
+ scale_factor, event->AsLocatedEvent()->root_location()); |
+ event->AsLocatedEvent()->set_root_location(root_location); |
+ } |
+ } |
+ |
if (matches_pointer_watcher && has_pointer_watcher_) { |
DCHECK(event->IsPointerEvent()); |
delegate_->OnPointerEventObserved(*event->AsPointerEvent(), |