blob: ae4a911c7b305c76e2397255e7ffc9b16aa7d2b6 [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#include "webrtc/modules/desktop_capture/window_finder_mac.h"
12
13#include <CoreFoundation/CoreFoundation.h>
14
15#include "webrtc/modules/desktop_capture/mac/window_list_utils.h"
16
17namespace webrtc {
18
19WindowFinderMac::WindowFinderMac() = default;
20WindowFinderMac::~WindowFinderMac() = default;
21
22WindowId WindowFinderMac::GetWindowUnderPoint(DesktopVector point) {
23 WindowId id = kNullWindowId;
24 GetWindowList([&id, point](CFDictionaryRef window) {
25 DesktopRect bounds = GetWindowBounds(window);
26 if (bounds.Contains(point)) {
27 id = GetWindowId(window);
28 return false;
29 }
30 return true;
31 },
32 true);
33 return id;
34}
35
36} // namespace webrtc