diff options
author | Eric Bachard <ericb2@apache.org> | 2011-10-30 21:57:34 +0000 |
---|---|---|
committer | Eric Bachard <ericb2@apache.org> | 2011-10-30 21:57:34 +0000 |
commit | dd98f0a238878e4dca1374a238692a13332d9649 (patch) | |
tree | 24ca27d326ec6a12470677d2b77fed2ef2941874 /apple_remote | |
parent | e8ce1258c41d23a20ed8bb658a8c4b9cf0a20d19 (diff) |
Propragating the modif in the implementation (HIDRemoteControlDevice.m)
Diffstat (limited to 'apple_remote')
-rw-r--r-- | apple_remote/HIDRemoteControlDevice.m | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/apple_remote/HIDRemoteControlDevice.m b/apple_remote/HIDRemoteControlDevice.m index 94215900717b..9b52f4765bd7 100644 --- a/apple_remote/HIDRemoteControlDevice.m +++ b/apple_remote/HIDRemoteControlDevice.m @@ -278,30 +278,40 @@ cleanup: [previousRemainingCookieString release], previousRemainingCookieString=nil; }*/ if (cookieString == nil || [cookieString length] == 0) return; - + NSNumber* buttonId = [[self cookieToButtonMapping] objectForKey: cookieString]; if (buttonId != nil) { - [self sendRemoteButtonEvent: [buttonId intValue] pressedDown: (sumOfValues>0)]; + switch ( (int)buttonId ) + { + case kMetallicRemote2009ButtonPlay: + case kMetallicRemote2009ButtonMiddlePlay: + buttonId = [NSNumber numberWithInt:kRemoteButtonPlay]; + break; + default: + break; + } + [self sendRemoteButtonEvent: [buttonId intValue] pressedDown: (sumOfValues>0)]; + } else { - // let's see if a number of events are stored in the cookie string. this does - // happen when the main thread is too busy to handle all incoming events in time. - NSString* subCookieString; - NSString* lastSubCookieString=nil; - while( (subCookieString = [self validCookieSubstring: cookieString]) ) { - cookieString = [cookieString substringFromIndex: [subCookieString length]]; - lastSubCookieString = subCookieString; - if (processesBacklog) [self handleEventWithCookieString: subCookieString sumOfValues:sumOfValues]; - } - if (processesBacklog == NO && lastSubCookieString != nil) { - // process the last event of the backlog and assume that the button is not pressed down any longer. - // The events in the backlog do not seem to be in order and therefore (in rare cases) the last event might be - // a button pressed down event while in reality the user has released it. - // NSLog(@"processing last event of backlog"); - [self handleEventWithCookieString: lastSubCookieString sumOfValues:0]; - } - if ([cookieString length] > 0) { - NSLog(@"Unknown button for cookiestring %@", cookieString); - } + // let's see if a number of events are stored in the cookie string. this does + // happen when the main thread is too busy to handle all incoming events in time. + NSString* subCookieString; + NSString* lastSubCookieString=nil; + while( (subCookieString = [self validCookieSubstring: cookieString]) ) { + cookieString = [cookieString substringFromIndex: [subCookieString length]]; + lastSubCookieString = subCookieString; + if (processesBacklog) [self handleEventWithCookieString: subCookieString sumOfValues:sumOfValues]; + } + if (processesBacklog == NO && lastSubCookieString != nil) { + // process the last event of the backlog and assume that the button is not pressed down any longer. + // The events in the backlog do not seem to be in order and therefore (in rare cases) the last event might be + // a button pressed down event while in reality the user has released it. + // NSLog(@"processing last event of backlog"); + [self handleEventWithCookieString: lastSubCookieString sumOfValues:0]; + } + if ([cookieString length] > 0) { + NSLog(@"Unknown button for cookiestring %@", cookieString); + } } } |