diff --git a/widget/src/cocoa/nsCocoaUtils.h b/widget/src/cocoa/nsCocoaUtils.h index 611392897d9..7f3015de312 100644 --- a/widget/src/cocoa/nsCocoaUtils.h +++ b/widget/src/cocoa/nsCocoaUtils.h @@ -69,6 +69,14 @@ typedef unsigned int NSUInteger; #endif /* NSINTEGER_DEFINED */ +#ifndef CGFLOAT_DEFINED +typedef float CGFloat; +# define CGFLOAT_MIN FLT_MIN +# define CGFLOAT_MAX FLT_MAX +# define CGFLOAT_IS_DOUBLE 0 +# define CGFLOAT_DEFINED 1 +#endif + // Used to retain a Cocoa object for the remainder of a method's execution. class nsAutoRetainCocoaObject { public: diff --git a/widget/src/cocoa/nsCocoaUtils.mm b/widget/src/cocoa/nsCocoaUtils.mm index e7996b34b42..29b55ae7957 100644 --- a/widget/src/cocoa/nsCocoaUtils.mm +++ b/widget/src/cocoa/nsCocoaUtils.mm @@ -126,15 +126,15 @@ NSWindow* nsCocoaUtils::FindWindowUnderPoint(NSPoint aPoint) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - int windowCount; + NSInteger windowCount; NSCountWindows(&windowCount); - int* windowList = (int*)malloc(sizeof(int) * windowCount); + NSInteger* windowList = (NSInteger*)malloc(sizeof(NSInteger) * windowCount); if (!windowList) return nil; // The list we get back here is in order from front to back. NSWindowList(windowCount, windowList); - for (int i = 0; i < windowCount; i++) { + for (NSInteger i = 0; i < windowCount; i++) { NSWindow* currentWindow = [NSApp windowWithWindowNumber:windowList[i]]; if (currentWindow && NSPointInRect(aPoint, [currentWindow frame])) { free(windowList); diff --git a/widget/src/cocoa/nsCocoaWindow.h b/widget/src/cocoa/nsCocoaWindow.h index cce0b59f764..874b184dd56 100644 --- a/widget/src/cocoa/nsCocoaWindow.h +++ b/widget/src/cocoa/nsCocoaWindow.h @@ -47,6 +47,7 @@ #include "nsBaseWidget.h" #include "nsPIWidgetCocoa.h" #include "nsAutoPtr.h" +#include "nsCocoaUtils.h" class nsCocoaWindow; class nsChildView; @@ -80,7 +81,7 @@ typedef struct _nsCocoaWindowList { BOOL mIsContextMenu; } -- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask +- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation; - (BOOL)isContextMenu; - (void)setIsContextMenu:(BOOL)flag; @@ -266,7 +267,7 @@ public: NS_IMETHOD BeginSecureKeyboardInput(); NS_IMETHOD EndSecureKeyboardInput(); - static void UnifiedShading(void* aInfo, const float* aIn, float* aOut); + static void UnifiedShading(void* aInfo, const CGFloat* aIn, CGFloat* aOut); protected: diff --git a/widget/src/cocoa/nsCocoaWindow.mm b/widget/src/cocoa/nsCocoaWindow.mm index 5cd250cb554..0628997c8a3 100644 --- a/widget/src/cocoa/nsCocoaWindow.mm +++ b/widget/src/cocoa/nsCocoaWindow.mm @@ -44,7 +44,6 @@ #include "nsWidgetsCID.h" #include "nsGUIEvent.h" #include "nsIRollupListener.h" -#include "nsCocoaUtils.h" #include "nsChildView.h" #include "nsWindowMap.h" #include "nsAppShell.h" @@ -1520,7 +1519,7 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKeyboardInput() // Callback used by the default titlebar and toolbar shading. // *aIn == 0 at the top of the titlebar/toolbar, *aIn == 1 at the bottom /* static */ void -nsCocoaWindow::UnifiedShading(void* aInfo, const float* aIn, float* aOut) +nsCocoaWindow::UnifiedShading(void* aInfo, const CGFloat* aIn, CGFloat* aOut) { UnifiedGradientInfo* info = (UnifiedGradientInfo*)aInfo; // The gradient percentage at the bottom of the titlebar / top of the toolbar @@ -1844,7 +1843,7 @@ nsCocoaWindow::UnifiedShading(void* aInfo, const float* aIn, float* aOut) // query the window for its titlebar height when drawing the toolbar. @implementation ToolbarWindow -- (id)initWithContentRect:(NSRect)aContentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)aBufferingType defer:(BOOL)aFlag +- (id)initWithContentRect:(NSRect)aContentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)aBufferingType defer:(BOOL)aFlag { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; @@ -2141,7 +2140,7 @@ void patternDraw(void* aInfo, CGContextRef aContext) CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL); CGContextSetFillColorSpace(context, patternSpace); CGColorSpaceRelease(patternSpace); - float component = 1.0f; + CGFloat component = 1.0f; CGContextSetFillPattern(context, pattern, &component); CGPatternRelease(pattern); @@ -2340,7 +2339,7 @@ void patternDraw(void* aInfo, CGContextRef aContext) NS_OBJC_END_TRY_ABORT_BLOCK; } -- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask +- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; diff --git a/widget/src/cocoa/nsFilePicker.mm b/widget/src/cocoa/nsFilePicker.mm index fec452d8a03..148097f491f 100644 --- a/widget/src/cocoa/nsFilePicker.mm +++ b/widget/src/cocoa/nsFilePicker.mm @@ -344,7 +344,7 @@ nsFilePicker::GetLocalFolder(const nsString& inTitle, nsILocalFile** outFile) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - NS_ENSURE_ARG(outFile); + NS_ENSURE_ARG_POINTER(outFile); *outFile = nsnull; PRInt16 retVal = (PRInt16)returnCancel; @@ -397,7 +397,7 @@ nsFilePicker::PutLocalFile(const nsString& inTitle, const nsString& inDefaultNam { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - NS_ENSURE_ARG(outFile); + NS_ENSURE_ARG_POINTER(outFile); *outFile = nsnull; PRInt16 retVal = returnCancel;