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

Unified Diff: ui/aura/env.cc

Issue 2657283003: mash: make Env::last_mouse_location() accurate for Mus (Closed)
Patch Set: cleanup Created 3 years, 11 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
Index: ui/aura/env.cc
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index 5e9411332e3aacd7299bd6c5c1a08fc6c58e8fce..9704b641579870d56bd2f201f6d192f8dca63a7f 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -123,6 +123,15 @@ bool Env::IsMouseButtonDown() const {
mouse_button_flags_ != 0;
}
+const gfx::Point& Env::last_mouse_location() {
+ if (mode_ == Mode::LOCAL || !get_last_mouse_location_from_mus_)
+ return last_mouse_location_;
+
+ DCHECK(window_tree_client_);
+ last_mouse_location_ = window_tree_client_->GetCursorScreenPoint();
+ return last_mouse_location_;
+}
+
void Env::SetWindowTreeClient(WindowTreeClient* window_tree_client) {
// The WindowTreeClient should only be set once. Test code may need to change
// the value after the fact, to do that use EnvTestHelper.
@@ -155,6 +164,7 @@ Env::Env(Mode mode)
: mode_(mode),
mouse_button_flags_(0),
is_touch_down_(false),
+ get_last_mouse_location_from_mus_(mode_ == Mode::MUS),
input_state_lookup_(InputStateLookup::Create()),
context_factory_(nullptr),
context_factory_private_(nullptr) {

Powered by Google App Engine
This is Rietveld 408576698