projects
/
enjoyable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean up some comments.
[enjoyable.git]
/
TargetMouseBtn.m
diff --git
a/TargetMouseBtn.m
b/TargetMouseBtn.m
index
28fe536
..
653014a
100644
(file)
--- a/
TargetMouseBtn.m
+++ b/
TargetMouseBtn.m
@@
-3,52
+3,49
@@
// Enjoy
//
// Created by Yifeng Huang on 7/27/12.
// Enjoy
//
// Created by Yifeng Huang on 7/27/12.
-// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "TargetMouseBtn.h"
@implementation TargetMouseBtn
//
#import "TargetMouseBtn.h"
@implementation TargetMouseBtn
-@synthesize which;
-
+ (NSString *)serializationCode {
return @"mbtn";
}
- (NSDictionary *)serialize {
+ (NSString *)serializationCode {
return @"mbtn";
}
- (NSDictionary *)serialize {
- return @{ @"type": @"mbtn", @"
which": @(self.which
) };
+ return @{ @"type": @"mbtn", @"
button": @(_button
) };
}
+ (Target *)targetDeserialize:(NSDictionary *)serialization
withConfigs:(NSArray *)configs {
TargetMouseBtn *target = [[TargetMouseBtn alloc] init];
}
+ (Target *)targetDeserialize:(NSDictionary *)serialization
withConfigs:(NSArray *)configs {
TargetMouseBtn *target = [[TargetMouseBtn alloc] init];
- target.
which = [serialization[@"which
"] intValue];
+ target.
button = [serialization[@"button
"] intValue];
return target;
}
-(void) trigger {
NSRect screenRect = [[NSScreen mainScreen] frame];
return target;
}
-(void) trigger {
NSRect screenRect = [[NSScreen mainScreen] frame];
-
NSInteger
height = screenRect.size.height;
+
CGFloat
height = screenRect.size.height;
NSPoint mouseLoc = [NSEvent mouseLocation];
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),
CGEventRef click = CGEventCreateMouseEvent(NULL,
eventType,
CGPointMake(mouseLoc.x, height - mouseLoc.y),
-
which
);
+
_button
);
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}
-(void) untrigger {
NSRect screenRect = [[NSScreen mainScreen] frame];
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}
-(void) untrigger {
NSRect screenRect = [[NSScreen mainScreen] frame];
-
NSInteger
height = screenRect.size.height;
+
CGFloat
height = screenRect.size.height;
NSPoint mouseLoc = [NSEvent mouseLocation];
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),
CGEventRef click = CGEventCreateMouseEvent(NULL,
eventType,
CGPointMake(mouseLoc.x, height - mouseLoc.y),
-
which
);
+
_button
);
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}