[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:13:17 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit a35edae7a739a7fb89ddbfc3cd9b4f76b22245f1
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu May 16 06:23:54 2002 +0000

    	Another quick events cleanup pass.
    
    	* Plugins.subproj/IFPluginNullEventSender.m:
    	(-[IFPluginNullEventSender sendNullEvents]): Use [IFPluginView getCarbonEvent:].
    
    	* Plugins.subproj/IFPluginView.h: Make almost all methods private.
    	* Plugins.subproj/IFPluginView.mm:
    	(+[IFPluginView getCarbonEvent:]): New.
    	(-[IFPluginView getCarbonEvent:]): New, calls class method.
    	(-[IFPluginView modifiersForEvent:isMouseDown:]): Reversed sense of btnState.
    	This flag is set if the mouse is up, not if the mouse is down.
    	(-[IFPluginView getCarbonEvent:withEvent:isMouseDown:]): New.
    	(-[IFPluginView getCarbonEvent:withEvent:]): New.
    	(-[IFPluginView sendActivateEvent:]): Now takes parameter for activate vs.
    	deactivate and uses [getCarbonEvent:].
    	(-[IFPluginView sendUpdateEvent]): Uses [getCarbonEvent:].
    	(-[IFPluginView becomeFirstResponder]): Uses [getCarbonEvent:].
    	(-[IFPluginView resignFirstResponder]): Uses [getCarbonEvent:].
    	(-[IFPluginView mouseDown:]): Uses [getCarbonEvent:withEvent:isMouseDown:].
    	(-[IFPluginView mouseUp:]): Uses [getCarbonEvent:withEvent:isMouseDown:].
    	(-[IFPluginView mouseEntered:]): Uses [getCarbonEvent:withEvent:].
    	(-[IFPluginView mouseExited:]): Uses [getCarbonEvent:withEvent:].
    	(-[IFPluginView keyUp:]): Uses [getCarbonEvent:withEvent:].
    	(-[IFPluginView keyDown:]): Uses [getCarbonEvent:withEvent:].
    	(-[IFPluginView start]): Call [sendActivateEvent:YES].
    	(-[IFPluginView windowBecameKey:]): Call [sendActivateEvent:YES].
    	(-[IFPluginView windowResignedKey:]): Call [sendActivateEvent:NO].
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1161 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index f2b4de7..aeee6bf 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,33 @@
+2002-05-15  Darin Adler  <darin at apple.com>
+
+	Another quick events cleanup pass.
+
+	* Plugins.subproj/IFPluginNullEventSender.m:
+	(-[IFPluginNullEventSender sendNullEvents]): Use [IFPluginView getCarbonEvent:].
+
+	* Plugins.subproj/IFPluginView.h: Make almost all methods private.
+	* Plugins.subproj/IFPluginView.mm:
+	(+[IFPluginView getCarbonEvent:]): New.
+	(-[IFPluginView getCarbonEvent:]): New, calls class method.
+	(-[IFPluginView modifiersForEvent:isMouseDown:]): Reversed sense of btnState.
+	This flag is set if the mouse is up, not if the mouse is down.
+	(-[IFPluginView getCarbonEvent:withEvent:isMouseDown:]): New.
+	(-[IFPluginView getCarbonEvent:withEvent:]): New.
+	(-[IFPluginView sendActivateEvent:]): Now takes parameter for activate vs.
+	deactivate and uses [getCarbonEvent:].
+	(-[IFPluginView sendUpdateEvent]): Uses [getCarbonEvent:].
+	(-[IFPluginView becomeFirstResponder]): Uses [getCarbonEvent:].
+	(-[IFPluginView resignFirstResponder]): Uses [getCarbonEvent:].
+	(-[IFPluginView mouseDown:]): Uses [getCarbonEvent:withEvent:isMouseDown:].
+	(-[IFPluginView mouseUp:]): Uses [getCarbonEvent:withEvent:isMouseDown:].
+	(-[IFPluginView mouseEntered:]): Uses [getCarbonEvent:withEvent:].
+	(-[IFPluginView mouseExited:]): Uses [getCarbonEvent:withEvent:].
+	(-[IFPluginView keyUp:]): Uses [getCarbonEvent:withEvent:].
+	(-[IFPluginView keyDown:]): Uses [getCarbonEvent:withEvent:].
+	(-[IFPluginView start]): Call [sendActivateEvent:YES].
+	(-[IFPluginView windowBecameKey:]): Call [sendActivateEvent:YES].
+	(-[IFPluginView windowResignedKey:]): Call [sendActivateEvent:NO].
+
 2002-05-15  Richard J. Williamson  <rjw at apple.com>
 
     Fixed problem dealing w/ characters in range 0x7f - 0xa0.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index f2b4de7..aeee6bf 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,33 @@
+2002-05-15  Darin Adler  <darin at apple.com>
+
+	Another quick events cleanup pass.
+
+	* Plugins.subproj/IFPluginNullEventSender.m:
+	(-[IFPluginNullEventSender sendNullEvents]): Use [IFPluginView getCarbonEvent:].
+
+	* Plugins.subproj/IFPluginView.h: Make almost all methods private.
+	* Plugins.subproj/IFPluginView.mm:
+	(+[IFPluginView getCarbonEvent:]): New.
+	(-[IFPluginView getCarbonEvent:]): New, calls class method.
+	(-[IFPluginView modifiersForEvent:isMouseDown:]): Reversed sense of btnState.
+	This flag is set if the mouse is up, not if the mouse is down.
+	(-[IFPluginView getCarbonEvent:withEvent:isMouseDown:]): New.
+	(-[IFPluginView getCarbonEvent:withEvent:]): New.
+	(-[IFPluginView sendActivateEvent:]): Now takes parameter for activate vs.
+	deactivate and uses [getCarbonEvent:].
+	(-[IFPluginView sendUpdateEvent]): Uses [getCarbonEvent:].
+	(-[IFPluginView becomeFirstResponder]): Uses [getCarbonEvent:].
+	(-[IFPluginView resignFirstResponder]): Uses [getCarbonEvent:].
+	(-[IFPluginView mouseDown:]): Uses [getCarbonEvent:withEvent:isMouseDown:].
+	(-[IFPluginView mouseUp:]): Uses [getCarbonEvent:withEvent:isMouseDown:].
+	(-[IFPluginView mouseEntered:]): Uses [getCarbonEvent:withEvent:].
+	(-[IFPluginView mouseExited:]): Uses [getCarbonEvent:withEvent:].
+	(-[IFPluginView keyUp:]): Uses [getCarbonEvent:withEvent:].
+	(-[IFPluginView keyDown:]): Uses [getCarbonEvent:withEvent:].
+	(-[IFPluginView start]): Call [sendActivateEvent:YES].
+	(-[IFPluginView windowBecameKey:]): Call [sendActivateEvent:YES].
+	(-[IFPluginView windowResignedKey:]): Call [sendActivateEvent:NO].
+
 2002-05-15  Richard J. Williamson  <rjw at apple.com>
 
     Fixed problem dealing w/ characters in range 0x7f - 0xa0.
diff --git a/WebKit/Plugins.subproj/IFPluginNullEventSender.m b/WebKit/Plugins.subproj/IFPluginNullEventSender.m
index 103ef89..e05d9b6 100644
--- a/WebKit/Plugins.subproj/IFPluginNullEventSender.m
+++ b/WebKit/Plugins.subproj/IFPluginNullEventSender.m
@@ -6,6 +6,7 @@
 #import "IFPluginNullEventSender.h"
 #import <Carbon/Carbon.h>
 #import <WebKitDebug.h>
+#import <WebKit/IFPluginView.h>
 
 @implementation IFPluginNullEventSender
 
@@ -19,20 +20,15 @@
 
 -(void)sendNullEvents
 {
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
+    if (!shouldStop) {
+        EventRecord event;
+        bool acceptedEvent;
     
-    GetGlobalMouse(&point);
-    
-    if(!shouldStop){
-        event.what = nullEvent;
-        event.message = 0;
-        event.when = TickCount();
-        event.where = point;
-        event.modifiers = GetCurrentKeyModifiers();
+        [IFPluginView getCarbonEvent:&event];
         acceptedEvent = NPP_HandleEvent(instance, &event);
+        
         //WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(nullEvent): %d  when: %u %d\n", acceptedEvent, (unsigned)event.when, shouldStop);
+        
         [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.01];
     }
 }
diff --git a/WebKit/Plugins.subproj/IFPluginView.h b/WebKit/Plugins.subproj/IFPluginView.h
index c080d44..f4b205a 100644
--- a/WebKit/Plugins.subproj/IFPluginView.h
+++ b/WebKit/Plugins.subproj/IFPluginView.h
@@ -50,43 +50,7 @@
 
 - initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSString *)location mime:(NSString *)mime arguments:(NSDictionary *)arguments mode:(uint16)mode;
 -(void)stop;
--(void)start;
 
--(void)drawRect:(NSRect)rect;
--(void)setWindow;
--(void)viewHasMoved:(NSNotification *)notification;
--(void)windowWillClose:(NSNotification *)notification;
--(void)newStream:(NSURL *)streamURL mimeType:(NSString *)mimeType notifyData:(void *)notifyData;
--(NSView *) findSuperview:(NSString *)viewName;
-
-// Events
--(BOOL)acceptsFirstResponder;
--(BOOL)becomeFirstResponder;
--(BOOL)resignFirstResponder;
--(void)sendActivateEvent;
--(void)sendUpdateEvent;
--(void)mouseDown:(NSEvent *)theEvent;
--(void)mouseUp:(NSEvent *)theEvent;
--(void)mouseEntered:(NSEvent *)theEvent;
--(void)mouseExited:(NSEvent *)theEvent;
--(void)keyDown:(NSEvent *)theEvent;
--(void)keyUp:(NSEvent *)theEvent;
-
-// plug-in to browser calls
--(NPError)getURLNotify:(const char *)url target:(const char *)target notifyData:(void *)notifyData;
--(NPError)getURL:(const char *)url target:(const char *)target;
--(NPError)postURLNotify:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file notifyData:(void *)notifyData;
--(NPError)postURL:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file;
--(NPError)newStream:(NPMIMEType)type target:(const char *)target stream:(NPStream**)stream;
--(NPError)write:(NPStream*)stream len:(SInt32)len buffer:(void *)buffer;
--(NPError)destroyStream:(NPStream*)stream reason:(NPReason)reason;
--(void)status:(const char *)message;
--(NPError)getValue:(NPNVariable)variable value:(void *)value;
--(NPError)setValue:(NPPVariable)variable value:(void *)value;
--(void)invalidateRect:(NPRect *)invalidRect;
--(void)invalidateRegion:(NPRegion)invalidateRegion;
--(void)forceRedraw;
++(void)getCarbonEvent:(EventRecord *)carbonEvent;
 
 @end
-
-NSString* startupVolumeName(void);
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index 0528986..cc4cd41 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -28,8 +28,225 @@
 #import <IFPluginNullEventSender.h>
 #import "IFNullPluginView.h"
 
+static NSString* startupVolumeName(void);
+
 @implementation IFPluginView
 
+#pragma mark EVENTS
+
++ (void)getCarbonEvent:(EventRecord *)carbonEvent
+{
+    carbonEvent->what = nullEvent;
+    carbonEvent->message = 0;
+    carbonEvent->when = TickCount();
+    GetGlobalMouse(&carbonEvent->where);
+    carbonEvent->modifiers = GetCurrentKeyModifiers();
+    if (!Button())
+        carbonEvent->modifiers |= btnState;
+}
+
+- (void)getCarbonEvent:(EventRecord *)carbonEvent
+{
+    [[self class] getCarbonEvent:carbonEvent];
+}
+
+- (EventModifiers)modifiersForEvent:(NSEvent *)event isMouseDown:(BOOL)isMouseDown
+{
+    EventModifiers modifiers;
+    unsigned int modifierFlags = [event modifierFlags];
+    
+    modifiers = 0;
+    
+    if (!isMouseDown)
+        modifiers |= btnState;
+    
+    if (modifierFlags & NSCommandKeyMask)
+        modifiers |= cmdKey;
+    
+    if (modifierFlags & NSShiftKeyMask)
+        modifiers |= shiftKey;
+
+    if (modifierFlags & NSAlphaShiftKeyMask)
+        modifiers |= alphaLock;
+
+    if (modifierFlags & NSAlternateKeyMask)
+        modifiers |= optionKey;
+
+    if (modifierFlags & NSControlKeyMask)
+        modifiers |= controlKey;
+
+    return modifiers;
+}
+
+- (void)getCarbonEvent:(EventRecord *)carbonEvent withEvent:(NSEvent *)cocoaEvent isMouseDown:(BOOL)isMouseDown
+{
+    NSPoint where;
+    
+    where = [[cocoaEvent window] convertBaseToScreen:[cocoaEvent locationInWindow]];
+    
+    carbonEvent->what = nullEvent;
+    carbonEvent->message = 0;
+    carbonEvent->when = (UInt32)([cocoaEvent timestamp] * 60); // seconds to ticks
+    carbonEvent->where.h = (short)where.x;
+    carbonEvent->where.v = (short)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - where.y);
+    carbonEvent->modifiers = [self modifiersForEvent:cocoaEvent isMouseDown:isMouseDown];    
+}
+
+- (void)getCarbonEvent:(EventRecord *)carbonEvent withEvent:(NSEvent *)cocoaEvent
+{
+    [self getCarbonEvent:carbonEvent withEvent:cocoaEvent isMouseDown:Button()];
+}
+
+-(void)sendActivateEvent:(BOOL)activate
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event];
+    event.what = activateEvt;
+    event.message = (UInt32)[[self window] _windowRef];
+    if (activate)
+        event.modifiers |= activMask;
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event); 
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(activateEvent): %d  isActive: %d\n", acceptedEvent, (event.modifiers & activeFlag));
+}
+
+- (void)sendUpdateEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event];
+    event.what = updateEvt;
+    event.message = (UInt32)[[self window] _windowRef];
+
+    acceptedEvent = NPP_HandleEvent(instance, &event); 
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(updateEvt): %d  when: %lu\n", acceptedEvent, event.when);
+}
+
+-(BOOL)acceptsFirstResponder
+{
+    return YES;
+}
+
+- (BOOL)becomeFirstResponder
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event];
+    event.what = getFocusEvent;
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event); 
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(getFocusEvent): %d  when: %lu\n", acceptedEvent, event.when);
+    return YES;
+}
+
+- (BOOL)resignFirstResponder
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event];
+    event.what = loseFocusEvent;
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(loseFocusEvent): %d  when: %lu\n", acceptedEvent, event.when);
+    return YES;
+}
+
+
+-(void)mouseDown:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event withEvent:theEvent isMouseDown:YES];
+    event.what = mouseDown;
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseDown): %d pt.v=%d, pt.h=%d ticks=%lu\n", acceptedEvent, event.where.v, event.where.h, event.when);
+}
+
+-(void)mouseUp:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    Point point;
+    
+    [self getCarbonEvent:&event withEvent:theEvent isMouseDown:NO];
+    event.what = mouseUp;
+
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseUp): %d pt.v=%d, pt.h=%d ticks=%lu\n", acceptedEvent, point.v, point.h, event.when);
+}
+
+- (void)mouseEntered:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event withEvent:theEvent];
+    event.what = adjustCursorEvent;
+
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseEntered): %d\n", acceptedEvent);
+}
+
+- (void)mouseExited:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event withEvent:theEvent];
+    event.what = adjustCursorEvent;
+
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseExited): %d\n", acceptedEvent);
+}
+
+- (void)keyUp:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+        
+    [self getCarbonEvent:&event withEvent:theEvent];
+    event.what = keyUp;
+    // FIXME: Unicode characters vs. Macintosh ASCII character codes?
+    // FIXME: Multiple characters?
+    // FIXME: Key codes?
+    event.message = [[theEvent characters] characterAtIndex:0];
+
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyUp): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
+}
+
+- (void)keyDown:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event withEvent:theEvent];
+    event.what = keyDown;
+    // FIXME: Unicode characters vs. Macintosh ASCII character codes?
+    // FIXME: Multiple characters?
+    // FIXME: Key codes?
+    event.message = [[theEvent characters] characterAtIndex:0];
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyDown): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
+}
+
 #pragma mark IFPLUGINVIEW
 
 // Could do this as a category on NSString if we wanted.
