summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/host/chromeos/mouse_cursor_monitor_aura.cc22
-rw-r--r--remoting/host/video_scheduler.cc2
-rw-r--r--remoting/protocol/client_control_dispatcher.cc4
3 files changed, 23 insertions, 5 deletions
diff --git a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
index ad48f14..f1120aa 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
diff --git a/remoting/host/video_scheduler.cc b/remoting/host/video_scheduler.cc
index 3e54e5a..aaa31d1 100644
--- a/remoting/host/video_scheduler.cc
+++ b/remoting/host/video_scheduler.cc
@@ -122,7 +122,7 @@ void VideoScheduler::OnMouseCursor(webrtc::MouseCursor* cursor) {
cursor_proto->set_hotspot_x(cursor->hotspot().x());
cursor_proto->set_hotspot_y(cursor->hotspot().y());
- std::string data;
+ cursor_proto->set_data(std::string());
uint8_t* current_row = cursor->image()->data();
for (int y = 0; y < cursor->image()->size().height(); ++y) {
cursor_proto->mutable_data()->append(
diff --git a/remoting/protocol/client_control_dispatcher.cc b/remoting/protocol/client_control_dispatcher.cc
index 599c779..5a6bad5 100644
--- a/remoting/protocol/client_control_dispatcher.cc
+++ b/remoting/protocol/client_control_dispatcher.cc
@@ -38,8 +38,8 @@ bool CursorShapeIsValid(const CursorShapeInfo& cursor_shape) {
// Verify that |width| and |height| are within sane limits. Otherwise integer
// overflow can occur while calculating |cursor_total_bytes| below.
- if (width <= 0 || width > (SHRT_MAX / 2) ||
- height <= 0 || height > (SHRT_MAX / 2)) {
+ if (width < 0 || width > (SHRT_MAX / 2) ||
+ height < 0 || height > (SHRT_MAX / 2)) {
LOG(ERROR) << "Cursor dimensions are out of bounds for SetCursor: "
<< width << "x" << height;
return false;