Fix native scrollbars from crashing with stubbing out mouseMove. Not part of build.

This commit is contained in:
pinkerton%netscape.com 2002-04-03 21:33:18 +00:00
parent 6627f3a26d
commit f39fd703d9
2 changed files with 64 additions and 5 deletions

View File

@ -111,10 +111,10 @@ private:
@interface NativeScrollbarView : NSScroller
{
// Our window [WEAK]
// Our window [WEAK]
NSWindow* mWindow;
// the nsChildView that created the view. It retains this NSView, so
// the nsChildView that created this view. It retains this NSView, so
// the link back to it must be weak.
nsChildView* mGeckoChild;
@ -125,7 +125,14 @@ private:
NSTrackingRectTag mMouseEnterExitTag;
}
- (void)drawRect:(NSRect)aRect;
// default initializer
- (id)initWithFrame:(NSRect)frameRect geckoChild:(nsChildView*)inChild;
// overridden parent class initializer
- (id)initWithFrame:(NSRect)frameRect;
// access the nsIWidget associated with this view. DOES NOT ADDREF.
- (nsIWidget*) widget;
- (NSWindow*) getNativeWindow;
- (void) setNativeWindow: (NSWindow*)aWindow;
@end

View File

@ -127,8 +127,7 @@ nsNativeScrollbar::CreateCocoaView ( )
orientation.size.width = 100;
orientation.size.height = 20;
}
return [[[NativeScrollbarView alloc] initWithFrame:orientation] autorelease];
return [[[NativeScrollbarView alloc] initWithFrame:orientation geckoChild:this] autorelease];
}
GrafPtr
@ -502,6 +501,35 @@ nsNativeScrollbar::IsEnabled(PRBool *aState)
@implementation NativeScrollbarView
//
// -initWithFrame:geckoChild
// Designated Initializer
//
// Init our superclass and make the connection to the gecko nsIWidget we're
// mirroring
//
- (id)initWithFrame:(NSRect)frameRect geckoChild:(nsChildView*)inChild
{
[super initWithFrame:frameRect];
NS_ASSERTION(inChild, "Need to provide a tether between this and a nsChildView class");
mGeckoChild = inChild;
}
//
// -initWithFrame
//
// overridden parent class initializer
//
- (id)initWithFrame:(NSRect)frameRect
{
NS_WARNING("You're calling the wrong initializer. You really want -initWithFrame:geckoChild");
[self initWithFrame:frameRect geckoChild:nsnull];
}
- (NSWindow*) getNativeWindow
{
NSWindow* currWin = [self window];
@ -537,5 +565,29 @@ nsNativeScrollbar::IsEnabled(PRBool *aState)
}
//
// -widget
//
// return our gecko child view widget. Note this does not AddRef.
//
- (nsIWidget*) widget
{
return NS_STATIC_CAST(nsIWidget*, mGeckoChild);
}
//
// -mouseMoved
//
// our parent view will try to forward this message down to us. The
// default behavior for NSResponder is to forward it up the chain. Can you
// say "infinite recursion"? I thought so. Just stub out the action to
// break the cycle of madness.
//
- (void)mouseMoved:(NSEvent*)theEvent
{
// do nothing
}
@end