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 "remoting/host/chromeos/mouse_cursor_monitor_aura.h" | 5 #include "remoting/host/chromeos/mouse_cursor_monitor_aura.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 last_mouse_location_ = position; | 46 last_mouse_location_ = position; |
47 callback_->OnMouseCursorPosition( | 47 callback_->OnMouseCursorPosition( |
48 INSIDE, webrtc::DesktopVector(position.x(), position.y())); | 48 INSIDE, webrtc::DesktopVector(position.x(), position.y())); |
49 } | 49 } |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 void MouseCursorMonitorAura::NotifyCursorChanged(const ui::Cursor& cursor) { | 53 void MouseCursorMonitorAura::NotifyCursorChanged(const ui::Cursor& cursor) { |
54 scoped_ptr<SkBitmap> cursor_bitmap(new SkBitmap()); | 54 scoped_ptr<SkBitmap> cursor_bitmap(new SkBitmap()); |
55 gfx::Point cursor_hotspot; | 55 gfx::Point cursor_hotspot; |
56 | |
57 if (cursor.native_type() == ui::kCursorNone) { | |
58 return; | |
Sergey Ulanov
2015/01/05 18:00:25
Should we notify the client that the cursor is hid
Wez
2015/01/05 20:02:46
Yes, please do. There is even an EmptyCursorShape(
kelvinp
2015/01/06 02:22:18
Whoa, excellent point.
I have taken the step a lit
| |
59 } | |
60 | |
56 if (!ui::GetCursorBitmap(cursor, cursor_bitmap.get(), &cursor_hotspot)) { | 61 if (!ui::GetCursorBitmap(cursor, cursor_bitmap.get(), &cursor_hotspot)) { |
57 LOG(ERROR) << "Failed to load bitmap for cursor type:" | 62 LOG(ERROR) << "Failed to load bitmap for cursor type:" |
58 << cursor.native_type(); | 63 << cursor.native_type(); |
59 return; | 64 return; |
60 } | 65 } |
61 | 66 |
62 last_cursor_ = cursor; | 67 last_cursor_ = cursor; |
63 | 68 |
64 // There is a bug (crbug.com/436993) in aura::GetCursorBitmap() such that it | 69 // There is a bug (crbug.com/436993) in aura::GetCursorBitmap() such that it |
65 // it would return a scale-factor-100 bitmap with a scale-factor-200 hotspot. | 70 // it would return a scale-factor-100 bitmap with a scale-factor-200 hotspot. |
(...skipping 13 matching lines...) Expand all Loading... | |
79 scoped_ptr<webrtc::DesktopFrame> image( | 84 scoped_ptr<webrtc::DesktopFrame> image( |
80 SkiaBitmapDesktopFrame::Create(cursor_bitmap.Pass())); | 85 SkiaBitmapDesktopFrame::Create(cursor_bitmap.Pass())); |
81 scoped_ptr<webrtc::MouseCursor> cursor_shape(new webrtc::MouseCursor( | 86 scoped_ptr<webrtc::MouseCursor> cursor_shape(new webrtc::MouseCursor( |
82 image.release(), | 87 image.release(), |
83 webrtc::DesktopVector(cursor_hotspot.x(), cursor_hotspot.y()))); | 88 webrtc::DesktopVector(cursor_hotspot.x(), cursor_hotspot.y()))); |
84 | 89 |
85 callback_->OnMouseCursor(cursor_shape.release()); | 90 callback_->OnMouseCursor(cursor_shape.release()); |
86 } | 91 } |
87 | 92 |
88 } // namespace remoting | 93 } // namespace remoting |
OLD | NEW |