Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use NSEvent.doubleClickInterval if available

  • Loading branch information...
commit 6f8041caa2f015421e8dd0af9edfddf32020cffb 1 parent ba726b8
@psychs psychs authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 Classes/Views/Log/LogScriptEventSink.m
View
14 Classes/Views/Log/LogScriptEventSink.m
@@ -9,6 +9,10 @@
#define DOUBLE_CLICK_RADIUS 3
+@interface NSEvent (SnowLeopardCompatibility)
++ (NSTimeInterval)doubleClickInterval;
+@end
+
@implementation LogScriptEventSink
@@ -76,12 +80,18 @@ - (BOOL)shouldStopDoubleClick:(id)e
BOOL res = NO;
- CFAbsoluteTime now = CFAbsoluteTimeGetCurrent();
- float doubleClickThreshold = GetDblTime() / 60.0;
+ CFAbsoluteTime doubleClickThreshold = 0;
+ if ([NSEvent respondsToSelector:@selector(doubleClickInterval)]) {
+ doubleClickThreshold = [NSEvent doubleClickInterval];
+ }
+ else {
+ doubleClickThreshold = GetDblTime() / 60.0;
+ }
if (doubleClickThreshold == 0) {
doubleClickThreshold = 0.5;
}
+ CFAbsoluteTime now = CFAbsoluteTimeGetCurrent();
if (x-d <= cx && cx <= x+d && y-d <= cy && cy <= y+d) {
if (now < lastClickTime + doubleClickThreshold) {
res = YES;

0 comments on commit 6f8041c

Please sign in to comment.
Something went wrong with that request. Please try again.