diff options
author | marc_culler <marc.culler@gmail.com> | 2021-12-06 12:59:55 (GMT) |
---|---|---|
committer | marc_culler <marc.culler@gmail.com> | 2021-12-06 12:59:55 (GMT) |
commit | b2a1f313cf3c96df11c7d7c85c1aead7687bee7c (patch) | |
tree | ae326585f225916d6d6b9df66148686fdc6bfa31 /macosx | |
parent | 93896fe7fdfe125311542dfff53199107f2cdf08 (diff) | |
download | tk-b2a1f313cf3c96df11c7d7c85c1aead7687bee7c.zip tk-b2a1f313cf3c96df11c7d7c85c1aead7687bee7c.tar.gz tk-b2a1f313cf3c96df11c7d7c85c1aead7687bee7c.tar.bz2 |
Add a guard against remaining in the ignoreUpDown state forever; edit comments.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXMouseEvent.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 1d3546e..6841aae 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -96,6 +96,7 @@ enum { static Bool isDragging = NO; static Bool ignoreDrags = NO; static Bool ignoreUpDown = NO; + static NSTimeInterval timestamp = 0; #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); @@ -186,13 +187,20 @@ enum { * and [39cbacb9e8]). Ignore button press events when ignoreUpDown is * set. These are extraneous events which appear when double-clicking * in a window without focus, causing duplicate Double-1 events (see - * ticket [7bda9882cb]. + * ticket [7bda9882cb]. To deal with this, when a LeftMouseDown event + * with clickCount 2 is received we ignore subsequent LeftMouseUp and + * LeftMouseDown events until the matching LeftMouseUp with click count + * 2 is received. */ + if ([theEvent timestamp] - timestamp > 1) { + ignoreUpDown = NO; + } if ([theEvent clickCount] == 2) { if (ignoreUpDown == YES) { return theEvent; } else { + timestamp = [theEvent timestamp]; ignoreUpDown = YES; } } |