blob: 031d92de2aec3633268f576a32318f02fb0161e6 [file] [log] [blame]
sergeyu@chromium.org3d34f662013-06-04 18:51:23 +00001/*
2 * Copyright (c) 2013 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_MAC_DESKTOP_CONFIGURATION_H_
12#define WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_
13
14#include <ApplicationServices/ApplicationServices.h>
15#include <Carbon/Carbon.h>
16#include <vector>
17
18#include "webrtc/typedefs.h"
19#include "webrtc/modules/desktop_capture/desktop_geometry.h"
20
21namespace webrtc {
22
23// Describes the configuration of a specific display.
24struct MacDisplayConfiguration {
25 MacDisplayConfiguration();
26
27 // Cocoa identifier for this display.
28 CGDirectDisplayID id;
29
30 // Bounds of this display in Density-Independent Pixels (DIPs).
31 DesktopRect bounds;
32
33 // Bounds of this display in physical pixels.
34 DesktopRect pixel_bounds;
35
36 // Scale factor from DIPs to physical pixels.
37 float dip_to_pixel_scale;
38};
39
40typedef std::vector<MacDisplayConfiguration> MacDisplayConfigurations;
41
42// Describes the configuration of the whole desktop.
43struct MacDesktopConfiguration {
44 // Used to request bottom-up or top-down coordinates.
45 enum Origin { BottomLeftOrigin, TopLeftOrigin };
46
47 MacDesktopConfiguration();
48 ~MacDesktopConfiguration();
49
50 // Returns the desktop & display configurations in Cocoa-style "bottom-up"
51 // (the origin is the bottom-left of the primary monitor, and coordinates
52 // increase as you move up the screen) or Carbon-style "top-down" coordinates.
53 static MacDesktopConfiguration GetCurrent(Origin origin);
54
jiayl@webrtc.orgcf1b51b2014-01-29 21:59:12 +000055 // Returns true if the given desktop configuration equals this one.
56 bool Equals(const MacDesktopConfiguration& other);
57
jiayl@webrtc.org1af5ea02014-02-01 02:03:24 +000058 // Returns the pointer to the display configuration with the specified id.
59 const MacDisplayConfiguration* FindDisplayConfigurationById(
60 CGDirectDisplayID id);
61
sergeyu@chromium.org3d34f662013-06-04 18:51:23 +000062 // Bounds of the desktop in Density-Independent Pixels (DIPs).
63 DesktopRect bounds;
64
65 // Bounds of the desktop in physical pixels.
66 DesktopRect pixel_bounds;
67
68 // Scale factor from DIPs to physical pixels.
69 float dip_to_pixel_scale;
70
71 // Configurations of the displays making up the desktop area.
72 MacDisplayConfigurations displays;
73};
74
75} // namespace webrtc
76
77#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_