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

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

Issue 2779093004: Update event states in Env when target window has been destroyed. (Closed)
Patch Set: test Created 3 years, 9 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/env_input_state_controller.cc ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('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 21332451bfa77dd56112fd5ad1fe9d2b5749ece9..56333ee27b2e010fa230ab468d854dbfc9a9951f 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"
@@ -46,6 +47,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/layout.h"
#include "ui/base/ui_base_types.h"
@@ -1212,7 +1214,9 @@ void WindowTreeClient::OnWindowInputEvent(uint32_t event_id,
if (event->IsKeyEvent()) {
DCHECK(!matches_pointer_watcher); // PointerWatcher isn't for key events.
if (!window || !window->GetWindow()->GetHost()) {
- tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
+ // Drop the |event| and not necessary to update event states as it's a
+ // key event.
+ tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::HANDLED);
sadrul 2017/03/31 05:10:51 I actually think this should be UNHANDLED. (becaus
riajiang 2017/03/31 21:24:03 Right! Done.
return;
}
InputMethodMus* input_method = GetWindowTreeHostMus(window)->input_method();
@@ -1229,9 +1233,30 @@ 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 and drop the |event|. Any WindowTreeHost should be okay
+ // to get aura::EnvInputStateController from since these are global states.
if (!window || !window->GetWindow()->GetHost()) {
- tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::UNHANDLED);
+ DCHECK(!roots_.empty());
+ EnvInputStateController* env_controller =
+ GetWindowTreeHostMus(*roots_.begin())->dispatcher()->env_controller();
+ if (event->IsMousePointerEvent()) {
+ if (event->type() == ui::ET_POINTER_WHEEL_CHANGED) {
+ ui::MouseWheelEvent mapped_event(*event->AsPointerEvent());
+ env_controller->UpdateStateForMouseEvent(nullptr, mapped_event);
+ } else {
+ ui::MouseEvent mapped_event(*event->AsPointerEvent());
+ env_controller->UpdateStateForMouseEvent(nullptr, mapped_event);
+ }
+ } else if (event->IsMouseEvent()) {
+ env_controller->UpdateStateForMouseEvent(nullptr, *event->AsMouseEvent());
+ } else if (event->IsTouchPointerEvent()) {
+ ui::TouchEvent mapped_event(*event->AsPointerEvent());
+ env_controller->UpdateStateForTouchEvent(mapped_event);
+ } else if (event->IsTouchEvent()) {
+ env_controller->UpdateStateForTouchEvent(*event->AsTouchEvent());
+ }
sadrul 2017/03/31 05:10:51 Two comments: . We should not receive MouseEvent o
riajiang 2017/03/31 21:24:03 As discussed offline, going to use the MapEvent he
+ tree_->OnWindowInputEventAck(event_id, ui::mojom::EventResult::HANDLED);
sadrul 2017/03/31 05:10:51 UNHANDLED.
riajiang 2017/03/31 21:24:03 Done.
return;
}
« no previous file with comments | « ui/aura/env_input_state_controller.cc ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698