2 // NJOutputSwitchMouseMode.m
5 // Created by Yifeng Huang on 7/28/12.
8 #import "NJOutputSwitchMouseMode.h"
10 #import "EnjoyableApplicationDelegate.h"
11 #import "NJDeviceController.h"
13 @implementation NJOutputSwitchMouseMode
15 + (NSString *)serializationCode {
16 return @"switch mouse mode";
19 - (NSDictionary *)serialize {
20 return @{ @"type": @"switch mouse mode" };
23 + (NJOutput *)outputDeserialize:(NSDictionary *)serialization
24 withMappings:(NSArray *)mappings {
25 return [[NJOutputSwitchMouseMode alloc] init];
28 // FIXME: It's hacky to get at the controller this way, but it's
29 // also hacky to pass it. Shouldn't need to do either.
30 EnjoyableApplicationDelegate *ac = NSApplication.sharedApplication.delegate;
31 NJDeviceController *jc = ac.inputController;
32 jc.frontWindowOnly = !jc.frontWindowOnly;