Patches backported from trunk.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_stable_20070311@25587 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2007-11-17 16:05:47 +00:00
parent 99c6b7e28e
commit bad8642e29
18 changed files with 1207 additions and 874 deletions

View file

@ -208,6 +208,10 @@ static GSDragView *sharedDragView = nil;
return loc;
}
- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
{
return [[self draggingSource] namesOfPromisedFilesDroppedAtDestination: dropDestination];
}
- (BOOL) isDragging
{
@ -306,25 +310,25 @@ static GSDragView *sharedDragView = nil;
NSDragOperation action = [theEvent data2];
if (destExternal)
{
{
}
}
else
{
if (action != targetMask)
{
targetMask = action;
[self _setCursor];
}
}
if (action != targetMask)
{
targetMask = action;
[self _setCursor];
}
}
}
}
- (void) sendExternalEvent: (GSAppKitSubtype)subtype
action: (NSDragOperation)action
position: (NSPoint)eventLocation
timestamp: (NSTimeInterval)time
toWindow: (int)dWindowNumber
action: (NSDragOperation)action
position: (NSPoint)eventLocation
timestamp: (NSTimeInterval)time
toWindow: (int)dWindowNumber
{
}
@ -334,7 +338,7 @@ static GSDragView *sharedDragView = nil;
set, if there is a native window, but no GNUstep window at this location.
*/
- (NSWindow*) windowAcceptingDnDunder: (NSPoint)mouseLocation
windowRef: (int*)mouseWindowRef
windowRef: (int*)mouseWindowRef
{
int win;
@ -363,8 +367,8 @@ static GSDragView *sharedDragView = nil;
- all instance variables pertaining to moving the window are initialized
*/
- (void) _setupWindowFor: (NSImage*)anImage
mousePosition: (NSPoint)mPoint
imagePosition: (NSPoint)iPoint
mousePosition: (NSPoint)mPoint
imagePosition: (NSPoint)iPoint
{
NSSize imageSize;
@ -678,21 +682,21 @@ static GSDragView *sharedDragView = nil;
[cursorBeforeDrag set];
NSDebugLLog(@"NSDragging", @"sending dnd drop\n");
if (!destExternal)
{
[self _sendLocalEvent: GSAppKitDraggingDrop
action: 0
position: NSZeroPoint
timestamp: [theEvent timestamp]
toWindow: destWindow];
}
{
[self _sendLocalEvent: GSAppKitDraggingDrop
action: 0
position: NSZeroPoint
timestamp: [theEvent timestamp]
toWindow: destWindow];
}
else
{
[self sendExternalEvent: GSAppKitDraggingDrop
action: 0
position: NSZeroPoint
timestamp: [theEvent timestamp]
toWindow: targetWindowRef];
}
{
[self sendExternalEvent: GSAppKitDraggingDrop
action: 0
position: NSZeroPoint
timestamp: [theEvent timestamp]
toWindow: targetWindowRef];
}
deposited = YES;
}
else
@ -707,7 +711,21 @@ static GSDragView *sharedDragView = nil;
}
if ([dragSource respondsToSelector:
@selector(draggedImage:endedAt:deposited:)])
@selector(draggedImage:endedAt:operation:)])
{
NSPoint point;
point = [theEvent locationInWindow];
// Convert from mouse cursor coordinate to image coordinate
point.x -= offset.width;
point.y -= offset.height;
point = [[theEvent window] convertBaseToScreen: point];
[dragSource draggedImage: [self draggedImage]
endedAt: point
operation: targetMask & dragMask & operationMask];
}
else if ([dragSource respondsToSelector:
@selector(draggedImage:endedAt:deposited:)])
{
NSPoint point;
@ -717,8 +735,8 @@ static GSDragView *sharedDragView = nil;
point.y -= offset.height;
point = [[theEvent window] convertBaseToScreen: point];
[dragSource draggedImage: [self draggedImage]
endedAt: point
deposited: deposited];
endedAt: point
deposited: deposited];
}
}
@ -737,7 +755,7 @@ static GSDragView *sharedDragView = nil;
{
case GSAppKitWindowMoved:
case GSAppKitWindowResized:
case GSAppKitRegionExposed:
case GSAppKitRegionExposed:
/*
* Keep window up-to-date with its current position.
*/
@ -763,9 +781,9 @@ static GSDragView *sharedDragView = nil;
break;
case GSAppKitWindowFocusIn:
case GSAppKitWindowFocusOut:
case GSAppKitWindowLeave:
case GSAppKitWindowEnter:
case GSAppKitWindowFocusOut:
case GSAppKitWindowLeave:
case GSAppKitWindowEnter:
break;
default:
@ -780,29 +798,29 @@ static GSDragView *sharedDragView = nil;
case NSLeftMouseDown:
case NSLeftMouseUp:
newPosition = [[theEvent window] convertBaseToScreen:
[theEvent locationInWindow]];
[theEvent locationInWindow]];
break;
case NSFlagsChanged:
if ([self _updateOperationMask: theEvent])
{
// If flags change, send update to allow
// destination to take note.
if (destWindow)
// If flags change, send update to allow
// destination to take note.
if (destWindow)
{
[self _sendLocalEvent: GSAppKitDraggingUpdate
action: dragMask & operationMask
position: newPosition
timestamp: [theEvent timestamp]
toWindow: destWindow];
}
else
{
action: dragMask & operationMask
position: newPosition
timestamp: [theEvent timestamp]
toWindow: destWindow];
}
else
{
[self sendExternalEvent: GSAppKitDraggingUpdate
action: dragMask & operationMask
position: newPosition
timestamp: [theEvent timestamp]
toWindow: targetWindowRef];
}
action: dragMask & operationMask
position: newPosition
timestamp: [theEvent timestamp]
toWindow: targetWindowRef];
}
[self _setCursor];
}
break;
@ -836,7 +854,7 @@ static GSDragView *sharedDragView = nil;
destWindow = [self windowAcceptingDnDunder: dragPosition
windowRef: &mouseWindowRef];
// If we have are not hovering above a window that we own
// If we are not hovering above a window that we own
// we are dragging to an external application.
destExternal = (mouseWindowRef != 0) && (destWindow == nil);
@ -858,18 +876,18 @@ static GSDragView *sharedDragView = nil;
if (oldDestWindow != nil)
{
[self _sendLocalEvent: GSAppKitDraggingExit
action: dragMask & operationMask
position: NSZeroPoint
action: dragMask & operationMask
position: NSZeroPoint
timestamp: dragSequence
toWindow: oldDestWindow];
toWindow: oldDestWindow];
}
else
{
[self sendExternalEvent: GSAppKitDraggingExit
action: dragMask & operationMask
position: NSZeroPoint
timestamp: dragSequence
toWindow: targetWindowRef];
action: dragMask & operationMask
position: NSZeroPoint
timestamp: dragSequence
toWindow: targetWindowRef];
}
}
@ -891,21 +909,22 @@ static GSDragView *sharedDragView = nil;
// same window, sending update
NSDebugLLog(@"NSDragging", @"sending dnd pos\n");
// FIXME: We should only send this when the destination wantsPeriodicDraggingUpdates
if (destWindow != nil)
{
[self _sendLocalEvent: GSAppKitDraggingUpdate
action: dragMask & operationMask
position: dragPosition
timestamp: dragSequence
toWindow: destWindow];
action: dragMask & operationMask
position: dragPosition
timestamp: dragSequence
toWindow: destWindow];
}
else
{
[self sendExternalEvent: GSAppKitDraggingUpdate
action: dragMask & operationMask
position: dragPosition
timestamp: dragSequence
toWindow: targetWindowRef];
[self sendExternalEvent: GSAppKitDraggingUpdate
action: dragMask & operationMask
position: dragPosition
timestamp: dragSequence
toWindow: targetWindowRef];
}
}
else if (mouseWindowRef != 0)
@ -917,10 +936,10 @@ static GSDragView *sharedDragView = nil;
if (destWindow != nil)
{
[self _sendLocalEvent: GSAppKitDraggingEnter
action: dragMask
position: dragPosition
timestamp: dragSequence
toWindow: destWindow];
action: dragMask
position: dragPosition
timestamp: dragSequence
toWindow: destWindow];
}
else
{