Commit 6c5e19b1 authored by tony@chromium.org's avatar tony@chromium.org

2010-11-01 Tony Chang <tony@chromium.org>

        Reviewed by Kent Tamura.

        add plugin event logging for linux
        https://bugs.webkit.org/show_bug.cgi?id=48779

        This is taken from Chromium's fork of the layout test plugin:
        http://git.chromium.org/gitweb/?p=chromium.git/.git;a=blob;f=webkit/tools/npapi_layout_test_plugin/main.cpp;h=3ebdada2f049b3624756438cff852364f86a2ede;hb=HEAD#l348

        * DumpRenderTree/TestNetscapePlugIn/main.cpp:
        (handleEventX11):
        (NPP_HandleEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 03fd20e1
2010-11-01 Tony Chang <tony@chromium.org>
Reviewed by Kent Tamura.
add plugin event logging for linux
https://bugs.webkit.org/show_bug.cgi?id=48779
This is taken from Chromium's fork of the layout test plugin:
http://git.chromium.org/gitweb/?p=chromium.git/.git;a=blob;f=webkit/tools/npapi_layout_test_plugin/main.cpp;h=3ebdada2f049b3624756438cff852364f86a2ede;hb=HEAD#l348
* DumpRenderTree/TestNetscapePlugIn/main.cpp:
(handleEventX11):
(NPP_HandleEvent):
2010-11-01 Dirk Pranke <dpranke@chromium.org>
Reviewed by James Robinson.
......
......@@ -29,6 +29,10 @@
#include <cstdlib>
#include <string>
#ifdef XP_UNIX
#include <X11/Xlib.h>
#endif
#if !defined(NP_NO_CARBON) && defined(QD_HEADERS_ARE_PRIVATE) && QD_HEADERS_ARE_PRIVATE
extern "C" void GlobalToLocal(Point*);
#endif
......@@ -565,6 +569,54 @@ static int16_t handleEventCocoa(NPP instance, PluginObject* obj, NPCocoaEvent* e
#endif // XP_MACOSX
#ifdef XP_UNIX
static int16_t handleEventX11(NPP instance, PluginObject* obj, XEvent* event)
{
XButtonPressedEvent* buttonPressEvent = reinterpret_cast<XButtonPressedEvent*>(event);
XButtonReleasedEvent* buttonReleaseEvent = reinterpret_cast<XButtonReleasedEvent*>(event);
switch (event->type) {
case ButtonPress:
pluginLog(instance, "mouseDown at (%d, %d)", buttonPressEvent->x, buttonPressEvent->y);
if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEvaluateScript)
executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
break;
case ButtonRelease:
pluginLog(instance, "mouseUp at (%d, %d)", buttonReleaseEvent->x, buttonReleaseEvent->y);
break;
case KeyPress:
// FIXME: extract key code
pluginLog(instance, "NOTIMPLEMENTED: keyDown '%c'", ' ');
if (obj->evaluateScriptOnMouseDownOrKeyDown && !obj->mouseDownForEvaluateScript)
executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
break;
case KeyRelease:
// FIXME: extract key code
pluginLog(instance, "NOTIMPLEMENTED: keyUp '%c'", ' ');
break;
case GraphicsExpose:
pluginLog(instance, "updateEvt");
break;
// NPAPI events
case FocusIn:
pluginLog(instance, "getFocusEvent");
break;
case FocusOut:
pluginLog(instance, "loseFocusEvent");
break;
case EnterNotify:
case LeaveNotify:
case MotionNotify:
pluginLog(instance, "adjustCursorEvent");
break;
default:
pluginLog(instance, "event %d", event->type);
}
fflush(stdout);
return 0;
}
#endif // XP_UNIX
int16_t NPP_HandleEvent(NPP instance, void *event)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
......@@ -579,6 +631,8 @@ int16_t NPP_HandleEvent(NPP instance, void *event)
assert(obj->eventModel == NPEventModelCocoa);
return handleEventCocoa(instance, obj, static_cast<NPCocoaEvent*>(event));
#elif defined(XP_UNIX)
return handleEventX11(instance, obj, static_cast<XEvent*>(event));
#else
// FIXME: Implement for other platforms.
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment