OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/env_input_state_controller.h" | 5 #include "ui/aura/env_input_state_controller.h" |
6 | 6 |
7 #include "ui/aura/client/screen_position_client.h" | 7 #include "ui/aura/client/screen_position_client.h" |
8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/gfx/geometry/point.h" | 10 #include "ui/gfx/geometry/point.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 default: | 57 default: |
58 NOTREACHED(); | 58 NOTREACHED(); |
59 break; | 59 break; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 void EnvInputStateController::SetLastMouseLocation( | 63 void EnvInputStateController::SetLastMouseLocation( |
64 const Window* root_window, | 64 const Window* root_window, |
65 const gfx::Point& location_in_root) const { | 65 const gfx::Point& location_in_root) const { |
| 66 // If |root_window| is null, we are only using the event to update event |
| 67 // states, so we shouldn't update mouse location. |
| 68 if (!root_window && Env::GetInstance()->mode() == aura::Env::Mode::MUS) |
| 69 return; |
| 70 |
66 client::ScreenPositionClient* client = | 71 client::ScreenPositionClient* client = |
67 client::GetScreenPositionClient(root_window); | 72 client::GetScreenPositionClient(root_window); |
68 if (client) { | 73 if (client) { |
69 gfx::Point location_in_screen = location_in_root; | 74 gfx::Point location_in_screen = location_in_root; |
70 client->ConvertPointToScreen(root_window, &location_in_screen); | 75 client->ConvertPointToScreen(root_window, &location_in_screen); |
71 Env::GetInstance()->set_last_mouse_location(location_in_screen); | 76 Env::GetInstance()->set_last_mouse_location(location_in_screen); |
72 } else { | 77 } else { |
73 Env::GetInstance()->set_last_mouse_location(location_in_root); | 78 Env::GetInstance()->set_last_mouse_location(location_in_root); |
74 } | 79 } |
75 } | 80 } |
76 | 81 |
77 } // namespace aura | 82 } // namespace aura |
OLD | NEW |