| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
| 10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 last_event_type_ = event->type(); | 248 last_event_type_ = event->type(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void Pointer::OnScrollEvent(ui::ScrollEvent* event) { | 251 void Pointer::OnScrollEvent(ui::ScrollEvent* event) { |
| 252 OnMouseEvent(event); | 252 OnMouseEvent(event); |
| 253 } | 253 } |
| 254 | 254 |
| 255 //////////////////////////////////////////////////////////////////////////////// | 255 //////////////////////////////////////////////////////////////////////////////// |
| 256 // WMHelper::CursorObserver overrides: | 256 // WMHelper::CursorObserver overrides: |
| 257 | 257 |
| 258 void Pointer::OnCursorSetChanged(ui::CursorSetType cursor_set) { | 258 void Pointer::OnCursorSizeChanged(ui::CursorSize cursor_size) { |
| 259 if (focus_) | 259 if (focus_) |
| 260 UpdateCursor(); | 260 UpdateCursor(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void Pointer::OnCursorDisplayChanged(const display::Display& display) { | 263 void Pointer::OnCursorDisplayChanged(const display::Display& display) { |
| 264 if (focus_) | 264 if (focus_) |
| 265 UpdateCursor(); | 265 UpdateCursor(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 //////////////////////////////////////////////////////////////////////////////// | 268 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 } else { | 380 } else { |
| 381 SkBitmap bitmap = cursor_bitmap_; | 381 SkBitmap bitmap = cursor_bitmap_; |
| 382 gfx::Point hotspot = | 382 gfx::Point hotspot = |
| 383 gfx::ScaleToFlooredPoint(hotspot_, kCursorCaptureScale); | 383 gfx::ScaleToFlooredPoint(hotspot_, kCursorCaptureScale); |
| 384 | 384 |
| 385 auto* helper = WMHelper::GetInstance(); | 385 auto* helper = WMHelper::GetInstance(); |
| 386 const display::Display& display = helper->GetCursorDisplay(); | 386 const display::Display& display = helper->GetCursorDisplay(); |
| 387 float scale = helper->GetDisplayInfo(display.id()).device_scale_factor() / | 387 float scale = helper->GetDisplayInfo(display.id()).device_scale_factor() / |
| 388 kCursorCaptureScale; | 388 kCursorCaptureScale; |
| 389 | 389 |
| 390 if (helper->GetCursorSet() == ui::CURSOR_SET_LARGE) | 390 if (helper->GetCursorSize() == ui::CursorSize::kLarge) |
| 391 scale *= kLargeCursorScale; | 391 scale *= kLargeCursorScale; |
| 392 | 392 |
| 393 ui::ScaleAndRotateCursorBitmapAndHotpoint(scale, display.rotation(), | 393 ui::ScaleAndRotateCursorBitmapAndHotpoint(scale, display.rotation(), |
| 394 &bitmap, &hotspot); | 394 &bitmap, &hotspot); |
| 395 | 395 |
| 396 ui::PlatformCursor platform_cursor; | 396 ui::PlatformCursor platform_cursor; |
| 397 #if defined(USE_OZONE) | 397 #if defined(USE_OZONE) |
| 398 // TODO(reveman): Add interface for creating cursors from GpuMemoryBuffers | 398 // TODO(reveman): Add interface for creating cursors from GpuMemoryBuffers |
| 399 // and use that here instead of the current bitmap API. crbug.com/686600 | 399 // and use that here instead of the current bitmap API. crbug.com/686600 |
| 400 platform_cursor = ui::CursorFactoryOzone::GetInstance()->CreateImageCursor( | 400 platform_cursor = ui::CursorFactoryOzone::GetInstance()->CreateImageCursor( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 416 if (!root_window) | 416 if (!root_window) |
| 417 return; | 417 return; |
| 418 | 418 |
| 419 aura::client::CursorClient* cursor_client = | 419 aura::client::CursorClient* cursor_client = |
| 420 aura::client::GetCursorClient(root_window); | 420 aura::client::GetCursorClient(root_window); |
| 421 if (cursor_client) | 421 if (cursor_client) |
| 422 cursor_client->SetCursor(cursor_); | 422 cursor_client->SetCursor(cursor_); |
| 423 } | 423 } |
| 424 | 424 |
| 425 } // namespace exo | 425 } // namespace exo |
| OLD | NEW |