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

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

Issue 2787263003: Delete all log messages depending on system_wrappers. (Closed)
Patch Set: Created 3 years, 8 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
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
11 #include <memory> 11 #include <memory>
12 12
13 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h" 13 #include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
14 14
15 #include <X11/extensions/Xfixes.h> 15 #include <X11/extensions/Xfixes.h>
16 #include <X11/Xlib.h> 16 #include <X11/Xlib.h>
17 #include <X11/Xutil.h> 17 #include <X11/Xutil.h>
18 18
19 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" 19 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
20 #include "webrtc/modules/desktop_capture/desktop_frame.h" 20 #include "webrtc/modules/desktop_capture/desktop_frame.h"
21 #include "webrtc/modules/desktop_capture/mouse_cursor.h" 21 #include "webrtc/modules/desktop_capture/mouse_cursor.h"
22 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h" 22 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h"
23 #include "webrtc/system_wrappers/include/logging.h"
24 23
25 namespace { 24 namespace {
26 25
27 // WindowCapturer returns window IDs of X11 windows with WM_STATE attribute. 26 // WindowCapturer returns window IDs of X11 windows with WM_STATE attribute.
28 // These windows may not be immediate children of the root window, because 27 // These windows may not be immediate children of the root window, because
29 // window managers may re-parent them to add decorations. However, 28 // window managers may re-parent them to add decorations. However,
30 // XQueryPointer() expects to be passed children of the root. This function 29 // XQueryPointer() expects to be passed children of the root. This function
31 // searches up the list of the windows to find the root child that corresponds 30 // searches up the list of the windows to find the root child that corresponds
32 // to |window|. 31 // to |window|.
33 Window GetTopLevelWindow(Display* display, Window window) { 32 Window GetTopLevelWindow(Display* display, Window window) {
34 while (true) { 33 while (true) {
35 // If the window is in WithdrawnState then look at all of its children. 34 // If the window is in WithdrawnState then look at all of its children.
36 ::Window root, parent; 35 ::Window root, parent;
37 ::Window *children; 36 ::Window *children;
38 unsigned int num_children; 37 unsigned int num_children;
39 if (!XQueryTree(display, window, &root, &parent, &children, 38 if (!XQueryTree(display, window, &root, &parent, &children,
40 &num_children)) { 39 &num_children)) {
41 LOG(LS_ERROR) << "Failed to query for child windows although window"
42 << "does not have a valid WM_STATE.";
43 return None; 40 return None;
44 } 41 }
45 if (children) 42 if (children)
46 XFree(children); 43 XFree(children);
47 44
48 if (parent == root) 45 if (parent == root)
49 break; 46 break;
50 47
51 window = parent; 48 window = parent;
52 } 49 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 have_xfixes_ = 137 have_xfixes_ =
141 XFixesQueryExtension(display(), &xfixes_event_base_, &xfixes_error_base_); 138 XFixesQueryExtension(display(), &xfixes_event_base_, &xfixes_error_base_);
142 139
143 if (have_xfixes_) { 140 if (have_xfixes_) {
144 // Register for changes to the cursor shape. 141 // Register for changes to the cursor shape.
145 XFixesSelectCursorInput(display(), window_, XFixesDisplayCursorNotifyMask); 142 XFixesSelectCursorInput(display(), window_, XFixesDisplayCursorNotifyMask);
146 x_display_->AddEventHandler(xfixes_event_base_ + XFixesCursorNotify, this); 143 x_display_->AddEventHandler(xfixes_event_base_ + XFixesCursorNotify, this);
147 144
148 CaptureCursor(); 145 CaptureCursor();
149 } else { 146 } else {
150 LOG(LS_INFO) << "X server does not support XFixes.";
151 } 147 }
152 } 148 }
153 149
154 void MouseCursorMonitorX11::Capture() { 150 void MouseCursorMonitorX11::Capture() {
155 RTC_DCHECK(callback_); 151 RTC_DCHECK(callback_);
156 152
157 // Process X11 events in case XFixes has sent cursor notification. 153 // Process X11 events in case XFixes has sent cursor notification.
158 x_display_->ProcessPendingXEvents(); 154 x_display_->ProcessPendingXEvents();
159 155
160 // cursor_shape_| is set only if we were notified of a cursor shape change. 156 // cursor_shape_| is set only if we were notified of a cursor shape change.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen( 243 MouseCursorMonitor* MouseCursorMonitor::CreateForScreen(
248 const DesktopCaptureOptions& options, 244 const DesktopCaptureOptions& options,
249 ScreenId screen) { 245 ScreenId screen) {
250 if (!options.x_display()) 246 if (!options.x_display())
251 return NULL; 247 return NULL;
252 return new MouseCursorMonitorX11( 248 return new MouseCursorMonitorX11(
253 options, DefaultRootWindow(options.x_display()->display())); 249 options, DefaultRootWindow(options.x_display()->display()));
254 } 250 }
255 251
256 } // namespace webrtc 252 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/mouse_cursor_monitor_win.cc ('k') | webrtc/modules/desktop_capture/screen_capturer_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698