[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 07:45:36 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 962e5f894ccc4942c5512fafd9daad4c1b0452b7
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jun 14 04:32:28 2003 +0000

            Reviewed by Darin (Richard wrote the first cut), then Don and Dave.
    
    	- fixed 3291467 -- CARBON: context menus are broken when using WebKit from Carbon
    
            * Carbon.subproj/HIWebView.m: (ContextMenuClick): Rewrite method to create a fake
            right mouse up event, and pass that to menuForEvent: and _popUpMenuWithEvent.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4549 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/Carbon.subproj/HIWebView.m b/WebKit/Carbon.subproj/HIWebView.m
index bc4e452..fb6d68b 100644
--- a/WebKit/Carbon.subproj/HIWebView.m
+++ b/WebKit/Carbon.subproj/HIWebView.m
@@ -17,6 +17,7 @@
 #include <WebKit/WebKit.h>
 #include "HIViewAdapter.h"
 
+
 extern Boolean GetEventPlatformEventRecord( EventRef inEvent, void * eventRec );
 
 struct HIWebView
@@ -617,31 +618,44 @@ MouseWheelMoved( HIWebView* inView, EventRef inEvent )
 static OSStatus
 ContextMenuClick( HIWebView* inView, EventRef inEvent )
 {
-	CGSEventRecord			eventRec;
-	NSEvent*				kitEvent;
-	OSStatus				result = eventNotHandledErr;
-	NSView*					targ;
-	
-	GetEventPlatformEventRecord( inEvent, &eventRec );
-	RetainEvent( inEvent );
-	kitEvent = [[NSEvent alloc] _initWithCGSEvent:(CGSEventRecord)eventRec eventRef:(void *)inEvent];
+    OSStatus result = eventNotHandledErr;
 
-	targ = [[inView->fKitWindow _borderView] hitTest:[kitEvent locationInWindow]];
+    NSView *webView = inView->fWebView;
+    NSWindow *window = [webView window];
 
-    if ( [targ _allowsContextMenus] )
-	{
-        NSMenu * contextMenu = [targ menuForEvent:kitEvent];
-
-        if ( contextMenu )
-		{
-            [contextMenu _popUpMenuWithEvent:kitEvent forView:targ];
-			result = noErr;
+    // Get the point out of the event.
+    HIPoint point;
+    GetEventParameter(inEvent, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(point), NULL, &point);
+    HIViewConvertPoint(&point, inView->fViewRef, NULL);
+    
+    // Flip the Y coordinate, since Carbon is flipped relative to the AppKit.
+    NSPoint location = NSMakePoint(point.x, [window frame].size.height - point.y);
+    
+    // Make up an event with the point.
+    NSEvent *kitEvent = [NSEvent mouseEventWithType:NSRightMouseUp
+                                           location:location
+                                      modifierFlags:0
+                                          timestamp:GetEventTime(inEvent)
+                                       windowNumber:[window windowNumber]
+                                            context:0
+                                        eventNumber:0
+                                         clickCount:1
+                                           pressure:0];
+    
+    // Convert from window coordinates to superview coordinates for hit testing.
+    NSPoint superviewPoint = [[webView superview] convertPoint:location fromView:nil];
+    NSView *target = [webView hitTest:superviewPoint];
+    
+    // Pop up the menu.
+    if ([target _allowsContextMenus]) {
+        NSMenu *contextMenu = [target menuForEvent:kitEvent];
+        if (contextMenu) {
+            [contextMenu _popUpMenuWithEvent:kitEvent forView:target];
+            result = noErr;
         }
     }
-
-	[kitEvent release];
-	
-	return result;
+    
+    return result;
 }
 
 //----------------------------------------------------------------------------------
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d5a6fb3..84bfa77 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,14 @@
 2003-06-13  Darin Adler  <darin at apple.com>
 
+        Reviewed by Darin (Richard wrote the first cut), then Don and Dave.
+
+	- fixed 3291467 -- CARBON: context menus are broken when using WebKit from Carbon
+
+        * Carbon.subproj/HIWebView.m: (ContextMenuClick): Rewrite method to create a fake
+        right mouse up event, and pass that to menuForEvent: and _popUpMenuWithEvent.
+
+2003-06-13  Darin Adler  <darin at apple.com>
+
         Reviewed by Chris.
 
         - fixed 3291778 -- REGRESSION (51-52): QT controller never shows up for mp3 in frame

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list