64-bit fixes for nsCocoaUtils and nsCocoaWindow. b=510428 r=mstange

This commit is contained in:
Josh Aas 2009-08-14 02:35:32 -04:00
parent da79c6cd85
commit adb8e4c947
5 changed files with 20 additions and 12 deletions

View File

@ -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:

View File

@ -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);

View File

@ -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:

View File

@ -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;

View File

@ -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;