| 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/common/display/display_info.h" | 7 #include "ash/common/display/display_info.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 break; | 209 break; |
| 210 } | 210 } |
| 211 | 211 |
| 212 // Update cursor widget to reflect current focus and pointer location. | 212 // Update cursor widget to reflect current focus and pointer location. |
| 213 if (focus_) { | 213 if (focus_) { |
| 214 if (!widget_) | 214 if (!widget_) |
| 215 CreatePointerWidget(); | 215 CreatePointerWidget(); |
| 216 | 216 |
| 217 // Update cursor location if mouse event caused it to change. | 217 // Update cursor location if mouse event caused it to change. |
| 218 gfx::Point mouse_location = aura::Env::GetInstance()->last_mouse_location(); | 218 gfx::Point mouse_location = aura::Env::GetInstance()->last_mouse_location(); |
| 219 if (mouse_location != widget_->GetNativeWindow()->bounds().origin()) { | 219 gfx::Rect bounds = widget_->GetWindowBoundsInScreen(); |
| 220 gfx::Rect bounds = widget_->GetNativeWindow()->bounds(); | 220 if (mouse_location != bounds.origin()) { |
| 221 bounds.set_origin(mouse_location); | 221 bounds.set_origin(mouse_location); |
| 222 widget_->GetNativeWindow()->SetBounds(bounds); | 222 widget_->SetBounds(bounds); |
| 223 } | 223 } |
| 224 | 224 |
| 225 UpdateCursorScale(); | 225 UpdateCursorScale(); |
| 226 } else { | 226 } else { |
| 227 if (widget_ && widget_->IsVisible()) | 227 if (widget_ && widget_->IsVisible()) |
| 228 widget_->Hide(); | 228 widget_->Hide(); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 void Pointer::OnScrollEvent(ui::ScrollEvent* event) { | 232 void Pointer::OnScrollEvent(ui::ScrollEvent* event) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 314 |
| 315 if (ui_scale != cursor_scale_) { | 315 if (ui_scale != cursor_scale_) { |
| 316 gfx::Transform transform; | 316 gfx::Transform transform; |
| 317 transform.Scale(ui_scale, ui_scale); | 317 transform.Scale(ui_scale, ui_scale); |
| 318 widget_->GetNativeWindow()->SetTransform(transform); | 318 widget_->GetNativeWindow()->SetTransform(transform); |
| 319 cursor_scale_ = ui_scale; | 319 cursor_scale_ = ui_scale; |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 } // namespace exo | 323 } // namespace exo |
| OLD | NEW |