blob: cfb76a79b85344345ee4c3cf6ec4cd093d3c8143 [file] [log] [blame]
Camilla Berglundfa4f6b42012-09-12 20:44:08 +02001//========================================================================
Camilla Berglund611006a2014-01-22 01:32:00 +01002// GLFW 3.1 OS X - www.glfw.org
Camilla Berglundfa4f6b42012-09-12 20:44:08 +02003//------------------------------------------------------------------------
4// Copyright (c) 2002-2006 Marcus Geelnard
5// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
6//
7// This software is provided 'as-is', without any express or implied
8// warranty. In no event will the authors be held liable for any damages
9// arising from the use of this software.
10//
11// Permission is granted to anyone to use this software for any purpose,
12// including commercial applications, and to alter it and redistribute it
13// freely, subject to the following restrictions:
14//
15// 1. The origin of this software must not be misrepresented; you must not
16// claim that you wrote the original software. If you use this software
17// in a product, an acknowledgment in the product documentation would
18// be appreciated but is not required.
19//
20// 2. Altered source versions must be plainly marked as such, and must not
21// be misrepresented as being the original software.
22//
23// 3. This notice may not be removed or altered from any source
24// distribution.
25//
26//========================================================================
27
28#include "internal.h"
29
Camilla Berglund55419bd2012-09-12 21:04:24 +020030#include <stdlib.h>
Camilla Berglund59d1aa52014-08-18 12:31:48 +020031#include <stdlib.h>
Camilla Berglund55419bd2012-09-12 21:04:24 +020032#include <limits.h>
33
Camilla Berglunda0305af2012-09-13 16:30:01 +020034#include <IOKit/graphics/IOGraphicsLib.h>
Camilla Berglundaab08712013-10-09 19:45:39 +020035#include <IOKit/graphics/IOGraphicsLib.h>
36#include <CoreVideo/CVBase.h>
Jack Moffitt5be45d22013-10-24 02:24:34 -060037#include <CoreVideo/CVDisplayLink.h>
Camilla Berglund59d1aa52014-08-18 12:31:48 +020038#include <ApplicationServices/ApplicationServices.h>
Camilla Berglunda0305af2012-09-13 16:30:01 +020039
40
Camilla Berglundaaac7152014-03-19 23:24:48 +010041// Get the name of the specified display
Matthew Henrybebae142013-12-14 01:03:39 +100042//
Camilla Berglund43095302014-03-10 16:50:20 +010043static char* getDisplayName(CGDirectDisplayID displayID)
Matthew Henrybebae142013-12-14 01:03:39 +100044{
Camilla Berglundaaac7152014-03-19 23:24:48 +010045 char* name;
46 CFDictionaryRef info, names;
47 CFStringRef value;
48 CFIndex size;
Camilla Berglund43095302014-03-10 16:50:20 +010049
Camilla Berglund3fcc2a62014-09-03 00:31:39 +020050 // NOTE: This uses a deprecated function because Apple has
51 // (as of September 2014) not provided any alternative
Camilla Berglundaaac7152014-03-19 23:24:48 +010052 info = IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID),
53 kIODisplayOnlyPreferredName);
54 names = CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
Camilla Berglund43095302014-03-10 16:50:20 +010055
Camilla Berglundaaac7152014-03-19 23:24:48 +010056 if (!names || !CFDictionaryGetValueIfPresent(names, CFSTR("en_US"),
57 (const void**) &value))
Camilla Berglund43095302014-03-10 16:50:20 +010058 {
Camilla Berglundaaac7152014-03-19 23:24:48 +010059 // This may happen if a desktop Mac is running headless
60 _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to retrieve display name");
Camilla Berglund43095302014-03-10 16:50:20 +010061
Matthew Henrybebae142013-12-14 01:03:39 +100062 CFRelease(info);
Camilla Berglundaaac7152014-03-19 23:24:48 +010063 return strdup("Unknown");
Matthew Henrybebae142013-12-14 01:03:39 +100064 }
Camilla Berglund43095302014-03-10 16:50:20 +010065
Camilla Berglundaaac7152014-03-19 23:24:48 +010066 size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(value),
67 kCFStringEncodingUTF8);
68 name = calloc(size + 1, sizeof(char));
69 CFStringGetCString(value, name, size, kCFStringEncodingUTF8);
70
71 CFRelease(info);
72
73 return name;
Matthew Henrybebae142013-12-14 01:03:39 +100074}
75
Camilla Berglund55419bd2012-09-12 21:04:24 +020076// Check whether the display mode should be included in enumeration
Camilla Berglundd97dddc2013-02-04 13:22:10 +010077//
Camilla Berglund55419bd2012-09-12 21:04:24 +020078static GLboolean modeIsGood(CGDisplayModeRef mode)
79{
80 uint32_t flags = CGDisplayModeGetIOFlags(mode);
81 if (!(flags & kDisplayModeValidFlag) || !(flags & kDisplayModeSafeFlag))
82 return GL_FALSE;
83
84 if (flags & kDisplayModeInterlacedFlag)
85 return GL_FALSE;
86
Camilla Berglund55419bd2012-09-12 21:04:24 +020087 if (flags & kDisplayModeStretchedFlag)
88 return GL_FALSE;
89
90 CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
91 if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) &&
92 CFStringCompare(format, CFSTR(IO32BitDirectPixels), 0))
93 {
94 CFRelease(format);
95 return GL_FALSE;
96 }
97
98 CFRelease(format);
99 return GL_TRUE;
100}
101
Camilla Berglund55419bd2012-09-12 21:04:24 +0200102// Convert Core Graphics display mode to GLFW video mode
Camilla Berglundd97dddc2013-02-04 13:22:10 +0100103//
Camilla Berglundaab08712013-10-09 19:45:39 +0200104static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode,
105 CVDisplayLinkRef link)
Camilla Berglund55419bd2012-09-12 21:04:24 +0200106{
107 GLFWvidmode result;
Shane Liesegang209de7b2013-10-08 10:42:17 -0400108 result.width = (int) CGDisplayModeGetWidth(mode);
109 result.height = (int) CGDisplayModeGetHeight(mode);
Camilla Berglund731812c2013-05-30 15:52:42 +0200110 result.refreshRate = (int) CGDisplayModeGetRefreshRate(mode);
Camilla Berglund55419bd2012-09-12 21:04:24 +0200111
Camilla Berglundaab08712013-10-09 19:45:39 +0200112 if (result.refreshRate == 0)
113 {
114 const CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(link);
115 if (!(time.flags & kCVTimeIsIndefinite))
116 result.refreshRate = (int) (time.timeScale / (double) time.timeValue);
117 }
118
Camilla Berglund55419bd2012-09-12 21:04:24 +0200119 CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
120
121 if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0)
122 {
123 result.redBits = 5;
124 result.greenBits = 5;
125 result.blueBits = 5;
126 }
127 else
128 {
129 result.redBits = 8;
130 result.greenBits = 8;
131 result.blueBits = 8;
132 }
133
134 CFRelease(format);
135 return result;
136}
137
Keith Pitt34ce04a2013-02-24 21:12:21 +0100138// Starts reservation for display fading
139//
Camilla Berglund8dde39b2013-02-24 21:14:44 +0100140static CGDisplayFadeReservationToken beginFadeReservation(void)
Keith Pitt34ce04a2013-02-24 21:12:21 +0100141{
142 CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken;
143
144 if (CGAcquireDisplayFadeReservation(5, &token) == kCGErrorSuccess)
145 CGDisplayFade(token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, TRUE);
146
147 return token;
148}
149
150// Ends reservation for display fading
151//
Camilla Berglund8dde39b2013-02-24 21:14:44 +0100152static void endFadeReservation(CGDisplayFadeReservationToken token)
Keith Pitt34ce04a2013-02-24 21:12:21 +0100153{
154 if (token != kCGDisplayFadeReservationInvalidToken)
155 {
156 CGDisplayFade(token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, FALSE);
157 CGReleaseDisplayFadeReservation(token);
158 }
159}
160
Camilla Berglund8dde39b2013-02-24 21:14:44 +0100161
162//////////////////////////////////////////////////////////////////////////
163////// GLFW internal API //////
164//////////////////////////////////////////////////////////////////////////
165
Camilla Berglund55419bd2012-09-12 21:04:24 +0200166// Change the current video mode
Camilla Berglundd97dddc2013-02-04 13:22:10 +0100167//
Camilla Berglundf5ba0d92013-04-21 21:28:07 +0200168GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
Camilla Berglund55419bd2012-09-12 21:04:24 +0200169{
Camilla Berglund55419bd2012-09-12 21:04:24 +0200170 CFArrayRef modes;
171 CFIndex count, i;
Camilla Berglund87dd7b82014-03-10 12:34:15 +0100172 CVDisplayLinkRef link;
173 CGDisplayModeRef native = NULL;
174 GLFWvidmode current;
175 const GLFWvidmode* best;
176
177 best = _glfwChooseVideoMode(monitor, desired);
178 _glfwPlatformGetVideoMode(monitor, &current);
179 if (_glfwCompareVideoModes(&current, best) == 0)
180 return GL_TRUE;
181
182 CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
Camilla Berglund55419bd2012-09-12 21:04:24 +0200183
Camilla Berglund7049f732013-01-03 20:11:41 +0100184 modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
Camilla Berglund55419bd2012-09-12 21:04:24 +0200185 count = CFArrayGetCount(modes);
186
187 for (i = 0; i < count; i++)
188 {
Camilla Berglund87dd7b82014-03-10 12:34:15 +0100189 CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
190 if (!modeIsGood(dm))
Camilla Berglund55419bd2012-09-12 21:04:24 +0200191 continue;
192
Camilla Berglund87dd7b82014-03-10 12:34:15 +0100193 const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
194 if (_glfwCompareVideoModes(best, &mode) == 0)
Camilla Berglund55419bd2012-09-12 21:04:24 +0200195 {
Camilla Berglund87dd7b82014-03-10 12:34:15 +0100196 native = dm;
197 break;
Camilla Berglund55419bd2012-09-12 21:04:24 +0200198 }
199 }
200
Camilla Berglund87dd7b82014-03-10 12:34:15 +0100201 if (native)
Camilla Berglund55419bd2012-09-12 21:04:24 +0200202 {
Camilla Berglund87dd7b82014-03-10 12:34:15 +0100203 if (monitor->ns.previousMode == NULL)
204 monitor->ns.previousMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
205
206 CGDisplayFadeReservationToken token = beginFadeReservation();
Camilla Berglund87dd7b82014-03-10 12:34:15 +0100207 CGDisplayCapture(monitor->ns.displayID);
208 CGDisplaySetDisplayMode(monitor->ns.displayID, native, NULL);
Camilla Berglund87dd7b82014-03-10 12:34:15 +0100209 endFadeReservation(token);
210 }
211
212 CFRelease(modes);
213 CVDisplayLinkRelease(link);
214
215 if (!native)
216 {
217 _glfwInputError(GLFW_PLATFORM_ERROR,
218 "Cocoa: Monitor mode list changed");
Camilla Berglund55419bd2012-09-12 21:04:24 +0200219 return GL_FALSE;
220 }
221
Camilla Berglund55419bd2012-09-12 21:04:24 +0200222 return GL_TRUE;
223}
224
Camilla Berglund55419bd2012-09-12 21:04:24 +0200225// Restore the previously saved (original) video mode
Camilla Berglundd97dddc2013-02-04 13:22:10 +0100226//
Camilla Berglund46c1e402013-01-02 17:29:24 +0100227void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
Camilla Berglund55419bd2012-09-12 21:04:24 +0200228{
Camilla Berglund78f1b8b2014-03-10 12:42:30 +0100229 if (monitor->ns.previousMode)
230 {
231 CGDisplayFadeReservationToken token = beginFadeReservation();
232 CGDisplaySetDisplayMode(monitor->ns.displayID,
233 monitor->ns.previousMode, NULL);
234 CGDisplayRelease(monitor->ns.displayID);
235 endFadeReservation(token);
Keith Pitt34ce04a2013-02-24 21:12:21 +0100236
Camilla Berglund78f1b8b2014-03-10 12:42:30 +0100237 CGDisplayModeRelease(monitor->ns.previousMode);
238 monitor->ns.previousMode = NULL;
239 }
Camilla Berglund55419bd2012-09-12 21:04:24 +0200240}
241
Camilla Berglundfa4f6b42012-09-12 20:44:08 +0200242
243//////////////////////////////////////////////////////////////////////////
244////// GLFW platform API //////
245//////////////////////////////////////////////////////////////////////////
246
Camilla Berglundfa4f6b42012-09-12 20:44:08 +0200247_GLFWmonitor** _glfwPlatformGetMonitors(int* count)
248{
Camilla Berglund6eec7972014-01-21 15:14:14 +0100249 uint32_t i, found = 0, displayCount;
Camilla Berglunda0305af2012-09-13 16:30:01 +0200250 _GLFWmonitor** monitors;
251 CGDirectDisplayID* displays;
252
Camilla Berglundfa4f6b42012-09-12 20:44:08 +0200253 *count = 0;
Camilla Berglunda0305af2012-09-13 16:30:01 +0200254
Camilla Berglund1b6d8a62014-09-12 17:00:05 +0200255 CGGetOnlineDisplayList(0, NULL, &displayCount);
Camilla Berglunda0305af2012-09-13 16:30:01 +0200256
Camilla Berglund6eec7972014-01-21 15:14:14 +0100257 displays = calloc(displayCount, sizeof(CGDirectDisplayID));
258 monitors = calloc(displayCount, sizeof(_GLFWmonitor*));
Camilla Berglunda0305af2012-09-13 16:30:01 +0200259
Camilla Berglund1b6d8a62014-09-12 17:00:05 +0200260 CGGetOnlineDisplayList(displayCount, displays, &displayCount);
Camilla Berglund46c1e402013-01-02 17:29:24 +0100261
Camilla Berglund6eec7972014-01-21 15:14:14 +0100262 NSArray* screens = [NSScreen screens];
263
264 for (i = 0; i < displayCount; i++)
Camilla Berglunda0305af2012-09-13 16:30:01 +0200265 {
Camilla Berglund6eec7972014-01-21 15:14:14 +0100266 int j;
Camilla Berglund1b6d8a62014-09-12 17:00:05 +0200267
268 if (CGDisplayIsAsleep(displays[i]))
269 continue;
270
271 CGDirectDisplayID screenDisplayID = CGDisplayMirrorsDisplay(displays[i]);
272 if (screenDisplayID == kCGNullDirectDisplay)
273 screenDisplayID = displays[i];
274
Camilla Berglunda0305af2012-09-13 16:30:01 +0200275 const CGSize size = CGDisplayScreenSize(displays[i]);
Camilla Berglund43095302014-03-10 16:50:20 +0100276 char* name = getDisplayName(displays[i]);
Camilla Berglunda0305af2012-09-13 16:30:01 +0200277
Camilla Berglund43095302014-03-10 16:50:20 +0100278 monitors[found] = _glfwAllocMonitor(name, size.width, size.height);
Camilla Berglundb72a97d2013-01-02 01:40:42 +0100279 monitors[found]->ns.displayID = displays[i];
Camilla Berglund57751a52013-04-17 23:07:44 +0200280
Camilla Berglund5c230712014-03-10 18:41:52 +0100281 free(name);
282
Camilla Berglund57751a52013-04-17 23:07:44 +0200283 for (j = 0; j < [screens count]; j++)
284 {
285 NSScreen* screen = [screens objectAtIndex:j];
286 NSDictionary* dictionary = [screen deviceDescription];
287 NSNumber* number = [dictionary objectForKey:@"NSScreenNumber"];
288
Camilla Berglund1b6d8a62014-09-12 17:00:05 +0200289 if ([number unsignedIntegerValue] == screenDisplayID)
Camilla Berglund57751a52013-04-17 23:07:44 +0200290 {
Camilla Berglund6eec7972014-01-21 15:14:14 +0100291 monitors[found]->ns.screen = screen;
Camilla Berglund57751a52013-04-17 23:07:44 +0200292 break;
293 }
294 }
295
Camilla Berglund6eec7972014-01-21 15:14:14 +0100296 if (monitors[found]->ns.screen)
297 found++;
298 else
Camilla Berglund57751a52013-04-17 23:07:44 +0200299 {
Camilla Berglund0548c712014-01-21 15:23:11 +0100300 _glfwFreeMonitor(monitors[found]);
Camilla Berglund6eec7972014-01-21 15:14:14 +0100301 monitors[found] = NULL;
Camilla Berglund57751a52013-04-17 23:07:44 +0200302 }
303 }
304
Camilla Berglund6eec7972014-01-21 15:14:14 +0100305 free(displays);
306
307 *count = found;
Camilla Berglunda0305af2012-09-13 16:30:01 +0200308 return monitors;
Camilla Berglundfa4f6b42012-09-12 20:44:08 +0200309}
310
Camilla Berglund7405bc42013-04-22 14:43:13 +0200311GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* second)
312{
313 return first->ns.displayID == second->ns.displayID;
314}
315
Camilla Berglund7b3783a2013-02-20 16:00:53 +0100316void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
317{
318 const CGRect bounds = CGDisplayBounds(monitor->ns.displayID);
319
320 if (xpos)
321 *xpos = (int) bounds.origin.x;
322 if (ypos)
323 *ypos = (int) bounds.origin.y;
324}
325
Camilla Berglunda0305af2012-09-13 16:30:01 +0200326GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
Camilla Berglund55419bd2012-09-12 21:04:24 +0200327{
328 CFArrayRef modes;
Camilla Berglund468714c2014-09-22 19:25:05 +0200329 CFIndex count, i, j;
Camilla Berglund55419bd2012-09-12 21:04:24 +0200330 GLFWvidmode* result;
Camilla Berglundaab08712013-10-09 19:45:39 +0200331 CVDisplayLinkRef link;
332
333 CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
Camilla Berglund55419bd2012-09-12 21:04:24 +0200334
Camilla Berglundb72a97d2013-01-02 01:40:42 +0100335 modes = CGDisplayCopyAllDisplayModes(monitor->ns.displayID, NULL);
Camilla Berglund55419bd2012-09-12 21:04:24 +0200336 count = CFArrayGetCount(modes);
337
Camilla Berglund7a03ca82013-07-04 14:54:07 +0200338 result = calloc(count, sizeof(GLFWvidmode));
Camilla Berglund55419bd2012-09-12 21:04:24 +0200339 *found = 0;
340
341 for (i = 0; i < count; i++)
342 {
Camilla Berglund468714c2014-09-22 19:25:05 +0200343 CGDisplayModeRef dm = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
344 if (!modeIsGood(dm))
345 continue;
346
347 const GLFWvidmode mode = vidmodeFromCGDisplayMode(dm, link);
348
349 for (j = 0; j < *found; j++)
Camilla Berglund55419bd2012-09-12 21:04:24 +0200350 {
Camilla Berglund468714c2014-09-22 19:25:05 +0200351 if (_glfwCompareVideoModes(result + j, &mode) == 0)
352 break;
Camilla Berglund55419bd2012-09-12 21:04:24 +0200353 }
Camilla Berglund468714c2014-09-22 19:25:05 +0200354
355 if (i < *found)
356 {
357 // This is a duplicate, so skip it
358 continue;
359 }
360
361 result[*found] = mode;
362 (*found)++;
Camilla Berglund55419bd2012-09-12 21:04:24 +0200363 }
364
365 CFRelease(modes);
Camilla Berglundaab08712013-10-09 19:45:39 +0200366
367 CVDisplayLinkRelease(link);
Camilla Berglund55419bd2012-09-12 21:04:24 +0200368 return result;
369}
370
Camilla Berglund55419bd2012-09-12 21:04:24 +0200371void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode)
372{
373 CGDisplayModeRef displayMode;
Camilla Berglundaab08712013-10-09 19:45:39 +0200374 CVDisplayLinkRef link;
375
376 CVDisplayLinkCreateWithCGDisplay(monitor->ns.displayID, &link);
Camilla Berglund55419bd2012-09-12 21:04:24 +0200377
Camilla Berglundb72a97d2013-01-02 01:40:42 +0100378 displayMode = CGDisplayCopyDisplayMode(monitor->ns.displayID);
Camilla Berglundaab08712013-10-09 19:45:39 +0200379 *mode = vidmodeFromCGDisplayMode(displayMode, link);
Camilla Berglund55419bd2012-09-12 21:04:24 +0200380 CGDisplayModeRelease(displayMode);
Camilla Berglundaab08712013-10-09 19:45:39 +0200381
382 CVDisplayLinkRelease(link);
Camilla Berglund55419bd2012-09-12 21:04:24 +0200383}
384
Camilla Berglund59d1aa52014-08-18 12:31:48 +0200385void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
386{
387 uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID);
388 CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue));
389
390 CGGetDisplayTransferByTable(monitor->ns.displayID,
391 size,
392 values,
393 values + size,
394 values + size * 2,
395 &size);
396
397 _glfwAllocGammaArrays(ramp, size);
398
399 for (i = 0; i < size; i++)
400 {
401 ramp->red[i] = (unsigned short) (values[i] * 65535);
402 ramp->green[i] = (unsigned short) (values[i + size] * 65535);
403 ramp->blue[i] = (unsigned short) (values[i + size * 2] * 65535);
404 }
405
406 free(values);
407}
408
409void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
410{
411 int i;
412 CGGammaValue* values = calloc(ramp->size * 3, sizeof(CGGammaValue));
413
414 for (i = 0; i < ramp->size; i++)
415 {
416 values[i] = ramp->red[i] / 65535.f;
417 values[i + ramp->size] = ramp->green[i] / 65535.f;
418 values[i + ramp->size * 2] = ramp->blue[i] / 65535.f;
419 }
420
421 CGSetDisplayTransferByTable(monitor->ns.displayID,
422 ramp->size,
423 values,
424 values + ramp->size,
425 values + ramp->size * 2);
426
427 free(values);
428}
429
Camilla Berglund16eb97d2014-01-13 20:02:43 +0100430
431//////////////////////////////////////////////////////////////////////////
432////// GLFW native API //////
433//////////////////////////////////////////////////////////////////////////
434
435GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle)
436{
437 _GLFWmonitor* monitor = (_GLFWmonitor*) handle;
Camilla Berglunda0742e92014-09-17 12:28:26 +0200438 _GLFW_REQUIRE_INIT_OR_RETURN(kCGNullDirectDisplay);
Camilla Berglund16eb97d2014-01-13 20:02:43 +0100439 return monitor->ns.displayID;
440}
441