-
Notifications
You must be signed in to change notification settings - Fork 32
/
CGSDisplays.h
executable file
·126 lines (90 loc) · 4.74 KB
/
CGSDisplays.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* Copyright (C) 2007-2008 Alacatia Labs
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
* Joe Ranieri [email protected]
* Ryan Govostes [email protected]
*
*/
//
// Updated by Robert Widmann.
// Copyright © 2015-2016 CodaFi. All rights reserved.
// Released under the MIT license.
//
#ifndef CGS_DISPLAYS_INTERNAL_H
#define CGS_DISPLAYS_INTERNAL_H
#include "CGSRegion.h"
typedef enum {
CGSDisplayQueryMirrorStatus = 9,
} CGSDisplayQuery;
typedef struct {
uint32_t mode;
uint32_t flags;
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t dc2[42];
uint16_t dc3;
uint16_t freq;
uint8_t dc4[16];
CGFloat scale;
} CGSDisplayModeDescription;
typedef int CGSDisplayMode;
/// Gets the main display.
CG_EXTERN CGDirectDisplayID CGSMainDisplayID(void);
#pragma mark - Display Properties
/// Gets the number of displays known to the system.
CG_EXTERN uint32_t CGSGetNumberOfDisplays(void);
/// Gets the depth of a display.
CG_EXTERN CGError CGSGetDisplayDepth(CGDirectDisplayID display, int *outDepth);
/// Gets the displays at a point. Note that multiple displays can have the same point - think mirroring.
CG_EXTERN CGError CGSGetDisplaysWithPoint(const CGPoint *point, int maxDisplayCount, CGDirectDisplayID *outDisplays, int *outDisplayCount);
/// Gets the displays which contain a rect. Note that multiple displays can have the same bounds - think mirroring.
CG_EXTERN CGError CGSGetDisplaysWithRect(const CGRect *point, int maxDisplayCount, CGDirectDisplayID *outDisplays, int *outDisplayCount);
/// Gets the bounds for the display. Note that multiple displays can have the same bounds - think mirroring.
CG_EXTERN CGError CGSGetDisplayRegion(CGDirectDisplayID display, CGSRegionRef *outRegion);
CG_EXTERN CGError CGSGetDisplayBounds(CGDirectDisplayID display, CGRect *outRect);
/// Gets the number of bytes per row.
CG_EXTERN CGError CGSGetDisplayRowBytes(CGDirectDisplayID display, int *outRowBytes);
/// Returns an array of dictionaries describing the spaces each screen contains.
CG_EXTERN CFArrayRef CGSCopyManagedDisplaySpaces(CGSConnectionID cid);
/// Gets the current display mode for the display.
CG_EXTERN CGError CGSGetCurrentDisplayMode(CGDirectDisplayID display, int *modeNum);
/// Gets the number of possible display modes for the display.
CG_EXTERN CGError CGSGetNumberOfDisplayModes(CGDirectDisplayID display, int *nModes);
/// Gets a description of the mode of the display.
CG_EXTERN CGError CGSGetDisplayModeDescriptionOfLength(CGDirectDisplayID display, int idx, CGSDisplayModeDescription *desc, int length);
/// Sets a display's configuration mode.
CG_EXTERN CGError CGSConfigureDisplayMode(CGDisplayConfigRef config, CGDirectDisplayID display, int modeNum);
/// Gets a list of on line displays */
CG_EXTERN CGDisplayErr CGSGetOnlineDisplayList(CGDisplayCount maxDisplays, CGDirectDisplayID *displays, CGDisplayCount *outDisplayCount);
/// Gets a list of active displays */
CG_EXTERN CGDisplayErr CGSGetActiveDisplayList(CGDisplayCount maxDisplays, CGDirectDisplayID *displays, CGDisplayCount *outDisplayCount);
#pragma mark - Display Configuration
/// Begins a new display configuration transacation.
CG_EXTERN CGDisplayErr CGSBeginDisplayConfiguration(CGDisplayConfigRef *config);
/// Sets the origin of a display relative to the main display. The main display is at (0, 0) and contains the menubar.
CG_EXTERN CGDisplayErr CGSConfigureDisplayOrigin(CGDisplayConfigRef config, CGDirectDisplayID display, int32_t x, int32_t y);
/// Applies the configuration changes made in this transaction.
CG_EXTERN CGDisplayErr CGSCompleteDisplayConfiguration(CGDisplayConfigRef config);
/// Drops the configuration changes made in this transaction.
CG_EXTERN CGDisplayErr CGSCancelDisplayConfiguration(CGDisplayConfigRef config);
#pragma mark - Querying for Display Status
/// Queries the Window Server about the status of the query.
CG_EXTERN CGError CGSDisplayStatusQuery(CGDirectDisplayID display, CGSDisplayQuery query);
#endif /* CGS_DISPLAYS_INTERNAL_H */