Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: remoting/host/chromeos/mouse_cursor_monitor_aura.cc

Issue 833693002: Hide the cursor on the client when it is hidden on the host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Sergey's feedback Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/host/video_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromeos/mouse_cursor_monitor_aura.cc
diff --git a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
index ad48f141bc0cc040193096016d546607ba7618c3..f1120aa2b5ed663c912fd2f7d6fe916e13925669 100644
--- a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
+++ b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
@@ -15,6 +15,18 @@
#include "ui/aura/window_tree_host.h"
#include "ui/base/cursor/cursors_aura.h"
+namespace {
+
+// Creates an empty webrtc::MouseCursor. The caller is responsible for
+// destroying the returned cursor.
+webrtc::MouseCursor* CreateEmptyMouseCursor() {
+ return new webrtc::MouseCursor(
+ new webrtc::BasicDesktopFrame(webrtc::DesktopSize(0, 0)),
+ webrtc::DesktopVector(0, 0));
+}
+
+} // namespace
+
namespace remoting {
MouseCursorMonitorAura::MouseCursorMonitorAura()
@@ -36,6 +48,7 @@ void MouseCursorMonitorAura::Capture() {
ash::Shell::GetPrimaryRootWindow()->GetHost()->last_cursor();
if (cursor != last_cursor_) {
+ last_cursor_ = cursor;
NotifyCursorChanged(cursor);
}
@@ -53,14 +66,19 @@ void MouseCursorMonitorAura::Capture() {
void MouseCursorMonitorAura::NotifyCursorChanged(const ui::Cursor& cursor) {
scoped_ptr<SkBitmap> cursor_bitmap(new SkBitmap());
gfx::Point cursor_hotspot;
+
+ if (cursor.native_type() == ui::kCursorNone) {
+ callback_->OnMouseCursor(CreateEmptyMouseCursor());
+ return;
+ }
+
if (!ui::GetCursorBitmap(cursor, cursor_bitmap.get(), &cursor_hotspot)) {
LOG(ERROR) << "Failed to load bitmap for cursor type:"
<< cursor.native_type();
+ callback_->OnMouseCursor(CreateEmptyMouseCursor());
return;
}
- last_cursor_ = cursor;
-
// There is a bug (crbug.com/436993) in aura::GetCursorBitmap() such that it
// it would return a scale-factor-100 bitmap with a scale-factor-200 hotspot.
// This causes the hotspot to go out of range. As a result, we would need to
« no previous file with comments | « no previous file | remoting/host/video_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698