diff --git a/ChangeLog b/ChangeLog index 5eb61ca72..4108673ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-03-09 Eric Wasylishen + + * Source/NSWindow.m: Only invoke -prepareForDragOperation: if the + most recent -draggingEntered: or -draggingUpdated: call returned + something other than NSDragOperationNone. + * Source/NSOutlineView.m (-draggingUpdated:): Save the drag operation + value returned from the data source in a static variable. + Previously it was fetched once and then discarded, so all drags were + being mistakenly permitted. + 2012-03-08 Fred Kiefer * Source/NSObjectController.m: Complete encoding/decoding methods. diff --git a/Source/NSOutlineView.m b/Source/NSOutlineView.m index 476b2568f..47581a83a 100644 --- a/Source/NSOutlineView.m +++ b/Source/NSOutlineView.m @@ -69,6 +69,7 @@ const int NSOutlineViewDropOnItemIndex = -1; static int lastVerticalQuarterPosition; static int lastHorizontalHalfPosition; +static NSDragOperation dragOperation; static NSRect oldDraggingRect; static id oldDropItem; @@ -1087,6 +1088,7 @@ static NSImage *unexpandable = nil; oldDropItem = currentDropItem = nil; oldDropIndex = currentDropIndex = -1; lastVerticalQuarterPosition = -1; + dragOperation = NSDragOperationCopy; oldDraggingRect = NSMakeRect(0.,0., 0., 0.); return NSDragOperationCopy; } @@ -1283,7 +1285,7 @@ Also returns the child index relative to this parent. */ * when the pointer is between two rows and the bottom row is a parent. */ NSInteger level; - NSDragOperation dragOperation = [sender draggingSourceOperationMask]; + ASSIGN(lastDragUpdate, [NSDate date]); //NSLog(@"draggingUpdated"); @@ -1423,18 +1425,23 @@ Also returns the child index relative to this parent. */ [self setNeedsDisplayInRect: oldDraggingRect]; [self displayIfNeeded]; - if (currentDropIndex != NSOutlineViewDropOnItemIndex && currentDropItem != nil) - { - [self drawDropAboveIndicatorWithDropItem: currentDropItem atRow: row childDropIndex: currentDropIndex]; - } - else if (currentDropIndex == NSOutlineViewDropOnItemIndex && currentDropItem == nil) - { - [self drawDropOnRootIndicator]; - } - else - { - [self drawDropOnIndicatorWithDropItem: currentDropItem]; - } + if (dragOperation != NSDragOperationNone) + { + if (currentDropIndex != NSOutlineViewDropOnItemIndex && currentDropItem != nil) + { + [self drawDropAboveIndicatorWithDropItem: currentDropItem + atRow: row + childDropIndex: currentDropIndex]; + } + else if (currentDropIndex == NSOutlineViewDropOnItemIndex && currentDropItem == nil) + { + [self drawDropOnRootIndicator]; + } + else + { + [self drawDropOnIndicatorWithDropItem: currentDropItem]; + } + } [_window flushWindow]; [self unlockFocus]; diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 0e3ef67d0..2881799af 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -4210,7 +4210,8 @@ resetCursorRectsForView(NSView *theView) case GSAppKitDraggingDrop: NSDebugLLog(@"NSDragging", @"GSAppKitDraggingDrop"); dragInfo = [GSServerForWindow(self) dragInfo]; - if (_lastDragView && _f.accepts_drag) + if (_lastDragView && _f.accepts_drag + && _lastDragOperationMask != NSDragOperationNone) { action = YES; GSPerformDragSelector(_lastDragView,