summaryrefslogtreecommitdiffstats
path: root/content/shell/tools
diff options
context:
space:
mode:
Diffstat (limited to 'content/shell/tools')
-rw-r--r--content/shell/tools/plugin/PluginObject.h1
-rw-r--r--content/shell/tools/plugin/main.cpp22
2 files changed, 17 insertions, 6 deletions
diff --git a/content/shell/tools/plugin/PluginObject.h b/content/shell/tools/plugin/PluginObject.h
index ff40a46..0c037e8 100644
--- a/content/shell/tools/plugin/PluginObject.h
+++ b/content/shell/tools/plugin/PluginObject.h
@@ -74,6 +74,7 @@ typedef struct {
void* coreAnimationLayer;
#endif
NPWindow lastWindow;
+ NPBool alwaysFilterEvents;
} PluginObject;
extern NPClass* createPluginClass(void);
diff --git a/content/shell/tools/plugin/main.cpp b/content/shell/tools/plugin/main.cpp
index 3236df6..0a4c3b8 100644
--- a/content/shell/tools/plugin/main.cpp
+++ b/content/shell/tools/plugin/main.cpp
@@ -199,6 +199,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
obj->eventModel = eventModel;
obj->coreAnimationLayer = 0;
#endif // XP_MACOSX
+ obj->alwaysFilterEvents = false;
string testIdentifier;
const char* onNewScript = 0;
@@ -292,6 +293,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
else
assert(false);
browser->setvalue(instance, NPPVpluginWindowBool, windowed);
+ } else if (!strcasecmp(argn[i], "alwaysFilterEvents")) {
+ obj->alwaysFilterEvents = true;
}
}
@@ -786,22 +789,29 @@ int16_t NPP_HandleEvent(NPP instance, void *event)
if (obj->pluginTest->NPP_HandleEvent(event) == 1)
return 1;
+ int16_t ret = 0;
#ifdef XP_MACOSX
#ifndef NP_NO_CARBON
if (obj->eventModel == NPEventModelCarbon)
- return handleEventCarbon(instance, obj, static_cast<EventRecord*>(event));
+ ret = handleEventCarbon(instance, obj, static_cast<EventRecord*>(event));
#endif
+ assert(obj->eventModel == NPEventModelCarbon ||
+ obj->eventModel == NPEventModelCocoa);
+ if (obj->eventModel == NPEventModelCocoa)
+ ret = handleEventCocoa(instance, obj, static_cast<NPCocoaEvent*>(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));
+ ret = handleEventX11(instance, obj, static_cast<XEvent*>(event));
#elif defined(XP_WIN)
- return handleEventWin(instance, obj, static_cast<NPEvent*>(event));
+ ret = handleEventWin(instance, obj, static_cast<NPEvent*>(event));
#else
// FIXME: Implement for other platforms.
- return 0;
+ return obj->alwaysFilterEvents;
#endif // XP_MACOSX
+
+ if (ret == 0 && obj->alwaysFilterEvents)
+ return 1;
+ return ret;
}
void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData)