[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:13:13 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit a2a42ef0029821037ecfb86ddb8b7762d8da328f
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed May 15 23:58:29 2002 +0000
Fixed Flash mouse-down, mouse-over Flash bug.
Added support for modifiers (control-click etc) (2884451).
A lot of events clean-up.
* Plugins.subproj/IFPluginNullEventSender.m:
(-[IFPluginNullEventSender sendNullEvents]):
* Plugins.subproj/IFPluginView.h:
* Plugins.subproj/IFPluginView.mm:
(newCString):
(-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]):
(-[IFPluginView start]):
(-[IFPluginView drawRect:]):
(-[IFPluginView isFlipped]):
(-[IFPluginView currentModifiers]):
(-[IFPluginView modifiersForEvent:isMouseDown:]):
(-[IFPluginView sendActivateEvent]):
(-[IFPluginView sendUpdateEvent]):
(-[IFPluginView becomeFirstResponder]):
(-[IFPluginView resignFirstResponder]):
(-[IFPluginView mouseDown:]):
(-[IFPluginView mouseUp:]):
(-[IFPluginView mouseEntered:]):
(-[IFPluginView mouseExited:]):
(-[IFPluginView keyUp:]):
(-[IFPluginView keyDown:]):
(-[IFPluginView windowBecameKey:]):
(-[IFPluginView windowResignedKey:]):
Case-sensitivity issue with an include.
* WebView.subproj/IFWebView.mm:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1159 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 1ec764e..6a9c334 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,37 @@
+2002-05-15 Chris Blumenberg <cblu at apple.com>
+
+ Fixed Flash mouse-down, mouse-over Flash bug.
+ Added support for modifiers (control-click etc) (2884451).
+ A lot of events clean-up.
+
+ * Plugins.subproj/IFPluginNullEventSender.m:
+ (-[IFPluginNullEventSender sendNullEvents]):
+ * Plugins.subproj/IFPluginView.h:
+ * Plugins.subproj/IFPluginView.mm:
+ (newCString):
+ (-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]):
+ (-[IFPluginView start]):
+ (-[IFPluginView drawRect:]):
+ (-[IFPluginView isFlipped]):
+ (-[IFPluginView currentModifiers]):
+ (-[IFPluginView modifiersForEvent:isMouseDown:]):
+ (-[IFPluginView sendActivateEvent]):
+ (-[IFPluginView sendUpdateEvent]):
+ (-[IFPluginView becomeFirstResponder]):
+ (-[IFPluginView resignFirstResponder]):
+ (-[IFPluginView mouseDown:]):
+ (-[IFPluginView mouseUp:]):
+ (-[IFPluginView mouseEntered:]):
+ (-[IFPluginView mouseExited:]):
+ (-[IFPluginView keyUp:]):
+ (-[IFPluginView keyDown:]):
+ (-[IFPluginView windowBecameKey:]):
+ (-[IFPluginView windowResignedKey:]):
+
+ Case-sensitivity issue with an include.
+
+ * WebView.subproj/IFWebView.mm:
+
2002-05-15 Darin Adler <darin at apple.com>
* Makefile.am:
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 1ec764e..6a9c334 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,37 @@
+2002-05-15 Chris Blumenberg <cblu at apple.com>
+
+ Fixed Flash mouse-down, mouse-over Flash bug.
+ Added support for modifiers (control-click etc) (2884451).
+ A lot of events clean-up.
+
+ * Plugins.subproj/IFPluginNullEventSender.m:
+ (-[IFPluginNullEventSender sendNullEvents]):
+ * Plugins.subproj/IFPluginView.h:
+ * Plugins.subproj/IFPluginView.mm:
+ (newCString):
+ (-[IFPluginView initWithFrame:plugin:url:mime:arguments:mode:]):
+ (-[IFPluginView start]):
+ (-[IFPluginView drawRect:]):
+ (-[IFPluginView isFlipped]):
+ (-[IFPluginView currentModifiers]):
+ (-[IFPluginView modifiersForEvent:isMouseDown:]):
+ (-[IFPluginView sendActivateEvent]):
+ (-[IFPluginView sendUpdateEvent]):
+ (-[IFPluginView becomeFirstResponder]):
+ (-[IFPluginView resignFirstResponder]):
+ (-[IFPluginView mouseDown:]):
+ (-[IFPluginView mouseUp:]):
+ (-[IFPluginView mouseEntered:]):
+ (-[IFPluginView mouseExited:]):
+ (-[IFPluginView keyUp:]):
+ (-[IFPluginView keyDown:]):
+ (-[IFPluginView windowBecameKey:]):
+ (-[IFPluginView windowResignedKey:]):
+
+ Case-sensitivity issue with an include.
+
+ * WebView.subproj/IFWebView.mm:
+
2002-05-15 Darin Adler <darin at apple.com>
* Makefile.am:
diff --git a/WebKit/Plugins.subproj/IFPluginNullEventSender.m b/WebKit/Plugins.subproj/IFPluginNullEventSender.m
index e6a3e80..103ef89 100644
--- a/WebKit/Plugins.subproj/IFPluginNullEventSender.m
+++ b/WebKit/Plugins.subproj/IFPluginNullEventSender.m
@@ -21,12 +21,16 @@
{
EventRecord event;
bool acceptedEvent;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
if(!shouldStop){
event.what = nullEvent;
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+ event.message = 0;
+ event.when = TickCount();
+ event.where = point;
+ event.modifiers = GetCurrentKeyModifiers();
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 79aa50c..c080d44 100644
--- a/WebKit/Plugins.subproj/IFPluginView.h
+++ b/WebKit/Plugins.subproj/IFPluginView.h
@@ -49,16 +49,21 @@
}
- 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)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:(BOOL)isActive;
+-(void)sendActivateEvent;
-(void)sendUpdateEvent;
-(void)mouseDown:(NSEvent *)theEvent;
-(void)mouseUp:(NSEvent *)theEvent;
@@ -66,8 +71,6 @@
-(void)mouseExited:(NSEvent *)theEvent;
-(void)keyDown:(NSEvent *)theEvent;
-(void)keyUp:(NSEvent *)theEvent;
--(void)stop;
--(void)start;
// plug-in to browser calls
-(NPError)getURLNotify:(const char *)url target:(const char *)target notifyData:(void *)notifyData;
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index ad22df8..0528986 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -28,29 +28,19 @@
#import <IFPluginNullEventSender.h>
#import "IFNullPluginView.h"
-#import <CoreGraphics/CoreGraphics.h>
-
-// Work around bug in CGSDefines.h.
-#import <CoreGraphics/CGSDefines.h>
-#undef CGS_EXTERN
-#define CGS_EXTERN extern "C"
-
-#import <CoreGraphics/CoreGraphicsPrivate.h>
-
@implementation IFPluginView
#pragma mark IFPLUGINVIEW
// Could do this as a category on NSString if we wanted.
-static char *
-newCString(NSString *string)
+static char *newCString(NSString *string)
{
char *cString = new char[[string cStringLength] + 1];
[string getCString:cString];
return cString;
}
-- initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSString *)location mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSString *)location mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
{
NSString *baseURLString;
@@ -260,7 +250,7 @@ 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:[theWindow isKeyWindow]];
+ [self sendActivateEvent];
if(URL)
[self newStream:[NSURL URLWithString:URL] mimeType:mime notifyData:NULL];
eventSender = [[IFPluginNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
@@ -304,55 +294,100 @@ newCString(NSString *string)
return nil;
}
+#pragma mark NSVIEW
+
+- (void)drawRect:(NSRect)rect
+{
+ if(!isStarted)
+ [self start];
+ if(isStarted)
+ [self sendUpdateEvent];
+}
+
+- (BOOL)isFlipped
+{
+ return YES;
+}
+
#pragma mark EVENTS
--(void)sendActivateEvent:(BOOL)isActive;
+- (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;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
event.what = activateEvt;
- event.message = (uint32)GetWindowPort([[self window] _windowRef]);
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
- event.modifiers = isActive;
+ 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
+- (void)sendUpdateEvent
{
EventRecord event;
bool acceptedEvent;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
event.what = updateEvt;
- event.message = (uint32)GetWindowPort([[self window] _windowRef]);
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+ 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);
}
-
-#pragma mark NSVIEW
-
-- (void)drawRect:(NSRect)rect
-{
- if(!isStarted)
- [self start];
- if(isStarted)
- [self sendUpdateEvent];
-}
-
-- (BOOL)isFlipped
-{
- return YES;
-}
-
-#pragma mark NSRESPONDER
-
-(BOOL)acceptsFirstResponder
{
return YES;
@@ -362,11 +397,15 @@ newCString(NSString *string)
{
EventRecord event;
bool acceptedEvent;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
event.what = getFocusEvent;
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+ 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;
@@ -376,11 +415,15 @@ newCString(NSString *string)
{
EventRecord event;
bool acceptedEvent;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
event.what = loseFocusEvent;
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+ 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;
@@ -391,44 +434,49 @@ newCString(NSString *string)
{
EventRecord event;
bool acceptedEvent;
- Point pt;
- CGPoint mousePoint = CGSCurrentInputPointerPosition();
+ Point point;
+
+ GetGlobalMouse(&point);
- pt.v = (short)mousePoint.y;
- pt.h = (short)mousePoint.x;
event.what = mouseDown;
- event.where = pt;
+ event.message = 0;
event.when = (uint32)([theEvent timestamp] * 60); // seconds to ticks
- event.modifiers = 0;
+ 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, pt.v, pt.h, event.when);
+ 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 pt;
- CGPoint mousePoint = CGSCurrentInputPointerPosition();
+ Point point;
+
+ GetGlobalMouse(&point);
- pt.v = (short)mousePoint.y;
- pt.h = (short)mousePoint.x;
event.what = mouseUp;
- event.where = pt;
+ event.message = 0;
event.when = (uint32)([theEvent timestamp] * 60);
- event.modifiers = 0;
+ 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, pt.v, pt.h, event.when);
+ 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.modifiers = 1;
+ 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);
}
@@ -437,10 +485,15 @@ newCString(NSString *string)
{
EventRecord event;
bool acceptedEvent;
-
+ Point point;
+
+ GetGlobalMouse(&point);
+
event.what = adjustCursorEvent;
+ event.message = 0;
event.when = (uint32)([theEvent timestamp] * 60);
- event.modifiers = 0;
+ 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);
}
@@ -449,23 +502,32 @@ newCString(NSString *string)
{
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));
- //Note: QT Plug-in doesn't use keyUp's
}
- (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));
}
@@ -480,12 +542,12 @@ newCString(NSString *string)
-(void) windowBecameKey:(NSNotification *)notification
{
- [self sendActivateEvent:YES];
+ [self sendActivateEvent];
}
-(void) windowResignedKey:(NSNotification *)notification
{
- [self sendActivateEvent:NO];
+ [self sendActivateEvent];
}
- (void) windowWillClose:(NSNotification *)notification
diff --git a/WebKit/Plugins.subproj/WebPluginNullEventSender.m b/WebKit/Plugins.subproj/WebPluginNullEventSender.m
index e6a3e80..103ef89 100644
--- a/WebKit/Plugins.subproj/WebPluginNullEventSender.m
+++ b/WebKit/Plugins.subproj/WebPluginNullEventSender.m
@@ -21,12 +21,16 @@
{
EventRecord event;
bool acceptedEvent;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
if(!shouldStop){
event.what = nullEvent;
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+ event.message = 0;
+ event.when = TickCount();
+ event.where = point;
+ event.modifiers = GetCurrentKeyModifiers();
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 79aa50c..c080d44 100644
--- a/WebKit/Plugins.subproj/WebPluginView.h
+++ b/WebKit/Plugins.subproj/WebPluginView.h
@@ -49,16 +49,21 @@
}
- 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)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:(BOOL)isActive;
+-(void)sendActivateEvent;
-(void)sendUpdateEvent;
-(void)mouseDown:(NSEvent *)theEvent;
-(void)mouseUp:(NSEvent *)theEvent;
@@ -66,8 +71,6 @@
-(void)mouseExited:(NSEvent *)theEvent;
-(void)keyDown:(NSEvent *)theEvent;
-(void)keyUp:(NSEvent *)theEvent;
--(void)stop;
--(void)start;
// plug-in to browser calls
-(NPError)getURLNotify:(const char *)url target:(const char *)target notifyData:(void *)notifyData;
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index ad22df8..0528986 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -28,29 +28,19 @@
#import <IFPluginNullEventSender.h>
#import "IFNullPluginView.h"
-#import <CoreGraphics/CoreGraphics.h>
-
-// Work around bug in CGSDefines.h.
-#import <CoreGraphics/CGSDefines.h>
-#undef CGS_EXTERN
-#define CGS_EXTERN extern "C"
-
-#import <CoreGraphics/CoreGraphicsPrivate.h>
-
@implementation IFPluginView
#pragma mark IFPLUGINVIEW
// Could do this as a category on NSString if we wanted.
-static char *
-newCString(NSString *string)
+static char *newCString(NSString *string)
{
char *cString = new char[[string cStringLength] + 1];
[string getCString:cString];
return cString;
}
-- initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSString *)location mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
+- (id)initWithFrame:(NSRect)r plugin:(IFPlugin *)plug url:(NSString *)location mime:(NSString *)mimeType arguments:(NSDictionary *)arguments mode:(uint16)mode
{
NSString *baseURLString;
@@ -260,7 +250,7 @@ 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:[theWindow isKeyWindow]];
+ [self sendActivateEvent];
if(URL)
[self newStream:[NSURL URLWithString:URL] mimeType:mime notifyData:NULL];
eventSender = [[IFPluginNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
@@ -304,55 +294,100 @@ newCString(NSString *string)
return nil;
}
+#pragma mark NSVIEW
+
+- (void)drawRect:(NSRect)rect
+{
+ if(!isStarted)
+ [self start];
+ if(isStarted)
+ [self sendUpdateEvent];
+}
+
+- (BOOL)isFlipped
+{
+ return YES;
+}
+
#pragma mark EVENTS
--(void)sendActivateEvent:(BOOL)isActive;
+- (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;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
event.what = activateEvt;
- event.message = (uint32)GetWindowPort([[self window] _windowRef]);
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
- event.modifiers = isActive;
+ 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
+- (void)sendUpdateEvent
{
EventRecord event;
bool acceptedEvent;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
event.what = updateEvt;
- event.message = (uint32)GetWindowPort([[self window] _windowRef]);
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+ 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);
}
-
-#pragma mark NSVIEW
-
-- (void)drawRect:(NSRect)rect
-{
- if(!isStarted)
- [self start];
- if(isStarted)
- [self sendUpdateEvent];
-}
-
-- (BOOL)isFlipped
-{
- return YES;
-}
-
-#pragma mark NSRESPONDER
-
-(BOOL)acceptsFirstResponder
{
return YES;
@@ -362,11 +397,15 @@ newCString(NSString *string)
{
EventRecord event;
bool acceptedEvent;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
event.what = getFocusEvent;
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+ 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;
@@ -376,11 +415,15 @@ newCString(NSString *string)
{
EventRecord event;
bool acceptedEvent;
- UnsignedWide msecs;
+ Point point;
+
+ GetGlobalMouse(&point);
event.what = loseFocusEvent;
- Microseconds(&msecs);
- event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
+ 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;
@@ -391,44 +434,49 @@ newCString(NSString *string)
{
EventRecord event;
bool acceptedEvent;
- Point pt;
- CGPoint mousePoint = CGSCurrentInputPointerPosition();
+ Point point;
+
+ GetGlobalMouse(&point);
- pt.v = (short)mousePoint.y;
- pt.h = (short)mousePoint.x;
event.what = mouseDown;
- event.where = pt;
+ event.message = 0;
event.when = (uint32)([theEvent timestamp] * 60); // seconds to ticks
- event.modifiers = 0;
+ 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, pt.v, pt.h, event.when);
+ 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 pt;
- CGPoint mousePoint = CGSCurrentInputPointerPosition();
+ Point point;
+
+ GetGlobalMouse(&point);
- pt.v = (short)mousePoint.y;
- pt.h = (short)mousePoint.x;
event.what = mouseUp;
- event.where = pt;
+ event.message = 0;
event.when = (uint32)([theEvent timestamp] * 60);
- event.modifiers = 0;
+ 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, pt.v, pt.h, event.when);
+ 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.modifiers = 1;
+ 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);
}
@@ -437,10 +485,15 @@ newCString(NSString *string)
{
EventRecord event;
bool acceptedEvent;
-
+ Point point;
+
+ GetGlobalMouse(&point);
+
event.what = adjustCursorEvent;
+ event.message = 0;
event.when = (uint32)([theEvent timestamp] * 60);
- event.modifiers = 0;
+ 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);
}
@@ -449,23 +502,32 @@ newCString(NSString *string)
{
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));
- //Note: QT Plug-in doesn't use keyUp's
}
- (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));
}
@@ -480,12 +542,12 @@ newCString(NSString *string)
-(void) windowBecameKey:(NSNotification *)notification
{
- [self sendActivateEvent:YES];
+ [self sendActivateEvent];
}
-(void) windowResignedKey:(NSNotification *)notification
{
- [self sendActivateEvent:NO];
+ [self sendActivateEvent];
}
- (void) windowWillClose:(NSNotification *)notification
diff --git a/WebKit/WebView.subproj/IFWebView.mm b/WebKit/WebView.subproj/IFWebView.mm
index 1f55b2d..9637a38 100644
--- a/WebKit/WebView.subproj/IFWebView.mm
+++ b/WebKit/WebView.subproj/IFWebView.mm
@@ -13,7 +13,7 @@
#import <WebKit/WebKitDebug.h>
// Needed for the mouse move notification.
-#import <Appkit/NSResponder_Private.h>
+#import <AppKit/NSResponder_Private.h>
// KDE related includes
#import <khtmlview.h>
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index 1f55b2d..9637a38 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -13,7 +13,7 @@
#import <WebKit/WebKitDebug.h>
// Needed for the mouse move notification.
-#import <Appkit/NSResponder_Private.h>
+#import <AppKit/NSResponder_Private.h>
// KDE related includes
#import <khtmlview.h>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list