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

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

Issue 2806553002: Gets events dispatching working in mushrome (Closed)
Patch Set: fix and merge Created 3 years, 8 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 | « ui/aura/mus/window_tree_client.h ('k') | no next file » | 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 6609d5390926a9659bd315cbf384311c78ab7ec9..90573b1a8b3865925cb9790e1e4f175a1a9f288f 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -278,8 +278,9 @@ void WindowTreeClient::ConnectViaWindowTreeFactory() {
SetWindowTree(std::move(window_tree));
}
-void WindowTreeClient::ConnectAsWindowManager() {
+void WindowTreeClient::ConnectAsWindowManager(bool dispatch_from_host) {
DCHECK(window_manager_delegate_);
+ dispatch_from_host_ = dispatch_from_host;
ui::mojom::WindowManagerWindowTreeFactoryPtr factory;
connector_->BindInterface(ui::mojom::kServiceName, &factory);
@@ -1252,7 +1253,16 @@ void WindowTreeClient::OnWindowInputEvent(uint32_t event_id,
// TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
// ui::TouchEvent once we have proper support for pointer events.
std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get());
- DispatchEventToTarget(mapped_event.get(), window);
+ if (dispatch_from_host_ && mapped_event->IsLocatedEvent()) {
+ gfx::Point host_location = mapped_event->AsLocatedEvent()->location();
+ aura::Window::ConvertPointToTarget(window->GetWindow(),
+ window->GetWindow()->GetHost()->window(),
+ &host_location);
+ mapped_event->AsLocatedEvent()->set_location(host_location);
+ GetWindowTreeHostMus(window)->SendEventToSink(mapped_event.get());
+ } else {
+ DispatchEventToTarget(mapped_event.get(), window);
+ }
ack_handler.set_handled(mapped_event->handled());
}
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698