1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-27 04:28:52 -05:00

Replaced final deprecated Core Graphics call.

This commit is contained in:
Camilla Berglund 2012-03-20 15:23:35 +01:00
parent be547da9d2
commit eb83a3e8f9
4 changed files with 15 additions and 6 deletions

View File

@ -312,7 +312,7 @@ version of GLFW.</p>
<li>[Cocoa] Added support for joysticks</li>
<li>[Cocoa] Postponed menu creation to first window creation</li>
<li>[Cocoa] Replaced <code>NSDate</code> time source with <code>mach_absolute_time</code></li>
<li>[Cocoa] Replaced deprecated CoreGraphics calls in video mode enumeration and setting</li>
<li>[Cocoa] Replaced all deprecated CoreGraphics calls with non-deprecated counterparts</li>
<li>[Cocoa] Bugfix: <code>glfwOpenWindow</code> did not properly enforce the forward-compatible and context profile hints</li>
<li>[Cocoa] Bugfix: The loop condition for saving video modes used the wrong index variable</li>
<li>[Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash</li>

View File

@ -102,6 +102,13 @@ int _glfwPlatformInit(void)
_glfwInitJoysticks();
_glfwLibrary.NS.eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
if (!_glfwLibrary.NS.eventSource)
return GL_FALSE;
CGEventSourceSetLocalEventsSuppressionInterval(_glfwLibrary.NS.eventSource,
0.0);
return GL_TRUE;
}
@ -113,6 +120,12 @@ int _glfwPlatformTerminate(void)
{
// TODO: Probably other cleanup
if (_glfwLibrary.NS.eventSource)
{
CFRelease(_glfwLibrary.NS.eventSource);
_glfwLibrary.NS.eventSource = NULL;
}
// Restore the original gamma ramp
_glfwPlatformSetGammaRamp(&_glfwLibrary.originalRamp);

View File

@ -93,6 +93,7 @@ typedef struct _GLFWlibraryNS
// dlopen handle for dynamically loading OpenGL extension entry points
void* OpenGLFramework;
CGDisplayModeRef desktopMode;
CGEventSourceRef eventSource;
id delegate;
id autoreleasePool;
} _GLFWlibraryNS;

View File

@ -1108,11 +1108,6 @@ void _glfwPlatformSetMouseCursorPos(_GLFWwindow* window, int x, int y)
// calculating the maximum y coordinate of all screens, since Cocoa's
// "global coordinates" are upside down from CG's...
// Without this (once per app run, but it's convenient to do it here)
// events will be suppressed for a default of 0.25 seconds after we
// move the cursor.
CGSetLocalEventsSuppressionInterval(0.0);
NSPoint localPoint = NSMakePoint(x, y);
NSPoint globalPoint = [window->NS.window convertBaseToScreen:localPoint];
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;