* 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.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34910 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2012-03-09 08:03:45 +00:00
parent 37db8ec30e
commit 88fdeb6886
3 changed files with 32 additions and 14 deletions

View file

@ -1,3 +1,13 @@
2012-03-09 Eric Wasylishen <ewasylishen@gmail.com>
* 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 <FredKiefer@gmx.de> 2012-03-08 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSObjectController.m: Complete encoding/decoding methods. * Source/NSObjectController.m: Complete encoding/decoding methods.

View file

@ -69,6 +69,7 @@ const int NSOutlineViewDropOnItemIndex = -1;
static int lastVerticalQuarterPosition; static int lastVerticalQuarterPosition;
static int lastHorizontalHalfPosition; static int lastHorizontalHalfPosition;
static NSDragOperation dragOperation;
static NSRect oldDraggingRect; static NSRect oldDraggingRect;
static id oldDropItem; static id oldDropItem;
@ -1087,6 +1088,7 @@ static NSImage *unexpandable = nil;
oldDropItem = currentDropItem = nil; oldDropItem = currentDropItem = nil;
oldDropIndex = currentDropIndex = -1; oldDropIndex = currentDropIndex = -1;
lastVerticalQuarterPosition = -1; lastVerticalQuarterPosition = -1;
dragOperation = NSDragOperationCopy;
oldDraggingRect = NSMakeRect(0.,0., 0., 0.); oldDraggingRect = NSMakeRect(0.,0., 0., 0.);
return NSDragOperationCopy; 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. * when the pointer is between two rows and the bottom row is a parent.
*/ */
NSInteger level; NSInteger level;
NSDragOperation dragOperation = [sender draggingSourceOperationMask];
ASSIGN(lastDragUpdate, [NSDate date]); ASSIGN(lastDragUpdate, [NSDate date]);
//NSLog(@"draggingUpdated"); //NSLog(@"draggingUpdated");
@ -1423,18 +1425,23 @@ Also returns the child index relative to this parent. */
[self setNeedsDisplayInRect: oldDraggingRect]; [self setNeedsDisplayInRect: oldDraggingRect];
[self displayIfNeeded]; [self displayIfNeeded];
if (currentDropIndex != NSOutlineViewDropOnItemIndex && currentDropItem != nil) if (dragOperation != NSDragOperationNone)
{ {
[self drawDropAboveIndicatorWithDropItem: currentDropItem atRow: row childDropIndex: currentDropIndex]; if (currentDropIndex != NSOutlineViewDropOnItemIndex && currentDropItem != nil)
} {
else if (currentDropIndex == NSOutlineViewDropOnItemIndex && currentDropItem == nil) [self drawDropAboveIndicatorWithDropItem: currentDropItem
{ atRow: row
[self drawDropOnRootIndicator]; childDropIndex: currentDropIndex];
} }
else else if (currentDropIndex == NSOutlineViewDropOnItemIndex && currentDropItem == nil)
{ {
[self drawDropOnIndicatorWithDropItem: currentDropItem]; [self drawDropOnRootIndicator];
} }
else
{
[self drawDropOnIndicatorWithDropItem: currentDropItem];
}
}
[_window flushWindow]; [_window flushWindow];
[self unlockFocus]; [self unlockFocus];

View file

@ -4210,7 +4210,8 @@ resetCursorRectsForView(NSView *theView)
case GSAppKitDraggingDrop: case GSAppKitDraggingDrop:
NSDebugLLog(@"NSDragging", @"GSAppKitDraggingDrop"); NSDebugLLog(@"NSDragging", @"GSAppKitDraggingDrop");
dragInfo = [GSServerForWindow(self) dragInfo]; dragInfo = [GSServerForWindow(self) dragInfo];
if (_lastDragView && _f.accepts_drag) if (_lastDragView && _f.accepts_drag
&& _lastDragOperationMask != NSDragOperationNone)
{ {
action = YES; action = YES;
GSPerformDragSelector(_lastDragView, GSPerformDragSelector(_lastDragView,