Change NJInputAnalog so magnitudes of subactions are always positive (e.g. -1 magnitu...
[enjoyable.git] / NJOutputSwitchMouseMode.m
1 //
2 // NJOutputSwitchMouseMode.m
3 // Enjoy
4 //
5 // Created by Yifeng Huang on 7/28/12.
6 //
7
8 #import "NJOutputSwitchMouseMode.h"
9
10 #import "EnjoyableApplicationDelegate.h"
11 #import "NJDeviceController.h"
12
13 @implementation NJOutputSwitchMouseMode
14
15 + (NSString *)serializationCode {
16 return @"switch mouse mode";
17 }
18
19 - (NSDictionary *)serialize {
20 return @{ @"type": self.class.serializationCode };
21 }
22
23 + (NJOutput *)outputDeserialize:(NSDictionary *)serialization
24 withMappings:(NSArray *)mappings {
25 return [[NJOutputSwitchMouseMode alloc] init];
26 }
27 - (void)trigger {
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;
33 }
34
35 @end