From 181c72a76b81dd0465cdd6898c20fadf41124504 Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 17 Jan 2001 21:19:31 +0000 Subject: [PATCH] Fixed clicking with mouse on a column side and doing no dragging git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8668 72102866-910b-0410-8b05-ffd578937521 --- Source/NSTableHeaderView.m | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Source/NSTableHeaderView.m b/Source/NSTableHeaderView.m index c820629df..658d89e82 100644 --- a/Source/NSTableHeaderView.m +++ b/Source/NSTableHeaderView.m @@ -257,6 +257,9 @@ float p; /* YES if some highlighting was done and needs to be undone */ BOOL lit = NO; + /* YES if some dragging was actually done - to avoid + retiling/redrawing the table if no dragging is done */ + BOOL dragged = NO; NSEvent *e; NSDate *farAway = [NSDate distantFuture]; unsigned int eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask; @@ -310,8 +313,14 @@ inMode: NSEventTrackingRunLoopMode dequeue: YES]; + /* Safety assignment to make sure p is never left + unitialized - should make no difference with current code + but anyway */ + p = NSMaxX (rectLow); + while ([e type] != NSLeftMouseUp) { + dragged = YES; p = [self convertPoint: [e locationInWindow] fromView: nil].x; if (p < minCoord) { @@ -348,9 +357,12 @@ /* The following tiles the table. We use a private method which avoids tiling the table twice. */ - [_tableView _userResizedTableColumn: _resizedColumn - leftWidth: (p - NSMinX (rectLow)) - rightWidth: (NSMaxX (rectHigh) - p)]; + if (dragged == YES) + { + [_tableView _userResizedTableColumn: _resizedColumn + leftWidth: (p - NSMinX (rectLow)) + rightWidth: (NSMaxX (rectHigh) - p)]; + } /* Clean up */ _resizedColumn = -1;