Commit 263e4cde authored by andersca@apple.com's avatar andersca@apple.com

2009-04-27 Anders Carlsson <andersca@apple.com>

        Reviewed by Adam Roben.

        Update the example plug-in for new changes to the Cocoa event model.
        
        * NetscapeCocoaPlugin/main.m:
        (handleDraw):
        (handleMouseEvent):
        (NPP_HandleEvent):



git-svn-id: svn://svn.chromium.org/blink/trunk@42899 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 03387985
2009-04-27 Anders Carlsson <andersca@apple.com>
Reviewed by Adam Roben.
Update the example plug-in for new changes to the Cocoa event model.
* NetscapeCocoaPlugin/main.m:
(handleDraw):
(handleMouseEvent):
(NPP_HandleEvent):
2009-03-13 Anders Carlsson <andersca@apple.com> 2009-03-13 Anders Carlsson <andersca@apple.com>
Reviewed by Kevin Decker. Reviewed by Kevin Decker.
......
...@@ -194,14 +194,13 @@ void NPP_Print(NPP instance, NPPrint* platformPrint) ...@@ -194,14 +194,13 @@ void NPP_Print(NPP instance, NPPrint* platformPrint)
} }
static void handleDraw(PluginObject *obj) static void handleDraw(PluginObject *obj, NPCocoaEvent *event)
{ {
NSGraphicsContext *oldContext = [[NSGraphicsContext currentContext] retain]; NSGraphicsContext *oldContext = [[NSGraphicsContext currentContext] retain];
NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithGraphicsPort:((NP_CGContext *)obj->window.window)->context NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithGraphicsPort:event->data.draw.context
flipped:YES]; flipped:YES];
[NSGraphicsContext setCurrentContext:context]; [NSGraphicsContext setCurrentContext:context];
NSRect rect = NSMakeRect(0, 0, obj->window.width, obj->window.height); NSRect rect = NSMakeRect(0, 0, obj->window.width, obj->window.height);
...@@ -289,7 +288,6 @@ static void handleMouseEvent(PluginObject *obj, NPCocoaEvent *event) ...@@ -289,7 +288,6 @@ static void handleMouseEvent(PluginObject *obj, NPCocoaEvent *event)
obj->menuHandler = [[MenuHandler alloc] initWithBrowserFuncs:browser instance:obj->npp]; obj->menuHandler = [[MenuHandler alloc] initWithBrowserFuncs:browser instance:obj->npp];
browser->popupcontextmenu(obj->npp, (NPNSMenu *)[obj->menuHandler menu]); browser->popupcontextmenu(obj->npp, (NPNSMenu *)[obj->menuHandler menu]);
NSLog(@"foo");
} }
} }
...@@ -328,7 +326,7 @@ int16 NPP_HandleEvent(NPP instance, void* event) ...@@ -328,7 +326,7 @@ int16 NPP_HandleEvent(NPP instance, void* event)
return 1; return 1;
case NPCocoaEventDrawRect: case NPCocoaEventDrawRect:
handleDraw(obj); handleDraw(obj, cocoaEvent);
return 1; return 1;
case NPCocoaEventKeyDown: case NPCocoaEventKeyDown:
......
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