@@ -221,6 +438,20 @@ static char *newCString(NSString *string)
     }
 }
 
+- (NSView *) findSuperview:(NSString *)viewName
+{
+    NSView *view;
+    
+    view = self;
+    while(view){
+        view = [view superview];
+        if([[view className] isEqualToString:viewName]){
+            return view;
+        }
+    }
+    return nil;
+}
+
 -(void)start
 {
     NPSavedData saved;
@@ -250,7 +481,8 @@ static char *newCString(NSString *string)
     [notificationCenter addObserver:self selector:@selector(windowResignedKey:) name:@"NSWindowDidResignKeyNotification" object:theWindow];
     [notificationCenter addObserver:self selector:@selector(defaultsHaveChanged:) name:@"NSUserDefaultsDidChangeNotification" object:nil];
     
-    [self sendActivateEvent];
+    if ([theWindow isKeyWindow])
+        [self sendActivateEvent:YES];
     if(URL)
         [self newStream:[NSURL URLWithString:URL] mimeType:mime notifyData:NULL];
     eventSender = [[IFPluginNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
@@ -280,20 +512,6 @@ static char *newCString(NSString *string)
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_Destroy: %d\n", npErr);
 }
 
-- (NSView *) findSuperview:(NSString *)viewName
-{
-    NSView *view;
-    
-    view = self;
-    while(view){
-        view = [view superview];
-        if([[view className] isEqualToString:viewName]){
-            return view;
-        }
-    }
-    return nil;
-}
-
 #pragma mark NSVIEW
 
 - (void)drawRect:(NSRect)rect
@@ -309,229 +527,6 @@ static char *newCString(NSString *string)
     return YES;
 }
 
-#pragma mark EVENTS
-
-- (UInt32)currentModifiers
-{
-    UInt32 modifiers = GetCurrentKeyModifiers();
-    
-    if([[self window] isKeyWindow])
-        modifiers |= activeFlag;
-        
-    //FIXME: Need to also set btnStateBit on modifiers
-    
-    return modifiers;
-}
-
-- (UInt32)modifiersForEvent:(NSEvent *)theEvent isMouseDown:(BOOL)isMouseDown
-{
-    UInt32 modifiers;
-    unsigned int modifierFlags = [theEvent modifierFlags];
-    
-    modifiers = 0;
-    
-    if([[self window] isKeyWindow])
-        modifiers |= activeFlag;
-    
-    if(isMouseDown)
-        modifiers |= btnState;
-    
-    if(modifierFlags & NSCommandKeyMask)
-        modifiers |= cmdKey;
-    
-    if(modifierFlags & NSShiftKeyMask)
-        modifiers |= shiftKey;
-
-    if(modifierFlags & NSAlphaShiftKeyMask)
-        modifiers |= alphaLock;
-
-    if(modifierFlags & NSAlternateKeyMask)
-        modifiers |= optionKey;
-
-    if(modifierFlags & NSControlKeyMask)
-        modifiers |= controlKey;
-
-    return modifiers;
-}
-
--(void)sendActivateEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = activateEvt;
-    event.message = (UInt32)[[self window] _windowRef];
-    event.when = TickCount();
-    event.where = point;
-    event.modifiers = [self currentModifiers];
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(activateEvent): %d  isActive: %d\n", acceptedEvent, (event.modifiers & activeFlag));
-}
-
-- (void)sendUpdateEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = updateEvt;
-    event.message = (UInt32)[[self window] _windowRef];
-    event.when = TickCount();
-    event.where = point;
-    event.modifiers = [self currentModifiers];
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(updateEvt): %d  when: %lu\n", acceptedEvent, event.when);
-}
-
--(BOOL)acceptsFirstResponder
-{
-    return YES;
-}
-
-- (BOOL)becomeFirstResponder
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = getFocusEvent;
-    event.message = 0;
-    event.when = TickCount();
-    event.where = point;
-    event.modifiers = [self currentModifiers];
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(getFocusEvent): %d  when: %lu\n", acceptedEvent, event.when);
-    return YES;
-}
-
-- (BOOL)resignFirstResponder
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = loseFocusEvent;
-    event.message = 0;
-    event.when = TickCount();
-    event.where = point;
-    event.modifiers = [self currentModifiers];
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(loseFocusEvent): %d  when: %lu\n", acceptedEvent, event.when);
-    return YES;
-}
-
-
--(void)mouseDown:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = mouseDown;
-    event.message = 0;
-    event.when = (uint32)([theEvent timestamp] * 60); // seconds to ticks
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:YES];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseDown): %d pt.v=%d, pt.h=%d ticks=%lu\n", acceptedEvent, point.v, point.h, event.when);
-}
-
--(void)mouseUp:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = mouseUp;
-    event.message = 0;
-    event.when = (uint32)([theEvent timestamp] * 60); 
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseUp): %d pt.v=%d, pt.h=%d ticks=%lu\n", acceptedEvent, point.v, point.h, event.when);
-}
-
-- (void)mouseEntered:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = adjustCursorEvent;
-    event.message = 0;
-    event.when = (uint32)([theEvent timestamp] * 60);
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseEntered): %d\n", acceptedEvent);
-}
-
-- (void)mouseExited:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = adjustCursorEvent;
-    event.message = 0;
-    event.when = (uint32)([theEvent timestamp] * 60);
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseExited): %d\n", acceptedEvent);
-}
-
-- (void)keyUp:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-        
-    event.what = keyUp;
-    event.message = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
-    event.when = (uint32)([theEvent timestamp] * 60);
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyUp): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
-}
-
-- (void)keyDown:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-        
-    event.what = keyDown;
-    event.message = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
-    event.when = (uint32)([theEvent timestamp] * 60);
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyDown): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
-}
-
 #pragma mark NOTIFICATIONS
 
 -(void) viewHasMoved:(NSNotification *)notification
