projects
/
enjoyable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move logic into messages rather than directly in the callback functions.
[enjoyable.git]
/
TargetMouseBtn.m
diff --git
a/TargetMouseBtn.m
b/TargetMouseBtn.m
index
2f56f7e
..
3efb88a
100644
(file)
--- a/
TargetMouseBtn.m
+++ b/
TargetMouseBtn.m
@@
-10,14
+10,12
@@
@implementation TargetMouseBtn
@implementation TargetMouseBtn
-@synthesize button;
-
+ (NSString *)serializationCode {
return @"mbtn";
}
- (NSDictionary *)serialize {
+ (NSString *)serializationCode {
return @"mbtn";
}
- (NSDictionary *)serialize {
- return @{ @"type": @"mbtn", @"button": @(
self.
button) };
+ return @{ @"type": @"mbtn", @"button": @(
_
button) };
}
+ (Target *)targetDeserialize:(NSDictionary *)serialization
}
+ (Target *)targetDeserialize:(NSDictionary *)serialization
@@
-31,11
+29,11
@@
NSRect screenRect = [[NSScreen mainScreen] frame];
NSInteger height = screenRect.size.height;
NSPoint mouseLoc = [NSEvent mouseLocation];
NSRect screenRect = [[NSScreen mainScreen] frame];
NSInteger height = screenRect.size.height;
NSPoint mouseLoc = [NSEvent mouseLocation];
- CGEventType eventType = (button == 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),
- button);
+
_
button);
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}
@@
-44,11
+42,11
@@
NSRect screenRect = [[NSScreen mainScreen] frame];
NSInteger height = screenRect.size.height;
NSPoint mouseLoc = [NSEvent mouseLocation];
NSRect screenRect = [[NSScreen mainScreen] frame];
NSInteger height = screenRect.size.height;
NSPoint mouseLoc = [NSEvent mouseLocation];
- CGEventType eventType = (button == 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),
- button);
+
_
button);
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}
CGEventPost(kCGHIDEventTap, click);
CFRelease(click);
}