New Implemantion of [dragImage:...slideBack:]. Replaced call to

[NSGraphicContext _postExternalEvents:] with [NSDragInfo
postDragEvent:].
Replaced most [NSScreen mainScreen] with [self screen].


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11855 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2001-12-21 00:45:48 +00:00
parent 652569d814
commit 607e008095

View file

@ -67,6 +67,17 @@
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo); BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
@interface NSObject (DragInfoBackend)
- (void) dragImage: (NSImage*)anImage
at: (NSPoint)screenLocation
offset: (NSSize)initialOffset
event: (NSEvent*)event
pasteboard: (NSPasteboard*)pboard
source: (id)sourceObject
slideBack: (BOOL)slideFlag;
- (void) postDragEvent: (NSEvent*)event;
@end
/* /*
* Catagory for internal methods (for use only within the * Catagory for internal methods (for use only within the
* NSWindow class itsself) * NSWindow class itsself)
@ -1423,7 +1434,7 @@ static NSNotificationCenter *nc = nil;
- (void) center - (void) center
{ {
NSSize screenSize = [[NSScreen mainScreen] frame].size; NSSize screenSize = [[self screen] frame].size;
NSPoint origin = _frame.origin; NSPoint origin = _frame.origin;
origin.x = (screenSize.width - _frame.size.width) / 2; origin.x = (screenSize.width - _frame.size.width) / 2;
@ -2901,7 +2912,7 @@ resetCursorRectsForView(NSView *theView)
data2: action]; data2: action];
_lastDragOperationMask = action; _lastDragOperationMask = action;
[GSCurrentContext() _postExternalEvent: e]; [dragInfo postDragEvent: e];
_lastDragView = v; _lastDragView = v;
break; break;
@ -2922,10 +2933,9 @@ resetCursorRectsForView(NSView *theView)
break; break;
case GSAppKitDraggingDrop: case GSAppKitDraggingDrop:
dragInfo = [GSCurrentContext() _dragInfo];
if (_lastDragView && _f.accepts_drag) if (_lastDragView && _f.accepts_drag)
{ {
dragInfo = [GSCurrentContext() _dragInfo];
action = NO; action = NO;
GSPerformDragSelector(_lastDragView, GSPerformDragSelector(_lastDragView,
@selector(prepareForDragOperation:), @selector(prepareForDragOperation:),
@ -2955,7 +2965,7 @@ resetCursorRectsForView(NSView *theView)
subtype: GSAppKitDraggingFinished subtype: GSAppKitDraggingFinished
data1: [theEvent data1] data1: [theEvent data1]
data2: 0]; data2: 0];
[GSCurrentContext() _postExternalEvent: e]; [dragInfo postDragEvent: e];
break; break;
case GSAppKitDraggingFinished: case GSAppKitDraggingFinished:
@ -3106,13 +3116,16 @@ resetCursorRectsForView(NSView *theView)
source: (id)sourceObject source: (id)sourceObject
slideBack: (BOOL)slideFlag slideBack: (BOOL)slideFlag
{ {
[_wv dragImage: anImage id dragView = [GSCurrentContext() _dragInfo];
at: baseLocation
offset: initialOffset [NSApp preventWindowOrdering];
event: event [dragView dragImage: anImage
pasteboard: pboard at: [self convertBaseToScreen: baseLocation]
source: sourceObject offset: initialOffset
slideBack: slideFlag]; event: event
pasteboard: pboard
source: sourceObject
slideBack: slideFlag];
} }
- (void) registerForDraggedTypes: (NSArray*)newTypes - (void) registerForDraggedTypes: (NSArray*)newTypes
@ -3319,7 +3332,7 @@ resetCursorRectsForView(NSView *theView)
* the window could be placed (ie a rectangle excluding the dock), but * the window could be placed (ie a rectangle excluding the dock), but
* there is no API for that yet - so we just use the screen at present. * there is no API for that yet - so we just use the screen at present.
*/ */
nRect = [[NSScreen mainScreen] frame]; nRect = [[self screen] frame];
/* /*
* FIXME - if the stored screen area is not the same as that currently * FIXME - if the stored screen area is not the same as that currently
@ -3393,7 +3406,7 @@ resetCursorRectsForView(NSView *theView)
* the window could be placed (ie a rectangle excluding the dock), but * the window could be placed (ie a rectangle excluding the dock), but
* there is no API for that yet - so we just use the screen at present. * there is no API for that yet - so we just use the screen at present.
*/ */
sRect = [[NSScreen mainScreen] frame]; sRect = [[self screen] frame];
return [NSString stringWithFormat: @"%d %d %d %d %d %d % d %d ", return [NSString stringWithFormat: @"%d %d %d %d %d %d % d %d ",
(int)fRect.origin.x, (int)fRect.origin.y, (int)fRect.origin.x, (int)fRect.origin.y,