[Libreoffice-commits] core.git: apple_remote/source

Herbert Dürr hdu at apache.org
Mon Feb 10 08:37:21 PST 2014


 apple_remote/source/AppleRemote.m            |    2 -
 apple_remote/source/GlobalKeyboardDevice.m   |    2 -
 apple_remote/source/HIDRemoteControlDevice.m |   16 ++++++------
 apple_remote/source/RemoteControl.m          |   34 ++++++++++++++-------------
 apple_remote/source/RemoteControlContainer.m |   12 ++++-----
 apple_remote/source/RemoteMainController.m   |    6 ++--
 6 files changed, 37 insertions(+), 35 deletions(-)

New commits:
commit 9d5841aa433ee325b702c3a8c4c8784052e09b3a
Author: Herbert Dürr <hdu at apache.org>
Date:   Mon Feb 10 14:36:17 2014 +0000

    Resolved: #i124201# mark debug-infos from the apple_remote...
    
    module appropriately
    
    to make the source of some log messages more clear
    
    (cherry picked from commit fe4ae4735c5a5e2b2210e684e97228cd91174e4c)
    
    Conflicts:
    	apple_remote/AppleRemote.m
    	apple_remote/source/HIDRemoteControlDevice.m
    	apple_remote/source/RemoteControl.m
    	apple_remote/source/RemoteControlContainer.m
    
    Change-Id: Ie57114f4d2d67f258808d03e01dff8bc05ba9f2c

diff --git a/apple_remote/source/AppleRemote.m b/apple_remote/source/AppleRemote.m
index 120297e..8f1b2ce 100644
--- a/apple_remote/source/AppleRemote.m
+++ b/apple_remote/source/AppleRemote.m
@@ -49,7 +49,7 @@ const char* AppleRemoteDeviceName = "AppleIRController";
     
     // TODO : avoid such magics 
 #ifdef DEBUG
-    NSLog( @"setting 10.6 cookies" );
+    NSLog( @"Apple Remote: setting 10.6 cookies" );
 #endif
     // 10.6.x Snow Leopard
     [_cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlus]		forKey:@"33_31_30_21_20_2_"];
diff --git a/apple_remote/source/GlobalKeyboardDevice.m b/apple_remote/source/GlobalKeyboardDevice.m
index 27322d2..f5ecb1f 100644
--- a/apple_remote/source/GlobalKeyboardDevice.m
+++ b/apple_remote/source/GlobalKeyboardDevice.m
@@ -112,7 +112,7 @@ static OSStatus hotKeyEventHandler(EventHandlerCallRef, EventRef, void*);
 			break;
 		default:
 #ifdef DEBUG
-			NSLog(@"Unknown global keyboard defaults key for remote button identifier %d", remoteButtonIdentifier);
+			NSLog( @"Apple Remote: Unknown global keyboard defaults key for button identifier %d", remoteButtonIdentifier);
 #endif
             break;
 	}
diff --git a/apple_remote/source/HIDRemoteControlDevice.m b/apple_remote/source/HIDRemoteControlDevice.m
index c7c6263..cffcfa0 100644
--- a/apple_remote/source/HIDRemoteControlDevice.m
+++ b/apple_remote/source/HIDRemoteControlDevice.m
@@ -279,7 +279,7 @@ cleanup:
 	/*
 	if (previousRemainingCookieString) {
 		cookieString = [previousRemainingCookieString stringByAppendingString: cookieString];
-		NSLog(@"New cookie string is %@", cookieString);
+		NSLog( @"Apple Remote: New cookie string is %@", cookieString);
 		[previousRemainingCookieString release], previousRemainingCookieString=nil;
 	}*/
 	if (cookieString == nil || [cookieString length] == 0) return;
@@ -315,7 +315,7 @@ cleanup:
 			[self handleEventWithCookieString: lastSubCookieString sumOfValues:0];
 		}
 		if ([cookieString length] > 0) {
-			NSLog(@"Unknown button for cookiestring %@", cookieString);
+		        NSLog( @"Apple Remote: Unknown button for cookiestring %@", cookieString);
 		}
 	}
 }
