| 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/window_capturer.h" | 11 #include "webrtc/modules/desktop_capture/window_capturer.h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 #include <string.h> | 14 #include <string.h> |
| 15 #include <X11/Xatom.h> | 15 #include <X11/Xatom.h> |
| 16 #include <X11/extensions/Xcomposite.h> | 16 #include <X11/extensions/Xcomposite.h> |
| 17 #include <X11/extensions/Xrender.h> | 17 #include <X11/extensions/Xrender.h> |
| 18 #include <X11/Xutil.h> | 18 #include <X11/Xutil.h> |
| 19 | 19 |
| 20 #include <algorithm> | 20 #include <algorithm> |
| 21 | 21 |
| 22 #include "webrtc/base/scoped_ptr.h" | 22 #include "webrtc/base/scoped_ptr.h" |
| 23 #include "webrtc/base/scoped_ref_ptr.h" |
| 23 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" | 24 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 24 #include "webrtc/modules/desktop_capture/desktop_frame.h" | 25 #include "webrtc/modules/desktop_capture/desktop_frame.h" |
| 25 #include "webrtc/modules/desktop_capture/x11/shared_x_display.h" | 26 #include "webrtc/modules/desktop_capture/x11/shared_x_display.h" |
| 26 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h" | 27 #include "webrtc/modules/desktop_capture/x11/x_error_trap.h" |
| 27 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h" | 28 #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h" |
| 28 #include "webrtc/system_wrappers/interface/logging.h" | 29 #include "webrtc/system_wrappers/interface/logging.h" |
| 29 #include "webrtc/system_wrappers/interface/scoped_refptr.h" | |
| 30 | 30 |
| 31 namespace webrtc { | 31 namespace webrtc { |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 // Convenience wrapper for XGetWindowProperty() results. | 35 // Convenience wrapper for XGetWindowProperty() results. |
| 36 template <class PropertyType> | 36 template <class PropertyType> |
| 37 class XWindowProperty { | 37 class XWindowProperty { |
| 38 public: | 38 public: |
| 39 XWindowProperty(Display* display, Window window, Atom property) | 39 XWindowProperty(Display* display, Window window, Atom property) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 ::Window GetApplicationWindow(::Window window); | 112 ::Window GetApplicationWindow(::Window window); |
| 113 | 113 |
| 114 // Returns true if the |window| is a desktop element. | 114 // Returns true if the |window| is a desktop element. |
| 115 bool IsDesktopElement(::Window window); | 115 bool IsDesktopElement(::Window window); |
| 116 | 116 |
| 117 // Returns window title for the specified X |window|. | 117 // Returns window title for the specified X |window|. |
| 118 bool GetWindowTitle(::Window window, std::string* title); | 118 bool GetWindowTitle(::Window window, std::string* title); |
| 119 | 119 |
| 120 Callback* callback_; | 120 Callback* callback_; |
| 121 | 121 |
| 122 scoped_refptr<SharedXDisplay> x_display_; | 122 rtc::scoped_refptr<SharedXDisplay> x_display_; |
| 123 | 123 |
| 124 Atom wm_state_atom_; | 124 Atom wm_state_atom_; |
| 125 Atom window_type_atom_; | 125 Atom window_type_atom_; |
| 126 Atom normal_window_type_atom_; | 126 Atom normal_window_type_atom_; |
| 127 bool has_composite_extension_; | 127 bool has_composite_extension_; |
| 128 | 128 |
| 129 ::Window selected_window_; | 129 ::Window selected_window_; |
| 130 XServerPixelBuffer x_server_pixel_buffer_; | 130 XServerPixelBuffer x_server_pixel_buffer_; |
| 131 | 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(WindowCapturerLinux); | 132 DISALLOW_COPY_AND_ASSIGN(WindowCapturerLinux); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } // namespace | 427 } // namespace |
| 428 | 428 |
| 429 // static | 429 // static |
| 430 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { | 430 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { |
| 431 if (!options.x_display()) | 431 if (!options.x_display()) |
| 432 return NULL; | 432 return NULL; |
| 433 return new WindowCapturerLinux(options); | 433 return new WindowCapturerLinux(options); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace webrtc | 436 } // namespace webrtc |
| OLD | NEW |