blob: f1ede97ae7a293d0223422de678d19da8b4181ee [file] [log] [blame]
Zijie He70fbbad2017-08-15 15:45:00 -07001/*
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 He77b7a1d2017-09-01 15:51:14 -070014#include <memory>
15
Zijie He70fbbad2017-08-15 15:45:00 -070016#include "webrtc/modules/desktop_capture/desktop_capture_types.h"
17#include "webrtc/modules/desktop_capture/desktop_geometry.h"
18
19namespace webrtc {
20
Zijie He77b7a1d2017-09-01 15:51:14 -070021#if defined(USE_X11)
22class XAtomCache;
23#endif
24
Zijie He70fbbad2017-08-15 15:45:00 -070025// An interface to return the id of the visible window under a certain point.
26class 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 He12827112017-08-29 11:19:13 -070034 // |point| is always in system coordinate, i.e. the primary monitor always
35 // starts from (0, 0).
Zijie He70fbbad2017-08-15 15:45:00 -070036 virtual WindowId GetWindowUnderPoint(DesktopVector point) = 0;
Zijie He77b7a1d2017-09-01 15:51:14 -070037
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 He70fbbad2017-08-15 15:45:00 -070048};
49
50} // namespace webrtc
51
52#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_WINDOW_FINDER_H_