OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/ozone/platform/dri/dri_cursor.h" | 5 #include "ui/ozone/platform/dri/dri_cursor.h" |
6 | 6 |
7 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 7 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
8 #include "ui/gfx/geometry/point.h" | 8 #include "ui/gfx/geometry/point.h" |
9 #include "ui/gfx/geometry/point_conversions.h" | 9 #include "ui/gfx/geometry/point_conversions.h" |
10 #include "ui/gfx/geometry/point_f.h" | 10 #include "ui/gfx/geometry/point_f.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 const gfx::Size& size = window->GetBounds().size(); | 71 const gfx::Size& size = window->GetBounds().size(); |
72 cursor_location_.SetToMax(gfx::PointF(0, 0)); | 72 cursor_location_.SetToMax(gfx::PointF(0, 0)); |
73 // Right and bottom edges are exclusive. | 73 // Right and bottom edges are exclusive. |
74 cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1)); | 74 cursor_location_.SetToMin(gfx::PointF(size.width() - 1, size.height() - 1)); |
75 | 75 |
76 if (cursor_.get()) | 76 if (cursor_.get()) |
77 sender_->MoveHardwareCursor(cursor_window_, bitmap_location()); | 77 sender_->MoveHardwareCursor(cursor_window_, bitmap_location()); |
78 } | 78 } |
79 | 79 |
80 void DriCursor::MoveCursorTo(const gfx::PointF& location) { | 80 void DriCursor::MoveCursorTo(const gfx::PointF& location) { |
81 MoveCursorTo(cursor_window_, location); | 81 DriWindow* window = |
| 82 window_manager_->GetWindowAt(gfx::ToFlooredPoint(location)); |
| 83 if (!window) |
| 84 return; |
| 85 |
| 86 MoveCursorTo(window->GetAcceleratedWidget(), |
| 87 location - window->GetBounds().OffsetFromOrigin()); |
82 } | 88 } |
83 | 89 |
84 void DriCursor::MoveCursor(const gfx::Vector2dF& delta) { | 90 void DriCursor::MoveCursor(const gfx::Vector2dF& delta) { |
85 #if defined(OS_CHROMEOS) | 91 #if defined(OS_CHROMEOS) |
86 gfx::Vector2dF transformed_delta = delta; | 92 gfx::Vector2dF transformed_delta = delta; |
87 ui::CursorController::GetInstance()->ApplyCursorConfigForWindow( | 93 ui::CursorController::GetInstance()->ApplyCursorConfigForWindow( |
88 cursor_window_, &transformed_delta); | 94 cursor_window_, &transformed_delta); |
89 MoveCursorTo(cursor_window_, cursor_location_ + transformed_delta); | 95 MoveCursorTo(cursor_window_, cursor_location_ + transformed_delta); |
90 #else | 96 #else |
91 MoveCursorTo(cursor_window_, cursor_location_ + delta); | 97 MoveCursorTo(cursor_window_, cursor_location_ + delta); |
(...skipping 19 matching lines...) Expand all Loading... |
111 gfx::PointF DriCursor::location() { | 117 gfx::PointF DriCursor::location() { |
112 return cursor_location_; | 118 return cursor_location_; |
113 } | 119 } |
114 | 120 |
115 gfx::Point DriCursor::bitmap_location() { | 121 gfx::Point DriCursor::bitmap_location() { |
116 return gfx::ToFlooredPoint(cursor_location_) - | 122 return gfx::ToFlooredPoint(cursor_location_) - |
117 cursor_->hotspot().OffsetFromOrigin(); | 123 cursor_->hotspot().OffsetFromOrigin(); |
118 } | 124 } |
119 | 125 |
120 } // namespace ui | 126 } // namespace ui |
OLD | NEW |