From eb83a3e8f9ba5aa68e0a17a2c935be93cb6c5aeb Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 20 Mar 2012 15:23:35 +0100 Subject: [PATCH] Replaced final deprecated Core Graphics call. --- readme.html | 2 +- src/cocoa_init.m | 13 +++++++++++++ src/cocoa_platform.h | 1 + src/cocoa_window.m | 5 ----- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/readme.html b/readme.html index 5f3af632..bde16bcf 100644 --- a/readme.html +++ b/readme.html @@ -312,7 +312,7 @@ version of GLFW.

  • [Cocoa] Added support for joysticks
  • [Cocoa] Postponed menu creation to first window creation
  • [Cocoa] Replaced NSDate time source with mach_absolute_time
  • -
  • [Cocoa] Replaced deprecated CoreGraphics calls in video mode enumeration and setting
  • +
  • [Cocoa] Replaced all deprecated CoreGraphics calls with non-deprecated counterparts
  • [Cocoa] Bugfix: glfwOpenWindow did not properly enforce the forward-compatible and context profile hints
  • [Cocoa] Bugfix: The loop condition for saving video modes used the wrong index variable
  • [Cocoa] Bugfix: The OpenGL framework was not retrieved, making glfwGetProcAddress crash
  • diff --git a/src/cocoa_init.m b/src/cocoa_init.m index 89260c56..00898778 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -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); diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h index a06c13a0..b70fb184 100644 --- a/src/cocoa_platform.h +++ b/src/cocoa_platform.h @@ -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; diff --git a/src/cocoa_window.m b/src/cocoa_window.m index c1d710c0..9d5ee5ec 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -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;