Automatically trigger/untrigger targets based on setting the 'running' property;...
[enjoyable.git] / TargetToggleMouseScope.m
1 //
2 // TargetToggleMouseScope.m
3 // Enjoy
4 //
5 // Created by Yifeng Huang on 7/28/12.
6 // Copyright (c) 2012 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "TargetToggleMouseScope.h"
10
11 @implementation TargetToggleMouseScope
12
13 -(NSString*) stringify {
14 return [[NSString alloc] initWithFormat: @"mtoggle"];
15 }
16
17 +(TargetToggleMouseScope*) unstringifyImpl: (NSArray*) comps {
18 NSParameterAssert([comps count] == 1);
19 TargetToggleMouseScope* target = [[TargetToggleMouseScope alloc] init];
20 return target;
21 }
22
23 - (void)trigger {
24 // FIXME: It's hacky to get at the controller this way, but it's
25 // also hacky to pass it. Shouldn't need to do either.
26 ApplicationController *ac = [NSApplication sharedApplication].delegate;
27 JoystickController *jc = ac.jsController;
28 [jc setFrontWindowOnly: ![jc frontWindowOnly]];
29 printf("Front window only: %d\n", [jc frontWindowOnly]);
30 }
31
32 @end