--- /dev/null
+//
+// NJOutputSwitchMouseMode.m
+// Enjoy
+//
+// Created by Yifeng Huang on 7/28/12.
+//
+
+#import "NJOutputSwitchMouseMode.h"
+
+#import "ApplicationController.h"
+#import "NJInputController.h"
+
+@implementation NJOutputSwitchMouseMode
+
++ (NSString *)serializationCode {
+ return @"switch mouse mode";
+}
+
+- (NSDictionary *)serialize {
+ return @{ @"type": @"switch mouse mode" };
+}
+
++ (NJOutput *)outputDeserialize:(NSDictionary *)serialization
+ withMappings:(NSArray *)mappings {
+ return [[NJOutputSwitchMouseMode alloc] init];
+}
+- (void)trigger {
+ // FIXME: It's hacky to get at the controller this way, but it's
+ // also hacky to pass it. Shouldn't need to do either.
+ ApplicationController *ac = NSApplication.sharedApplication.delegate;
+ NJInputController *jc = ac.inputController;
+ jc.frontWindowOnly = !jc.frontWindowOnly;
+}
+
+@end