@@ -339,7 +339,7 @@ static void QueueCallbackFunction(void* target,  IOReturn result, void* refcon,
     (void)refcon;
     (void)sender;
 	if ((intptr_t)target < 0) {
-		NSLog(@"QueueCallbackFunction called with invalid target!");
+		NSLog( @"Apple Remote: QueueCallbackFunction called with invalid target!");
 		return;
 	}
 	NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -381,7 +381,7 @@ static void QueueCallbackFunction(void* target,  IOReturn result, void* refcon,
 	ioReturnValue = IOObjectGetClass(hidDevice, className);
 
 	if (ioReturnValue != kIOReturnSuccess) {
-		NSLog(@"Error: Failed to get class name.");
+		NSLog( @"Apple Remote: Error: Failed to get RemoteControlDevice class name.");
 		return NULL;
 	}
 
@@ -396,7 +396,7 @@ static void QueueCallbackFunction(void* target,  IOReturn result, void* refcon,
 		plugInResult = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (LPVOID) &hidDeviceInterface);
 
 		if (plugInResult != S_OK) {
-			NSLog(@"Error: Couldn't create HID class device interface");
+			NSLog( @"Apple Remote: Error: Couldn't create HID class device interface");
 		}
 		// Release
 		if (plugInInterface) (*plugInInterface)->Release(plugInInterface);
@@ -489,13 +489,13 @@ static void QueueCallbackFunction(void* target,  IOReturn result, void* refcon,
 					(*queue)->start(queue);
 					return YES;
 				} else {
-					NSLog(@"Error when setting event callback");
+					NSLog( @"Apple Remote: Error when setting event callback");
 				}
 			} else {
-				NSLog(@"Error when creating async event source");
+				NSLog( @"Apple Remote: Error when creating async event source");
 			}
 		} else {
-			NSLog(@"Error when opening device");
+			NSLog( @"Apple Remote: Error when opening device");
 		}
 	} else if (ioReturnValue == kIOReturnExclusiveAccess) {
 		// the device is used exclusive by another application
diff --git a/apple_remote/source/RemoteControl.m b/apple_remote/source/RemoteControl.m
index 36f7ffe..d43597d 100644
--- a/apple_remote/source/RemoteControl.m
+++ b/apple_remote/source/RemoteControl.m
@@ -52,7 +52,7 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
 	if ( (self = [super init]) ) {
         delegate = [_remoteControlDelegate retain];
 #ifdef DEBUG
-        NSLog(@"RemoteControl initWithDelegate ok");
+        NSLog( @"Apple RemoteControl initWithDelegate ok");
 #endif
     }
     return self;
@@ -65,7 +65,7 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
 
 - (void) setListeningToRemote: (BOOL) value {
 #ifdef DEBUG
-        NSLog(@"setListeningToRemote ok");
+        NSLog( @"Apple RemoteControl setListeningToRemote ok");
 #endif
     (void)value;
 }
@@ -75,13 +75,13 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
 
 - (void) startListening: (id) sender {
 #ifdef DEBUG
-            NSLog(@"startListening ok");
+            NSLog( @"Apple RemoteControl startListening ok");
 #endif
     (void)sender;
 }
 - (void) stopListening: (id) sender {
 #ifdef DEBUG
-            NSLog(@"stopListening ok");
+            NSLog( @"Apple RemoteControl stopListening ok");
 #endif
     (void)sender;
 }
@@ -95,7 +95,7 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
 
 - (BOOL) sendsEventForButtonIdentifier: (RemoteControlEventIdentifier) identifier {
 #ifdef DEBUG
-    NSLog(@"sending event for button identifier \n");
+    NSLog( @"Apple RemoteControl: sending event for button identifier\n");
 #endif
     (void)identifier;
     return YES;
@@ -111,17 +111,19 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
                             kTargetApplicationIdentifier /*targetBundleIdentifier -> does not appear, since the peer is nil*/,
                             nil];
 #ifdef DEBUG
+    NSLog( @"Apple Remote: sendDistributedNotification ...");
     // Debug purpose: returns all the existing dictionary keys.
-    NSString *s;
-    NSEnumerator *e = [userInfo keyEnumerator];
-    while ( (s = [e nextObject]) ) {
-        NSLog(@"key = %@ ",s);
+    NSEnumerator* itKey = [userInfo keyEnumerator];
+    NSEnumerator* itVal = [userInfo objectEnumerator];
+    for(;;) {
+        NSString* sKey = [itKey nextObject];
+        NSString* sVal = [itVal nextObject];
+        if( !sKey && !sVal)
+            break;
+        if( !sKey) sKey = @"nil";
+        if( !sVal) sVal = @"nil";
+        NSLog( @"\tARdict[\"%@\"] = \"%@\"",sKey,sVal);
     }
-    NSEnumerator *f = [userInfo objectEnumerator ];
-    while ( (s = [f nextObject]) ) {
-        NSLog(@"value = %@ ",s);
-    }
-    NSLog(@"sendDistributedNotification ...");
 #endif
 
     [[NSDistributedNotificationCenter defaultCenter] postNotificationName:notificationName
@@ -133,13 +135,13 @@ NSString* kTargetApplicationIdentifier = @"TargetBundleIdentifier";
 + (void) sendFinishedNotifcationForAppIdentifier: (NSString*) identifier {
     [self sendDistributedNotification:FINISHED_USING_REMOTE_CONTROL_NOTIFICATION targetBundleIdentifier:identifier];
 #ifdef DEBUG
-    NSLog(@"sendFinishedNotifcationForAppIdentifier ...");
+    NSLog( @"Apple RemoteControl: sendFinishedNotifcationForAppIdentifier ...");
 #endif
 }
 + (void) sendRequestForRemoteControlNotification {
     [self sendDistributedNotification:REQUEST_FOR_REMOTE_CONTROL_NOTIFCATION targetBundleIdentifier:nil];
 #ifdef DEBUG
-    NSLog(@"sendRequestForRemoteControlNotification ...");
+    NSLog( @"Apple RemoteControl: sendRequestForRemoteControlNotification ...");
 #endif
 }
 
diff --git a/apple_remote/source/RemoteControlContainer.m b/apple_remote/source/RemoteControlContainer.m
index 0ebf898..0071c80 100644
--- a/apple_remote/source/RemoteControlContainer.m
+++ b/apple_remote/source/RemoteControlContainer.m
@@ -37,10 +37,10 @@
     if ( (self = [super initWithDelegate:_remoteControlDelegate]) ) {
         remoteControls = [[NSMutableArray alloc] init];
 #ifdef DEBUG
-        NSLog(@"RemoteControlContainer initWithDelegate ok");
+        NSLog( @"Apple Remote: ControlContainer initWithDelegate ok");
     }
     else {
-        NSLog(@"RemoteControlContainer initWithDelegate failed");
+        NSLog( @"Apple Remote: RemoteControlContainer initWithDelegate failed");
 #endif
     }
 
@@ -63,7 +63,7 @@
     }
 #ifdef DEBUG
     else {
-        NSLog(@"RemoteControlContainer instantiateAndAddRemoteControlDeviceWithClass failed");
+        NSLog( @"Apple Remote: ControlContainer instantiateAndAddRemoteControlDeviceWithClass failed");
         toReturn = NO;
     }
 #endif
@@ -79,7 +79,7 @@
     [self didChangeValueForKey:@"listeningToRemote"];
 #ifdef DEBUG
     // debug purpose
-    NSLog(@"reset... (after listening to remote)");
+    NSLog( @"Apple Remote: reset... (after listening)");
 #endif
 }
 
@@ -110,7 +110,7 @@
 
 - (void) startListening: (id) sender {
 #ifdef DEBUG
-    NSLog(@"startListening to events... ");
+    NSLog(@"Apple Remote: start listening to events... ");
 #endif
     unsigned int i;
     for(i=0; i < [remoteControls count]; i++) {
@@ -119,7 +119,7 @@
 }
 - (void) stopListening: (id) sender {
 #ifdef DEBUG
-    NSLog(@"stopListening to events... ");
+    NSLog(@"Apple Remote: stopListening to events... ");
 #endif
     unsigned int i;
     for(i=0; i < [remoteControls count]; i++) {
diff --git a/apple_remote/source/RemoteMainController.m b/apple_remote/source/RemoteMainController.m
index caf145e..c163a38 100644
--- a/apple_remote/source/RemoteMainController.m
+++ b/apple_remote/source/RemoteMainController.m
@@ -108,7 +108,7 @@
 #endif
     if (pressedDown)
     {
-        pressed = @"(pressed)";
+        pressed = @"(AppleRemoteMainController: button pressed)";
 
 #ifdef DEBUG
         switch(buttonIdentifier)
@@ -127,14 +127,14 @@
             case kRemoteButtonMenu_Hold:    buttonName = @"Menu (long)";            break;  // MEDIA_COMMAND_MENU_HOLD
             case kRemoteControl_Switched:   buttonName = @"Remote Control Switched";break;
 
-            default:    NSLog(@"Unmapped event for button %d", buttonIdentifier);   break;
+            default:    NSLog( @"AppleRemoteMainController: Unmapped event for button %d", buttonIdentifier);   break;
         }
 #endif
         [ self postTheEvent:buttonIdentifier modifierFlags: 0 ];
     }
     else // not pressed
     {
-        pressed = @"(released)";
+        pressed = @"(AppleRemoteMainController: button released)";
     }
 
 #ifdef DEBUG


More information about the Libreoffice-commits mailing list