diff --git a/ChangeLog b/ChangeLog index 4d4550718..b0a9576c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-03-21 Pierre-Yves Rivaille + + * Source/NSEvent.m + ([NSEvent +startPeriodicEventsAfterDelay:withPeriod:]): + ([NSEvent +_registerRealTimer:]): + The first periodic event is sent after delay seconds. + It was incorrectly sent after delay+period seconds. + * Source/NSScroller.m ([NSScroller -drawParts]): + Set the scrollbuttons to send actions on mouseDown instead of + mouseUp. Changed the initial delay (to reflect NSEvent changes) + and the period so that it feels smoother. + 2002-03-20 Richard Frith-Macdonald * configure.in: Use info from make package, and look in GNUstep diff --git a/Source/NSEvent.m b/Source/NSEvent.m index 7f0d2059f..e29eb8bb7 100644 --- a/Source/NSEvent.m +++ b/Source/NSEvent.m @@ -293,21 +293,15 @@ static Class eventClass; @"this thread %x", GSCurrentThread()]; /* - * If the delay time is 0 then register a timer immediately. Otherwise - * register a timer with no repeat that when fired registers the real timer + * Register a timer that will fire in delaySeconds. + * This timer will fire the first event and register + * a repeat timer that will send the following events */ - if (!delaySeconds) - timer = [NSTimer timerWithTimeInterval: periodSeconds - target: self - selector: @selector(_timerFired:) - userInfo: nil - repeats: YES]; - else - timer = [NSTimer timerWithTimeInterval: delaySeconds - target: self - selector: @selector(_registerRealTimer:) - userInfo: [NSNumber numberWithDouble: periodSeconds] - repeats: NO]; + timer = [NSTimer timerWithTimeInterval: delaySeconds + target: self + selector: @selector(_registerRealTimer:) + userInfo: [NSNumber numberWithDouble: periodSeconds] + repeats: NO]; [[NSRunLoop currentRunLoop] addTimer: timer forMode: NSEventTrackingRunLoopMode]; @@ -343,6 +337,23 @@ static Class eventClass; NSMutableDictionary *dict = GSCurrentThreadDictionary(); NSDebugLog (@"_registerRealTimer: "); + { + NSTimeInterval timeInterval; + NSEvent *periodicEvent; + + timeInterval = [[NSDate date] timeIntervalSinceReferenceDate]; + periodicEvent = [self otherEventWithType: NSPeriodic + location: NSZeroPoint + modifierFlags: 0 + timestamp: timeInterval + windowNumber: 0 + context: [NSApp context] + subtype: 0 + data1: 0 + data2: 0]; + + [NSApp postEvent: periodicEvent atStart: NO]; + } realTimer = [NSTimer timerWithTimeInterval: [[timer userInfo] doubleValue] target: self diff --git a/Source/NSScroller.m b/Source/NSScroller.m index d222dcf93..223e29f0a 100644 --- a/Source/NSScroller.m +++ b/Source/NSScroller.m @@ -241,7 +241,8 @@ static NSColor *scrollBarColor = nil; [upCell setAlternateImage: [NSImage imageNamed: @"common_ArrowUpH"]]; [upCell setImagePosition: NSImageOnly]; [upCell setContinuous: YES]; - [upCell setPeriodicDelay: 0.05 interval: 0.05]; + [upCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)]; + [upCell setPeriodicDelay: 0.3 interval: 0.04]; downCell = [NSButtonCell new]; [downCell setHighlightsBy: NSChangeBackgroundCellMask|NSContentsCellMask]; @@ -249,7 +250,8 @@ static NSColor *scrollBarColor = nil; [downCell setAlternateImage: [NSImage imageNamed: @"common_ArrowDownH"]]; [downCell setImagePosition: NSImageOnly]; [downCell setContinuous: YES]; - [downCell setPeriodicDelay: 0.05 interval: 0.05]; + [downCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)]; + [downCell setPeriodicDelay: 0.3 interval: 0.04]; leftCell = [NSButtonCell new]; [leftCell setHighlightsBy: NSChangeBackgroundCellMask|NSContentsCellMask]; @@ -257,7 +259,8 @@ static NSColor *scrollBarColor = nil; [leftCell setAlternateImage: [NSImage imageNamed: @"common_ArrowLeftH"]]; [leftCell setImagePosition: NSImageOnly]; [leftCell setContinuous: YES]; - [leftCell setPeriodicDelay: 0.05 interval: 0.05]; + [leftCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)]; + [leftCell setPeriodicDelay: 0.3 interval: 0.04]; rightCell = [NSButtonCell new]; [rightCell setHighlightsBy: NSChangeBackgroundCellMask|NSContentsCellMask]; @@ -265,7 +268,8 @@ static NSColor *scrollBarColor = nil; [rightCell setAlternateImage: [NSImage imageNamed: @"common_ArrowRightH"]]; [rightCell setImagePosition: NSImageOnly]; [rightCell setContinuous: YES]; - [rightCell setPeriodicDelay: 0.05 interval: 0.05]; + [rightCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)]; + [rightCell setPeriodicDelay: 0.3 interval: 0.04]; knobCell = [NSButtonCell new]; [knobCell setButtonType: NSMomentaryChangeButton];