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

Unified Diff: ui/aura/mus/window_tree_client.cc

Issue 2677153003: Fix event dispatching offset problem in the client-lib in high-dpi mode. (conversion) (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/aura/window_event_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..42930fceb4ec2f075027591ad23854d43628badd 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -42,6 +42,7 @@
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
+#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tracker.h"
#include "ui/base/ui_base_types.h"
#include "ui/display/display.h"
@@ -1152,10 +1153,13 @@ void WindowTreeClient::OnWindowInputEvent(uint32_t event_id,
// The location of the event is relative to |window|. As the event is handed
// to WindowTreeHost we need it to be relative to WindowTreeHost.
if (event->IsLocatedEvent()) {
- gfx::Point host_location = event->AsLocatedEvent()->location();
+ gfx::Point host_location_in_pixels = event->AsLocatedEvent()->location();
+ gfx::Point host_location_in_dip = gfx::ConvertPointToDIP(
+ ScaleFactorForDisplay(window->GetWindow()), host_location_in_pixels);
aura::Window::ConvertPointToTarget(window->GetWindow(), host->window(),
- &host_location);
- event->AsLocatedEvent()->set_location(host_location);
+ &host_location_in_dip);
+ event->AsLocatedEvent()->set_location(host_location_in_dip);
+ window->GetWindow()->GetHost()->dispatcher()->set_transform_events(false);
}
EventAckHandler ack_handler(CreateEventResultCallback(event_id));
« no previous file with comments | « no previous file | ui/aura/window_event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698