Chromium Code Reviews| Index: ash/display/display_controller.cc |
| diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc |
| index 5d5144b7064bff010abc48a7b9518876381e0d49..9cdd3780a6bf29e6e5ebaa616ba916907eb03e77 100644 |
| --- a/ash/display/display_controller.cc |
| +++ b/ash/display/display_controller.cc |
| @@ -30,6 +30,7 @@ |
| #include "ui/aura/client/capture_client.h" |
| #include "ui/aura/client/focus_client.h" |
| #include "ui/aura/client/screen_position_client.h" |
| +#include "ui/aura/env.h" |
| #include "ui/aura/window.h" |
| #include "ui/aura/window_event_dispatcher.h" |
| #include "ui/aura/window_property.h" |
| @@ -586,25 +587,33 @@ void DisplayController::EnsurePointerInDisplays() { |
| #if defined(USE_OZONE) |
| gfx::Point target_location_in_screen = target_location_in_root; |
| ::wm::ConvertPointToScreen(dst_root_window, &target_location_in_screen); |
| - int64 target_display_id = |
| - display_manager->FindDisplayContainingPoint(target_location_in_screen) |
| - .id(); |
| + const gfx::Display& target_display = |
| + display_manager->FindDisplayContainingPoint(target_location_in_screen); |
| + int64 target_display_id = target_display.id(); |
| // Do not move the cursor if the cursor's location did not change. This avoids |
| - // moving (and showing) the cursor on startup. |
| - // - |cursor_location_in_screen_coords_for_restore_| is checked to ensure that |
| - // the cursor is moved when the cursor's native position does not change but |
| - // the scale factor or rotation of the display it is on have changed. |
| - // - |cursor_display_id_for_restore_| is checked to ensure that the cursor is |
| - // moved when the cursor's native position and screen position do not change |
| - // but the display that it is on has changed. This occurs when swapping the |
| - // primary display. |
| + // moving (and showing) the cursor: |
| + // - At startup. |
| + // - When the device is rotated in maximized mode. |
| + // |cursor_display_id_for_restore_| is checked to ensure that the cursor is |
| + // moved when the cursor's native position does not change but the display |
| + // that it is on has changed. This occurs when swapping the primary display. |
| if (target_location_in_native != |
| cursor_location_in_native_coords_for_restore_ || |
| - target_location_in_screen != |
| - cursor_location_in_screen_coords_for_restore_ || |
| target_display_id != cursor_display_id_for_restore_) { |
| dst_root_window->MoveCursorTo(target_location_in_root); |
| + } else if (target_location_in_screen != |
| + cursor_location_in_screen_coords_for_restore_) { |
| + // The cursor's native position did not change but its screen position did |
| + // change. This occurs when the scale factor or the rotation of the display |
| + // that the cursor is on changes. |
| + Shell::GetInstance()->cursor_manager()->SetDisplay(target_display); |
| + |
| + // Dispatch a synthetic mouse move. Synthetic mouse moves do not affect the |
| + // cursor's visibility. |
|
sadrul
2015/03/04 00:53:49
Can you update the comment to explain why we want
|
| + aura::Env::GetInstance()->set_last_mouse_location( |
| + target_location_in_screen); |
| + dst_root_window->GetHost()->dispatcher()->PostSynthesizeMouseMove(); |
| } |
| #else |
| dst_root_window->MoveCursorTo(target_location_in_root); |