Zijie He | 70fbbad | 2017-08-15 15:45:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WINDOW_FINDER_H_ |
| 12 | #define WEBRTC_MODULES_DESKTOP_CAPTURE_WINDOW_FINDER_H_ |
| 13 | |
Zijie He | 77b7a1d | 2017-09-01 15:51:14 -0700 | [diff] [blame] | 14 | #include <memory> |
| 15 | |
Zijie He | 70fbbad | 2017-08-15 15:45:00 -0700 | [diff] [blame] | 16 | #include "webrtc/modules/desktop_capture/desktop_capture_types.h" |
| 17 | #include "webrtc/modules/desktop_capture/desktop_geometry.h" |
| 18 | |
| 19 | namespace webrtc { |
| 20 | |
Zijie He | 77b7a1d | 2017-09-01 15:51:14 -0700 | [diff] [blame] | 21 | #if defined(USE_X11) |
| 22 | class XAtomCache; |
| 23 | #endif |
| 24 | |
Zijie He | 70fbbad | 2017-08-15 15:45:00 -0700 | [diff] [blame] | 25 | // An interface to return the id of the visible window under a certain point. |
| 26 | class WindowFinder { |
| 27 | public: |
| 28 | WindowFinder() = default; |
| 29 | virtual ~WindowFinder() = default; |
| 30 | |
| 31 | // Returns the id of the visible window under |point|. This function returns |
| 32 | // kNullWindowId if no window is under |point| and the platform does not have |
| 33 | // "root window" concept, i.e. the visible area under |point| is the desktop. |
Zijie He | 1282711 | 2017-08-29 11:19:13 -0700 | [diff] [blame] | 34 | // |point| is always in system coordinate, i.e. the primary monitor always |
| 35 | // starts from (0, 0). |
Zijie He | 70fbbad | 2017-08-15 15:45:00 -0700 | [diff] [blame] | 36 | virtual WindowId GetWindowUnderPoint(DesktopVector point) = 0; |
Zijie He | 77b7a1d | 2017-09-01 15:51:14 -0700 | [diff] [blame] | 37 | |
| 38 | struct Options { |
| 39 | #if defined(USE_X11) |
| 40 | XAtomCache* cache = nullptr; |
| 41 | #endif |
| 42 | }; |
| 43 | |
| 44 | // Creates a platform-independent WindowFinder implementation. This function |
| 45 | // returns nullptr if |options| does not contain enough information or |
| 46 | // WindowFinder does not support current platform. |
| 47 | static std::unique_ptr<WindowFinder> Create(const Options& options); |
Zijie He | 70fbbad | 2017-08-15 15:45:00 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | } // namespace webrtc |
| 51 | |
| 52 | #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WINDOW_FINDER_H_ |