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
This commit is contained in:
Richard Frith-MacDonald 2000-03-18 06:51:12 +00:00
parent 5628505c5a
commit f4ae81a101
2 changed files with 25 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2000-03-18 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSSplitView.m: ([-mouseDown:]) only highlight/unhighlight
divider when actually necessary.
Fri Mar 17 23:33:40 2000 Nicola Pero <n.pero@mi.flashnet.it>
First alpha implementation of NSTableView. Mouse interaction

View file

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