Source/NSEvent.m

Source/NSScroller.m


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13187 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Pierre-Yves Rivaille 2002-03-21 21:47:15 +00:00
parent 9b0cf55518
commit 2de3301639
3 changed files with 45 additions and 18 deletions

View file

@ -1,3 +1,15 @@
2002-03-21 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
* 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 <rfm@gnu.org>
* configure.in: Use info from make package, and look in GNUstep

View file

@ -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

View file

@ -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];