| 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 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 WindowCapturerLinux(const DesktopCaptureOptions& options); | 88 WindowCapturerLinux(const DesktopCaptureOptions& options); |
| 89 virtual ~WindowCapturerLinux(); | 89 virtual ~WindowCapturerLinux(); |
| 90 | 90 |
| 91 // WindowCapturer interface. | 91 // WindowCapturer interface. |
| 92 bool GetWindowList(WindowList* windows) override; | 92 bool GetWindowList(WindowList* windows) override; |
| 93 bool SelectWindow(WindowId id) override; | 93 bool SelectWindow(WindowId id) override; |
| 94 bool BringSelectedWindowToFront() override; | 94 bool BringSelectedWindowToFront() override; |
| 95 | 95 |
| 96 // DesktopCapturer interface. | 96 // DesktopCapturer interface. |
| 97 void Start(Callback* callback) override; | 97 void Start(Callback* callback) override; |
| 98 void Capture(const DesktopRegion& region) override; | 98 void CaptureFrame() override; |
| 99 | 99 |
| 100 // SharedXDisplay::XEventHandler interface. | 100 // SharedXDisplay::XEventHandler interface. |
| 101 bool HandleXEvent(const XEvent& event) override; | 101 bool HandleXEvent(const XEvent& event) override; |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 Display* display() { return x_display_->display(); } | 104 Display* display() { return x_display_->display(); } |
| 105 | 105 |
| 106 // Iterates through |window| hierarchy to find first visible window, i.e. one | 106 // Iterates through |window| hierarchy to find first visible window, i.e. one |
| 107 // that has WM_STATE property set to NormalState. | 107 // that has WM_STATE property set to NormalState. |
| 108 // See http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.3.1 . | 108 // See http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.3.1 . |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 return true; | 264 return true; |
| 265 } | 265 } |
| 266 | 266 |
| 267 void WindowCapturerLinux::Start(Callback* callback) { | 267 void WindowCapturerLinux::Start(Callback* callback) { |
| 268 assert(!callback_); | 268 assert(!callback_); |
| 269 assert(callback); | 269 assert(callback); |
| 270 | 270 |
| 271 callback_ = callback; | 271 callback_ = callback; |
| 272 } | 272 } |
| 273 | 273 |
| 274 void WindowCapturerLinux::Capture(const DesktopRegion& region) { | 274 void WindowCapturerLinux::CaptureFrame() { |
| 275 if (!x_server_pixel_buffer_.IsWindowValid()) { | 275 if (!x_server_pixel_buffer_.IsWindowValid()) { |
| 276 LOG(LS_INFO) << "The window is no longer valid."; | 276 LOG(LS_INFO) << "The window is no longer valid."; |
| 277 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); | 277 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); |
| 278 return; | 278 return; |
| 279 } | 279 } |
| 280 | 280 |
| 281 x_display_->ProcessPendingXEvents(); | 281 x_display_->ProcessPendingXEvents(); |
| 282 | 282 |
| 283 if (!has_composite_extension_) { | 283 if (!has_composite_extension_) { |
| 284 // Without the Xcomposite extension we capture when the whole window is | 284 // Without the Xcomposite extension we capture when the whole window is |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 } // namespace | 421 } // namespace |
| 422 | 422 |
| 423 // static | 423 // static |
| 424 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { | 424 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { |
| 425 if (!options.x_display()) | 425 if (!options.x_display()) |
| 426 return nullptr; | 426 return nullptr; |
| 427 return new WindowCapturerLinux(options); | 427 return new WindowCapturerLinux(options); |
| 428 } | 428 } |
| 429 | 429 |
| 430 } // namespace webrtc | 430 } // namespace webrtc |
| OLD | NEW |