Backed out changeset 955501353745

This commit is contained in:
Josh Aas 2010-05-05 15:58:41 -04:00
Родитель a8d685b98a
Коммит 99fd8ad2db
2 изменённых файлов: 51 добавлений и 71 удалений

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

@ -45,37 +45,34 @@
#include "nptypes.h" #include "nptypes.h"
#if defined (__OS2__) || defined (OS2) #if defined (__OS2__) || defined (OS2)
#ifndef XP_OS2 # ifndef XP_OS2
#define XP_OS2 1 # define XP_OS2 1
#endif # endif /* XP_OS2 */
#endif #endif /* __OS2__ */
#ifdef _WINDOWS #ifdef _WINDOWS
#include <windef.h> # include <windef.h>
#ifndef XP_WIN # ifndef XP_WIN
#define XP_WIN 1 # define XP_WIN 1
#endif # endif /* XP_WIN */
#endif #endif /* _WINDOWS */
#if defined(XP_MACOSX) && defined(__LP64__)
#define NP_NO_QUICKDRAW
#define NP_NO_CARBON
#endif
#ifdef XP_MACOSX #ifdef XP_MACOSX
#ifdef __LP64__
#define NP_NO_QUICKDRAW
#define NP_NO_CARBON
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#include <OpenGL/OpenGL.h> #else
#ifndef NP_NO_CARBON
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#endif #endif
#endif #endif
#if defined(XP_UNIX) #if defined(XP_UNIX)
#include <stdio.h> # include <stdio.h>
#if defined(MOZ_X11) # if defined(MOZ_X11)
#include <X11/Xlib.h> # include <X11/Xlib.h>
#include <X11/Xutil.h> # include <X11/Xutil.h>
#endif # endif
#endif #endif
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
@ -142,7 +139,7 @@ typedef char* NPMIMEType;
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
#if !defined(__LP64__) #if !defined(__LP64__)
#if defined(XP_MACOSX) #if defined(XP_MAC) || defined(XP_MACOSX)
#pragma options align=mac68k #pragma options align=mac68k
#endif #endif
#endif /* __LP64__ */ #endif /* __LP64__ */
@ -205,11 +202,6 @@ typedef struct _NPSize
int32_t height; int32_t height;
} NPSize; } NPSize;
/* Return values for NPP_HandleEvent */
const int16_t kNPEventNotHandled = 0;
const int16_t kNPEventHandled = 1;
const int16_t kNPEventStartIME = 2; /* Exact meaning must be spec'd in event model. */
#ifdef XP_UNIX #ifdef XP_UNIX
/* /*
* Unix specific structures and definitions * Unix specific structures and definitions
@ -255,7 +247,6 @@ typedef enum {
NPDrawingModelQuickDraw = 0, NPDrawingModelQuickDraw = 0,
#endif #endif
NPDrawingModelCoreGraphics = 1, NPDrawingModelCoreGraphics = 1,
NPDrawingModelOpenGL = 2,
NPDrawingModelCoreAnimation = 3 NPDrawingModelCoreAnimation = 3
} NPDrawingModel; } NPDrawingModel;
@ -308,23 +299,29 @@ typedef enum {
NPPVpluginDescriptionString, NPPVpluginDescriptionString,
NPPVpluginWindowBool, NPPVpluginWindowBool,
NPPVpluginTransparentBool, NPPVpluginTransparentBool,
NPPVjavaClass, NPPVjavaClass, /* Not implemented in Mozilla 1.0 */
NPPVpluginWindowSize, NPPVpluginWindowSize,
NPPVpluginTimerInterval, NPPVpluginTimerInterval,
NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
NPPVpluginScriptableIID = 11, NPPVpluginScriptableIID = 11,
/* Introduced in Mozilla 0.9.9 */
NPPVjavascriptPushCallerBool = 12, NPPVjavascriptPushCallerBool = 12,
/* Introduced in Mozilla 1.0 */
NPPVpluginKeepLibraryInMemory = 13, NPPVpluginKeepLibraryInMemory = 13,
NPPVpluginNeedsXEmbed = 14, NPPVpluginNeedsXEmbed = 14,
/* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14. /* Get the NPObject for scripting the plugin. Introduced in Firefox
* 1.0 (NPAPI minor version 14).
*/ */
NPPVpluginScriptableNPObject = 15, NPPVpluginScriptableNPObject = 15,
/* Get the plugin value (as \0-terminated UTF-8 string data) for /* Get the plugin value (as \0-terminated UTF-8 string data) for
* form submission if the plugin is part of a form. Use * form submission if the plugin is part of a form. Use
* NPN_MemAlloc() to allocate memory for the string data. Introduced * NPN_MemAlloc() to allocate memory for the string data. Introduced
* in NPAPI minor version 15. * in Mozilla 1.8b2 (NPAPI minor version 15).
*/ */
NPPVformValue = 16, NPPVformValue = 16,
@ -333,13 +330,7 @@ typedef enum {
/* Checks if the plugin is interested in receiving the http body of /* Checks if the plugin is interested in receiving the http body of
* all http requests (including failed ones, http status != 200). * all http requests (including failed ones, http status != 200).
*/ */
NPPVpluginWantsAllNetworkStreams = 18, NPPVpluginWantsAllNetworkStreams = 18
/* Browsers can retrieve a native ATK accessibility plug ID via this variable. */
NPPVpluginNativeAccessibleAtkPlugId = 19,
/* Checks to see if the plug-in would like the browser to load the "src" attribute. */
NPPVpluginCancelSrcStream = 20
#ifdef XP_MACOSX #ifdef XP_MACOSX
/* Used for negotiating drawing models */ /* Used for negotiating drawing models */
@ -356,7 +347,7 @@ typedef enum {
} NPPVariable; } NPPVariable;
/* /*
* List of variable names for which NPN_GetValue should be implemented. * List of variable names for which NPN_GetValue is implemented by Mozilla
*/ */
typedef enum { typedef enum {
NPNVxDisplay = 1, NPNVxDisplay = 1,
@ -366,8 +357,9 @@ typedef enum {
NPNVasdEnabledBool, NPNVasdEnabledBool,
NPNVisOfflineBool, NPNVisOfflineBool,
/* 10 and over are available on Mozilla builds starting with 0.9.4 */
NPNVserviceManager = (10 | NP_ABI_MASK), NPNVserviceManager = (10 | NP_ABI_MASK),
NPNVDOMElement = (11 | NP_ABI_MASK), NPNVDOMElement = (11 | NP_ABI_MASK), /* available in Mozilla 1.2 */
NPNVDOMWindow = (12 | NP_ABI_MASK), NPNVDOMWindow = (12 | NP_ABI_MASK),
NPNVToolkit = (13 | NP_ABI_MASK), NPNVToolkit = (13 | NP_ABI_MASK),
NPNVSupportsXEmbedBool = 14, NPNVSupportsXEmbedBool = 14,
@ -389,7 +381,6 @@ typedef enum {
, NPNVsupportsQuickDrawBool = 2000 , NPNVsupportsQuickDrawBool = 2000
#endif #endif
, NPNVsupportsCoreGraphicsBool = 2001 , NPNVsupportsCoreGraphicsBool = 2001
, NPNVsupportsOpenGLBool = 2002
, NPNVsupportsCoreAnimationBool = 2003 , NPNVsupportsCoreAnimationBool = 2003
#ifndef NP_NO_CARBON #ifndef NP_NO_CARBON
, NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */ , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
@ -554,21 +545,6 @@ typedef struct NP_CGContext
#endif #endif
} NP_CGContext; } NP_CGContext;
/*
* NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its
* drawing model.
*/
typedef struct NP_GLContext
{
CGLContextObj context;
#ifdef NP_NO_CARBON
NPNSWindow *window;
#else
void *window; // Can be either an NSWindow or a WindowRef depending on the event model
#endif
} NP_GLContext;
typedef enum { typedef enum {
NPCocoaEventDrawRect = 1, NPCocoaEventDrawRect = 1,
NPCocoaEventMouseDown, NPCocoaEventMouseDown,
@ -634,6 +610,11 @@ enum NPEventType {
NPEventType_ScrollingBeginsEvent = 1000, NPEventType_ScrollingBeginsEvent = 1000,
NPEventType_ScrollingEndsEvent NPEventType_ScrollingEndsEvent
}; };
#ifdef OBSOLETE
#define getFocusEvent (osEvt + 16)
#define loseFocusEvent (osEvt + 17)
#define adjustCursorEvent (osEvt + 18)
#endif /* OBSOLETE */
#endif /* NP_NO_CARBON */ #endif /* NP_NO_CARBON */
#endif /* XP_MACOSX */ #endif /* XP_MACOSX */
@ -655,7 +636,7 @@ enum NPEventType {
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) #define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
#if !defined(__LP64__) #if !defined(__LP64__)
#if defined(XP_MACOSX) #if defined(XP_MAC) || defined(XP_MACOSX)
#pragma options align=reset #pragma options align=reset
#endif #endif
#endif /* __LP64__ */ #endif /* __LP64__ */

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

@ -249,13 +249,13 @@ pluginHandleEvent(InstanceData* instanceData, void* event)
if (instanceData->eventModel == NPEventModelCarbon) { if (instanceData->eventModel == NPEventModelCarbon) {
EventRecord* carbonEvent = (EventRecord*)event; EventRecord* carbonEvent = (EventRecord*)event;
if (!carbonEvent) if (!carbonEvent)
return kNPEventNotHandled; return 1;
NPWindow* w = &instanceData->window; NPWindow* w = &instanceData->window;
switch (carbonEvent->what) { switch (carbonEvent->what) {
case updateEvt: case updateEvt:
pluginDraw(instanceData, NULL); pluginDraw(instanceData, NULL);
break; return 1;
case mouseDown: case mouseDown:
case mouseUp: case mouseUp:
case osEvt: case osEvt:
@ -266,45 +266,44 @@ pluginHandleEvent(InstanceData* instanceData, void* event)
::GetWindowBounds(nativeWindow, kWindowStructureRgn, &globalBounds); ::GetWindowBounds(nativeWindow, kWindowStructureRgn, &globalBounds);
instanceData->lastMouseX = carbonEvent->where.h - w->x - globalBounds.left; instanceData->lastMouseX = carbonEvent->where.h - w->x - globalBounds.left;
instanceData->lastMouseY = carbonEvent->where.v - w->y - globalBounds.top; instanceData->lastMouseY = carbonEvent->where.v - w->y - globalBounds.top;
break; return 1;
} }
default: default:
return kNPEventNotHandled; return 1;
} }
return 1;
return kNPEventHandled;
} }
#endif #endif
NPCocoaEvent* cocoaEvent = (NPCocoaEvent*)event; NPCocoaEvent* cocoaEvent = (NPCocoaEvent*)event;
if (!cocoaEvent) if (!cocoaEvent)
return kNPEventNotHandled; return 1;
switch (cocoaEvent->type) { switch (cocoaEvent->type) {
case NPCocoaEventDrawRect: case NPCocoaEventDrawRect:
pluginDraw(instanceData, cocoaEvent); pluginDraw(instanceData, cocoaEvent);
break; return 1;
case NPCocoaEventMouseDown: case NPCocoaEventMouseDown:
case NPCocoaEventMouseUp: case NPCocoaEventMouseUp:
case NPCocoaEventMouseMoved: case NPCocoaEventMouseMoved:
instanceData->lastMouseX = (int32_t)cocoaEvent->data.mouse.pluginX; instanceData->lastMouseX = (int32_t)cocoaEvent->data.mouse.pluginX;
instanceData->lastMouseY = (int32_t)cocoaEvent->data.mouse.pluginY; instanceData->lastMouseY = (int32_t)cocoaEvent->data.mouse.pluginY;
break; return 1;
case NPCocoaEventWindowFocusChanged: case NPCocoaEventWindowFocusChanged:
instanceData->topLevelWindowActivationState = cocoaEvent->data.focus.hasFocus ? instanceData->topLevelWindowActivationState = cocoaEvent->data.focus.hasFocus ?
ACTIVATION_STATE_ACTIVATED : ACTIVATION_STATE_DEACTIVATED; ACTIVATION_STATE_ACTIVATED : ACTIVATION_STATE_DEACTIVATED;
instanceData->topLevelWindowActivationEventCount = instanceData->topLevelWindowActivationEventCount + 1; instanceData->topLevelWindowActivationEventCount = instanceData->topLevelWindowActivationEventCount + 1;
break; return 1;
case NPCocoaEventFocusChanged: case NPCocoaEventFocusChanged:
instanceData->focusState = cocoaEvent->data.focus.hasFocus ? instanceData->focusState = cocoaEvent->data.focus.hasFocus ?
ACTIVATION_STATE_ACTIVATED : ACTIVATION_STATE_DEACTIVATED; ACTIVATION_STATE_ACTIVATED : ACTIVATION_STATE_DEACTIVATED;
instanceData->focusEventCount = instanceData->focusEventCount + 1; instanceData->focusEventCount = instanceData->focusEventCount + 1;
break; return 1;
default: default:
return kNPEventNotHandled; return 1;
} }
return kNPEventHandled; return 1;
} }
int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge) int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge)