From bba9d5ce7857de8af17d7e4ad085c0b68681831c Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Mon, 28 Sep 2009 02:01:05 -0400 Subject: [PATCH] Minor improvements for Mac OS X scrollwheel code including 64-bit support. b=518542 r=mstange --- widget/src/cocoa/nsChildView.mm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 8e983db5664..da6119a8cb2 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -3543,8 +3543,6 @@ static const PRInt32 sShadowInvalidationInterval = 100; mGeckoChild->DispatchWindowEvent(geckoEvent); } -//XXXTODO handle scroll wheel events in 64-bit builds -#ifndef __LP64__ // Handle an NSScrollWheel event for a single axis only. -(void)scrollWheel:(NSEvent*)theEvent forAxis:(enum nsMouseScrollEvent::nsMouseScrollFlags)inAxis { @@ -3561,15 +3559,18 @@ static const PRInt32 sShadowInvalidationInterval = 100; if (prefs) prefs->GetBoolPref("mousewheel.enable_pixel_scrolling", &checkPixels); - EventRef theCarbonEvent = [theEvent _eventRef]; - UInt32 carbonEventKind = theCarbonEvent ? ::GetEventKind(theCarbonEvent) : 0; // Calling deviceDeltaX or deviceDeltaY on theEvent will trigger a Cocoa // assertion and an Objective-C NSInternalInconsistencyException if the // underlying "Carbon" event doesn't contain pixel scrolling information. // For these events, carbonEventKind is kEventMouseWheelMoved instead of // kEventMouseScroll. - if (carbonEventKind != mozkEventMouseScroll) - checkPixels = PR_FALSE; + if (checkPixels) { + EventRef theCarbonEvent = [theEvent _eventRef]; + UInt32 carbonEventKind = theCarbonEvent ? ::GetEventKind(theCarbonEvent) : 0; + if (carbonEventKind != mozkEventMouseScroll) + checkPixels = PR_FALSE; + } + // Some scrolling devices supports pixel scrolling, e.g. a Macbook // touchpad or a Mighty Mouse. On those devices, [event deviceDeltaX/Y] // contains the amount of pixels to scroll. @@ -3615,8 +3616,9 @@ static const PRInt32 sShadowInvalidationInterval = 100; if (!mGeckoChild) return; +#ifndef NP_NO_CARBON // dispatch scroll wheel carbon event for plugins - { + if (mPluginEventModel == NPEventModelCarbon) { EventRef theEvent; OSStatus err = ::CreateEvent(NULL, kEventClassMouse, @@ -3656,6 +3658,7 @@ static const PRInt32 sShadowInvalidationInterval = 100; ReleaseEvent(theEvent); } } +#endif } if (hasPixels) { @@ -3694,7 +3697,6 @@ static const PRInt32 sShadowInvalidationInterval = 100; NS_OBJC_END_TRY_ABORT_BLOCK; } -#endif -(NSMenu*)menuForEvent:(NSEvent*)theEvent {