OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/pointer.h" | 5 #include "components/exo/pointer.h" |
6 | 6 |
7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
9 #include "cc/output/copy_output_result.h" | 9 #include "cc/output/copy_output_result.h" |
10 #include "components/exo/pointer_delegate.h" | 10 #include "components/exo/pointer_delegate.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 // Reparent the cursor to the root window where the mouse is located. | 258 // Reparent the cursor to the root window where the mouse is located. |
259 if (container->GetRootWindow() != cursor_->GetRootWindow()) { | 259 if (container->GetRootWindow() != cursor_->GetRootWindow()) { |
260 if (cursor_->parent()) | 260 if (cursor_->parent()) |
261 cursor_->parent()->RemoveChild(cursor_.get()); | 261 cursor_->parent()->RemoveChild(cursor_.get()); |
262 container->AddChild(cursor_.get()); | 262 container->AddChild(cursor_.get()); |
263 } | 263 } |
264 | 264 |
265 auto info = helper->GetDisplayInfo(display.id()); | 265 auto info = helper->GetDisplayInfo(display.id()); |
266 display_scale_ = info.GetEffectiveUIScale() * info.device_scale_factor(); | 266 display_scale_ = info.GetEffectiveUIScale() * info.device_scale_factor(); |
267 device_scale_factor_ = display.device_scale_factor(); | 267 device_scale_factor_ = display.device_scale_factor(); |
268 | |
269 if (focus_ && surface_) { | |
270 // Capture is asynchronous, so avoid rendering old cursor in the meantime. | |
reveman
2017/04/28 21:37:09
I'm still not convinced that we should do this. On
oshima
2017/05/01 22:18:04
Yes, we need a better way to handle custom cursors
Dominik Laskowski
2017/05/06 00:34:45
Done, and filed a bug: http://crbug.com/719116
| |
271 cursor_capture_weak_ptr_factory_.InvalidateWeakPtrs(); | |
272 UpdateCursor(ui::CursorType::kNone); | |
273 CaptureCursor(); | |
274 } | |
268 } | 275 } |
269 | 276 |
270 //////////////////////////////////////////////////////////////////////////////// | 277 //////////////////////////////////////////////////////////////////////////////// |
271 // SurfaceDelegate overrides: | 278 // SurfaceDelegate overrides: |
272 | 279 |
273 void Pointer::OnSurfaceCommit() { | 280 void Pointer::OnSurfaceCommit() { |
274 surface_->CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces(); | 281 surface_->CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces(); |
275 surface_->CommitSurfaceHierarchy(); | 282 surface_->CommitSurfaceHierarchy(); |
276 | 283 |
277 // Capture new cursor to reflect result of commit. | 284 // Capture new cursor to reflect result of commit. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 if (!root_window) | 375 if (!root_window) |
369 return; | 376 return; |
370 | 377 |
371 aura::client::CursorClient* cursor_client = | 378 aura::client::CursorClient* cursor_client = |
372 aura::client::GetCursorClient(root_window); | 379 aura::client::GetCursorClient(root_window); |
373 if (cursor_client) | 380 if (cursor_client) |
374 cursor_client->SetCursor(cursor); | 381 cursor_client->SetCursor(cursor); |
375 } | 382 } |
376 | 383 |
377 } // namespace exo | 384 } // namespace exo |
OLD | NEW |