From 72921c6e774404b35a5732177bf4c942c755da73 Mon Sep 17 00:00:00 2001 From: netcrep Date: Wed, 6 Aug 1997 20:29:07 +0000 Subject: [PATCH] Bugs removed from NSButton and NSDPSContext. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2374 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 16 ++++++++++++++++ Source/NSApplication.m | 10 +++++++--- Source/NSButton.m | 8 ++++++-- Source/NSCell.m | 4 ++-- Source/NSClipView.m | 2 +- Source/NSDPSContext.m | 2 +- Source/NSScrollView.m | 10 +++++----- Source/NSScroller.m | 7 +++++-- 8 files changed, 43 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4e6cfad0..028f5a332 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Wed Aug 6 13:27:53 1997 Ovidiu Predescu + + * Source/NSApplication (-nextEventMatchingMask:untilDate:inMode: + dequeue:): Restored the old behavior of getting time events from the + queue because otherwise the scroll view class works slowly; I have to + find some other way to put such events on the events queue. + * Source/NSButton.m (mouseDown:): Don't send the action to the target + since it is already done in trackMouse:inRect:ofView:untilMouseUp:. + * Source/NSCell.m (getPeriodicDelay:interval:): Set the delay to 0.05. + * Source/NSDPSContext.m (+initialize): Create a retained dictionary + for GNU_CONTEXT_THREAD_DICT instead of an autoreleased one. + * Source/NSClipView.m: Turned NSLog into NSDebugLog. + * Source/NSScrollView.m: Likewise. + * Source/NSScroller.m (drawParts): Set the scroller buttons delay and + repeat interval. + Tue Aug 5 14:39:29 1997 Ovidiu Predescu * Images/common_ArrowLeftH.tiff: New file. diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 961cdc7c5..de278e7b5 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -413,6 +413,9 @@ static BOOL gnustep_gui_app_is_in_dealloc; NSEvent *event; BOOL done = NO; + if (!expiration) + expiration = [NSDate distantFuture]; + event = [self _eventMatchingMask:mask]; if (event) done = YES; @@ -421,8 +424,9 @@ static BOOL gnustep_gui_app_is_in_dealloc; while (!done) { NSDate* limitDate = [currentLoop limitDateForMode:mode]; - if (!expiration) - expiration = [NSDate distantFuture]; + event = [self _eventMatchingMask:mask]; + if (event) + break; if (limitDate) limitDate = [expiration earlierDate:limitDate]; @@ -433,7 +437,7 @@ static BOOL gnustep_gui_app_is_in_dealloc; event = [self _eventMatchingMask:mask]; if (event) - done = YES; + break; } type = [event type]; diff --git a/Source/NSButton.m b/Source/NSButton.m index 75fc617fe..4d6d1d970 100644 --- a/Source/NSButton.m +++ b/Source/NSButton.m @@ -289,6 +289,7 @@ id gnustep_gui_nsbutton_class = nil; NSEvent *e; unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask | NSMouseMovedMask | NSLeftMouseDraggedMask | NSRightMouseDraggedMask; +// int oldActionMask = [cell sendActionOn:0]; NSDebugLog(@"NSButton mouseDown\n"); @@ -335,9 +336,12 @@ id gnustep_gui_nsbutton_class = nil; } [self unlockFocus]; + /* Restore the old action mask */ +// [cell sendActionOn:oldActionMask]; + // Have the target perform the action - if (mouseUp) - [self sendAction:[self action] to:[self target]]; +// if (mouseUp) +// [self sendAction:[self action] to:[self target]]; } - (void)performClick:(id)sender diff --git a/Source/NSCell.m b/Source/NSCell.m index 0e379c6c0..4d5be1dc8 100644 --- a/Source/NSCell.m +++ b/Source/NSCell.m @@ -591,7 +591,7 @@ - (void)getPeriodicDelay:(float *)delay interval:(float *)interval { - *delay = 0.0; + *delay = 0.05; *interval = 0.05; } @@ -719,7 +719,7 @@ // Did the mouse go up? if (eventType == NSLeftMouseUp) { - NSLog(@"NSCell mouse went up\n"); + NSDebugLog(@"NSCell mouse went up\n"); mouseWentUp = YES; done = YES; if ((action_mask & NSLeftMouseUpMask)) diff --git a/Source/NSClipView.m b/Source/NSClipView.m index b2b7387af..7f93dbb8d 100644 --- a/Source/NSClipView.m +++ b/Source/NSClipView.m @@ -94,7 +94,7 @@ { NSPoint currentPoint = [self bounds].origin; - NSLog (@"scrollToPoint: current point (%f, %f), point (%f, %f)", + NSDebugLog (@"scrollToPoint: current point (%f, %f), point (%f, %f)", currentPoint.x, currentPoint.y, point.x, point.y); diff --git a/Source/NSDPSContext.m b/Source/NSDPSContext.m index 50068cbc3..3209b5be8 100644 --- a/Source/NSDPSContext.m +++ b/Source/NSDPSContext.m @@ -69,7 +69,7 @@ static BOOL GNU_CONTEXT_SYNCHRONIZED = NO; // Allocate dictionary for maintaining // mapping of threads to contexts - GNU_CONTEXT_THREAD_DICT = [NSMutableDictionary dictionary]; + GNU_CONTEXT_THREAD_DICT = [NSMutableDictionary new]; // Create lock for serializing access to dictionary GNU_CONTEXT_LOCK = [[NSRecursiveLock alloc] init]; diff --git a/Source/NSScrollView.m b/Source/NSScrollView.m index 14692a1d8..5f5478191 100644 --- a/Source/NSScrollView.m +++ b/Source/NSScrollView.m @@ -197,7 +197,7 @@ static Class rulerViewClass = nil; NSPoint point; BOOL wasAScrollerButton = YES; - NSLog (@"_doScroll: float value = %f", floatValue); + NSDebugLog (@"_doScroll: float value = %f", floatValue); if (hitPart == NSScrollerIncrementLine) amount = _lineScroll; @@ -225,7 +225,7 @@ static Class rulerViewClass = nil; if (![_contentView isFlipped]) amount = -amount; - NSLog (@"increment/decrement: amount = %f, flipped = %d", + NSDebugLog (@"increment/decrement: amount = %f, flipped = %d", amount, [_contentView isFlipped]); point.y = clipViewBounds.origin.y + amount; } @@ -266,7 +266,7 @@ static Class rulerViewClass = nil; / (documentRect.size.width - newClipViewBounds.size.width); [_horizScroller setFloatValue:floatValue]; [_horizScroller display]; - NSLog (@"new horiz float value %f", floatValue); + NSDebugLog (@"new horiz float value %f", floatValue); } if (newClipViewBounds.origin.x != clipViewBounds.origin.y) { @@ -279,7 +279,7 @@ static Class rulerViewClass = nil; floatValue = 1 - floatValue; [_vertScroller setFloatValue:floatValue]; [_vertScroller display]; - NSLog (@"new vert float value %f", floatValue); + NSDebugLog (@"new vert float value %f", floatValue); } } } @@ -291,7 +291,7 @@ static Class rulerViewClass = nil; float floatValue; float knobProportion; - NSLog (@"reflectScrolledClipView:"); + NSDebugLog (@"reflectScrolledClipView:"); if (_hasVertScroller) { if (documentRect.size.height < clipViewBounds.size.height) diff --git a/Source/NSScroller.m b/Source/NSScroller.m index 1ed33a575..facb3c234 100644 --- a/Source/NSScroller.m +++ b/Source/NSScroller.m @@ -114,6 +114,7 @@ static NSButtonCell* knobCell = nil; [upCell setAlternateImage:[NSImage imageNamed:@"common_ArrowUpH"]]; [upCell setImagePosition:NSImageOnly]; [upCell setContinuous:YES]; + [upCell setPeriodicDelay:0.05 interval:0.05]; downCell = [NSButtonCell new]; [downCell setHighlightsBy:NSChangeBackgroundCellMask|NSContentsCellMask]; @@ -121,6 +122,7 @@ static NSButtonCell* knobCell = nil; [downCell setAlternateImage:[NSImage imageNamed:@"common_ArrowDownH"]]; [downCell setImagePosition:NSImageOnly]; [downCell setContinuous:YES]; + [downCell setPeriodicDelay:0.05 interval:0.05]; leftCell = [NSButtonCell new]; [leftCell setHighlightsBy:NSChangeBackgroundCellMask|NSContentsCellMask]; @@ -128,6 +130,7 @@ static NSButtonCell* knobCell = nil; [leftCell setAlternateImage:[NSImage imageNamed:@"common_ArrowLeftH"]]; [leftCell setImagePosition:NSImageOnly]; [leftCell setContinuous:YES]; + [leftCell setPeriodicDelay:0.05 interval:0.05]; rightCell = [NSButtonCell new]; [rightCell setHighlightsBy:NSChangeBackgroundCellMask|NSContentsCellMask]; @@ -135,6 +138,7 @@ static NSButtonCell* knobCell = nil; [rightCell setAlternateImage:[NSImage imageNamed:@"common_ArrowRightH"]]; [rightCell setImagePosition:NSImageOnly]; [rightCell setContinuous:YES]; + [rightCell setPeriodicDelay:0.05 interval:0.05]; knobCell = [NSButtonCell new]; [knobCell setButtonType:NSMomentaryChangeButton]; @@ -399,8 +403,7 @@ static NSButtonCell* knobCell = nil; if (eventType != NSPeriodic) point = [self convertPoint:[theEvent locationInWindow] fromView:nil]; - else if (point.x != knobRect.origin.x - || point.y != knobRect.origin.y) { + else if (point.x != knobRect.origin.x || point.y != knobRect.origin.y) { float floatValue = [self _floatValueForMousePoint:point]; if (floatValue != oldFloatValue) {