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

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: Only ignore cursor bitmap when host hides it 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 (last_cursor_ != cursor_info.hCursor) { 95 if (cursor_info.flags == CURSOR_SHOWING &&
Sergey Ulanov 2016/05/10 20:51:15 I still think that wont do the right thing. Partic
Sergey Ulanov 2016/05/10 20:58:12 Actually looking at this again I see your point -
Hzj_jie 2016/05/11 00:55:49 Done.
Hzj_jie 2016/05/11 00:55:49 Based on our discussion, we will do this, 1. Alway
96 last_cursor_ = cursor_info.hCursor; 96 last_cursor_ != cursor_info.hCursor) {
97 // Note that |cursor_info.hCursor| does not need to be freed. 97 // Note that |cursor_info.hCursor| does not need to be freed.
98 std::unique_ptr<MouseCursor> cursor( 98 std::unique_ptr<MouseCursor> cursor(
99 CreateMouseCursorFromHCursor(desktop_dc_, cursor_info.hCursor)); 99 CreateMouseCursorFromHCursor(desktop_dc_, cursor_info.hCursor));
100 if (cursor.get()) 100 if (cursor) {
101 last_cursor_ = cursor_info.hCursor;
101 callback_->OnMouseCursor(cursor.release()); 102 callback_->OnMouseCursor(cursor.release());
103 } else {
104 last_cursor_ = NULL;
105 }
102 } 106 }
103 107
104 if (mode_ != SHAPE_AND_POSITION) 108 if (mode_ != SHAPE_AND_POSITION)
105 return; 109 return;
106 110
107 DesktopVector position(cursor_info.ptScreenPos.x, cursor_info.ptScreenPos.y); 111 DesktopVector position(cursor_info.ptScreenPos.x, cursor_info.ptScreenPos.y);
108 bool inside = cursor_info.flags == CURSOR_SHOWING; 112 bool inside = cursor_info.flags == CURSOR_SHOWING;
109 113
110 if (window_) { 114 if (window_) {
111 DesktopRect original_rect; 115 DesktopRect original_rect;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return new MouseCursorMonitorWin(reinterpret_cast<HWND>(window)); 170 return new MouseCursorMonitorWin(reinterpret_cast<HWND>(window));
167 } 171 }
168 172
169 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen( 173 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen(
170 const DesktopCaptureOptions& options, 174 const DesktopCaptureOptions& options,
171 ScreenId screen) { 175 ScreenId screen) {
172 return new MouseCursorMonitorWin(screen); 176 return new MouseCursorMonitorWin(screen);
173 } 177 }
174 178
175 } // namespace webrtc 179 } // 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