et.eventClass = kEventClassApplication;
et.eventKind = kEventAppFrontSwitched;
EventHandlerUPP handler = NewEventHandlerUPP(appSwitch);
- InstallApplicationEventHandler(handler, 1, &et, self, NULL);
+ InstallApplicationEventHandler(handler, 1, &et, (void *)CFBridgingRetain(self), NULL);
}
-(void) applicationWillTerminate: (NSNotification *)aNotification {
}
pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void* userData) {
- ApplicationController* self = (ApplicationController*)userData;
+ ApplicationController* self = (__bridge ApplicationController*)userData;
NSDictionary* currentApp = [[NSWorkspace sharedWorkspace] activeApplication];
ProcessSerialNumber psn;
- psn.lowLongOfPSN = [[currentApp objectForKey:@"NSApplicationProcessSerialNumberLow"] longValue];
- psn.highLongOfPSN = [[currentApp objectForKey:@"NSApplicationProcessSerialNumberHigh"] longValue];
- [self->configsController applicationSwitchedTo: [currentApp objectForKey:@"NSApplicationName"] withPsn: psn];
+ psn.lowLongOfPSN = [currentApp[@"NSApplicationProcessSerialNumberLow"] longValue];
+ psn.highLongOfPSN = [currentApp[@"NSApplicationProcessSerialNumberHigh"] longValue];
+ [self->configsController applicationSwitchedTo: currentApp[@"NSApplicationName"] withPsn: psn];
return noErr;
}
Config* current = [configsController currentConfig];
NSArray* configs = [configsController configs];
for(int i=0; i<[configs count]; i++)
- [[dockMenuBase itemAtIndex: (2+i)] setState: (([configs objectAtIndex:i] == current) ? YES : NO)];
+ [[dockMenuBase itemAtIndex: (2+i)] setState: ((configs[i] == current) ? YES : NO)];
}
-(void) chooseConfig: (id) sender {
- [configsController activateConfig: [[configsController configs] objectAtIndex: ([dockMenuBase indexOfItem: sender]-2)] forApplication: NULL];
+ [configsController activateConfig: [configsController configs][([dockMenuBase indexOfItem: sender]-2)] forApplication: NULL];
}
@end