5 // Created by Yifeng Huang on 7/26/12.
6 // Copyright (c) 2012 __MyCompanyName__. All rights reserved.
9 #import "TargetMouseMove.h"
11 @implementation TargetMouseMove
13 -(void) setInputValue: (int) newIV {
14 NSRect screenRect = [[NSScreen mainScreen] frame];
15 NSInteger height = screenRect.size.height;
16 NSPoint mouseLoc = [NSEvent mouseLocation];
22 CGEventRef move = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved,
23 CGPointMake(mouseLoc.x, height - mouseLoc.y),
25 CGEventPost(kCGHIDEventTap, move);
31 -(NSString*) stringify {
32 return [[NSString alloc] initWithFormat: @"mmove~%d", dir];
35 +(TargetMouseMove*) unstringifyImpl: (NSArray*) comps {
36 NSParameterAssert([comps count] == 2);
37 TargetMouseMove* target = [[TargetMouseMove alloc] init];
38 [target setDir: [[comps objectAtIndex:1] integerValue]];