| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h" | 11 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 | 14 |
| 15 #include <memory> |
| 16 |
| 15 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 17 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
| 16 #include "webrtc/modules/desktop_capture/mouse_cursor.h" | 18 #include "webrtc/modules/desktop_capture/mouse_cursor.h" |
| 17 #include "webrtc/modules/desktop_capture/win/cursor.h" | 19 #include "webrtc/modules/desktop_capture/win/cursor.h" |
| 18 #include "webrtc/modules/desktop_capture/win/window_capture_utils.h" | 20 #include "webrtc/modules/desktop_capture/win/window_capture_utils.h" |
| 19 #include "webrtc/system_wrappers/include/logging.h" | 21 #include "webrtc/system_wrappers/include/logging.h" |
| 20 | 22 |
| 21 namespace webrtc { | 23 namespace webrtc { |
| 22 | 24 |
| 23 class MouseCursorMonitorWin : public MouseCursorMonitor { | 25 class MouseCursorMonitorWin : public MouseCursorMonitor { |
| 24 public: | 26 public: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 CURSORINFO cursor_info; | 88 CURSORINFO cursor_info; |
| 87 cursor_info.cbSize = sizeof(CURSORINFO); | 89 cursor_info.cbSize = sizeof(CURSORINFO); |
| 88 if (!GetCursorInfo(&cursor_info)) { | 90 if (!GetCursorInfo(&cursor_info)) { |
| 89 LOG_F(LS_ERROR) << "Unable to get cursor info. Error = " << GetLastError(); | 91 LOG_F(LS_ERROR) << "Unable to get cursor info. Error = " << GetLastError(); |
| 90 return; | 92 return; |
| 91 } | 93 } |
| 92 | 94 |
| 93 if (last_cursor_ != cursor_info.hCursor) { | 95 if (last_cursor_ != cursor_info.hCursor) { |
| 94 last_cursor_ = cursor_info.hCursor; | 96 last_cursor_ = cursor_info.hCursor; |
| 95 // Note that |cursor_info.hCursor| does not need to be freed. | 97 // Note that |cursor_info.hCursor| does not need to be freed. |
| 96 rtc::scoped_ptr<MouseCursor> cursor( | 98 std::unique_ptr<MouseCursor> cursor( |
| 97 CreateMouseCursorFromHCursor(desktop_dc_, cursor_info.hCursor)); | 99 CreateMouseCursorFromHCursor(desktop_dc_, cursor_info.hCursor)); |
| 98 if (cursor.get()) | 100 if (cursor.get()) |
| 99 callback_->OnMouseCursor(cursor.release()); | 101 callback_->OnMouseCursor(cursor.release()); |
| 100 } | 102 } |
| 101 | 103 |
| 102 if (mode_ != SHAPE_AND_POSITION) | 104 if (mode_ != SHAPE_AND_POSITION) |
| 103 return; | 105 return; |
| 104 | 106 |
| 105 DesktopVector position(cursor_info.ptScreenPos.x, cursor_info.ptScreenPos.y); | 107 DesktopVector position(cursor_info.ptScreenPos.x, cursor_info.ptScreenPos.y); |
| 106 bool inside = cursor_info.flags == CURSOR_SHOWING; | 108 bool inside = cursor_info.flags == CURSOR_SHOWING; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 return new MouseCursorMonitorWin(reinterpret_cast<HWND>(window)); | 166 return new MouseCursorMonitorWin(reinterpret_cast<HWND>(window)); |
| 165 } | 167 } |
| 166 | 168 |
| 167 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen( | 169 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen( |
| 168 const DesktopCaptureOptions& options, | 170 const DesktopCaptureOptions& options, |
| 169 ScreenId screen) { | 171 ScreenId screen) { |
| 170 return new MouseCursorMonitorWin(screen); | 172 return new MouseCursorMonitorWin(screen); |
| 171 } | 173 } |
| 172 | 174 |
| 173 } // namespace webrtc | 175 } // namespace webrtc |
| OLD | NEW |