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

Side by Side Diff: ash/display/cursor_window_controller.cc

Issue 1137303004: Always update cursor visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/display/cursor_window_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/display/cursor_window_controller.h" 5 #include "ash/display/cursor_window_controller.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/mirror_window_controller.h" 8 #include "ash/display/mirror_window_controller.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 10 matching lines...) Expand all
21 #include "ui/gfx/display.h" 21 #include "ui/gfx/display.h"
22 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
23 #include "ui/gfx/image/image_skia_operations.h" 23 #include "ui/gfx/image/image_skia_operations.h"
24 24
25 namespace ash { 25 namespace ash {
26 26
27 class CursorWindowDelegate : public aura::WindowDelegate { 27 class CursorWindowDelegate : public aura::WindowDelegate {
28 public: 28 public:
29 CursorWindowDelegate() : is_cursor_compositing_enabled_(false) {} 29 CursorWindowDelegate() : is_cursor_compositing_enabled_(false) {}
30 ~CursorWindowDelegate() override {} 30 ~CursorWindowDelegate() override {}
31
Albert Bodenhamer 2015/05/14 16:42:02 Why the whitespace change?
32 // aura::WindowDelegate overrides: 31 // aura::WindowDelegate overrides:
33 gfx::Size GetMinimumSize() const override { return size_; } 32 gfx::Size GetMinimumSize() const override { return size_; }
34 gfx::Size GetMaximumSize() const override { return size_; } 33 gfx::Size GetMaximumSize() const override { return size_; }
35 void OnBoundsChanged(const gfx::Rect& old_bounds, 34 void OnBoundsChanged(const gfx::Rect& old_bounds,
36 const gfx::Rect& new_bounds) override {} 35 const gfx::Rect& new_bounds) override {}
37 ui::TextInputClient* GetFocusedTextInputClient() override { return nullptr; } 36 ui::TextInputClient* GetFocusedTextInputClient() override { return nullptr; }
38 gfx::NativeCursor GetCursor(const gfx::Point& point) override { 37 gfx::NativeCursor GetCursor(const gfx::Point& point) override {
39 return gfx::kNullCursor; 38 return gfx::kNullCursor;
40 } 39 }
41 int GetNonClientComponent(const gfx::Point& point) const override { 40 int GetNonClientComponent(const gfx::Point& point) const override {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 UpdateCursorImage(); 173 UpdateCursorImage();
175 UpdateCursorVisibility(); 174 UpdateCursorVisibility();
176 } 175 }
177 176
178 void CursorWindowController::SetCursorSet(ui::CursorSetType cursor_set) { 177 void CursorWindowController::SetCursorSet(ui::CursorSetType cursor_set) {
179 cursor_set_ = cursor_set; 178 cursor_set_ = cursor_set;
180 UpdateCursorImage(); 179 UpdateCursorImage();
181 } 180 }
182 181
183 void CursorWindowController::SetVisibility(bool visible) { 182 void CursorWindowController::SetVisibility(bool visible) {
184 if (!cursor_window_)
Albert Bodenhamer 2015/05/14 16:42:02 What is the removed code supposed to accomplish? I
oshima 2015/05/14 16:58:52 The visibility state has to be updated regardless
185 return;
186 visible_ = visible; 183 visible_ = visible;
187 UpdateCursorVisibility(); 184 UpdateCursorVisibility();
188 } 185 }
189 186
190 void CursorWindowController::SetContainer(aura::Window* container) { 187 void CursorWindowController::SetContainer(aura::Window* container) {
191 if (container_ == container) 188 if (container_ == container)
192 return; 189 return;
193 container_ = container; 190 container_ = container;
194 if (!container) { 191 if (!container) {
195 cursor_window_.reset(); 192 cursor_window_.reset();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 cursor_window_->SetBounds(gfx::Rect(delegate_->size())); 261 cursor_window_->SetBounds(gfx::Rect(delegate_->size()));
265 cursor_window_->SchedulePaintInRect( 262 cursor_window_->SchedulePaintInRect(
266 gfx::Rect(cursor_window_->bounds().size())); 263 gfx::Rect(cursor_window_->bounds().size()));
267 UpdateLocation(); 264 UpdateLocation();
268 } 265 }
269 } 266 }
270 267
271 void CursorWindowController::UpdateCursorVisibility() { 268 void CursorWindowController::UpdateCursorVisibility() {
272 if (!cursor_window_) 269 if (!cursor_window_)
273 return; 270 return;
271
Albert Bodenhamer 2015/05/14 16:42:02 And here?
274 bool visible = (visible_ && cursor_type_ != ui::kCursorNone); 272 bool visible = (visible_ && cursor_type_ != ui::kCursorNone);
275 if (visible) 273 if (visible)
276 cursor_window_->Show(); 274 cursor_window_->Show();
277 else 275 else
278 cursor_window_->Hide(); 276 cursor_window_->Hide();
279 } 277 }
280 278
281 } // namespace ash 279 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/cursor_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698