OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/utility/partial_screenshot_controller.h" | 5 #include "ash/utility/partial_screenshot_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "ash/screenshot_delegate.h" | 9 #include "ash/screenshot_delegate.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 class PartialScreenshotController::ScopedCursorSetter { | 88 class PartialScreenshotController::ScopedCursorSetter { |
89 public: | 89 public: |
90 ScopedCursorSetter(::wm::CursorManager* cursor_manager, | 90 ScopedCursorSetter(::wm::CursorManager* cursor_manager, |
91 gfx::NativeCursor cursor) | 91 gfx::NativeCursor cursor) |
92 : cursor_manager_(nullptr) { | 92 : cursor_manager_(nullptr) { |
93 if (cursor_manager->IsCursorLocked()) | 93 if (cursor_manager->IsCursorLocked()) |
94 return; | 94 return; |
95 gfx::NativeCursor original_cursor = cursor_manager->GetCursor(); | 95 gfx::NativeCursor original_cursor = cursor_manager->GetCursor(); |
96 cursor_manager_ = cursor_manager; | 96 cursor_manager_ = cursor_manager; |
97 cursor_manager_->SetCursor(cursor); | 97 cursor_manager_->SetCursor(cursor); |
98 bool was_visible = cursor_manager_->IsCursorVisible(); | |
99 if (!was_visible) | |
100 cursor_manager_->ShowCursor(); | |
98 cursor_manager_->LockCursor(); | 101 cursor_manager_->LockCursor(); |
99 // SetCursor does not make any effects at this point but it sets back to the | 102 // SetCursor/HideCursor do not make any effects at this point |
100 // original cursor when unlocked. | 103 // but it sets back to the original cursor state when unlocked. |
101 cursor_manager_->SetCursor(original_cursor); | 104 cursor_manager_->SetCursor(original_cursor); |
105 if (!was_visible) | |
106 cursor_manager_->HideCursor(); | |
Jun Mukai
2015/05/14 22:49:10
Does it have to hide the cursor again?
When cursor
oshima
2015/05/14 23:15:55
I was thinking "shift-ctrl-f5 then esc" scenario,
| |
102 } | 107 } |
103 | 108 |
104 ~ScopedCursorSetter() { | 109 ~ScopedCursorSetter() { |
105 if (cursor_manager_) | 110 if (cursor_manager_) |
106 cursor_manager_->UnlockCursor(); | 111 cursor_manager_->UnlockCursor(); |
107 } | 112 } |
108 | 113 |
109 private: | 114 private: |
110 ::wm::CursorManager* cursor_manager_; | 115 ::wm::CursorManager* cursor_manager_; |
111 | 116 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 return; | 261 return; |
257 Cancel(); | 262 Cancel(); |
258 } | 263 } |
259 | 264 |
260 void PartialScreenshotController::OnDisplayMetricsChanged( | 265 void PartialScreenshotController::OnDisplayMetricsChanged( |
261 const gfx::Display& display, | 266 const gfx::Display& display, |
262 uint32_t changed_metrics) { | 267 uint32_t changed_metrics) { |
263 } | 268 } |
264 | 269 |
265 } // namespace ash | 270 } // namespace ash |
OLD | NEW |