tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

window_finder.h (2105B)


      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 MODULES_DESKTOP_CAPTURE_WINDOW_FINDER_H_
     12 #define MODULES_DESKTOP_CAPTURE_WINDOW_FINDER_H_
     13 
     14 #include <memory>
     15 
     16 #include "modules/desktop_capture/desktop_capture_types.h"
     17 #include "modules/desktop_capture/desktop_geometry.h"
     18 
     19 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
     20 #include "modules/desktop_capture/mac/desktop_configuration_monitor.h"
     21 #endif
     22 
     23 namespace webrtc {
     24 
     25 #if defined(WEBRTC_USE_X11)
     26 class XAtomCache;
     27 #endif
     28 
     29 // An interface to return the id of the visible window under a certain point.
     30 class WindowFinder {
     31 public:
     32  WindowFinder() = default;
     33  virtual ~WindowFinder() = default;
     34 
     35  // Returns the id of the visible window under `point`. This function returns
     36  // kNullWindowId if no window is under `point` and the platform does not have
     37  // "root window" concept, i.e. the visible area under `point` is the desktop.
     38  // `point` is always in system coordinate, i.e. the primary monitor always
     39  // starts from (0, 0).
     40  virtual WindowId GetWindowUnderPoint(DesktopVector point) = 0;
     41 
     42  struct Options final {
     43    Options();
     44    ~Options();
     45    Options(const Options& other);
     46    Options(Options&& other);
     47 
     48 #if defined(WEBRTC_USE_X11)
     49    XAtomCache* cache = nullptr;
     50 #endif
     51 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
     52    scoped_refptr<DesktopConfigurationMonitor> configuration_monitor;
     53 #endif
     54  };
     55 
     56  // Creates a platform-independent WindowFinder implementation. This function
     57  // returns nullptr if `options` does not contain enough information or
     58  // WindowFinder does not support current platform.
     59  static std::unique_ptr<WindowFinder> Create(const Options& options);
     60 };
     61 
     62 }  // namespace webrtc
     63 
     64 #endif  // MODULES_DESKTOP_CAPTURE_WINDOW_FINDER_H_