-
Notifications
You must be signed in to change notification settings - Fork 67
/
cg_utils.h
47 lines (41 loc) · 1.67 KB
/
cg_utils.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
// vim: ts=4:sw=4
/*
* screenresolution sets the screen resolution on Mac computers.
* Copyright (C) 2011 John Ford <john@johnford.info>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef __CG_UTILS__H
#define __CG_UTILS__H
#include <ApplicationServices/ApplicationServices.h>
// http://stackoverflow.com/questions/3060121/core-foundation-equivalent-for-nslog/3062319#3062319
#ifndef __OBJC__
void NSLog(CFStringRef format, ...);
void NSLogv(CFStringRef format, va_list args);
#endif
struct config {
size_t w; // width
size_t h; // height
size_t d; // colour depth
double r; // refresh rate
};
unsigned int setDisplayToMode(CGDirectDisplayID display, CGDisplayModeRef mode);
unsigned int configureDisplay(CGDirectDisplayID display,
struct config *config,
int displayNum);
unsigned int parseStringConfig(const char *string, struct config *out);
size_t bitDepth(CGDisplayModeRef mode);
CFComparisonResult _compareCFDisplayModes (CGDisplayModeRef *mode1Ptr, CGDisplayModeRef *mode2Ptr, void *context);
#endif