From b79a1682c908805a5f7c843192dd510cd745ce74 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Fri, 22 Feb 2002 01:58:21 +0000 Subject: [PATCH] Make cocoa support mouse moves. Yay. Not part of build. --- widget/src/cocoa/nsChildView.h | 2 +- widget/src/cocoa/nsChildView.mm | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/widget/src/cocoa/nsChildView.h b/widget/src/cocoa/nsChildView.h index 4597b6cd723b..9402df726439 100644 --- a/widget/src/cocoa/nsChildView.h +++ b/widget/src/cocoa/nsChildView.h @@ -246,7 +246,7 @@ protected: // is converted to Cocoa). This MUST be overridden if CreateCocoaView() // does not create something that inherits from NSQuickDrawView! virtual GrafPtr GetQuickDrawPort() ; - + protected: #if DEBUG const char* gInstanceClassName; diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 51fc27e44855..cd570d111386 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -124,7 +124,6 @@ ConvertGeckoRectToMacRect(const nsRect& aRect, Rect& outMacRect) #pragma mark - - //------------------------------------------------------------------------- // // nsChildView constructor @@ -187,7 +186,6 @@ nsChildView::~nsChildView() NS_IF_RELEASE(mFontMetrics); delete mPluginPort; - } NS_IMPL_ISUPPORTS_INHERITED1(nsChildView, nsBaseWidget, nsIKBStateControl); @@ -1861,9 +1859,15 @@ nsChildView::GetQuickDrawPort ( ) } // mouseUp - - (void)mouseMoved:(NSEvent*)theEvent { + NSView* view = [[[self window] contentView] hitTest: [theEvent locationInWindow]]; + if (view != (NSView*)self) { + // We shouldn't handle this. Send it to the right view. + [view mouseMoved: theEvent]; + return; + } + nsMouseEvent geckoEvent; geckoEvent.eventStructType = NS_MOUSE_EVENT; [self convert:theEvent message:NS_MOUSE_MOVE toGeckoEvent:&geckoEvent]; @@ -1871,7 +1875,6 @@ nsChildView::GetQuickDrawPort ( ) // send event into Gecko by going directly to the // the widget. mGeckoChild->DispatchMouseEvent(geckoEvent); - } - (void)mouseDragged:(NSEvent*)theEvent