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 d272bad304b7fd8c3e26437a9cf8df824b03117e..46193428a31982c1d13b079b3bacd2a5f799c017 100644 |
--- a/ui/aura/mus/window_tree_client.cc |
+++ b/ui/aura/mus/window_tree_client.cc |
@@ -29,6 +29,7 @@ |
#include "ui/aura/client/drag_drop_client.h" |
#include "ui/aura/client/transient_window_client.h" |
#include "ui/aura/env.h" |
+#include "ui/aura/env_input_state_controller.h" |
#include "ui/aura/mus/capture_synchronizer.h" |
#include "ui/aura/mus/drag_drop_controller_mus.h" |
#include "ui/aura/mus/focus_synchronizer.h" |
@@ -47,6 +48,7 @@ |
#include "ui/aura/mus/window_tree_host_mus_init_params.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/layout.h" |
#include "ui/base/ui_base_types.h" |
@@ -1302,8 +1304,20 @@ void WindowTreeClient::OnWindowInputEvent(uint32_t event_id, |
window ? window->GetWindow() : nullptr); |
} |
- // TODO: use |display_id| to find host and send there. |
+ // If the window has already been deleted, use |event| to update event states |
+ // kept in aura::Env. Any WindowTreeHost should be okay to get |
+ // aura::EnvInputStateController from since these are global states. |
if (!window || !window->GetWindow()->GetHost()) { |
+ DCHECK(!roots_.empty()); |
+ EnvInputStateController* env_controller = |
+ GetWindowTreeHostMus(*roots_.begin())->dispatcher()->env_controller(); |
+ std::unique_ptr<ui::Event> mapped_event = MapEvent(*event.get()); |
+ if (mapped_event->IsMouseEvent()) { |
+ env_controller->UpdateStateForMouseEvent(nullptr, |
+ *mapped_event->AsMouseEvent()); |
+ } else if (mapped_event->IsTouchEvent()) { |
+ env_controller->UpdateStateForTouchEvent(*mapped_event->AsTouchEvent()); |
+ } |
tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED); |
return; |
} |