@@ -542,12 +537,12 @@ static char *newCString(NSString *string)
 
 -(void) windowBecameKey:(NSNotification *)notification
 {
-    [self sendActivateEvent];
+    [self sendActivateEvent:YES];
 }
 
 -(void) windowResignedKey:(NSNotification *)notification
 {
-    [self sendActivateEvent];
+    [self sendActivateEvent:NO];
 }
 
 - (void) windowWillClose:(NSNotification *)notification
diff --git a/WebKit/Plugins.subproj/WebPluginNullEventSender.m b/WebKit/Plugins.subproj/WebPluginNullEventSender.m
index 103ef89..e05d9b6 100644
--- a/WebKit/Plugins.subproj/WebPluginNullEventSender.m
+++ b/WebKit/Plugins.subproj/WebPluginNullEventSender.m
@@ -6,6 +6,7 @@
 #import "IFPluginNullEventSender.h"
 #import <Carbon/Carbon.h>
 #import <WebKitDebug.h>
+#import <WebKit/IFPluginView.h>
 
 @implementation IFPluginNullEventSender
 
@@ -19,20 +20,15 @@
 
 -(void)sendNullEvents
 {
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
+    if (!shouldStop) {
+        EventRecord event;
+        bool acceptedEvent;
     
-    GetGlobalMouse(&point);
-    
-    if(!shouldStop){
-        event.what = nullEvent;
-        event.message = 0;
-        event.when = TickCount();
-        event.where = point;
-        event.modifiers = GetCurrentKeyModifiers();
+        [IFPluginView getCarbonEvent:&event];
         acceptedEvent = NPP_HandleEvent(instance, &event);
+        
         //WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(nullEvent): %d  when: %u %d\n", acceptedEvent, (unsigned)event.when, shouldStop);
+        
         [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.01];
     }
 }
diff --git a/WebKit/Plugins.subproj/WebPluginView.h b/WebKit/Plugins.subproj/WebPluginView.h
index c080d44..f4b205a 100644
--- a/WebKit/Plugins.subproj/WebPluginView.h
+++ b/WebKit/Plugins.subproj/WebPluginView.h
@@ -50,43 +50,7 @@
 
 - initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSString *)location mime:(NSString *)mime arguments:(NSDictionary *)arguments mode:(uint16)mode;
 -(void)stop;
--(void)start;
 
--(void)drawRect:(NSRect)rect;
--(void)setWindow;
--(void)viewHasMoved:(NSNotification *)notification;
--(void)windowWillClose:(NSNotification *)notification;
--(void)newStream:(NSURL *)streamURL mimeType:(NSString *)mimeType notifyData:(void *)notifyData;
--(NSView *) findSuperview:(NSString *)viewName;
-
-// Events
--(BOOL)acceptsFirstResponder;
--(BOOL)becomeFirstResponder;
--(BOOL)resignFirstResponder;
--(void)sendActivateEvent;
--(void)sendUpdateEvent;
--(void)mouseDown:(NSEvent *)theEvent;
--(void)mouseUp:(NSEvent *)theEvent;
--(void)mouseEntered:(NSEvent *)theEvent;
--(void)mouseExited:(NSEvent *)theEvent;
--(void)keyDown:(NSEvent *)theEvent;
--(void)keyUp:(NSEvent *)theEvent;
-
-// plug-in to browser calls
--(NPError)getURLNotify:(const char *)url target:(const char *)target notifyData:(void *)notifyData;
--(NPError)getURL:(const char *)url target:(const char *)target;
--(NPError)postURLNotify:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file notifyData:(void *)notifyData;
--(NPError)postURL:(const char *)url target:(const char *)target len:(UInt32)len buf:(const char *)buf file:(NPBool)file;
--(NPError)newStream:(NPMIMEType)type target:(const char *)target stream:(NPStream**)stream;
--(NPError)write:(NPStream*)stream len:(SInt32)len buffer:(void *)buffer;
--(NPError)destroyStream:(NPStream*)stream reason:(NPReason)reason;
--(void)status:(const char *)message;
--(NPError)getValue:(NPNVariable)variable value:(void *)value;
--(NPError)setValue:(NPPVariable)variable value:(void *)value;
--(void)invalidateRect:(NPRect *)invalidRect;
--(void)invalidateRegion:(NPRegion)invalidateRegion;
--(void)forceRedraw;
++(void)getCarbonEvent:(EventRecord *)carbonEvent;
 
 @end
-
-NSString* startupVolumeName(void);
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 0528986..cc4cd41 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -28,8 +28,225 @@
 #import <IFPluginNullEventSender.h>
 #import "IFNullPluginView.h"
 
+static NSString* startupVolumeName(void);
+
 @implementation IFPluginView
 
+#pragma mark EVENTS
+
++ (void)getCarbonEvent:(EventRecord *)carbonEvent
+{
+    carbonEvent->what = nullEvent;
+    carbonEvent->message = 0;
+    carbonEvent->when = TickCount();
+    GetGlobalMouse(&carbonEvent->where);
+    carbonEvent->modifiers = GetCurrentKeyModifiers();
+    if (!Button())
+        carbonEvent->modifiers |= btnState;
+}
+
+- (void)getCarbonEvent:(EventRecord *)carbonEvent
+{
+    [[self class] getCarbonEvent:carbonEvent];
+}
+
+- (EventModifiers)modifiersForEvent:(NSEvent *)event isMouseDown:(BOOL)isMouseDown
+{
+    EventModifiers modifiers;
+    unsigned int modifierFlags = [event modifierFlags];
+    
+    modifiers = 0;
+    
+    if (!isMouseDown)
+        modifiers |= btnState;
+    
+    if (modifierFlags & NSCommandKeyMask)
+        modifiers |= cmdKey;
+    
+    if (modifierFlags & NSShiftKeyMask)
+        modifiers |= shiftKey;
+
+    if (modifierFlags & NSAlphaShiftKeyMask)
+        modifiers |= alphaLock;
+
+    if (modifierFlags & NSAlternateKeyMask)
+        modifiers |= optionKey;
+
+    if (modifierFlags & NSControlKeyMask)
+        modifiers |= controlKey;
+
+    return modifiers;
+}
+
+- (void)getCarbonEvent:(EventRecord *)carbonEvent withEvent:(NSEvent *)cocoaEvent isMouseDown:(BOOL)isMouseDown
+{
+    NSPoint where;
+    
+    where = [[cocoaEvent window] convertBaseToScreen:[cocoaEvent locationInWindow]];
+    
+    carbonEvent->what = nullEvent;
+    carbonEvent->message = 0;
+    carbonEvent->when = (UInt32)([cocoaEvent timestamp] * 60); // seconds to ticks
+    carbonEvent->where.h = (short)where.x;
+    carbonEvent->where.v = (short)(NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - where.y);
+    carbonEvent->modifiers = [self modifiersForEvent:cocoaEvent isMouseDown:isMouseDown];    
+}
+
+- (void)getCarbonEvent:(EventRecord *)carbonEvent withEvent:(NSEvent *)cocoaEvent
+{
+    [self getCarbonEvent:carbonEvent withEvent:cocoaEvent isMouseDown:Button()];
+}
+
+-(void)sendActivateEvent:(BOOL)activate
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event];
+    event.what = activateEvt;
+    event.message = (UInt32)[[self window] _windowRef];
+    if (activate)
+        event.modifiers |= activMask;
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event); 
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(activateEvent): %d  isActive: %d\n", acceptedEvent, (event.modifiers & activeFlag));
+}
+
+- (void)sendUpdateEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event];
+    event.what = updateEvt;
+    event.message = (UInt32)[[self window] _windowRef];
+
+    acceptedEvent = NPP_HandleEvent(instance, &event); 
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(updateEvt): %d  when: %lu\n", acceptedEvent, event.when);
+}
+
+-(BOOL)acceptsFirstResponder
+{
+    return YES;
+}
+
+- (BOOL)becomeFirstResponder
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event];
+    event.what = getFocusEvent;
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event); 
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(getFocusEvent): %d  when: %lu\n", acceptedEvent, event.when);
+    return YES;
+}
+
+- (BOOL)resignFirstResponder
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event];
+    event.what = loseFocusEvent;
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(loseFocusEvent): %d  when: %lu\n", acceptedEvent, event.when);
+    return YES;
+}
+
+
+-(void)mouseDown:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event withEvent:theEvent isMouseDown:YES];
+    event.what = mouseDown;
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseDown): %d pt.v=%d, pt.h=%d ticks=%lu\n", acceptedEvent, event.where.v, event.where.h, event.when);
+}
+
+-(void)mouseUp:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    Point point;
+    
+    [self getCarbonEvent:&event withEvent:theEvent isMouseDown:NO];
+    event.what = mouseUp;
+
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseUp): %d pt.v=%d, pt.h=%d ticks=%lu\n", acceptedEvent, point.v, point.h, event.when);
+}
+
+- (void)mouseEntered:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event withEvent:theEvent];
+    event.what = adjustCursorEvent;
+
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseEntered): %d\n", acceptedEvent);
+}
+
+- (void)mouseExited:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event withEvent:theEvent];
+    event.what = adjustCursorEvent;
+
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseExited): %d\n", acceptedEvent);
+}
+
+- (void)keyUp:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+        
+    [self getCarbonEvent:&event withEvent:theEvent];
+    event.what = keyUp;
+    // FIXME: Unicode characters vs. Macintosh ASCII character codes?
+    // FIXME: Multiple characters?
+    // FIXME: Key codes?
+    event.message = [[theEvent characters] characterAtIndex:0];
+
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyUp): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
+}
+
+- (void)keyDown:(NSEvent *)theEvent
+{
+    EventRecord event;
+    bool acceptedEvent;
+    
+    [self getCarbonEvent:&event withEvent:theEvent];
+    event.what = keyDown;
+    // FIXME: Unicode characters vs. Macintosh ASCII character codes?
+    // FIXME: Multiple characters?
+    // FIXME: Key codes?
+    event.message = [[theEvent characters] characterAtIndex:0];
+    
+    acceptedEvent = NPP_HandleEvent(instance, &event);
+    
+    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyDown): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
+}
+
 #pragma mark IFPLUGINVIEW
 
 // Could do this as a category on NSString if we wanted.
