This commit is contained in:
av%netscape.com 1999-06-08 06:07:51 +00:00
Родитель 0ab30b5521
Коммит c9ea8157ef
6 изменённых файлов: 44 добавлений и 97 удалений

Просмотреть файл

@ -1520,9 +1520,10 @@ nsObjectFrame::HandleEvent(nsIPresContext& aPresContext,
case NS_KEY_UP: case NS_KEY_UP:
case NS_KEY_DOWN: case NS_KEY_DOWN:
//case set cursor must be here: //case set cursor must be here:
anEventStatus = mInstanceOwner->ProcessEvent(*anEvent);
return rv;
case NS_GOTFOCUS: case NS_GOTFOCUS:
case NS_LOSTFOCUS: case NS_LOSTFOCUS:
anEventStatus = mInstanceOwner->ProcessEvent(*anEvent);
return rv; return rv;
default: default:
break; break;
@ -2400,49 +2401,6 @@ static void GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord& aMacEvent)
} }
#endif #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 nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
{ {
nsEventStatus rv = nsEventStatus_eIgnore; nsEventStatus rv = nsEventStatus_eIgnore;
@ -2465,10 +2423,9 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
//~~~ //~~~
#ifdef XP_WIN #ifdef XP_WIN
nsPluginEvent pluginEvent; nsPluginEvent * pPluginEvent = (nsPluginEvent *)anEvent.nativeMsg;
GUItoWinEvent(anEvent, pluginEvent);
PRBool eventHandled = PR_FALSE; PRBool eventHandled = PR_FALSE;
mInstance->HandleEvent(&pluginEvent, &eventHandled); mInstance->HandleEvent(pPluginEvent, &eventHandled);
if (eventHandled) if (eventHandled)
rv = nsEventStatus_eConsumeNoDefault; rv = nsEventStatus_eConsumeNoDefault;
#endif #endif

Просмотреть файл

@ -1520,9 +1520,10 @@ nsObjectFrame::HandleEvent(nsIPresContext& aPresContext,
case NS_KEY_UP: case NS_KEY_UP:
case NS_KEY_DOWN: case NS_KEY_DOWN:
//case set cursor must be here: //case set cursor must be here:
anEventStatus = mInstanceOwner->ProcessEvent(*anEvent);
return rv;
case NS_GOTFOCUS: case NS_GOTFOCUS:
case NS_LOSTFOCUS: case NS_LOSTFOCUS:
anEventStatus = mInstanceOwner->ProcessEvent(*anEvent);
return rv; return rv;
default: default:
break; break;
@ -2400,49 +2401,6 @@ static void GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord& aMacEvent)
} }
#endif #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 nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
{ {
nsEventStatus rv = nsEventStatus_eIgnore; nsEventStatus rv = nsEventStatus_eIgnore;
@ -2465,10 +2423,9 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
//~~~ //~~~
#ifdef XP_WIN #ifdef XP_WIN
nsPluginEvent pluginEvent; nsPluginEvent * pPluginEvent = (nsPluginEvent *)anEvent.nativeMsg;
GUItoWinEvent(anEvent, pluginEvent);
PRBool eventHandled = PR_FALSE; PRBool eventHandled = PR_FALSE;
mInstance->HandleEvent(&pluginEvent, &eventHandled); mInstance->HandleEvent(pPluginEvent, &eventHandled);
if (eventHandled) if (eventHandled)
rv = nsEventStatus_eConsumeNoDefault; rv = nsEventStatus_eConsumeNoDefault;
#endif #endif

Просмотреть файл

@ -533,12 +533,22 @@ NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* hand
#if !TARGET_CARBON #if !TARGET_CARBON
// pinkerton // pinkerton
// relies on routine descriptors, not present in carbon. We need to fix this. // 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, res = CallNPP_HandleEventProc(fCallbacks->event,
&fNPP, &fNPP,
(void*) event->event); (void*) event->event);
#endif #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 #endif
*handled = res; *handled = res;

Просмотреть файл

@ -533,12 +533,22 @@ NS_IMETHODIMP ns4xPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* hand
#if !TARGET_CARBON #if !TARGET_CARBON
// pinkerton // pinkerton
// relies on routine descriptors, not present in carbon. We need to fix this. // 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, res = CallNPP_HandleEventProc(fCallbacks->event,
&fNPP, &fNPP,
(void*) event->event); (void*) event->event);
#endif #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 #endif
*handled = res; *handled = res;

Просмотреть файл

@ -365,7 +365,6 @@ PRBool nsWindow::ConvertStatus(nsEventStatus aStatus)
// Initialize an event to dispatch // Initialize an event to dispatch
// //
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint) void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint)
{ {
event.widget = this; event.widget = this;
@ -398,6 +397,8 @@ void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint
mLastPoint.x = event.point.x; mLastPoint.x = event.point.x;
mLastPoint.y = event.point.y; 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) 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 UINT vkKeyCached = 0; // caches VK code fon WM_KEYDOWN
static BOOL firstTime = TRUE; // for mouse wheel logic static BOOL firstTime = TRUE; // for mouse wheel logic
static int iDeltaPerLine, iAccumDelta ; // for mouse wheel logic static int iDeltaPerLine, iAccumDelta ; // for mouse wheel logic

Просмотреть файл

@ -34,6 +34,10 @@
#include "nsVoidArray.h" #include "nsVoidArray.h"
//~~~ for windowless plugin support
#include "nsplugindefs.h"
#ifdef NEW_DRAG_AND_DROP #ifdef NEW_DRAG_AND_DROP
class nsNativeDragTarget; class nsNativeDragTarget;
#endif #endif
@ -209,6 +213,9 @@ protected:
HPALETTE mPalette; HPALETTE mPalette;
WNDPROC mPrevWndProc; WNDPROC mPrevWndProc;
//~~~
nsPluginEvent mPluginEvent;
PRBool mHas3DBorder; PRBool mHas3DBorder;
HBRUSH mBrush; HBRUSH mBrush;
PRBool mIsShiftDown; PRBool mIsShiftDown;