Rename displayLink to _displayLink.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Tue, 12 Nov 2013 11:10:39 +0000 (12:10 +0100)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Tue, 12 Nov 2013 11:10:39 +0000 (12:10 +0100)
Classes/NJInputController.m
Enjoyable.xcodeproj/project.pbxproj

index 3ee088455f2d282b6a227662a03b75d2bc9872b3..ed0d72d8208c14ef0f771bff4bb7ec66bc7be188 100644 (file)
 
 @end
 
-static CVReturn displayLink_update_cb(CVDisplayLinkRef displayLink,
-                                          const CVTimeStamp *inNow,
-                                          const CVTimeStamp *inOutputTime,
-                                          CVOptionFlags flagsIn,
-                                          CVOptionFlags *flagsOut,
-                                          void *ctxManager) {
+static CVReturn _updateDL(CVDisplayLinkRef displayLink,
+                          const CVTimeStamp *inNow,
+                          const CVTimeStamp *inOutputTime,
+                          CVOptionFlags flagsIn,
+                          CVOptionFlags *flagsOut,
+                          void *ctxManager) {
     NJInputController *manager = (__bridge NJInputController *)ctxManager;
     [manager performSelectorOnMainThread:@selector(updateContinuousOutputs)
                               withObject:nil
@@ -38,8 +38,7 @@ static CVReturn displayLink_update_cb(CVDisplayLinkRef displayLink,
     NSMutableArray *_devices;
     NSMutableArray *_mappings;
     NJMapping *_manualMapping;
-    CVDisplayLinkRef displayLink;
-
+    CVDisplayLinkRef _displayLink;
 }
 
 #define NSSTR(e) ((NSString *)CFSTR(e))
@@ -49,16 +48,16 @@ static CVReturn displayLink_update_cb(CVDisplayLinkRef displayLink,
         _devices = [[NSMutableArray alloc] initWithCapacity:16];
         _continousOutputs = [[NSMutableArray alloc] initWithCapacity:32];
 
-        CVReturn error = CVDisplayLinkCreateWithActiveCGDisplays(&displayLink);
-        if (error) {
-            [self.delegate inputController:self
-                                  didError:[NSError errorWithDomain:NSCocoaErrorDomain
-                                                               code:error
-                                                           userInfo:nil]];
-            NSLog(@"DisplayLink failed creation with error: %d.", error);
-            displayLink = NULL;
+        CVReturn cvErr = CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
+        if (cvErr) {
+            NSError *error = [NSError errorWithDomain:NSCocoaErrorDomain
+                                                 code:cvErr
+                                             userInfo:nil];
+            [self.delegate inputController:self didError:error];
+            NSLog(@"DisplayLink failed creation with error: %@", error);
+            _displayLink = NULL;
         }
-        CVDisplayLinkSetOutputCallback(displayLink, displayLink_update_cb, (__bridge void *)self);
+        CVDisplayLinkSetOutputCallback(_displayLink, _updateDL, (__bridge void *)self);
         
         _HIDManager = [[NJHIDManager alloc] initWithCriteria:@[
                        @{ NSSTR(kIOHIDDeviceUsagePageKey) : @(kHIDPage_GenericDesktop),
@@ -101,9 +100,9 @@ static CVReturn displayLink_update_cb(CVDisplayLinkRef displayLink,
 
 - (void)dealloc {
     [NSNotificationCenter.defaultCenter removeObserver:self];
-    if (displayLink) {
-        CVDisplayLinkStop(displayLink);
-        CVDisplayLinkRelease(displayLink);
+    if (_displayLink) {
+        CVDisplayLinkStop(_displayLink);
+        CVDisplayLinkRelease(_displayLink);
     }
 }
 
@@ -112,9 +111,8 @@ static CVReturn displayLink_update_cb(CVDisplayLinkRef displayLink,
     // re-adding them or they trigger multiple times each time.
     if (![_continousOutputs containsObject:output])
         [_continousOutputs addObject:output];
-    if (displayLink && !CVDisplayLinkIsRunning(displayLink)) {
-        CVDisplayLinkStart(displayLink);
-    }
+    if (_displayLink && !CVDisplayLinkIsRunning(_displayLink))
+        CVDisplayLinkStart(_displayLink);
 }
 
 - (void)runOutputForDevice:(IOHIDDeviceRef)device value:(IOHIDValueRef)value {
@@ -195,16 +193,16 @@ static CVReturn displayLink_update_cb(CVDisplayLinkRef displayLink,
             [_continousOutputs removeObject:output];
         }
     }
-    if (!_continousOutputs.count && displayLink) {
-        CVDisplayLinkStop(displayLink);
+    if (!_continousOutputs.count && _displayLink) {
+        CVDisplayLinkStop(_displayLink);
     }
 }
 
 - (void)HIDManager:(NJHIDManager *)manager didError:(NSError *)error {
     [self.delegate inputController:self didError:error];
     self.simulatingEvents = NO;
-    if (displayLink)
-        CVDisplayLinkStop(displayLink);
+    if (_displayLink)
+        CVDisplayLinkStop(_displayLink);
 }
 
 - (void)HIDManagerDidStart:(NJHIDManager *)manager {
@@ -213,8 +211,8 @@ static CVReturn displayLink_update_cb(CVDisplayLinkRef displayLink,
 
 - (void)HIDManagerDidStop:(NJHIDManager *)manager {
     [_devices removeAllObjects];
-    if (displayLink)
-        CVDisplayLinkStop(displayLink);
+    if (_displayLink)
+        CVDisplayLinkStop(_displayLink);
     [self.delegate inputControllerDidStopHID:self];
 }
 
index 0e6ca04924a13e1a16c4d411f5f96965489f98ed..c244de0795310bf3e67886b8d62a96a7261410e4 100644 (file)
                29B97313FDCFA39411CA2CEA /* Project object */ = {
                        isa = PBXProject;
                        attributes = {
-                               LastUpgradeCheck = 0460;
+                               LastUpgradeCheck = 0500;
                        };
                        buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Enjoyable" */;
                        compatibilityVersion = "Xcode 3.2";
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                ALWAYS_SEARCH_USER_PATHS = NO;
-                               ARCHS = "$(ARCHS_STANDARD_64_BIT)";
                                CLANG_ENABLE_OBJC_ARC = YES;
                                CLANG_WARN_EMPTY_BODY = YES;
                                CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                ALWAYS_SEARCH_USER_PATHS = NO;
-                               ARCHS = "$(ARCHS_STANDARD_64_BIT)";
                                CLANG_ENABLE_OBJC_ARC = YES;
                                CLANG_WARN_EMPTY_BODY = YES;
                                CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO;
                C01FCF4F08A954540054247B /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               ARCHS = "$(ARCHS_STANDARD_64_BIT)";
                                CLANG_ENABLE_OBJC_ARC = YES;
                                CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
                                CLANG_WARN_ENUM_CONVERSION = YES;
                C01FCF5008A954540054247B /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               ARCHS = "$(ARCHS_STANDARD_64_BIT)";
                                CLANG_ENABLE_OBJC_ARC = YES;
                                CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
                                CLANG_WARN_ENUM_CONVERSION = YES;