2008-12-12 Anders Carlsson <andersca@apple.com>
[WebKit-https.git] / WebKitExamplePlugins / NetscapeCocoaPlugin / main.m
index 4073f8adf9498eb1772b596d695fbd9ab02235d0..1f66ac147177ecb0d00129d8c898d167b8297b37 100644 (file)
@@ -127,7 +127,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
         return NPERR_INCOMPATIBLE_VERSION_ERROR;
     
     // If the browser supports the CoreGraphics drawing model, enable it.
-    browser->setvalue(instance, NPNVpluginDrawingModel, (void *)NPDrawingModelCoreGraphics);
+    browser->setvalue(instance, NPPVpluginDrawingModel, (void *)NPDrawingModelCoreGraphics);
 
     // If the browser supports the Cocoa event model, enable it.
     NPBool supportsCocoa;
@@ -137,9 +137,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
     if (!supportsCocoa)
         return NPERR_INCOMPATIBLE_VERSION_ERROR;
     
-    browser->setvalue(instance, NPNVpluginEventModel, (void *)NPEventModelCocoa);
+    browser->setvalue(instance, NPPVpluginEventModel, (void *)NPEventModelCocoa);
     
-   
     return NPERR_NO_ERROR;
 }
 
@@ -272,12 +271,12 @@ static void handleMouseEvent(PluginObject *obj, NPCocoaEvent *event)
                                                    "Click count: %d\n"
                                                    "Delta: (%g, %g, %g)",
                                                    eventType(event->type), 
-                                                   event->event.mouse.modifierFlags,
-                                                   event->event.mouse.pluginX,
-                                                   event->event.mouse.pluginY,
-                                                   event->event.mouse.buttonNumber,
-                                                   event->event.mouse.clickCount,
-                                                   event->event.mouse.deltaX, event->event.mouse.deltaY, event->event.mouse.deltaZ];
+                                                   event->data.mouse.modifierFlags,
+                                                   event->data.mouse.pluginX,
+                                                   event->data.mouse.pluginY,
+                                                   event->data.mouse.buttonNumber,
+                                                   event->data.mouse.clickCount,
+                                                   event->data.mouse.deltaX, event->data.mouse.deltaY, event->data.mouse.deltaZ];
     
     
     [obj->string release];
@@ -285,7 +284,7 @@ static void handleMouseEvent(PluginObject *obj, NPCocoaEvent *event)
  
     invalidatePlugin(obj);
     
-    if (event->event.mouse.buttonNumber == 1) {
+    if (event->data.mouse.buttonNumber == 1) {
         if (!obj->menuHandler)
             obj->menuHandler = [[MenuHandler alloc] initWithBrowserFuncs:browser instance:obj->npp];
         
@@ -303,11 +302,11 @@ static void handleKeyboardEvent(PluginObject *obj, NPCocoaEvent *event)
                         "Is a repeat: %@\n"
                         "Key code: %d",
                         eventType(event->type), 
-                        event->event.key.modifierFlags,
-                        event->event.key.characters,
-                        event->event.key.charactersIgnoringModifiers,
-                        event->event.key.isARepeat ? @"YES" : @"NO",
-                        event->event.key.keyCode];
+                        event->data.key.modifierFlags,
+                        event->data.key.characters,
+                        event->data.key.charactersIgnoringModifiers,
+                        event->data.key.isARepeat ? @"YES" : @"NO",
+                        event->data.key.keyCode];
     
     
     [obj->string release];
@@ -324,7 +323,7 @@ int16 NPP_HandleEvent(NPP instance, void* event)
     
     switch(cocoaEvent->type) {
         case NPCocoaEventFocusChanged:
-            obj->hasFocus = cocoaEvent->event.focus.hasFocus;
+            obj->hasFocus = cocoaEvent->data.focus.hasFocus;
             invalidatePlugin(obj);
             return 1;