diff options
Diffstat (limited to 'WebKit/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm')
-rw-r--r-- | WebKit/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/WebKit/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm b/WebKit/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm index e3fb362..a8ad861 100644 --- a/WebKit/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm +++ b/WebKit/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm @@ -46,16 +46,19 @@ static inline void initializeEvent(NPCocoaEvent* event, NPCocoaEventType type) event->version = 0; } -void WebNetscapePluginEventHandlerCocoa::drawRect(const NSRect& rect) +void WebNetscapePluginEventHandlerCocoa::drawRect(CGContextRef context, const NSRect& rect) { NPCocoaEvent event; initializeEvent(&event, NPCocoaEventDrawRect); + event.data.draw.context = context; event.data.draw.x = rect.origin.x; event.data.draw.y = rect.origin.y; event.data.draw.width = rect.size.width; event.data.draw.height = rect.size.height; + RetainPtr<CGContextRef> protect(context); + sendEvent(&event); } @@ -151,6 +154,23 @@ void WebNetscapePluginEventHandlerCocoa::flagsChanged(NSEvent *nsEvent) sendEvent(&event); } +void WebNetscapePluginEventHandlerCocoa::syntheticKeyDownWithCommandModifier(int keyCode, char character) +{ + char nullTerminatedString[] = { character, '\0' }; + + RetainPtr<NSString> characters(AdoptNS, [[NSString alloc] initWithUTF8String:nullTerminatedString]); + + NPCocoaEvent event; + initializeEvent(&event, NPCocoaEventKeyDown); + event.data.key.modifierFlags = NSCommandKeyMask; + event.data.key.keyCode = keyCode; + event.data.key.isARepeat = false; + event.data.key.characters = (NPNSString *)characters.get(); + event.data.key.charactersIgnoringModifiers = (NPNSString *)characters.get(); + + sendEvent(&event); +} + bool WebNetscapePluginEventHandlerCocoa::sendKeyEvent(NSEvent* nsEvent, NPCocoaEventType type) { NPCocoaEvent event; |