diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index 200d4ad920b..9e7f0f4092c 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -1520,9 +1520,10 @@ nsObjectFrame::HandleEvent(nsIPresContext& aPresContext, case NS_KEY_UP: case NS_KEY_DOWN: //case set cursor must be here: + anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); + return rv; case NS_GOTFOCUS: case NS_LOSTFOCUS: - anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); return rv; default: break; @@ -2400,49 +2401,6 @@ static void GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord& aMacEvent) } #endif -//~~~ -#ifdef XP_WIN -static void GUItoWinEvent(const nsGUIEvent& anEvent, nsPluginEvent& aWinEvent) -{ - switch (anEvent.message) - { - case NS_PAINT: - break; - case NS_MOUSE_LEFT_BUTTON_DOWN: - break; - case NS_MOUSE_LEFT_BUTTON_UP: - break; - case NS_MOUSE_LEFT_DOUBLECLICK: - break; - case NS_MOUSE_RIGHT_BUTTON_DOWN: - break; - case NS_MOUSE_RIGHT_BUTTON_UP: - break; - case NS_MOUSE_RIGHT_DOUBLECLICK: - break; - case NS_MOUSE_MIDDLE_BUTTON_DOWN: - break; - case NS_MOUSE_MIDDLE_BUTTON_UP: - break; - case NS_MOUSE_MIDDLE_DOUBLECLICK: - break; - case NS_MOUSE_MOVE: - break; - case NS_KEY_UP: - break; - case NS_KEY_DOWN: - break; - //case set cursor must be here: - case NS_GOTFOCUS: - break; - case NS_LOSTFOCUS: - break; - default: - break; - } -} -#endif // XP_WIN - nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent) { nsEventStatus rv = nsEventStatus_eIgnore; @@ -2465,10 +2423,9 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent) //~~~ #ifdef XP_WIN - nsPluginEvent pluginEvent; - GUItoWinEvent(anEvent, pluginEvent); + nsPluginEvent * pPluginEvent = (nsPluginEvent *)anEvent.nativeMsg; PRBool eventHandled = PR_FALSE; - mInstance->HandleEvent(&pluginEvent, &eventHandled); + mInstance->HandleEvent(pPluginEvent, &eventHandled); if (eventHandled) rv = nsEventStatus_eConsumeNoDefault; #endif diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index 200d4ad920b..9e7f0f4092c 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -1520,9 +1520,10 @@ nsObjectFrame::HandleEvent(nsIPresContext& aPresContext, case NS_KEY_UP: case NS_KEY_DOWN: //case set cursor must be here: + anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); + return rv; case NS_GOTFOCUS: case NS_LOSTFOCUS: - anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); return rv; default: break; @@ -2400,49 +2401,6 @@ static void GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord& aMacEvent) } #endif -//~~~ -#ifdef XP_WIN -static void GUItoWinEvent(const nsGUIEvent& anEvent, nsPluginEvent& aWinEvent) -{ - switch (anEvent.message) - { - case NS_PAINT: - break; - case NS_MOUSE_LEFT_BUTTON_DOWN: - break; - case NS_MOUSE_LEFT_BUTTON_UP: - break; - case NS_MOUSE_LEFT_DOUBLECLICK: - break; - case NS_MOUSE_RIGHT_BUTTON_DOWN: - break; - case NS_MOUSE_RIGHT_BUTTON_UP: - break; - case NS_MOUSE_RIGHT_DOUBLECLICK: - break; - case NS_MOUSE_MIDDLE_BUTTON_DOWN: - break; - case NS_MOUSE_MIDDLE_BUTTON_UP: - break; - case NS_MOUSE_MIDDLE_DOUBLECLICK: - break; - case NS_MOUSE_MOVE: - break; - case NS_KEY_UP: - break; - case NS_KEY_DOWN: - break; - //case set cursor must be here: - case NS_GOTFOCUS: - break; - case NS_LOSTFOCUS: - break; - default: - break; - } -} -#endif // XP_WIN - nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent) { nsEventStatus rv = nsEventStatus_eIgnore; @@ -2465,10 +2423,9 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent) //~~~ #ifdef XP_WIN - nsPluginEvent pluginEvent; - GUItoWinEvent(anEvent, pluginEvent); + nsPluginEvent * pPluginEvent = (nsPluginEvent *)anEvent.nativeMsg; PRBool eventHandled = PR_FALSE; - mInstance->HandleEvent(&pluginEvent, &eventHandled); + mInstance->HandleEvent(pPluginEvent, &eventHandled); if (eventHandled) rv = nsEventStatus_eConsumeNoDefault; #endif diff --git a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp index 7b69592d8f4..5720b0b0a4b 100644 --- a/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/base/src/ns4xPluginInstance.cpp @@ -533,12 +533,22 @@ NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* hand #if !TARGET_CARBON // pinkerton // relies on routine descriptors, not present in carbon. We need to fix this. -#if defined(XP_MAC) || defined(XP_WIN) //~~~ +#ifdef XP_MAC res = CallNPP_HandleEventProc(fCallbacks->event, &fNPP, (void*) event->event); #endif +#ifdef XP_WIN //~~~ + NPEvent npEvent; + npEvent.event = event->event; + npEvent.wParam = event->wParam; + npEvent.lParam = event->lParam; + res = CallNPP_HandleEventProc(fCallbacks->event, + &fNPP, + (void*)&npEvent); +#endif + #endif *handled = res; diff --git a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp index 7b69592d8f4..5720b0b0a4b 100644 --- a/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp +++ b/mozilla/modules/plugin/nglsrc/ns4xPluginInstance.cpp @@ -533,12 +533,22 @@ NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* hand #if !TARGET_CARBON // pinkerton // relies on routine descriptors, not present in carbon. We need to fix this. -#if defined(XP_MAC) || defined(XP_WIN) //~~~ +#ifdef XP_MAC res = CallNPP_HandleEventProc(fCallbacks->event, &fNPP, (void*) event->event); #endif +#ifdef XP_WIN //~~~ + NPEvent npEvent; + npEvent.event = event->event; + npEvent.wParam = event->wParam; + npEvent.lParam = event->lParam; + res = CallNPP_HandleEventProc(fCallbacks->event, + &fNPP, + (void*)&npEvent); +#endif + #endif *handled = res; diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index 8a10e2efe23..c61ade2caae 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -365,7 +365,6 @@ PRBool nsWindow::ConvertStatus(nsEventStatus aStatus) // Initialize an event to dispatch // //------------------------------------------------------------------------- - void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint) { event.widget = this; @@ -398,6 +397,8 @@ void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint mLastPoint.x = event.point.x; mLastPoint.y = event.point.y; + + event.nativeMsg = (void *)&mPluginEvent; } //------------------------------------------------------------------------- @@ -2143,6 +2144,11 @@ BOOL nsWindow::OnChar( UINT aVirtualKeyCode ) //------------------------------------------------------------------------- PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *aRetValue) { + //~~~ Cache this for event.nativeMsg initialization + mPluginEvent.event = msg; + mPluginEvent.wParam = wParam; + mPluginEvent.lParam = lParam; + static UINT vkKeyCached = 0; // caches VK code fon WM_KEYDOWN static BOOL firstTime = TRUE; // for mouse wheel logic static int iDeltaPerLine, iAccumDelta ; // for mouse wheel logic diff --git a/mozilla/widget/src/windows/nsWindow.h b/mozilla/widget/src/windows/nsWindow.h index d829ec178e1..7966d17f82f 100644 --- a/mozilla/widget/src/windows/nsWindow.h +++ b/mozilla/widget/src/windows/nsWindow.h @@ -34,6 +34,10 @@ #include "nsVoidArray.h" +//~~~ for windowless plugin support +#include "nsplugindefs.h" + + #ifdef NEW_DRAG_AND_DROP class nsNativeDragTarget; #endif @@ -208,6 +212,9 @@ protected: HWND mTooltip; HPALETTE mPalette; WNDPROC mPrevWndProc; + + //~~~ + nsPluginEvent mPluginEvent; PRBool mHas3DBorder; HBRUSH mBrush;