From cd8647660227fb6ad86264df7cc4cb073640dc90 Mon Sep 17 00:00:00 2001 From: qmathe Date: Sat, 5 Dec 2009 23:22:39 +0000 Subject: [PATCH] Modified the drag code to call -canDragRowsWithIndexes:atPoint: as expected git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29100 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSTableView.m | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0043905fc..e2cd43107 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-05 Quentin Mathe + + * Source/NSTableView.m (-_startDragOperationWithEvent:): Modified to call + -canDragRowsWithIndexes:atPoint: as expected. + 2009-12-05 Quentin Mathe * Source/NSOutlineView.m (-draggingUpdated): Further simplified. diff --git a/Source/NSTableView.m b/Source/NSTableView.m index edbc8707f..bf681de5a 100644 --- a/Source/NSTableView.m +++ b/Source/NSTableView.m @@ -3440,11 +3440,12 @@ static inline float computePeriod(NSPoint mouseLocationWin, - (BOOL) _startDragOperationWithEvent: (NSEvent *) theEvent { - NSPasteboard *pboard; + NSPasteboard *pboard = [NSPasteboard pasteboardWithName: NSDragPboard]; + NSPoint startPoint = [self convertPoint: [theEvent locationInWindow] + fromView: nil]; - pboard = [NSPasteboard pasteboardWithName: NSDragPboard]; - if ([self _writeRows: _selectedRows - toPasteboard: pboard] == YES) + if ([self canDragRowsWithIndexes: _selectedRows atPoint: startPoint] + && [self _writeRows: _selectedRows toPasteboard: pboard]) { NSPoint p = NSZeroPoint; NSImage *dragImage; @@ -3468,12 +3469,12 @@ static inline float computePeriod(NSPoint mouseLocationWin, s.height = p.y + s.height/2; // View is flipped /* - * Find the current mouse location and adjust + * Reuse the current mouse location and adjust * it to determine the location of the bottom * left corner of the image in this view's * coordinate system. */ - p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; + p = startPoint; p.x += s.width; p.y += s.height;