From 3ab8468ab96e5a3bd1e5ebcd19472d01a43b260e Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Fri, 14 May 1999 18:49:42 +0000 Subject: [PATCH] Accept any kind of drag event, not just drops. --- widget/src/mac/nsMacEventHandler.cpp | 21 ++++++++++----------- widget/src/mac/nsMacEventHandler.h | 6 ++++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/widget/src/mac/nsMacEventHandler.cpp b/widget/src/mac/nsMacEventHandler.cpp index 0d25a23f952f..fe0698d87b75 100644 --- a/widget/src/mac/nsMacEventHandler.cpp +++ b/widget/src/mac/nsMacEventHandler.cpp @@ -188,22 +188,19 @@ PRBool nsMacEventHandler::HandleMenuCommand( } -//------------------------------------------------------------------------- // -// DropOccurred +// DragEvent // -//------------------------------------------------------------------------- - -// -// Someone on the outside told us that a drop from the DragManager has occurred in -// this window. We need to send this event into Gecko for processing. Create a Gecko -// event of type NS_DRAGDROP_DROP and pass it in. +// Someone on the outside told us that something related to a drag is happening. The +// exact event type is passed in as |aMessage|. We need to send this event into Gecko +// for processing. Create a Gecko event (using the appropriate message type) and pass +// it along. // // ¥¥¥THIS REALLY NEEDS TO BE CLEANED UP! TOO MUCH CODE COPIED FROM ConvertOSEventToMouseEvent // -PRBool nsMacEventHandler::DropOccurred ( Point aMouseGlobal, UInt16 aKeyModifiers ) +PRBool nsMacEventHandler::DragEvent ( unsigned int aMessage, Point aMouseGlobal, UInt16 aKeyModifiers ) { -printf("dispatching drop into Gecko\n"); +printf("dispatching event %ld into Gecko\n", aMessage); nsMouseEvent geckoEvent; // convert the mouse to local coordinates. We have to do all the funny port origin @@ -234,10 +231,12 @@ printf("dispatching drop into Gecko\n"); widgetHit->LocalToWindowCoordinate(widgetOrigin); widgetHitPoint.MoveBy(-widgetOrigin.x, -widgetOrigin.y); } + else + widgetHit = mTopLevelWidget; // nsEvent geckoEvent.eventStructType = NS_DRAGDROP_EVENT; - geckoEvent.message = NS_DRAGDROP_DROP; + geckoEvent.message = aMessage; geckoEvent.point = widgetHitPoint; geckoEvent.time = PR_IntervalNow(); diff --git a/widget/src/mac/nsMacEventHandler.h b/widget/src/mac/nsMacEventHandler.h index 968641a35a2d..5819ccc152b3 100644 --- a/widget/src/mac/nsMacEventHandler.h +++ b/widget/src/mac/nsMacEventHandler.h @@ -23,6 +23,8 @@ #include "nsDeleteObserver.h" #include "nsCOMPtr.h" #include "nsGUIEvent.h" +#include "prtypes.h" + class nsWindow; class nsMacWindow; @@ -36,8 +38,8 @@ public: virtual PRBool HandleOSEvent(EventRecord& aOSEvent); virtual PRBool HandleMenuCommand(EventRecord& aOSEvent, long aMenuResult); - // Tell Gecko that a drop has occurred - virtual PRBool DropOccurred ( Point aMouseGlobal, UInt16 aKeyModifiers ) ; + // Tell Gecko that a drag event has occurred and should go into Gecko + virtual PRBool DragEvent ( unsigned int aMessage, Point aMouseGlobal, UInt16 aKeyModifiers ) ; //virtual PRBool TrackDrag ( Point aMouseGlobal, UInt32 aKeyModifiers ) ; protected: