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

Side by Side Diff: webrtc/modules/desktop_capture/mouse_cursor_monitor_win.cc

Issue 1959863002: CURSORINFO.flags should be checked before capturing its bitmap (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void MouseCursorMonitorWin::Capture() { 85 void MouseCursorMonitorWin::Capture() {
86 assert(callback_); 86 assert(callback_);
87 87
88 CURSORINFO cursor_info; 88 CURSORINFO cursor_info;
89 cursor_info.cbSize = sizeof(CURSORINFO); 89 cursor_info.cbSize = sizeof(CURSORINFO);
90 if (!GetCursorInfo(&cursor_info)) { 90 if (!GetCursorInfo(&cursor_info)) {
91 LOG_F(LS_ERROR) << "Unable to get cursor info. Error = " << GetLastError(); 91 LOG_F(LS_ERROR) << "Unable to get cursor info. Error = " << GetLastError();
92 return; 92 return;
93 } 93 }
94 94
95 if (cursor_info.flags != CURSOR_SHOWING) {
joedow 2016/05/09 17:14:05 Do any clients rely on receiving the bitmap when t
Hzj_jie 2016/05/10 00:40:58 I believe other platform won't be impacted, they d
Hzj_jie 2016/05/10 18:15:22 Done.
Hzj_jie 2016/05/10 18:15:22 Done.
96 return;
Sergey Ulanov 2016/05/10 17:17:07 I see two issues with this fix: 1. This code is u
Hzj_jie 2016/05/10 18:15:22 The following logic (after if (mode_ != SHAPE_AND_
97 }
98
95 if (last_cursor_ != cursor_info.hCursor) { 99 if (last_cursor_ != cursor_info.hCursor) {
96 last_cursor_ = cursor_info.hCursor;
97 // Note that |cursor_info.hCursor| does not need to be freed. 100 // Note that |cursor_info.hCursor| does not need to be freed.
98 std::unique_ptr<MouseCursor> cursor( 101 std::unique_ptr<MouseCursor> cursor(
99 CreateMouseCursorFromHCursor(desktop_dc_, cursor_info.hCursor)); 102 CreateMouseCursorFromHCursor(desktop_dc_, cursor_info.hCursor));
100 if (cursor.get()) 103 if (cursor) {
104 last_cursor_ = cursor_info.hCursor;
101 callback_->OnMouseCursor(cursor.release()); 105 callback_->OnMouseCursor(cursor.release());
106 } else {
107 last_cursor_ = NULL;
108 }
102 } 109 }
103 110
104 if (mode_ != SHAPE_AND_POSITION) 111 if (mode_ != SHAPE_AND_POSITION)
105 return; 112 return;
106 113
107 DesktopVector position(cursor_info.ptScreenPos.x, cursor_info.ptScreenPos.y); 114 DesktopVector position(cursor_info.ptScreenPos.x, cursor_info.ptScreenPos.y);
108 bool inside = cursor_info.flags == CURSOR_SHOWING; 115 bool inside = cursor_info.flags == CURSOR_SHOWING;
109 116
110 if (window_) { 117 if (window_) {
111 DesktopRect original_rect; 118 DesktopRect original_rect;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return new MouseCursorMonitorWin(reinterpret_cast<HWND>(window)); 173 return new MouseCursorMonitorWin(reinterpret_cast<HWND>(window));
167 } 174 }
168 175
169 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen( 176 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen(
170 const DesktopCaptureOptions& options, 177 const DesktopCaptureOptions& options,
171 ScreenId screen) { 178 ScreenId screen) {
172 return new MouseCursorMonitorWin(screen); 179 return new MouseCursorMonitorWin(screen);
173 } 180 }
174 181
175 } // namespace webrtc 182 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698