Some bugfixing in DnD logic.CVS: ----------------------------------------------------------------------

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12143 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-01-20 21:08:58 +00:00
parent 4cce5e649a
commit dc04c6077a
2 changed files with 27 additions and 8 deletions

View file

@ -2,7 +2,8 @@
* Source/NSWindow.m: ([-sendEvent:]) use ASSIGN() and DESTROY() to * Source/NSWindow.m: ([-sendEvent:]) use ASSIGN() and DESTROY() to
update _lastDragView so we don't run into problems if something update _lastDragView so we don't run into problems if something
deallocates it. deallocates it. Added some debug logging. Fixed bug in logic of
drag entry/update. Restructured a little to improve readability.
Thu Jan 17 18:16:08 2002 Nicola Pero <n.pero@mi.flashnet.it> Thu Jan 17 18:16:08 2002 Nicola Pero <n.pero@mi.flashnet.it>

View file

@ -2895,29 +2895,44 @@ resetCursorRectsForView(NSView *theView)
case GSAppKitDraggingEnter: case GSAppKitDraggingEnter:
case GSAppKitDraggingUpdate: case GSAppKitDraggingUpdate:
{
BOOL isEntry;
v = [_contentView hitTest: [theEvent locationInWindow]]; v = [_contentView hitTest: [theEvent locationInWindow]];
if (v != nil) if (v == nil)
{ {
v = _contentView; v = _contentView;
} }
dragInfo = [GSCurrentContext() _dragInfo]; dragInfo = [GSCurrentContext() _dragInfo];
if (_lastDragView && _lastDragView != v && _f.accepts_drag) if (_lastDragView == v)
{ {
GSPerformVoidDragSelector(_lastDragView, isEntry = NO;
@selector(draggingExited:), dragInfo); }
else
{
isEntry = YES;
if (_lastDragView != nil && _f.accepts_drag)
{
NSDebugLLog(@"NSDragging", @"Dragging exit");
GSPerformVoidDragSelector(_lastDragView,
@selector(draggingExited:), dragInfo);
}
ASSIGN(_lastDragView, v);
_f.accepts_drag = GSViewAcceptsDrag(v, dragInfo);
} }
_f.accepts_drag = GSViewAcceptsDrag(v, dragInfo);
if (_f.accepts_drag) if (_f.accepts_drag)
{ {
if (_lastDragView != v) if (isEntry == YES)
{ {
action = NSDragOperationNone; action = NSDragOperationNone;
NSDebugLLog(@"NSDragging", @"Dragging entered");
GSPerformDragSelector(v, @selector(draggingEntered:), GSPerformDragSelector(v, @selector(draggingEntered:),
dragInfo, action); dragInfo, action);
} }
else else
{ {
action = _lastDragOperationMask; action = _lastDragOperationMask;
NSDebugLLog(@"NSDragging", @"Dragging updated");
GSPerformDragSelector(v, @selector(draggingUpdated:), GSPerformDragSelector(v, @selector(draggingUpdated:),
dragInfo, action); dragInfo, action);
} }
@ -2939,8 +2954,8 @@ resetCursorRectsForView(NSView *theView)
_lastDragOperationMask = action; _lastDragOperationMask = action;
[dragInfo postDragEvent: e]; [dragInfo postDragEvent: e];
ASSIGN(_lastDragView, v);
break; break;
}
case GSAppKitDraggingStatus: case GSAppKitDraggingStatus:
NSDebugLLog(@"NSDragging", NSDebugLLog(@"NSDragging",
@ -2948,9 +2963,11 @@ resetCursorRectsForView(NSView *theView)
break; break;
case GSAppKitDraggingExit: case GSAppKitDraggingExit:
NSDebugLLog(@"NSDragging", @"GSAppKitDraggingExit");
dragInfo = [GSCurrentContext() _dragInfo]; dragInfo = [GSCurrentContext() _dragInfo];
if (_lastDragView && _f.accepts_drag) if (_lastDragView && _f.accepts_drag)
{ {
NSDebugLLog(@"NSDragging", @"Dragging exit");
GSPerformVoidDragSelector(_lastDragView, GSPerformVoidDragSelector(_lastDragView,
@selector(draggingExited:), dragInfo); @selector(draggingExited:), dragInfo);
} }
@ -2959,6 +2976,7 @@ resetCursorRectsForView(NSView *theView)
break; break;
case GSAppKitDraggingDrop: case GSAppKitDraggingDrop:
NSDebugLLog(@"NSDragging", @"GSAppKitDraggingDrop");
dragInfo = [GSCurrentContext() _dragInfo]; dragInfo = [GSCurrentContext() _dragInfo];
if (_lastDragView && _f.accepts_drag) if (_lastDragView && _f.accepts_drag)
{ {