| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 // If surface is different than the current pointer surface then remove the | 83 // If surface is different than the current pointer surface then remove the |
| 84 // current surface and add the new surface. | 84 // current surface and add the new surface. |
| 85 if (surface != surface_) { | 85 if (surface != surface_) { |
| 86 if (surface && surface->HasSurfaceDelegate()) { | 86 if (surface && surface->HasSurfaceDelegate()) { |
| 87 DLOG(ERROR) << "Surface has already been assigned a role"; | 87 DLOG(ERROR) << "Surface has already been assigned a role"; |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 if (surface_) { | 90 if (surface_) { |
| 91 surface_->window()->SetTransform(gfx::Transform()); | 91 surface_->window()->SetTransform(gfx::Transform()); |
| 92 WMHelper::GetInstance() | 92 if (surface_->window()->parent()) |
| 93 ->GetContainer(ash::kShellWindowId_MouseCursorContainer) | 93 surface_->window()->parent()->RemoveChild(surface_->window()); |
| 94 ->RemoveChild(surface_->window()); | |
| 95 surface_->SetSurfaceDelegate(nullptr); | 94 surface_->SetSurfaceDelegate(nullptr); |
| 96 surface_->RemoveSurfaceObserver(this); | 95 surface_->RemoveSurfaceObserver(this); |
| 97 } | 96 } |
| 98 surface_ = surface; | 97 surface_ = surface; |
| 99 if (surface_) { | 98 if (surface_) { |
| 100 surface_->SetSurfaceDelegate(this); | 99 surface_->SetSurfaceDelegate(this); |
| 101 surface_->AddSurfaceObserver(this); | 100 surface_->AddSurfaceObserver(this); |
| 102 // Note: Surface window needs to be added to the tree so we can take a | 101 // Note: Surface window needs to be added to the tree so we can take a |
| 103 // snapshot. Where in the tree is not important but we might as well use | 102 // snapshot. Where in the tree is not important but we might as well use |
| 104 // the cursor container. | 103 // the cursor container. |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 if (!root_window) | 381 if (!root_window) |
| 383 return; | 382 return; |
| 384 | 383 |
| 385 aura::client::CursorClient* cursor_client = | 384 aura::client::CursorClient* cursor_client = |
| 386 aura::client::GetCursorClient(root_window); | 385 aura::client::GetCursorClient(root_window); |
| 387 if (cursor_client) | 386 if (cursor_client) |
| 388 cursor_client->SetCursor(cursor_); | 387 cursor_client->SetCursor(cursor_); |
| 389 } | 388 } |
| 390 | 389 |
| 391 } // namespace exo | 390 } // namespace exo |
| OLD | NEW |