From 5c6e6f88c98e07cd7f5353f0dde70e1e6b3577bf Mon Sep 17 00:00:00 2001 From: ericwa Date: Sun, 24 Jan 2010 06:27:36 +0000 Subject: [PATCH] * Source/NSColorWell.m: Add a minimum distance which you need to drag the color from a well before it is treated as a drag. TODO: Unify this with the dragging threshold in other parts of gui and make a user default called GSDragThreshold, maybe? git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29377 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 7 +++++++ Source/NSColorWell.m | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 80a470de8..120d5c809 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-01-23 Eric Wasylishen + + * Source/NSColorWell.m: Add a minimum distance which you need to + drag the color from a well before it is treated as a drag. + TODO: Unify this with the dragging threshold in other parts of + gui and make a user default called GSDragThreshold, maybe? + 2010-01-23 Eric Wasylishen * Source/GSWindowDecorationView.m: In drawRect:, clear the window diff --git a/Source/NSColorWell.m b/Source/NSColorWell.m index 6952c2d55..7dfa336d4 100644 --- a/Source/NSColorWell.m +++ b/Source/NSColorWell.m @@ -43,6 +43,7 @@ #include "GNUstepGUI/GSTheme.h" #include #include +#include static NSString *GSColorWellDidBecomeExclusiveNotification = @"GSColorWellDidBecomeExclusiveNotification"; @@ -333,6 +334,14 @@ static NSString *GSColorWellDidBecomeExclusiveNotification = BOOL inside = [self mouse: point inRect: [self bounds]]; BOOL startedInWell = [self mouse: _mouseDownPoint inRect: _wellRect]; + NSSize delta = NSMakeSize(_mouseDownPoint.x - point.x, + _mouseDownPoint.y - point.y); + double distance = sqrt(delta.width*delta.width + delta.height*delta.height); + + // FIXME: Make the dragging threshold a user default + if (distance < 4) + return; + if ([self isEnabled] == NO) return;