From 7548119a416545005a19e4c5dce675ccf817821f Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Thu, 25 Apr 2002 22:40:00 +0000 Subject: [PATCH] Can now drop items onto ChildView and they are correctly processed by gecko. Not part of build. --- widget/src/cocoa/Makefile.in | 4 ++++ widget/src/cocoa/nsChildView.mm | 28 ++++++++++++------------ widget/src/cocoa/nsDragHelperService.cpp | 1 - 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/widget/src/cocoa/Makefile.in b/widget/src/cocoa/Makefile.in index afd5a3c247d8..e021bcb3a8e8 100644 --- a/widget/src/cocoa/Makefile.in +++ b/widget/src/cocoa/Makefile.in @@ -50,6 +50,10 @@ REQUIRES = xpcom \ unicharutil \ $(NULL) +EXPORTS = \ + mozView.h \ + $(NULL) + GFX_LCPPSRCS = \ nsRegionMac.cpp \ nsWatchTask.cpp \ diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 8a45fd72767b..368cd1bf9d3b 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -1702,25 +1702,25 @@ NS_IMETHODIMP nsChildView::DragEvent(PRUint32 aMessage, PRInt16 aMouseGlobalX, PRInt16 aMouseGlobalY, PRUint16 aKeyModifiers, PRBool *_retval) { -printf("--------- dragEvent\n"); nsMouseEvent geckoEvent; geckoEvent.eventStructType = NS_DRAGDROP_EVENT; + + // we're given the point in global coordinates. We need to convert it to + // window coordinates for convert:message:toGeckoEvent NSPoint pt; pt.x = aMouseGlobalX; pt.y = aMouseGlobalY; + [[mView window] convertScreenToBase:pt]; [mView convert:pt message:aMessage modifiers:0 toGeckoEvent:&geckoEvent]; -printf("mouse location is %d %d\n", geckoEvent.point.x, geckoEvent.point.y); - DispatchMouseEvent(geckoEvent); - -#if 0 - nsMouseEvent geckoEvent; - geckoEvent.eventStructType = NS_MOUSE_EVENT; - [mView convert:theEvent message:aMessage toGeckoEvent:&geckoEvent]; - - *_retval = PR_FALSE; - Point globalPoint = {aMouseGlobalY, aMouseGlobalX}; // QD Point stored as v, h - if (mMacEventHandler.get()) - *_retval = mMacEventHandler->DragEvent(aMessage, globalPoint, aKeyModifiers); -#endif +// XXXPINK +// hack, because we're currently getting the point in Carbon global coordinates, +// but obviously the cocoa views don't know how to convert those (because they +// use an entirely different coordinate system). + geckoEvent.point.x = 50; geckoEvent.point.y = 50; +//printf("mouse location is %d %d\n", geckoEvent.point.x, geckoEvent.point.y); + DispatchWindowEvent(geckoEvent); + + // we handled the event + *_retval = PR_TRUE; return NS_OK; } diff --git a/widget/src/cocoa/nsDragHelperService.cpp b/widget/src/cocoa/nsDragHelperService.cpp index 0d7068cf845f..42546cd09c1b 100644 --- a/widget/src/cocoa/nsDragHelperService.cpp +++ b/widget/src/cocoa/nsDragHelperService.cpp @@ -142,7 +142,6 @@ nsDragHelperService::Tracking ( DragReference inDragRef, nsIEventSink *inSink, P // check if gecko has since allowed the drop and return it if ( session ) session->GetCanDrop(outDropAllowed); - return NS_OK; }