@@ -221,6 +438,20 @@ static char *newCString(NSString *string)
     }
 }
 
+- (NSView *) findSuperview:(NSString *)viewName
+{
+    NSView *view;
+    
+    view = self;
+    while(view){
+        view = [view superview];
+        if([[view className] isEqualToString:viewName]){
+            return view;
+        }
+    }
+    return nil;
+}
+
 -(void)start
 {
     NPSavedData saved;
@@ -250,7 +481,8 @@ static char *newCString(NSString *string)
     [notificationCenter addObserver:self selector:@selector(windowResignedKey:) name:@"NSWindowDidResignKeyNotification" object:theWindow];
     [notificationCenter addObserver:self selector:@selector(defaultsHaveChanged:) name:@"NSUserDefaultsDidChangeNotification" object:nil];
     
-    [self sendActivateEvent];
+    if ([theWindow isKeyWindow])
+        [self sendActivateEvent:YES];
     if(URL)
         [self newStream:[NSURL URLWithString:URL] mimeType:mime notifyData:NULL];
     eventSender = [[IFPluginNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
@@ -280,20 +512,6 @@ static char *newCString(NSString *string)
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_Destroy: %d\n", npErr);
 }
 
-- (NSView *) findSuperview:(NSString *)viewName
-{
-    NSView *view;
-    
-    view = self;
-    while(view){
-        view = [view superview];
-        if([[view className] isEqualToString:viewName]){
-            return view;
-        }
-    }
-    return nil;
-}
-
 #pragma mark NSVIEW
 
 - (void)drawRect:(NSRect)rect
@@ -309,229 +527,6 @@ static char *newCString(NSString *string)
     return YES;
 }
 
-#pragma mark EVENTS
-
-- (UInt32)currentModifiers
-{
-    UInt32 modifiers = GetCurrentKeyModifiers();
-    
-    if([[self window] isKeyWindow])
-        modifiers |= activeFlag;
-        
-    //FIXME: Need to also set btnStateBit on modifiers
-    
-    return modifiers;
-}
-
-- (UInt32)modifiersForEvent:(NSEvent *)theEvent isMouseDown:(BOOL)isMouseDown
-{
-    UInt32 modifiers;
-    unsigned int modifierFlags = [theEvent modifierFlags];
-    
-    modifiers = 0;
-    
-    if([[self window] isKeyWindow])
-        modifiers |= activeFlag;
-    
-    if(isMouseDown)
-        modifiers |= btnState;
-    
-    if(modifierFlags & NSCommandKeyMask)
-        modifiers |= cmdKey;
-    
-    if(modifierFlags & NSShiftKeyMask)
-        modifiers |= shiftKey;
-
-    if(modifierFlags & NSAlphaShiftKeyMask)
-        modifiers |= alphaLock;
-
-    if(modifierFlags & NSAlternateKeyMask)
-        modifiers |= optionKey;
-
-    if(modifierFlags & NSControlKeyMask)
-        modifiers |= controlKey;
-
-    return modifiers;
-}
-
--(void)sendActivateEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = activateEvt;
-    event.message = (UInt32)[[self window] _windowRef];
-    event.when = TickCount();
-    event.where = point;
-    event.modifiers = [self currentModifiers];
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(activateEvent): %d  isActive: %d\n", acceptedEvent, (event.modifiers & activeFlag));
-}
-
-- (void)sendUpdateEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = updateEvt;
-    event.message = (UInt32)[[self window] _windowRef];
-    event.when = TickCount();
-    event.where = point;
-    event.modifiers = [self currentModifiers];
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(updateEvt): %d  when: %lu\n", acceptedEvent, event.when);
-}
-
--(BOOL)acceptsFirstResponder
-{
-    return YES;
-}
-
-- (BOOL)becomeFirstResponder
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = getFocusEvent;
-    event.message = 0;
-    event.when = TickCount();
-    event.where = point;
-    event.modifiers = [self currentModifiers];
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(getFocusEvent): %d  when: %lu\n", acceptedEvent, event.when);
-    return YES;
-}
-
-- (BOOL)resignFirstResponder
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = loseFocusEvent;
-    event.message = 0;
-    event.when = TickCount();
-    event.where = point;
-    event.modifiers = [self currentModifiers];
-    acceptedEvent = NPP_HandleEvent(instance, &event); 
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(loseFocusEvent): %d  when: %lu\n", acceptedEvent, event.when);
-    return YES;
-}
-
-
--(void)mouseDown:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = mouseDown;
-    event.message = 0;
-    event.when = (uint32)([theEvent timestamp] * 60); // seconds to ticks
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:YES];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseDown): %d pt.v=%d, pt.h=%d ticks=%lu\n", acceptedEvent, point.v, point.h, event.when);
-}
-
--(void)mouseUp:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = mouseUp;
-    event.message = 0;
-    event.when = (uint32)([theEvent timestamp] * 60); 
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseUp): %d pt.v=%d, pt.h=%d ticks=%lu\n", acceptedEvent, point.v, point.h, event.when);
-}
-
-- (void)mouseEntered:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = adjustCursorEvent;
-    event.message = 0;
-    event.when = (uint32)([theEvent timestamp] * 60);
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseEntered): %d\n", acceptedEvent);
-}
-
-- (void)mouseExited:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-    
-    event.what = adjustCursorEvent;
-    event.message = 0;
-    event.when = (uint32)([theEvent timestamp] * 60);
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(mouseExited): %d\n", acceptedEvent);
-}
-
-- (void)keyUp:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-        
-    event.what = keyUp;
-    event.message = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
-    event.when = (uint32)([theEvent timestamp] * 60);
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyUp): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
-}
-
-- (void)keyDown:(NSEvent *)theEvent
-{
-    EventRecord event;
-    bool acceptedEvent;
-    Point point;
-    
-    GetGlobalMouse(&point);
-        
-    event.what = keyDown;
-    event.message = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
-    event.when = (uint32)([theEvent timestamp] * 60);
-    event.where = point;
-    event.modifiers = [self modifiersForEvent:theEvent isMouseDown:NO];
-    acceptedEvent = NPP_HandleEvent(instance, &event);
-    WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyDown): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
-}
-
 #pragma mark NOTIFICATIONS
 
 -(void) viewHasMoved:(NSNotification *)notification
@@ -542,12 +537,12 @@ static char *newCString(NSString *string)
 
 -(void) windowBecameKey:(NSNotification *)notification
 {
-    [self sendActivateEvent];
+    [self sendActivateEvent:YES];
 }
 
 -(void) windowResignedKey:(NSNotification *)notification
 {
-    [self sendActivateEvent];
+    [self sendActivateEvent:NO];
 }
 
 - (void) windowWillClose:(NSNotification *)notification

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list