From f4ae81a101247258313b20b35fa6090010fb92dc Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Sat, 18 Mar 2000 06:51:12 +0000 Subject: [PATCH] Reduce flicker by only highlighting when needed git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6318 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSSplitView.m | 26 ++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79aa94b38..343fd0b62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-03-18 Richard Frith-Macdonald + + * Source/NSSplitView.m: ([-mouseDown:]) only highlight/unhighlight + divider when actually necessary. + Fri Mar 17 23:33:40 2000 Nicola Pero First alpha implementation of NSTableView. Mouse interaction diff --git a/Source/NSSplitView.m b/Source/NSSplitView.m index 6c6a2cfe9..02290270d 100644 --- a/Source/NSSplitView.m +++ b/Source/NSSplitView.m @@ -68,6 +68,7 @@ { NSApplication *app = [NSApplication sharedApplication]; static NSRect oldRect; //only one can be dragged at a time + static BOOL lit = NO; NSPoint p; NSEvent *e; NSRect r, r1, bigRect, vis; @@ -245,18 +246,31 @@ r.origin.x = p.x - (divHorizontal/2.); r.origin.y = NSMinY(vis); } - NSDebugLog(@"drawing divider at x: %d, y: %d, w: %d, h: %d\n", - (int)NSMinX(r),(int)NSMinY(r),(int)NSWidth(r), - (int)NSHeight(r)); - [_dividerColor set]; - NSHighlightRect(r); - oldRect = r; + if (NSEqualRects(r, oldRect) == NO) + { + NSDebugLog(@"drawing divider at x: %d, y: %d, w: %d, h: %d\n", + (int)NSMinX(r), (int)NSMinY(r), (int)NSWidth(r), (int)NSHeight(r)); + [_dividerColor set]; + if (lit == YES) + { + NSHighlightRect(oldRect); + lit = NO; + } + NSHighlightRect(r); + lit = YES; + oldRect = r; + } e = [app nextEventMatchingMask: eventMask untilDate: farAway inMode: NSEventTrackingRunLoopMode dequeue: YES]; + } + + if (lit == YES) + { [_dividerColor set]; NSHighlightRect(oldRect); + lit = NO; } [self unlockFocus];