From d93bedaa03ecfe270de35ac88ae95a20a67d1266 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Thu, 3 Aug 2000 22:06:10 +0000 Subject: [PATCH] Actually set the modifier keys before dispatching d&d event into gecko. r=bienvenu, bug#47195 --- widget/src/windows/nsNativeDragTarget.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/widget/src/windows/nsNativeDragTarget.cpp b/widget/src/windows/nsNativeDragTarget.cpp index c38a3f0bce1..088c31b014b 100644 --- a/widget/src/windows/nsNativeDragTarget.cpp +++ b/widget/src/windows/nsNativeDragTarget.cpp @@ -49,6 +49,9 @@ static NS_DEFINE_IID(kIDragServiceIID, NS_IDRAGSERVICE_IID); // This is cached for Leave notification static POINTL gDragLastPoint; + + + /* * class nsNativeDragTarget */ @@ -149,6 +152,16 @@ void nsNativeDragTarget::GetGeckoDragAction(DWORD grfKeyState, LPDWORD pdwEffect } } + +PRBool IsKeyDown ( char key ) ; + +inline +PRBool IsKeyDown ( char key ) +{ + return GetKeyState(key) & 0x80 ? PR_TRUE : PR_FALSE; +} + + //----------------------------------------------------- void nsNativeDragTarget::DispatchDragDropEvent(PRUint32 aEventType, POINTL aPT) @@ -159,7 +172,6 @@ void nsNativeDragTarget::DispatchDragDropEvent(PRUint32 aEventType, nsWindow * win = NS_STATIC_CAST(nsWindow *, mWindow); win->InitEvent(event, aEventType); - POINT cpos; cpos.x = aPT.x; @@ -174,6 +186,11 @@ void nsNativeDragTarget::DispatchDragDropEvent(PRUint32 aEventType, event.point.y = 0; } + event.isShift = IsKeyDown(NS_VK_SHIFT); + event.isControl = IsKeyDown(NS_VK_CONTROL); + event.isMeta = PR_FALSE; + event.isAlt = IsKeyDown(NS_VK_ALT); + mWindow->DispatchEvent(&event, status); }