}
case 3: {
TargetMouseMove *mm = [[TargetMouseMove alloc] init];
- mm.dir = mouseDirSelect.selectedSegment;
+ mm.axis = mouseDirSelect.selectedSegment;
return mm;
}
case 4: {
TargetMouseBtn *mb = [[TargetMouseBtn alloc] init];
- mb.which = mouseBtnSelect.selectedSegment == 0 ? kCGMouseButtonLeft : kCGMouseButtonRight;
+ mb.button = mouseBtnSelect.selectedSegment == 0 ? kCGMouseButtonLeft : kCGMouseButtonRight;
return mb;
}
case 5: {
TargetMouseScroll *ms = [[TargetMouseScroll alloc] init];
- ms.howMuch = scrollDirSelect.selectedSegment ? 1 : -1;
+ ms.amount = scrollDirSelect.selectedSegment ? 1 : -1;
return ms;
}
case 6: {
}
else if ([target isKindOfClass:[TargetMouseMove class]]) {
[radioButtons setState:1 atRow:3 column:0];
- [mouseDirSelect setSelectedSegment:[(TargetMouseMove *)target dir]];
+ [mouseDirSelect setSelectedSegment:[(TargetMouseMove *)target axis]];
}
else if ([target isKindOfClass:[TargetMouseBtn class]]) {
[radioButtons setState:1 atRow:4 column:0];
- mouseBtnSelect.selectedSegment = [(TargetMouseBtn *)target which] == kCGMouseButtonLeft ? 0 : 1;
+ mouseBtnSelect.selectedSegment = [(TargetMouseBtn *)target button] == kCGMouseButtonLeft ? 0 : 1;
}
else if ([target isKindOfClass:[TargetMouseScroll class]]) {
[radioButtons setState:1 atRow:5 column:0];
- scrollDirSelect.selectedSegment = [(TargetMouseScroll *)target howMuch] > 0;
+ scrollDirSelect.selectedSegment = [(TargetMouseScroll *)target amount] > 0;
}
else if ([target isKindOfClass:[TargetToggleMouseScope class]]) {
[radioButtons setState:1 atRow:6 column:0];
@interface TargetMouseBtn : Target
-@property (assign) CGMouseButton which;
+@property (assign) CGMouseButton button;
@end
@implementation TargetMouseBtn
-@synthesize which;
+@synthesize button;
+ (NSString *)serializationCode {
return @"mbtn";
}
- (NSDictionary *)serialize {
- return @{ @"type": @"mbtn", @"which": @(self.which) };
+ return @{ @"type": @"mbtn", @"button": @(self.button) };
}
+ (Target *)targetDeserialize:(NSDictionary *)serialization
withConfigs:(NSArray *)configs {
TargetMouseBtn *target = [[TargetMouseBtn alloc] init];
- target.which = [serialization[@"which"] intValue];
+ target.button = [serialization[@"button"] intValue];
return target;
}
NSRect screenRect = [[NSScreen mainScreen] frame];
NSInteger height = screenRect.size.height;
NSPoint mouseLoc = [NSEvent mouseLocation];
- CGEventType eventType = (which == kCGMouseButtonLeft) ? kCGEventLeftMouseDown : kCGEventRightMouseDown;
+ CGEventType eventType = (button == kCGMouseButtonLeft) ? kCGEventLeftMouseDown : kCGEventRightMouseDown;
CGEventRef click = CGEventCreateMouseEvent(NULL,
eventType,
CGPointMake(mouseLoc.x, height - mouseLoc.y),
- which);
+ button);
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}
NSRect screenRect = [[NSScreen mainScreen] frame];
NSInteger height = screenRect.size.height;
NSPoint mouseLoc = [NSEvent mouseLocation];
- CGEventType eventType = (which == kCGMouseButtonLeft) ? kCGEventLeftMouseUp : kCGEventRightMouseUp;
+ CGEventType eventType = (button == kCGMouseButtonLeft) ? kCGEventLeftMouseUp : kCGEventRightMouseUp;
CGEventRef click = CGEventCreateMouseEvent(NULL,
eventType,
CGPointMake(mouseLoc.x, height - mouseLoc.y),
- which);
+ button);
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}
@interface TargetMouseMove : Target
-@property (assign) int dir;
+@property (assign) int axis;
@end
return YES;
}
-@synthesize dir;
+@synthesize axis;
+ (NSString *)serializationCode {
return @"mmove";
}
- (NSDictionary *)serialize {
- return @{ @"type": @"mmove", @"dir": @(self.dir) };
+ return @{ @"type": @"mmove", @"axis": @(self.axis) };
}
+ (Target *)targetDeserialize:(NSDictionary *)serialization
withConfigs:(NSArray *)configs {
TargetMouseMove *target = [[TargetMouseMove alloc] init];
- target.dir = [serialization[@"dir"] intValue];
+ target.axis = [serialization[@"axis"] intValue];
return target;
}
if ([jc frontWindowOnly])
speed = 12.f;
float dx = 0.f, dy = 0.f;
- if (self.dir == 0)
+ if (axis == 0)
dx = self.magnitude * speed;
else
dy = self.magnitude * speed;
@interface TargetMouseScroll : Target
-@property (assign) int howMuch;
+@property (assign) int amount;
@end
@implementation TargetMouseScroll
-@synthesize howMuch;
+@synthesize amount;
+ (NSString *)serializationCode {
return @"mscroll";
}
- (NSDictionary *)serialize {
- return @{ @"type": @"mscroll", @"howMuch": @(self.howMuch) };
+ return @{ @"type": @"mscroll", @"amount": @(self.amount) };
}
+ (Target *)targetDeserialize:(NSDictionary *)serialization
withConfigs:(NSArray *)configs {
TargetMouseScroll *target = [[TargetMouseScroll alloc] init];
- target.howMuch = [serialization[@"howMuch"] intValue];
+ target.amount = [serialization[@"amount"] intValue];
return target;
}
-(void) trigger {
CGEventRef scroll = CGEventCreateScrollWheelEvent(NULL,
kCGScrollEventUnitLine,
1,
- self.howMuch);
+ self.amount);
CGEventPost(kCGHIDEventTap, scroll);
CFRelease(scroll);
}