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 "components/exo/pointer_delegate.h" | 10 #include "components/exo/pointer_delegate.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 | 253 |
254 // Update cursor widget to reflect current focus and pointer location. | 254 // Update cursor widget to reflect current focus and pointer location. |
255 if (focus_) { | 255 if (focus_) { |
256 if (!widget_) | 256 if (!widget_) |
257 CreatePointerWidget(); | 257 CreatePointerWidget(); |
258 | 258 |
259 // Update cursor location if mouse event caused it to change. | 259 // Update cursor location if mouse event caused it to change. |
260 gfx::Point mouse_location = aura::Env::GetInstance()->last_mouse_location(); | 260 gfx::Point mouse_location = aura::Env::GetInstance()->last_mouse_location(); |
261 gfx::Rect bounds = widget_->GetWindowBoundsInScreen(); | 261 gfx::Rect bounds = widget_->GetWindowBoundsInScreen(); |
262 if (mouse_location != bounds.origin()) { | 262 if (mouse_location != bounds.origin()) { |
263 if (event->flags() & ui::EF_DIRECT_INPUT) { | |
reveman
2016/08/29 22:34:08
Can we move this check to line 255 instead? ie. (f
denniskempin
2016/08/30 00:28:11
Done.
| |
264 if (widget_->IsVisible()) | |
265 widget_->Hide(); | |
266 } else { | |
267 if (!widget_->IsVisible()) | |
268 widget_->Show(); | |
269 } | |
270 | |
263 bounds.set_origin(mouse_location); | 271 bounds.set_origin(mouse_location); |
264 widget_->SetBounds(bounds); | 272 widget_->SetBounds(bounds); |
265 } | 273 } |
266 | 274 |
267 UpdateCursorScale(); | 275 UpdateCursorScale(); |
268 } else { | 276 } else { |
269 if (widget_ && widget_->IsVisible()) | 277 if (widget_ && widget_->IsVisible()) |
270 widget_->Hide(); | 278 widget_->Hide(); |
271 } | 279 } |
272 } | 280 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 | 360 |
353 if (ui_scale != cursor_scale_) { | 361 if (ui_scale != cursor_scale_) { |
354 gfx::Transform transform; | 362 gfx::Transform transform; |
355 transform.Scale(ui_scale, ui_scale); | 363 transform.Scale(ui_scale, ui_scale); |
356 widget_->GetNativeWindow()->SetTransform(transform); | 364 widget_->GetNativeWindow()->SetTransform(transform); |
357 cursor_scale_ = ui_scale; | 365 cursor_scale_ = ui_scale; |
358 } | 366 } |
359 } | 367 } |
360 | 368 |
361 } // namespace exo | 369 } // namespace exo |
OLD | NEW |